5 #ifndef CNOID_UTIL_YAML_READER_H
6 #define CNOID_UTIL_YAML_READER_H
9 #include "exportdecl.h"
17 class MappingFactoryBase {
19 virtual Mapping* create(
int line,
int column) = 0;
20 virtual ~MappingFactoryBase() { }
23 template <
class MappingType>
class MappingFactory :
public MappingFactoryBase {
25 virtual Mapping* create(
int line,
int column) {
return new MappingType(line, column); }
34 setMappingFactory(
new MappingFactory<TMapping>());
37 void expectRegularMultiListing();
38 #ifdef CNOID_BACKWARD_COMPATIBILITY
39 void expectRegularMultiSequence() { expectRegularMultiListing(); }
40 bool load_string(
const std::string& yamlstring) {
return parse(yamlstring); }
43 bool load(
const std::string& filename);
44 bool parse(
const std::string& yamlstring);
45 bool parse(
const char* input,
size_t size);
47 ValueNode* loadDocument(
const std::string& filename);
50 ValueNode* document(
int index = 0);
52 ValueNode* findAnchoredNode(
const std::string& anchor);
53 void importAnchors(
const YAMLReader& anotherReader);
55 void clearDocuments();
57 const std::string& errorMessage();
61 friend class YAMLReaderImpl;
65 void setMappingFactory(MappingFactoryBase* factory);
68 #ifdef CNOID_BACKWARD_COMPATIBILITY