00001 #ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
00002 #define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
00003
00004 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
00005 #pragma once
00006 #endif
00007
00008
00009 #include <string>
00010
00011 namespace YAML_PM
00012 {
00013 enum EMITTER_MANIP {
00014
00015 Auto,
00016 TagByKind,
00017 Newline,
00018
00019
00020 EmitNonAscii,
00021 EscapeNonAscii,
00022
00023
00024
00025 SingleQuoted,
00026 DoubleQuoted,
00027 Literal,
00028
00029
00030 YesNoBool,
00031 TrueFalseBool,
00032 OnOffBool,
00033 UpperCase,
00034 LowerCase,
00035 CamelCase,
00036 LongBool,
00037 ShortBool,
00038
00039
00040 Dec,
00041 Hex,
00042 Oct,
00043
00044
00045 BeginDoc,
00046 EndDoc,
00047
00048
00049 BeginSeq,
00050 EndSeq,
00051 Flow,
00052 Block,
00053
00054
00055 BeginMap,
00056 EndMap,
00057 Key,
00058 Value,
00059
00060
00061
00062 LongKey
00063 };
00064
00065 struct _Indent {
00066 _Indent(int value_): value(value_) {}
00067 int value;
00068 };
00069
00070 inline _Indent Indent(int value) {
00071 return _Indent(value);
00072 }
00073
00074 struct _Alias {
00075 _Alias(const std::string& content_): content(content_) {}
00076 std::string content;
00077 };
00078
00079 inline _Alias Alias(const std::string content) {
00080 return _Alias(content);
00081 }
00082
00083 struct _Anchor {
00084 _Anchor(const std::string& content_): content(content_) {}
00085 std::string content;
00086 };
00087
00088 inline _Anchor Anchor(const std::string content) {
00089 return _Anchor(content);
00090 }
00091
00092 struct _Tag {
00093 struct Type { enum value { Verbatim, PrimaryHandle, NamedHandle }; };
00094
00095 explicit _Tag(const std::string& prefix_, const std::string& content_, Type::value type_)
00096 : prefix(prefix_), content(content_), type(type_)
00097 {
00098 }
00099 std::string prefix;
00100 std::string content;
00101 Type::value type;
00102 };
00103
00104 inline _Tag VerbatimTag(const std::string content) {
00105 return _Tag("", content, _Tag::Type::Verbatim);
00106 }
00107
00108 inline _Tag LocalTag(const std::string content) {
00109 return _Tag("", content, _Tag::Type::PrimaryHandle);
00110 }
00111
00112 inline _Tag LocalTag(const std::string& prefix, const std::string content) {
00113 return _Tag(prefix, content, _Tag::Type::NamedHandle);
00114 }
00115
00116 inline _Tag SecondaryTag(const std::string content) {
00117 return _Tag("", content, _Tag::Type::NamedHandle);
00118 }
00119
00120 struct _Comment {
00121 _Comment(const std::string& content_): content(content_) {}
00122 std::string content;
00123 };
00124
00125 inline _Comment Comment(const std::string content) {
00126 return _Comment(content);
00127 }
00128
00129 struct _Precision {
00130 _Precision(int floatPrecision_, int doublePrecision_): floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
00131
00132 int floatPrecision;
00133 int doublePrecision;
00134 };
00135
00136 inline _Precision FloatPrecision(int n) {
00137 return _Precision(n, -1);
00138 }
00139
00140 inline _Precision DoublePrecision(int n) {
00141 return _Precision(-1, n);
00142 }
00143
00144 inline _Precision Precision(int n) {
00145 return _Precision(n, n);
00146 }
00147 }
00148
00149 #endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM