Go to the documentation of this file.
5 #ifndef CNOID_UTIL_YAML_WRITER_H
6 #define CNOID_UTIL_YAML_WRITER_H
10 #include "exportdecl.h"
24 void setOutput(std::ostream& os);
26 bool openFile(
const std::string& filename);
30 void setMessageSink(std::ostream& os);
31 void putMessage(
const std::string& message);
32 std::ostream& messageSink();
36 void setIndentWidth(
int n);
37 int indentWidth()
const;
38 void setKeyOrderPreservationMode(
bool on);
42 void putComment(
const std::string& comment,
bool doNewLine =
true);
44 void putString(
const char* value);
45 void putString(
const std::string& value);
46 void putSingleQuotedString(
const char* value);
47 void putSingleQuotedString(
const std::string& value);
48 void putDoubleQuotedString(
const char* value);
49 void putDoubleQuotedString(
const std::string& value);
50 void putBlockStyleString(
const char* value,
bool isLiteral);
51 void putBlockStyleString(
const std::string& value,
bool isLiteral);
55 void putFoldedString(
const std::string& value) { putBlockStyleString(value,
false); }
56 void putScalar(
bool value);
57 void putScalar(
int value);
58 void putScalar(
double value);
59 void putScalar(
const char* value) { putString(value); }
60 void putScalar(
const std::string& value){ putString(value); }
61 void setDoubleFormat(
const char* format);
64 void startFlowStyleMapping();
68 template <
class DataType>
void putKeyValue(
const char* key,
const DataType& value){
73 template <
class DataType>
void putKeyValue(
const std::string& key,
const DataType& value){
81 void startFlowStyleListing();
87 template<
typename T> T info(
const std::string& key)
const;
88 template<
typename T> T info(
const std::string& key,
const T& defaultValue)
const;
89 template<
typename T> T getOrCreateInfo(
const std::string& key,
const T& defaultValue);
90 template<
typename T>
void setInfo(
const std::string& key,
const T& value);
94 #ifdef CNOID_BACKWARD_COMPATIBILITY
95 void startSequence() { startListing(); }
96 void startFlowStyleSequence() { startFlowStyleListing(); }
97 void endSequence() { endListing(); }
101 YAMLWriterImpl* impl;
104 template<> CNOID_EXPORT
double YAMLWriter::info(
const std::string& key)
const;
105 template<> CNOID_EXPORT
double YAMLWriter::info(
const std::string& key,
const double& defaultValue)
const;
106 template<> CNOID_EXPORT
bool YAMLWriter::info(
const std::string& key,
const bool& defaultValue)
const;
109 template<> CNOID_EXPORT
void YAMLWriter::setInfo(
const std::string& key,
const double& value);
110 template<> CNOID_EXPORT
void YAMLWriter::setInfo(
const std::string& key,
const bool& value);
112 #ifdef CNOID_BACKWARD_COMPATIBILITY
113 typedef YAMLWriter YamlWriter;
void setInfo(const std::string &key, const T &value)
Definition: ValueTree.h:253
Definition: YAMLWriter.h:16
void putKeyValue(const char *key, const DataType &value)
Definition: YAMLWriter.h:68
Definition: ValueTree.h:34
void putFoldedString(const char *value)
Definition: YAMLWriter.h:54
void putFoldedString(const std::string &value)
Definition: YAMLWriter.h:55
Definition: AbstractSceneLoader.h:11
StringStyle
Definition: ValueTree.h:24
void putScalar(const std::string &value)
Definition: YAMLWriter.h:60
T getOrCreateInfo(const std::string &key, const T &defaultValue)
void putLiteralString(const std::string &value)
Definition: YAMLWriter.h:53
void putScalar(const char *value)
Definition: YAMLWriter.h:59
@ PLAIN_STRING
Definition: ValueTree.h:24
const Mapping * info() const
Definition: YAMLWriter.cpp:794
void putKeyValue(const std::string &key, const DataType &value)
Definition: YAMLWriter.h:73
void putLiteralString(const char *value)
Definition: YAMLWriter.h:52