Choreonoid  1.8
ValueTree.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_UTIL_VALUE_TREE_H
6 #define CNOID_UTIL_VALUE_TREE_H
7 
8 #include "Referenced.h"
9 #include <map>
10 #include <vector>
11 #include <string>
12 #include <initializer_list>
13 #include "exportdecl.h"
14 
15 namespace cnoid {
16 
17 class YAMLReaderImpl;
18 class ValueNode;
19 class ScalarNode;
20 class Mapping;
21 class Listing;
22 
23 #ifndef CNOID_BACKWARD_COMPATIBILITY
25 #else
26 enum StringStyle { PLAIN_STRING, YAML_PLAIN_STRING = PLAIN_STRING,
27  SINGLE_QUOTED, YAML_SINGLE_QUOTED = SINGLE_QUOTED,
28  DOUBLE_QUOTED, YAML_DOUBLE_QUOTED = DOUBLE_QUOTED,
29  LITERAL_STRING, YAML_LITERAL = LITERAL_STRING,
30  FOLDED_STRING, YAML_FOLDED = FOLDED_STRING
31 };
32 #endif
33 
34 class CNOID_EXPORT ValueNode : public Referenced
35 {
36  struct Initializer {
37  Initializer();
38  };
39  static Initializer initializer;
40 
41 public:
42  virtual ValueNode* clone() const;
43 
44  enum TypeBit {
45  INVALID_NODE = 0,
46  SCALAR = 1,
47  MAPPING = 2,
48  LISTING = 4,
49  INSERT_LF = 8,
50  APPEND_LF = 16,
51  FORCED_RADIAN_MODE = 32
52  };
53 
54  bool isValid() const { return typeBits; }
55  explicit operator bool() const { return isValid(); }
56 
57  TypeBit LFType() const { return (TypeBit)(typeBits & (INSERT_LF | APPEND_LF)); }
58  TypeBit nodeType() const { return (TypeBit)(typeBits & 7); }
59 
60  int toInt() const;
61  double toDouble() const;
62  float toFloat() const;
63  bool toBool() const;
64  [[deprecated("Check isForcedRadianMode() of the top node.")]]
65  double toAngle() const;
66 
67  bool isScalar() const { return typeBits & SCALAR; }
68  bool isString() const { return typeBits & SCALAR; }
69  bool isCollection() const { return typeBits & (MAPPING | LISTING); }
70 
71  const std::string& toString() const;
72 
73  operator const std::string& () const {
74  return toString();
75  }
76 
82  bool isForcedRadianMode() const { return typeBits & FORCED_RADIAN_MODE; }
83  void setForcedRadianMode(bool on = true) { typeBits |= FORCED_RADIAN_MODE; }
84  [[deprecated("Use 'isForcedRadianMode' to determine the angle unit.")]]
85  bool isDegreeMode() const { return !isForcedRadianMode(); }
86  [[deprecated("Use ''setForcedRadianMode' to specify the angle unit.")]]
87  void setDegreeMode() { setForcedRadianMode(false); }
88 
89  template<typename T> T to() const;
90 
91  bool isMapping() const { return typeBits & MAPPING; }
92  const Mapping* toMapping() const;
93  Mapping* toMapping();
94 
95  bool isListing() const { return typeBits & LISTING; }
96  const Listing* toListing() const;
97  Listing* toListing();
98 
99 #ifdef CNOID_BACKWARD_COMPATIBILITY
100  bool isSequence() const { return typeBits & LISTING; }
101  const Listing* toSequence() const { return toListing(); }
102  Listing* toSequence() { return toListing(); }
103 #endif
104 
105  bool read(int &out_value) const;
106  bool read(double &out_value) const;
107  bool read(float &out_value) const;
108  bool read(bool &out_value) const;
109  bool read(std::string &out_value) const;
110 
111  bool hasLineInfo() const { return (line_ >= 0); }
112  int line() const { return line_ + 1; }
113  int column() const { return column_ + 1; }
114 
115  void throwException(const std::string& message) const;
116 
120  class CNOID_EXPORT Exception {
121 public:
122  Exception();
123  virtual ~Exception();
124  int line() const { return line_; }
125  int column() const { return column_; }
126  std::string message() const;
127  void setPosition(int line, int column) {
128  line_ = line;
129  column_ = column;
130  }
131  void setMessage(const std::string& m){
132  message_ = m;
133  }
134 private:
135  int line_;
136  int column_;
137  std::string message_;
138  };
139 
141  public:
142  const std::string& key() { return key_; }
143  void setKey(const std::string& key) { key_ = key; }
144  private:
145  std::string key_;
146  };
147 
148  class EmptyKeyException : public Exception {
149  };
150 
151  class NotScalarException : public Exception {
152  };
153 
155  };
156 
158  };
159 
161  };
162 
163  class SyntaxException : public Exception {
164  };
165 
167  };
168 
169  class FileException : public Exception {
170  };
171 
173  };
174 
175  // This function is only used by YAMLWriter
176  int indexInMapping() const { return indexInMapping_; }
177  void setAsHeaderInMapping(int priority = 1) { indexInMapping_ = -priority; }
178 
179 protected:
180 
181  ValueNode() { }
182  ValueNode(TypeBit type) : typeBits(type), line_(-1), column_(-1) { }
183 
184  virtual ~ValueNode() { }
185 
186  void throwNotScalrException() const;
187  void throwNotMappingException() const;
188  void throwNotListingException() const;
189 
190  int typeBits;
191 
192 private:
193  ValueNode(const ValueNode& org);
194  ValueNode& operator=(const ValueNode&);
195 
196  int line_;
197  int column_;
198 
200  int indexInMapping_;
201 
202  friend class YAMLReaderImpl;
203  friend class ScalarNode;
204  friend class Mapping;
205  friend class Listing;
206 };
207 
208 template<> inline double ValueNode::to<double>() const { return toDouble(); }
209 template<> inline float ValueNode::to<float>() const { return toFloat(); }
210 template<> inline int ValueNode::to<int>() const { return toInt(); }
211 template<> inline std::string ValueNode::to<std::string>() const { return toString(); }
212 
214 
215 
216 class CNOID_EXPORT ScalarNode : public ValueNode
217 {
218 public:
219  ScalarNode(const std::string& value, StringStyle stringStyle = PLAIN_STRING);
220  ScalarNode(int value);
221 
222  virtual ValueNode* clone() const;
223 
224  const std::string& stringValue() const { return stringValue_; }
225  StringStyle stringStyle() const { return stringStyle_; }
226 
227 private:
228  ScalarNode(const char* text, size_t length);
229  ScalarNode(const char* text, size_t length, StringStyle stringStyle);
230  ScalarNode(const ScalarNode& org);
231 
232  std::string stringValue_;
233  StringStyle stringStyle_;
234 
235  friend class YAMLReaderImpl;
236  friend class ValueNode;
237  friend class Mapping;
238  friend class Listing;
239 };
240 
242 
243 
244 inline const std::string& ValueNode::toString() const
245 {
246  if(!isScalar()){
248  }
249  return static_cast<const ScalarNode* const>(this)->stringValue_;
250 }
251 
252 
253 class CNOID_EXPORT Mapping : public ValueNode
254 {
255  typedef std::map<std::string, ValueNodePtr> Container;
256 
257 public:
258 
259  typedef Container::iterator iterator;
260  typedef Container::const_iterator const_iterator;
261 
262  Mapping();
263  Mapping(int line, int column);
264  virtual ~Mapping();
265 
266  virtual ValueNode* clone() const;
267  virtual Mapping* cloneMapping() const;
268 
269  bool empty() const { return values.empty(); }
270  int size() const { return static_cast<int>(values.size()); }
271  void clear();
272 
273  void setFlowStyle(bool isFlowStyle = true) { isFlowStyle_ = isFlowStyle; }
274  bool isFlowStyle() const { return isFlowStyle_; }
275 
276  void setFloatingNumberFormat(const char* format);
277  const char* floatingNumberFormat() { return floatingNumberFormat_; }
278 
279  [[deprecated("Use Mapping::setFloatingNumberFormat")]]
280  void setDoubleFormat(const char* format) { setFloatingNumberFormat(format); }
281  [[deprecated("Use Mapping::floatingNumberFormat")]]
282  const char* doubleFormat() { return floatingNumberFormat(); }
283 
284  void setKeyQuoteStyle(StringStyle style);
285 
286  ValueNode* find(const std::string& key) const;
287  ValueNode* find(std::initializer_list<const char*> keys) const;
288  Mapping* findMapping(const std::string& key) const;
289  Mapping* findMapping(std::initializer_list<const char*> keys) const;
290  Listing* findListing(const std::string& key) const;
291  Listing* findListing(std::initializer_list<const char*> keys) const;
292 
293  ValueNodePtr extract(const std::string& key);
294  ValueNodePtr extract(std::initializer_list<const char*> keys);
295 
296  bool extract(const std::string& key, double& out_value);
297  bool extract(const std::string& key, std::string& out_value);
298 
299  ValueNode& get(const std::string& key) const;
300 
301  ValueNode& operator[](const std::string& key) const {
302  return get(key);
303  }
304 
305  void insert(const std::string& key, ValueNode* node);
306 
307  void insert(const Mapping* other);
308 
309  Mapping* openMapping(const std::string& key) {
310  return openMapping_(key, false);
311  }
312 
313  Mapping* openFlowStyleMapping(const std::string& key) {
314  return openFlowStyleMapping_(key, false);
315  }
316 
317  Mapping* createMapping(const std::string& key) {
318  return openMapping_(key, true);
319  }
320 
321  Mapping* createFlowStyleMapping(const std::string& key) {
322  return openFlowStyleMapping_(key, true);
323  }
324 
325  Listing* openListing(const std::string& key) {
326  return openListing_(key, false);
327  }
328 
329  Listing* openFlowStyleListing(const std::string& key){
330  return openFlowStyleListing_(key, false);
331  }
332 
333  Listing* createListing(const std::string& key){
334  return openListing_(key, true);
335  }
336 
337  Listing* createFlowStyleListing(const std::string& key){
338  return openFlowStyleListing_(key, true);
339  }
340 
341  bool remove(const std::string& key);
342 
343  bool read(const std::string& key, std::string& out_value) const;
344  bool read(const std::string& key, bool& out_value) const;
345  bool read(const std::string& key, int& out_value) const;
346  bool read(const std::string& key, double& out_value) const;
347  bool read(const std::string& key, float& out_value) const;
348 
349  template<class T>
350  bool read(std::initializer_list<const char*> keys, T& out_value) const {
351  for(auto& key : keys){
352  if(this->read(key, out_value)){
353  return true;
354  }
355  }
356  return false;
357  }
358 
359  bool readAngle(const std::string& key, double& out_angle, const ValueNode* unitAttrNode = nullptr) const;
360  bool readAngle(const std::string& key, float& out_angle, const ValueNode* unitAttrNode = nullptr) const;
361  bool readAngle(std::initializer_list<const char*> keys, double& out_angle, const ValueNode* unitAttrNode = nullptr) const;
362  bool readAngle(std::initializer_list<const char*> keys, float& out_angle, const ValueNode* unitAttrNode = nullptr) const;
363 
364  template <class T> T get(const std::string& key) const {
365  T value;
366  if(read(key, value)){
367  return value;
368  } else {
369  throwKeyNotFoundException(key);
370  return value;
371  }
372  }
373 
374  template <class T>
375  T get(const std::string& key, const T& defaultValue) const {
376  T value;
377  if(read(key, value)){
378  return value;
379  } else {
380  return defaultValue;
381  }
382  }
383 
384  std::string get(const std::string& key, const char* defaultValue) const {
385  std::string value;
386  if(read(key, value)){
387  return value;
388  } else {
389  return defaultValue;
390  }
391  }
392 
393  template<class T>
394  T get(std::initializer_list<const char*> keys, const T& defaultValue) const {
395  T value;
396  if(read(keys, value)){
397  return value;
398  } else {
399  return defaultValue;
400  }
401  }
402 
403  void write(const std::string& key, const std::string& value, StringStyle stringStyle = PLAIN_STRING);
404  void write(const std::string& key, const char* value, StringStyle stringStyle = PLAIN_STRING){
405  write(key, std::string(value), stringStyle);
406  }
407 
408  void write(const std::string& key, bool value);
409  void write(const std::string& key, int value);
410  void write(const std::string& key, double value);
411  void writePath(const std::string &key, const std::string& value);
412 
413  template<class ArrayType> void writeAsListing(const std::string& key, const ArrayType& container);
414 
415  typedef enum { READ_MODE, WRITE_MODE } AssignMode;
416 
417  void setAssignMode(AssignMode mode) { this->mode = mode; }
418 
419  template <class T>
420  void assign(const std::string& key, T& io_value, const T& defaultValue){
421  switch(mode){
422  case READ_MODE:
423  if(!read(key, io_value)){
424  io_value = defaultValue;
425  }
426  break;
427  case WRITE_MODE:
428  write(key, io_value);
429  break;
430  }
431  }
432 
433  iterator begin() { return values.begin(); }
434  iterator end() { return values.end(); }
435  const_iterator begin() const { return values.begin(); }
436  const_iterator end() const { return values.end(); }
437 
438  void throwKeyNotFoundException(const std::string& key) const;
439 
440  StringStyle keyStringStyle() const { return keyStringStyle_; }
441 
443  template <class T> T read(const std::string& key) const { return get<T>(key); }
444 
445 #ifdef CNOID_BACKWARD_COMPATIBILITY
446  Listing* findSequence(const std::string& key) const { return findListing(key); }
447  Listing* openSequence(const std::string& key) { return openListing(key); }
448  Listing* openFlowStyleSequence(const std::string& key){ return openFlowStyleListing(key); }
449  Listing* createSequence(const std::string& key){ return createListing(key); }
450  Listing* createFlowStyleSequence(const std::string& key){ return createFlowStyleListing(key); }
451 #endif
452 
453 private:
454 
455  Mapping(const Mapping& org);
456  Mapping& operator=(const Mapping&);
457 
458  Mapping* openMapping_(const std::string& key, bool doOverwrite);
459  Mapping* openFlowStyleMapping_(const std::string& key, bool doOverwrite);
460  Listing* openListing_(const std::string& key, bool doOverwrite);
461  Listing* openFlowStyleListing_(const std::string& key, bool doOverwrite);
462 
463  inline void insertSub(const std::string& key, ValueNode* node);
464 
465  void writeSub(const std::string &key, const char* text, size_t length, StringStyle stringStyle);
466 
467  Container values;
468  AssignMode mode;
469  int indexCounter;
470  const char* floatingNumberFormat_;
471  bool isFlowStyle_;
472  StringStyle keyStringStyle_;
473 
474  friend class Listing;
475  friend class YAMLReaderImpl;
476 };
477 
479 
480 
486 class CNOID_EXPORT Listing : public ValueNode
487 {
488  typedef std::vector<ValueNodePtr> Container;
489 
490 public:
491 
492  Listing();
493  Listing(int size);
494  ~Listing();
495 
496  virtual ValueNode* clone() const;
497 
498  typedef Container::iterator iterator;
499  typedef Container::const_iterator const_iterator;
500 
501  bool empty() const { return values.empty(); }
502  int size() const { return static_cast<int>(values.size()); }
503  void clear();
504  void reserve(int size);
505 
506  void setFlowStyle(bool isFlowStyle = true) { isFlowStyle_ = isFlowStyle; }
507  bool isFlowStyle() const { return isFlowStyle_; }
508 
509  void setFloatingNumberFormat(const char* format);
510  const char* floatingNumberFormat() { return floatingNumberFormat_; }
511 
512  [[deprecated("Use Mapping::setFloatingNumberFormat")]]
513  void setDoubleFormat(const char* format) { setFloatingNumberFormat(format); }
514  [[deprecated("Use Mapping::floatingNumberFormat")]]
515  const char* doubleFormat() { return floatingNumberFormat(); }
516 
517  ValueNode* front() const {
518  return values.front();
519  }
520 
521  ValueNode* back() const {
522  return values.back();
523  }
524 
525  ValueNode* at(int i) const {
526  return values[i];
527  }
528 
532  ValueNode& get(int i) const {
533  return *values[i];
534  }
535 
536  void write(int i, int value);
537  void write(int i, const std::string& value, StringStyle stringStyle = PLAIN_STRING);
538 
542  ValueNode& operator[](int i) const {
543  return *values[i];
544  }
545 
547  //MappingPtr extractMapping(const std::string& key) const;
548 
549  Mapping* newMapping();
550 
551  void append(ValueNode* node) {
552  values.push_back(node);
553  }
554 
555  void insert(int index, ValueNode* node);
556 
557  void append(int value);
558 
564  void append(int value, int maxColumns, int numValues = 0) {
565  insertLF(maxColumns, numValues);
566  append(value);
567  }
568 
569  void append(size_t value);
570  void append(double value);
571 
577  void append(double value, int maxColumns, int numValues = 0) {
578  insertLF(maxColumns, numValues);
579  append(value);
580  }
581 
582  void append(const std::string& value, StringStyle stringStyle = PLAIN_STRING);
583 
589  void append(const std::string& value, int maxColumns, int numValues = 0, StringStyle stringStyle = PLAIN_STRING){
590  insertLF(maxColumns, numValues);
591  append(value, stringStyle);
592  }
593 
594  void appendLF();
595 
596  iterator begin() { return values.begin(); }
597  iterator end() { return values.end(); }
598  const_iterator begin() const { return values.begin(); }
599  const_iterator end() const { return values.end(); };
600 
601 private:
602 
603  Listing(int line, int column);
604  Listing(int line, int column, int reservedSize);
605 
606  Listing(const Listing& org);
607  Listing& operator=(const Listing&);
608 
609  void insertLF(int maxColumns, int numValues);
610 
611  Container values;
612  const char* floatingNumberFormat_;
613  bool isFlowStyle_;
614  bool doInsertLFBeforeNextElement;
615 
616  friend class Mapping;
617  friend class YAMLReaderImpl;
618 };
619 
620 
621 template<class ArrayType>
622 void Mapping::writeAsListing(const std::string& key, const ArrayType& container)
623 {
624  auto listing = createFlowStyleListing(key);
625  for(auto& value : container){
626  listing->append(value);
627  }
628 }
629 
630 
632 
633 #ifdef CNOID_BACKWARD_COMPATIBILITY
634 typedef ValueNode YamlNode;
635 typedef ValueNodePtr YamlNodePtr;
636 typedef ScalarNode YamlScalar;
637 typedef Mapping YamlMapping;
638 typedef MappingPtr YamlMappingPtr;
639 typedef Listing YamlSequence;
640 typedef ListingPtr YamlSequencePtr;
641 typedef Listing Sequence;
642 typedef ListingPtr SequencePtr;
643 #endif
644 }
645 
646 #endif
cnoid::Listing::isFlowStyle
bool isFlowStyle() const
Definition: ValueTree.h:507
cnoid::LISTING
@ LISTING
Definition: YAMLWriter.cpp:18
cnoid::ValueNode::ValueNode
ValueNode(TypeBit type)
Definition: ValueTree.h:182
cnoid::Mapping::begin
iterator begin()
Definition: ValueTree.h:433
cnoid::ValueNode::isValid
bool isValid() const
Definition: ValueTree.h:54
Referenced.h
cnoid::ValueNode::~ValueNode
virtual ~ValueNode()
Definition: ValueTree.h:184
cnoid::ValueNode::isScalar
bool isScalar() const
Definition: ValueTree.h:67
cnoid::ValueNode::Exception::column
int column() const
Definition: ValueTree.h:125
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::Mapping::get
T get(const std::string &key) const
Definition: ValueTree.h:364
cnoid::Mapping::openListing
Listing * openListing(const std::string &key)
Definition: ValueTree.h:325
cnoid::Mapping::setFlowStyle
void setFlowStyle(bool isFlowStyle=true)
Definition: ValueTree.h:273
cnoid::Mapping::size
int size() const
Definition: ValueTree.h:270
cnoid::Mapping::openFlowStyleListing
Listing * openFlowStyleListing(const std::string &key)
Definition: ValueTree.h:329
cnoid::Mapping::operator[]
ValueNode & operator[](const std::string &key) const
Definition: ValueTree.h:301
cnoid::Listing::append
void append(const std::string &value, int maxColumns, int numValues=0, StringStyle stringStyle=PLAIN_STRING)
Definition: ValueTree.h:589
cnoid::ValueNode::isDegreeMode
bool isDegreeMode() const
Definition: ValueTree.h:85
cnoid::write
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
cnoid::ValueNode::Exception::setPosition
void setPosition(int line, int column)
Definition: ValueTree.h:127
cnoid::ValueNode::isCollection
bool isCollection() const
Definition: ValueTree.h:69
cnoid::Mapping::keyStringStyle
StringStyle keyStringStyle() const
Definition: ValueTree.h:440
cnoid::ValueNode::toString
const std::string & toString() const
Definition: ValueTree.h:244
cnoid::DOUBLE_QUOTED
@ DOUBLE_QUOTED
Definition: ValueTree.h:24
cnoid::ValueNode::hasLineInfo
bool hasLineInfo() const
Definition: ValueTree.h:111
cnoid::FOLDED_STRING
@ FOLDED_STRING
Definition: ValueTree.h:24
cnoid::Mapping::begin
const_iterator begin() const
Definition: ValueTree.h:435
cnoid::ValueNode::isForcedRadianMode
bool isForcedRadianMode() const
Definition: ValueTree.h:82
cnoid::ValueNode::KeyNotFoundException::key
const std::string & key()
Definition: ValueTree.h:142
cnoid::ScalarNode::stringStyle
StringStyle stringStyle() const
Definition: ValueTree.h:225
cnoid::Listing::end
iterator end()
Definition: ValueTree.h:597
cnoid::ValueNode::LFType
TypeBit LFType() const
Definition: ValueTree.h:57
cnoid::ValueNode
Definition: ValueTree.h:34
cnoid::Mapping::read
bool read(std::initializer_list< const char * > keys, T &out_value) const
Definition: ValueTree.h:350
cnoid::Mapping::empty
bool empty() const
Definition: ValueTree.h:269
cnoid::ValueNode::indexInMapping
int indexInMapping() const
Definition: ValueTree.h:176
cnoid::ValueNode::TypeBit
TypeBit
Definition: ValueTree.h:44
cnoid::Mapping::createMapping
Mapping * createMapping(const std::string &key)
Definition: ValueTree.h:317
cnoid::ValueNode::typeBits
int typeBits
Definition: ValueTree.h:190
cnoid::Mapping::get
T get(const std::string &key, const T &defaultValue) const
Definition: ValueTree.h:375
cnoid::Listing::front
ValueNode * front() const
Definition: ValueTree.h:517
cnoid::Mapping::setDoubleFormat
void setDoubleFormat(const char *format)
Definition: ValueTree.h:280
cnoid::Mapping::doubleFormat
const char * doubleFormat()
Definition: ValueTree.h:282
cnoid::ValueNode::throwNotScalrException
void throwNotScalrException() const
Definition: ValueTree.cpp:414
cnoid::Listing::empty
bool empty() const
Definition: ValueTree.h:501
cnoid::Listing::end
const_iterator end() const
Definition: ValueTree.h:599
cnoid::ValueNode::toFloat
float toFloat() const
Definition: ValueTree.cpp:240
cnoid::ValueNode::EmptyKeyException
Definition: ValueTree.h:148
cnoid::Listing::back
ValueNode * back() const
Definition: ValueTree.h:521
cnoid::MAPPING
@ MAPPING
Definition: YAMLWriter.cpp:18
cnoid::read
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
cnoid::ValueNode::isListing
bool isListing() const
Definition: ValueTree.h:95
cnoid::ValueNode::SyntaxException
Definition: ValueTree.h:163
cnoid::Listing::begin
const_iterator begin() const
Definition: ValueTree.h:598
cnoid::ValueNode::NotMappingException
Definition: ValueTree.h:157
cnoid::Mapping::createFlowStyleListing
Listing * createFlowStyleListing(const std::string &key)
Definition: ValueTree.h:337
cnoid::Listing::floatingNumberFormat
const char * floatingNumberFormat()
Definition: ValueTree.h:510
cnoid::Mapping::get
T get(std::initializer_list< const char * > keys, const T &defaultValue) const
Definition: ValueTree.h:394
cnoid::ref_ptr< ValueNode >
cnoid::ValueNode::toInt
int toInt() const
Definition: ValueTree.cpp:166
cnoid::SINGLE_QUOTED
@ SINGLE_QUOTED
Definition: ValueTree.h:24
cnoid::Listing::const_iterator
Container::const_iterator const_iterator
Definition: ValueTree.h:499
cnoid::Mapping::const_iterator
Container::const_iterator const_iterator
Definition: ValueTree.h:260
cnoid::ValueNode::line
int line() const
Definition: ValueTree.h:112
cnoid::ValueNode::Exception
Definition: ValueTree.h:120
cnoid::Mapping::get
std::string get(const std::string &key, const char *defaultValue) const
Definition: ValueTree.h:384
cnoid::ValueNodePtr
ref_ptr< ValueNode > ValueNodePtr
Definition: ValueTree.h:213
cnoid::ValueNode::nodeType
TypeBit nodeType() const
Definition: ValueTree.h:58
cnoid::ScalarNodePtr
ref_ptr< ScalarNode > ScalarNodePtr
Definition: ValueTree.h:241
cnoid::Mapping::createFlowStyleMapping
Mapping * createFlowStyleMapping(const std::string &key)
Definition: ValueTree.h:321
cnoid::Listing::size
int size() const
Definition: ValueTree.h:502
cnoid::Listing::doubleFormat
const char * doubleFormat()
Definition: ValueTree.h:515
cnoid::Listing
Definition: ValueTree.h:486
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::LITERAL_STRING
@ LITERAL_STRING
Definition: ValueTree.h:24
cnoid::Mapping::openMapping
Mapping * openMapping(const std::string &key)
Definition: ValueTree.h:309
cnoid::StringStyle
StringStyle
Definition: ValueTree.h:24
cnoid::ValueNode::DocumentNotFoundException
Definition: ValueTree.h:166
cnoid::ValueNode::isString
bool isString() const
Definition: ValueTree.h:68
cnoid::ValueNode::NotListingException
Definition: ValueTree.h:160
cnoid::Mapping::end
const_iterator end() const
Definition: ValueTree.h:436
cnoid::PLAIN_STRING
@ PLAIN_STRING
Definition: ValueTree.h:24
cnoid::Mapping::createListing
Listing * createListing(const std::string &key)
Definition: ValueTree.h:333
cnoid::Mapping::read
T read(const std::string &key) const
Definition: ValueTree.h:443
cnoid::ValueNode::ValueNode
ValueNode()
Definition: ValueTree.h:181
cnoid::ValueNode::toDouble
double toDouble() const
Definition: ValueTree.cpp:217
cnoid::Listing::append
void append(int value, int maxColumns, int numValues=0)
Definition: ValueTree.h:564
cnoid::Listing::append
void append(ValueNode *node)
Definition: ValueTree.h:551
cnoid::ValueNode::isMapping
bool isMapping() const
Definition: ValueTree.h:91
cnoid::Listing::begin
iterator begin()
Definition: ValueTree.h:596
cnoid::ValueNode::setForcedRadianMode
void setForcedRadianMode(bool on=true)
Definition: ValueTree.h:83
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Mapping::AssignMode
AssignMode
Definition: ValueTree.h:415
cnoid::ValueNode::KeyNotFoundException::setKey
void setKey(const std::string &key)
Definition: ValueTree.h:143
cnoid::Mapping::setAssignMode
void setAssignMode(AssignMode mode)
Definition: ValueTree.h:417
cnoid::ValueNode::FileException
Definition: ValueTree.h:169
cnoid::ScalarNode::stringValue
const std::string & stringValue() const
Definition: ValueTree.h:224
cnoid::Mapping::floatingNumberFormat
const char * floatingNumberFormat()
Definition: ValueTree.h:277
cnoid::ValueNode::UnknownNodeTypeException
Definition: ValueTree.h:172
cnoid::Listing::setFlowStyle
void setFlowStyle(bool isFlowStyle=true)
Definition: ValueTree.h:506
cnoid::ValueNode::column
int column() const
Definition: ValueTree.h:113
cnoid::Mapping::openFlowStyleMapping
Mapping * openFlowStyleMapping(const std::string &key)
Definition: ValueTree.h:313
cnoid::ScalarNode
Definition: ValueTree.h:216
cnoid::ValueNode::ScalarTypeMismatchException
Definition: ValueTree.h:154
cnoid::Listing::iterator
Container::iterator iterator
Definition: ValueTree.h:498
cnoid::Mapping::end
iterator end()
Definition: ValueTree.h:434
cnoid::ValueNode::Exception::line
int line() const
Definition: ValueTree.h:124
cnoid::ValueNode::NotScalarException
Definition: ValueTree.h:151
cnoid::Listing::setDoubleFormat
void setDoubleFormat(const char *format)
Definition: ValueTree.h:513
cnoid::ValueNode::setDegreeMode
void setDegreeMode()
Definition: ValueTree.h:87
cnoid::Listing::at
ValueNode * at(int i) const
Definition: ValueTree.h:525
cnoid::Listing::operator[]
ValueNode & operator[](int i) const
Definition: ValueTree.h:542
cnoid::ValueNode::KeyNotFoundException
Definition: ValueTree.h:140
cnoid::Mapping::iterator
Container::iterator iterator
Definition: ValueTree.h:259
cnoid::ListingPtr
ref_ptr< Listing > ListingPtr
Definition: ValueTree.h:631
cnoid::ValueNode::Exception::setMessage
void setMessage(const std::string &m)
Definition: ValueTree.h:131
cnoid::MappingPtr
ref_ptr< Mapping > MappingPtr
Definition: StdSceneWriter.h:12
cnoid::ValueNode::setAsHeaderInMapping
void setAsHeaderInMapping(int priority=1)
Definition: ValueTree.h:177
cnoid::Listing::append
void append(double value, int maxColumns, int numValues=0)
Definition: ValueTree.h:577
cnoid::Mapping::assign
void assign(const std::string &key, T &io_value, const T &defaultValue)
Definition: ValueTree.h:420
cnoid::Mapping::isFlowStyle
bool isFlowStyle() const
Definition: ValueTree.h:274
cnoid::Mapping::write
void write(const std::string &key, const char *value, StringStyle stringStyle=PLAIN_STRING)
Definition: ValueTree.h:404
cnoid::Listing::get
ValueNode & get(int i) const
Definition: ValueTree.h:532
cnoid::Mapping::writeAsListing
void writeAsListing(const std::string &key, const ArrayType &container)
Definition: ValueTree.h:622