File indexing completed on 2025-05-12 09:08:10
0001 #ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0002 #define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0003
0004 #if defined(_MSC_VER) || \
0005 (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
0006 (__GNUC__ >= 4))
0007 #pragma once
0008 #endif
0009
0010 #include <string>
0011
0012 #include "emitterstate.h"
0013 #include "ATOOLS/YAML/yaml-cpp/emittermanip.h"
0014 #include "ATOOLS/YAML/yaml-cpp/ostream_wrapper.h"
0015
0016 namespace SHERPA_YAML {
0017 class ostream_wrapper;
0018 }
0019
0020 namespace SHERPA_YAML {
0021 class Binary;
0022
0023 struct StringFormat {
0024 enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
0025 };
0026
0027 struct StringEscaping {
0028 enum value { None, NonAscii, JSON };
0029 };
0030
0031 namespace Utils {
0032 StringFormat::value ComputeStringFormat(const std::string& str,
0033 EMITTER_MANIP strFormat,
0034 FlowType::value flowType,
0035 bool escapeNonAscii);
0036
0037 bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
0038 bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
0039 StringEscaping::value stringEscaping);
0040 bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
0041 std::size_t indent);
0042 bool WriteChar(ostream_wrapper& out, char ch,
0043 StringEscaping::value stringEscapingStyle);
0044 bool WriteComment(ostream_wrapper& out, const std::string& str,
0045 std::size_t postCommentIndent);
0046 bool WriteAlias(ostream_wrapper& out, const std::string& str);
0047 bool WriteAnchor(ostream_wrapper& out, const std::string& str);
0048 bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
0049 bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
0050 const std::string& tag);
0051 bool WriteBinary(ostream_wrapper& out, const Binary& binary);
0052 }
0053 }
0054
0055 #endif