chore: use to_string() to avoid warning

This commit is contained in:
res0nance 2022-08-24 01:17:44 +08:00 committed by Patrick Boettcher
parent 0bbb0da522
commit d2210f65da
4 changed files with 6 additions and 6 deletions

View File

@ -179,7 +179,7 @@ public:
auto fragment = new_uri.pointer(); auto fragment = new_uri.pointer();
// is there a reference looking for this unknown-keyword, which is thus no longer a unknown keyword but a schema // is there a reference looking for this unknown-keyword, which is thus no longer a unknown keyword but a schema
auto unresolved = file.unresolved.find(fragment); auto unresolved = file.unresolved.find(fragment.to_string());
if (unresolved != file.unresolved.end()) if (unresolved != file.unresolved.end())
schema::make(value, this, {}, {{new_uri}}); schema::make(value, this, {}, {{new_uri}});
else { // no, nothing ref'd it, keep for later else { // no, nothing ref'd it, keep for later

View File

@ -61,7 +61,7 @@ protected:
std::tuple<std::string, std::string, std::string, std::string, std::string> as_tuple() const std::tuple<std::string, std::string, std::string, std::string, std::string> as_tuple() const
{ {
return std::make_tuple(urn_, scheme_, authority_, path_, identifier_ != "" ? identifier_ : pointer_); return std::make_tuple(urn_, scheme_, authority_, path_, identifier_ != "" ? identifier_ : pointer_.to_string());
} }
public: public:
@ -80,7 +80,7 @@ public:
std::string fragment() const std::string fragment() const
{ {
if (identifier_ == "") if (identifier_ == "")
return pointer_; return pointer_.to_string();
else else
return identifier_; return identifier_;
} }

View File

@ -163,7 +163,7 @@ int main()
val.set_root_schema(array_of_types_without_binary); val.set_root_schema(array_of_types_without_binary);
val.validate({{"something", binary}}, err); val.validate({{"something", binary}}, err);
EXPECT_EQ(err.failed_pointers.size(), 1); EXPECT_EQ(err.failed_pointers.size(), 1);
EXPECT_EQ(err.failed_pointers[0], "/something"); EXPECT_EQ(err.failed_pointers[0].to_string(), "/something");
err.reset(); err.reset();
// check that without content callback you get exception with schema with contentEncoding or contentMeditType // check that without content callback you get exception with schema with contentEncoding or contentMeditType

View File

@ -75,11 +75,11 @@ static void pointer_plain_name(json_uri start,
a = a.derive("#foo/looks_like_json/poiner/but/isnt"); a = a.derive("#foo/looks_like_json/poiner/but/isnt");
EXPECT_EQ(a, full + " # foo/looks_like_json/poiner/but/isnt"); EXPECT_EQ(a, full + " # foo/looks_like_json/poiner/but/isnt");
EXPECT_EQ(a.identifier(), "foo/looks_like_json/poiner/but/isnt"); EXPECT_EQ(a.identifier(), "foo/looks_like_json/poiner/but/isnt");
EXPECT_EQ(a.pointer(), ""); EXPECT_EQ(a.pointer().to_string(), "");
a = a.derive("#/looks_like_json/poiner/and/it/is"); a = a.derive("#/looks_like_json/poiner/and/it/is");
EXPECT_EQ(a, full + " # /looks_like_json/poiner/and/it/is"); EXPECT_EQ(a, full + " # /looks_like_json/poiner/and/it/is");
EXPECT_EQ(a.pointer(), "/looks_like_json/poiner/and/it/is"); EXPECT_EQ(a.pointer().to_string(), "/looks_like_json/poiner/and/it/is");
EXPECT_EQ(a.identifier(), ""); EXPECT_EQ(a.identifier(), "");
} }