diff options
author | imarom <imarom@cisco.com> | 2015-08-24 17:52:52 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-08-24 17:52:52 +0300 |
commit | 36c6c87fe4380b214f8ff8a45dc0213fa109821c (patch) | |
tree | ac4886a9e36fef3d0d7f621ac46678ebb7486015 /external_libs/cpp/yaml-cpp/src/tag.cpp | |
parent | 7d3be8c612e295820649779335288c197b80ccb2 (diff) |
fix compile issues with external libarries
Diffstat (limited to 'external_libs/cpp/yaml-cpp/src/tag.cpp')
-rwxr-xr-x | external_libs/cpp/yaml-cpp/src/tag.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/external_libs/cpp/yaml-cpp/src/tag.cpp b/external_libs/cpp/yaml-cpp/src/tag.cpp new file mode 100755 index 00000000..82a47047 --- /dev/null +++ b/external_libs/cpp/yaml-cpp/src/tag.cpp @@ -0,0 +1,52 @@ +#include "tag.h" +#include "directives.h" +#include "token.h" +#include <cassert> +#include <stdexcept> + +namespace YAML +{ + Tag::Tag(const Token& token): type(static_cast<TYPE>(token.data)) + { + switch(type) { + case VERBATIM: + value = token.value; + break; + case PRIMARY_HANDLE: + value = token.value; + break; + case SECONDARY_HANDLE: + value = token.value; + break; + case NAMED_HANDLE: + handle = token.value; + value = token.params[0]; + break; + case NON_SPECIFIC: + break; + default: + assert(false); + } + } + + const std::string Tag::Translate(const Directives& directives) + { + switch(type) { + case VERBATIM: + return value; + case PRIMARY_HANDLE: + return directives.TranslateTagHandle("!") + value; + case SECONDARY_HANDLE: + return directives.TranslateTagHandle("!!") + value; + case NAMED_HANDLE: + return directives.TranslateTagHandle("!" + handle + "!") + value; + case NON_SPECIFIC: + // TODO: + return "!"; + default: + assert(false); + } + throw std::runtime_error("yaml-cpp: internal error, bad tag type"); + } +} + |