2009-07-30 02:27:20 +04:00
|
|
|
#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
|
|
|
|
#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
|
|
|
|
|
2014-03-22 21:49:16 +04:00
|
|
|
#if defined(_MSC_VER) || \
|
|
|
|
|
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
|
|
|
|
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
2011-03-02 09:11:41 +03:00
|
|
|
#pragma once
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-03-23 07:46:04 +04:00
|
|
|
#include <string>
|
|
|
|
|
|
2012-05-22 04:07:56 +04:00
|
|
|
#include "emitterstate.h"
|
2014-03-23 07:46:04 +04:00
|
|
|
#include "yaml-cpp/emittermanip.h"
|
2012-05-26 02:28:35 +04:00
|
|
|
#include "yaml-cpp/ostream_wrapper.h"
|
2014-03-23 07:46:04 +04:00
|
|
|
|
|
|
|
|
namespace YAML {
|
|
|
|
|
class ostream_wrapper;
|
|
|
|
|
} // namespace YAML
|
2009-05-23 01:52:31 +04:00
|
|
|
|
2014-03-22 21:49:16 +04:00
|
|
|
namespace YAML {
|
|
|
|
|
class Binary;
|
|
|
|
|
|
|
|
|
|
struct StringFormat {
|
2014-03-24 05:08:54 +04:00
|
|
|
enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
|
2014-03-22 21:49:16 +04:00
|
|
|
};
|
2012-05-22 04:07:56 +04:00
|
|
|
|
2014-03-22 21:49:16 +04:00
|
|
|
namespace Utils {
|
|
|
|
|
StringFormat::value ComputeStringFormat(const std::string& str,
|
|
|
|
|
EMITTER_MANIP strFormat,
|
|
|
|
|
FlowType::value flowType,
|
|
|
|
|
bool escapeNonAscii);
|
|
|
|
|
|
|
|
|
|
bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
|
|
|
|
|
bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
|
|
|
|
|
bool escapeNonAscii);
|
|
|
|
|
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
|
|
|
|
|
int indent);
|
|
|
|
|
bool WriteChar(ostream_wrapper& out, char ch);
|
|
|
|
|
bool WriteComment(ostream_wrapper& out, const std::string& str,
|
|
|
|
|
int postCommentIndent);
|
|
|
|
|
bool WriteAlias(ostream_wrapper& out, const std::string& str);
|
|
|
|
|
bool WriteAnchor(ostream_wrapper& out, const std::string& str);
|
|
|
|
|
bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
|
|
|
|
|
bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
|
|
|
|
|
const std::string& tag);
|
|
|
|
|
bool WriteBinary(ostream_wrapper& out, const Binary& binary);
|
|
|
|
|
}
|
2009-05-23 01:52:31 +04:00
|
|
|
}
|
2009-07-30 02:27:20 +04:00
|
|
|
|
2014-03-22 21:49:16 +04:00
|
|
|
#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|