revert changes in methods bodies
This commit is contained in:
parent
56f39208a5
commit
7d1c3763d0
@ -3,19 +3,15 @@
|
||||
namespace YAML {
|
||||
Directives::Directives() : version{true, 1, 2}, tags{} {}
|
||||
|
||||
std::string Directives::TranslateTagHandle(
|
||||
const std::string Directives::TranslateTagHandle(
|
||||
const std::string& handle) const {
|
||||
std::string result;
|
||||
auto it = tags.find(handle);
|
||||
if (it == tags.end()) {
|
||||
if (handle == "!!")
|
||||
result = "tag:yaml.org,2002:";
|
||||
else
|
||||
result = handle;
|
||||
} else {
|
||||
result = it->second;
|
||||
return "tag:yaml.org,2002:";
|
||||
return handle;
|
||||
}
|
||||
|
||||
return result;
|
||||
return it->second;
|
||||
}
|
||||
} // namespace YAML
|
||||
|
||||
23
src/tag.cpp
23
src/tag.cpp
@ -29,31 +29,22 @@ Tag::Tag(const Token& token)
|
||||
}
|
||||
}
|
||||
|
||||
std::string Tag::Translate(const Directives& directives) {
|
||||
std::string result;
|
||||
|
||||
const std::string Tag::Translate(const Directives& directives) {
|
||||
switch (type) {
|
||||
case VERBATIM:
|
||||
result = value;
|
||||
break;
|
||||
return value;
|
||||
case PRIMARY_HANDLE:
|
||||
result = directives.TranslateTagHandle("!") + value;
|
||||
break;
|
||||
return directives.TranslateTagHandle("!") + value;
|
||||
case SECONDARY_HANDLE:
|
||||
result = directives.TranslateTagHandle("!!") + value;
|
||||
break;
|
||||
return directives.TranslateTagHandle("!!") + value;
|
||||
case NAMED_HANDLE:
|
||||
result = directives.TranslateTagHandle("!" + handle + "!") + value;
|
||||
break;
|
||||
return directives.TranslateTagHandle("!" + handle + "!") + value;
|
||||
case NON_SPECIFIC:
|
||||
// TODO:
|
||||
result = "!";
|
||||
break;
|
||||
return "!";
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
throw std::runtime_error("yaml-cpp: internal error, bad tag type");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
} // namespace YAML
|
||||
|
||||
Loading…
Reference in New Issue
Block a user