yaml-cpp/src/directives.cpp

22 lines
437 B
C++
Raw Normal View History

#include "directives.h"
2014-03-22 21:49:16 +04:00
namespace YAML {
Directives::Directives() : version{true, 1, 2}, tags{} {}
2014-03-22 21:49:16 +04:00
std::string Directives::TranslateTagHandle(
2014-03-24 05:08:54 +04:00
const std::string& handle) const {
std::string result;
auto it = tags.find(handle);
2014-03-22 21:49:16 +04:00
if (it == tags.end()) {
if (handle == "!!")
result = "tag:yaml.org,2002:";
else
result = handle;
} else {
result = it->second;
2014-03-22 21:49:16 +04:00
}
return result;
2014-03-22 21:49:16 +04:00
}
} // namespace YAML