2010-10-18 10:45:03 +04:00
|
|
|
#include "directives.h"
|
2008-09-04 02:20:39 +04:00
|
|
|
|
2014-03-22 21:49:16 +04:00
|
|
|
namespace YAML {
|
2019-03-14 01:18:34 +03:00
|
|
|
Directives::Directives() : version{true, 1, 2}, tags{} {}
|
2014-03-22 21:49:16 +04:00
|
|
|
|
2022-05-31 23:41:00 +03:00
|
|
|
std::string Directives::TranslateTagHandle(
|
2014-03-24 05:08:54 +04:00
|
|
|
const std::string& handle) const {
|
2022-05-31 23:41:00 +03:00
|
|
|
std::string result;
|
2020-06-16 18:22:14 +03:00
|
|
|
auto it = tags.find(handle);
|
2014-03-22 21:49:16 +04:00
|
|
|
if (it == tags.end()) {
|
|
|
|
|
if (handle == "!!")
|
2022-05-31 23:41:00 +03:00
|
|
|
result = "tag:yaml.org,2002:";
|
|
|
|
|
else
|
|
|
|
|
result = handle;
|
|
|
|
|
} else {
|
|
|
|
|
result = it->second;
|
2014-03-22 21:49:16 +04:00
|
|
|
}
|
|
|
|
|
|
2022-05-31 23:41:00 +03:00
|
|
|
return result;
|
2014-03-22 21:49:16 +04:00
|
|
|
}
|
2019-03-14 01:18:34 +03:00
|
|
|
} // namespace YAML
|