diff options
author | 2015-09-08 18:41:17 -0400 | |
---|---|---|
committer | 2015-09-08 18:41:17 -0400 | |
commit | 60e901aabaeab7d205da65030849056c05c8b73e (patch) | |
tree | 20883ed8ae63c326f3c042992e8dbe668656568e /external_libs/yaml-cpp/src/tag.cpp | |
parent | 9a524989d331f04abecd3faa72d98157a8651739 (diff) | |
parent | 463cb7c212e927a732fb5b702a288a06550c5eb8 (diff) |
Merge remote-tracking branch
Conflicts:
linux/b
linux/ws_main.py
linux_dpdk/ws_main.py
src/bp_sim.h
Diffstat (limited to 'external_libs/yaml-cpp/src/tag.cpp')
-rw-r--r-- | external_libs/yaml-cpp/src/tag.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/external_libs/yaml-cpp/src/tag.cpp b/external_libs/yaml-cpp/src/tag.cpp new file mode 100644 index 00000000..82a47047 --- /dev/null +++ b/external_libs/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"); + } +} + |