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