File indexing completed on 2025-01-18 09:13:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef XML_XMLELEMENTS_H
0014 #define XML_XMLELEMENTS_H
0015
0016
0017 #include <cmath>
0018 #include <string>
0019 #include <vector>
0020 #include <stdexcept>
0021
0022
0023 #include <XML/config.h>
0024
0025 #ifndef RAD_2_DEGREE
0026 #define RAD_2_DEGREE 57.295779513082320876798154814105
0027 #endif
0028 #ifndef M_PI
0029 #define M_PI 3.14159265358979323846
0030 #endif
0031
0032
0033 namespace dd4hep {
0034
0035
0036 namespace xml {
0037
0038 typedef const XmlAttr* Attribute;
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 class XmlString {
0052 public:
0053
0054 static XmlChar* replicate(const XmlChar* c);
0055
0056 static XmlChar* transcode(const char* c);
0057
0058 static void release(char** p);
0059
0060 static size_t length(const char* s);
0061 #ifndef __TIXML__
0062
0063 static size_t length(const XmlChar* s);
0064
0065 static char* transcode(const XmlChar* c);
0066
0067 static void release(XmlChar** p);
0068 #endif
0069 };
0070
0071 #ifdef __TIXML__
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 class XmlException {
0082 public:
0083 std::string msg;
0084 XmlException() : msg() {}
0085 XmlException(const std::string& m) : msg(m) {}
0086 XmlException(const XmlException& e) : msg(e.msg) {}
0087 virtual ~XmlException() {}
0088 XmlException& operator=(const XmlException& c) {
0089 if ( &c != this ) msg = c.msg;
0090 return *this;
0091 }
0092 };
0093 #endif
0094
0095 typedef const std::string& CSTR;
0096
0097
0098 void dumpTree(XmlDocument* doc);
0099
0100
0101 int set_float_precision(int precision);
0102
0103 int get_float_precision();
0104
0105
0106 std::string _toString(const Attribute attr);
0107
0108 std::string _toString(const XmlChar *toTranscode);
0109
0110 std::string _toString(const char* s);
0111
0112 std::string _toString(const std::string& s);
0113
0114 std::string _toString(unsigned long i, const char* fmt = "%lu");
0115
0116 std::string _toString(unsigned int i, const char* fmt = "%u");
0117
0118 std::string _toString(int i, const char* fmt = "%d");
0119
0120 std::string _toString(long i, const char* fmt = "%ld");
0121
0122 std::string _toString(float d, const char* fmt = "%.17e");
0123
0124 std::string _toString(double d, const char* fmt = "%.17e");
0125
0126 std::string _ptrToString(const void* p, const char* fmt = "%p");
0127
0128 template <typename T> std::string _toString(const T* p, const char* fmt = "%p")
0129 { return _ptrToString((void*)p,fmt); }
0130
0131
0132 void _toDictionary(const XmlChar* name, const XmlChar* value);
0133
0134 template <typename T> void _toDictionary(const XmlChar* name, T value);
0135
0136
0137 void _toDictionary(const XmlChar* name, float value);
0138
0139 void _toDictionary(const XmlChar* name, double value);
0140
0141
0142 bool _toBool(const XmlChar* value);
0143
0144 int _toInt(const XmlChar* value);
0145
0146 unsigned int _toUInt(const XmlChar* value);
0147
0148 long _toLong(const XmlChar* value);
0149
0150 unsigned long _toULong(const XmlChar* value);
0151
0152 float _toFloat(const XmlChar* value);
0153
0154 double _toDouble(const XmlChar* value);
0155
0156
0157 std::string getEnviron(const std::string& env);
0158
0159 bool enableEnvironResolution(bool new_value);
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170 class Strng_t {
0171 public:
0172
0173 XmlChar* m_xml;
0174 #ifndef __TIXML__
0175
0176 Strng_t(const XmlChar* c) {
0177 m_xml = XmlString::replicate(c);
0178 }
0179
0180 Strng_t& operator=(const XmlChar* s);
0181 #endif
0182
0183 Strng_t(const char* c) {
0184 m_xml = XmlString::transcode(c);
0185 }
0186
0187 Strng_t(const std::string& c) {
0188 m_xml = XmlString::transcode(c.c_str());
0189 }
0190
0191 Strng_t(const Strng_t& c) {
0192 m_xml = XmlString::replicate(c.m_xml);
0193 }
0194
0195 ~Strng_t() {
0196 if (m_xml)
0197 XmlString::release(&m_xml);
0198 }
0199
0200 operator const XmlChar*() const {
0201 return m_xml;
0202 }
0203
0204 const XmlChar* ptr() const {
0205 return m_xml;
0206 }
0207
0208 size_t length() const {
0209 return XmlString::length(m_xml);
0210 }
0211
0212 Strng_t& operator=(const char* s);
0213
0214 Strng_t& operator=(const Strng_t& s);
0215
0216 Strng_t& operator=(const std::string& s);
0217 };
0218
0219
0220 Strng_t operator+(const Strng_t& a, const char* b);
0221
0222 Strng_t operator+(const Strng_t& a, const std::string& b);
0223
0224 Strng_t operator+(const Strng_t& a, const Strng_t& b);
0225
0226 Strng_t operator+(const char* a, const Strng_t& b);
0227
0228 Strng_t operator+(const std::string& a, const Strng_t& b);
0229
0230 #ifndef __TIXML__
0231
0232 Strng_t operator+(const Strng_t& a, const XmlChar* b);
0233
0234 Strng_t operator+(const XmlChar* a, const Strng_t& b);
0235
0236 Strng_t operator+(const XmlChar* a, const std::string& b);
0237
0238 Strng_t operator+(const std::string& a, const XmlChar* b);
0239
0240 #endif
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254 class Tag_t : public Strng_t {
0255 public:
0256
0257 std::string m_str;
0258 #ifndef __TIXML__
0259
0260 Tag_t(const char* s)
0261 : Strng_t(s), m_str(s) {
0262 }
0263 #endif
0264
0265 Tag_t(const XmlChar* s)
0266 : Strng_t(s), m_str(_toString(s)) {
0267 }
0268
0269 Tag_t(const Strng_t& s)
0270 : Strng_t(s), m_str(_toString(s)) {
0271 }
0272
0273 Tag_t(const std::string& s)
0274 : Strng_t(s), m_str(s) {
0275 }
0276
0277
0278 Tag_t(const std::string& v, const std::string& s, void (*register_func)(const std::string&, Tag_t*))
0279 : Strng_t(s), m_str(s) {
0280 register_func(v, this);
0281 }
0282
0283 Tag_t(const Tag_t& c)
0284 : Strng_t(c), m_str(c.m_str) {
0285 }
0286
0287 ~Tag_t() {
0288 }
0289
0290
0291 Tag_t& operator=(const char* s);
0292
0293 Tag_t& operator=(const Tag_t& s);
0294
0295 Tag_t& operator=(const Strng_t& s);
0296
0297 Tag_t& operator=(const std::string& s);
0298
0299
0300 operator const std::string&() const {
0301 return m_str;
0302 }
0303
0304 const std::string& str() const {
0305 return m_str;
0306 }
0307
0308 const char* c_str() const {
0309 return m_str.c_str();
0310 }
0311 };
0312
0313
0314 Tag_t operator+(const Tag_t& a, const char* b);
0315
0316 Tag_t operator+(const char* a, const Tag_t& b);
0317
0318 Tag_t operator+(const Tag_t& a, const XmlChar* b);
0319
0320 Tag_t operator+(const Tag_t& a, const Strng_t& b);
0321
0322 Tag_t operator+(const Tag_t& a, const std::string& b);
0323
0324 inline bool operator==(const std::string& c, const Tag_t& b) {
0325 return c == b.m_str;
0326 }
0327
0328
0329 std::string _toString(const Strng_t& s);
0330
0331 std::string _toString(const Tag_t& s);
0332
0333 void _toDictionary(const XmlChar* name, const Strng_t& s);
0334
0335 void _toDictionary(const XmlChar* name, const Tag_t& t);
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349 class NodeList {
0350 public:
0351 Tag_t m_tag;
0352 XmlElement* m_node;
0353 mutable XmlElement* m_ptr;
0354
0355
0356 NodeList(const NodeList& l);
0357
0358 NodeList(XmlElement* frst, const XmlChar* t);
0359
0360 ~NodeList();
0361
0362 XmlElement* reset();
0363
0364 XmlElement* next() const;
0365
0366 XmlElement* previous() const;
0367
0368 NodeList& operator=(const NodeList& l);
0369 };
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380 class Handle_t {
0381 public:
0382
0383 typedef XmlElement* Elt_t;
0384
0385
0386 mutable Elt_t m_node;
0387
0388
0389 Handle_t(Elt_t e = 0)
0390 : m_node(e) {
0391 }
0392
0393 Elt_t operator->() const {
0394 return m_node;
0395 }
0396
0397 operator Elt_t() const {
0398 return m_node;
0399 }
0400
0401 Elt_t ptr() const {
0402 return m_node;
0403 }
0404
0405 Handle_t clone(XmlDocument* new_doc) const;
0406
0407
0408 const XmlChar* rawTag() const;
0409
0410 const XmlChar* rawText() const;
0411
0412 const XmlChar* rawValue() const;
0413
0414 std::string tag() const {
0415 return _toString(rawTag());
0416 }
0417
0418 std::string text() const {
0419 return _toString(rawText());
0420 }
0421
0422 std::string value() const {
0423 return _toString(rawValue());
0424 }
0425
0426 void setValue(const XmlChar* text) const;
0427
0428 void setValue(const std::string& text) const;
0429
0430 void setText(const XmlChar* text) const;
0431
0432 void setText(const std::string& text) const;
0433
0434
0435
0436
0437 const XmlChar* attr_name(const Attribute attr) const;
0438
0439 const XmlChar* attr_value(const Attribute attr) const;
0440
0441 const XmlChar* attr_value(const XmlChar* attr) const;
0442
0443 const XmlChar* attr_value_nothrow(const XmlChar* attr) const;
0444
0445
0446 Attribute attr_ptr(const XmlChar* attr) const;
0447
0448 Attribute attr_nothrow(const XmlChar* tag) const;
0449
0450 bool hasAttr(const XmlChar* t) const;
0451
0452 std::vector<Attribute> attributes() const;
0453
0454 template <class T> T attr(const Attribute a) const {
0455 return this->attr<T>(this->attr_name(a));
0456 }
0457
0458 void removeAttrs() const;
0459
0460 void setAttrs(Handle_t e) const;
0461
0462 template <class T> T attr(const XmlChar* name) const;
0463
0464 template <class T> T attr(const XmlChar* name, T default_value) const;
0465
0466
0467 Attribute setAttr(const XmlChar* t, const XmlChar* v) const;
0468
0469 Attribute setAttr(const XmlChar* t, const Attribute v) const;
0470
0471 Attribute setAttr(const XmlChar* t, int val) const;
0472
0473 Attribute setAttr(const XmlChar* t, bool val) const;
0474
0475 Attribute setAttr(const XmlChar* t, float val) const;
0476
0477 Attribute setAttr(const XmlChar* t, double val) const;
0478
0479 Attribute setAttr(const XmlChar* t, const std::string& val) const;
0480 #ifndef __TIXML__
0481
0482 bool hasAttr(const char* t) const {
0483 return hasAttr(Strng_t(t));
0484 }
0485
0486 template <class T> T attr(const char* name) const {
0487 return this->attr<T>(Strng_t(name));
0488 }
0489
0490 template <class T> T attr(const char* name, const T& default_value) const {
0491 Strng_t tag(name);
0492 return this->hasAttr(tag) ? this->attr<T>(tag) : default_value;
0493 }
0494
0495 Attribute setAttr(const XmlChar* t, const char* v) const;
0496 #endif
0497
0498
0499 Handle_t setRef(const XmlChar* tag, const XmlChar* ref);
0500
0501 Handle_t setRef(const XmlChar* tag, const std::string& ref);
0502
0503
0504
0505
0506 bool hasChild(const XmlChar* tag) const;
0507
0508 Handle_t child(const XmlChar* tag, bool throw_exception = true) const;
0509
0510 NodeList children(const XmlChar* tag) const;
0511
0512 size_t numChildren(const XmlChar* tag, bool throw_exception) const;
0513
0514 Handle_t remove(Handle_t e) const;
0515
0516 void removeChildren(const XmlChar* tag) const;
0517
0518 void append(Handle_t e) const;
0519
0520 Handle_t parent() const;
0521
0522 unsigned int checksum(unsigned int param, unsigned int (fcn)(unsigned int param, const XmlChar*, size_t)=0) const;
0523 };
0524
0525 #define INLINE inline
0526 typedef const XmlChar* cpXmlChar;
0527
0528 template <> INLINE Attribute Handle_t::attr<Attribute>(const XmlChar* tag_value) const {
0529 return attr_ptr(tag_value);
0530 }
0531
0532 template <> INLINE cpXmlChar Handle_t::attr<cpXmlChar>(const XmlChar* tag_value) const {
0533 return attr_value(tag_value);
0534 }
0535
0536 template <> INLINE bool Handle_t::attr<bool>(const XmlChar* tag_value) const {
0537 return _toBool(attr_value(tag_value));
0538 }
0539
0540 template <> INLINE int Handle_t::attr<int>(const XmlChar* tag_value) const {
0541 return _toInt(attr_value(tag_value));
0542 }
0543
0544 template <> INLINE unsigned int Handle_t::attr<unsigned int>(const XmlChar* tag_value) const {
0545 return _toUInt(attr_value(tag_value));
0546 }
0547
0548 template <> INLINE long Handle_t::attr<long>(const XmlChar* tag_value) const {
0549 return _toLong(attr_value(tag_value));
0550 }
0551
0552 template <> INLINE unsigned long Handle_t::attr<unsigned long>(const XmlChar* tag_value) const {
0553 return _toULong(attr_value(tag_value));
0554 }
0555
0556 template <> INLINE float Handle_t::attr<float>(const XmlChar* tag_value) const {
0557 return _toFloat(attr_value(tag_value));
0558 }
0559
0560 template <> INLINE double Handle_t::attr<double>(const XmlChar* tag_value) const {
0561 return _toDouble(attr_value(tag_value));
0562 }
0563
0564 template <> INLINE std::string Handle_t::attr<std::string>(const XmlChar* tag_value) const {
0565 return _toString(attr_value(tag_value));
0566 }
0567
0568 template <> INLINE Attribute Handle_t::attr<Attribute>(const XmlChar* tag_value, Attribute default_value) const {
0569 Attribute a = attr_nothrow(tag_value);
0570 return a ? a : std::move(default_value);
0571 }
0572
0573 template <> INLINE bool Handle_t::attr<bool>(const XmlChar* tag_value, bool default_value) const {
0574 Attribute a = attr_nothrow(tag_value);
0575 return a ? _toBool(attr_value(a)) : default_value;
0576 }
0577
0578 template <> INLINE int Handle_t::attr<int>(const XmlChar* tag_value, int default_value) const {
0579 Attribute a = attr_nothrow(tag_value);
0580 return a ? _toInt(attr_value(a)) : default_value;
0581 }
0582
0583 template <> INLINE unsigned int Handle_t::attr<unsigned int>(const XmlChar* tag_value, unsigned int default_value) const {
0584 Attribute a = attr_nothrow(tag_value);
0585 return a ? _toUInt(attr_value(a)) : default_value;
0586 }
0587
0588 template <> INLINE long Handle_t::attr<long>(const XmlChar* tag_value, long default_value) const {
0589 Attribute a = attr_nothrow(tag_value);
0590 return a ? _toLong(attr_value(a)) : default_value;
0591 }
0592
0593 template <> INLINE unsigned long Handle_t::attr<unsigned long>(const XmlChar* tag_value, unsigned long default_value) const {
0594 Attribute a = attr_nothrow(tag_value);
0595 return a ? _toULong(attr_value(a)) : default_value;
0596 }
0597
0598 template <> INLINE float Handle_t::attr<float>(const XmlChar* tag_value, float default_value) const {
0599 Attribute a = attr_nothrow(tag_value);
0600 return a ? _toFloat(attr_value(a)) : default_value;
0601 }
0602
0603 template <> INLINE double Handle_t::attr<double>(const XmlChar* tag_value, double default_value) const {
0604 Attribute a = attr_nothrow(tag_value);
0605 return a ? _toDouble(attr_value(a)) : default_value;
0606 }
0607
0608 template <> INLINE std::string Handle_t::attr<std::string>(const XmlChar* tag_value, std::string default_value) const {
0609 Attribute a = attr_nothrow(tag_value);
0610 return a ? _toString(attr_value(a)) : std::move(default_value);
0611 }
0612
0613 #if 0
0614 template<> INLINE bool Handle_t::attr<bool>(const Attribute tag_value) const
0615 { return _toBool(attr_value(tag_value));}
0616
0617 template<> INLINE int Handle_t::attr<int>(const Attribute tag_value) const
0618 { return _toInt(attr_value(tag_value));}
0619
0620 template<> INLINE float Handle_t::attr<float>(const Attribute tag_value) const
0621 { return _toFloat(attr_value(tag_value));}
0622
0623 template<> INLINE double Handle_t::attr<double>(const Attribute tag_value) const
0624 { return _toDouble(attr_value(tag_value));}
0625
0626 template<> INLINE std::string Handle_t::attr<std::string>(const Attribute tag_value) const
0627 { return _toString(attr_value(tag_value));}
0628 #endif
0629
0630
0631
0632
0633
0634
0635
0636 class Collection_t : public Handle_t {
0637 public:
0638
0639 NodeList m_children;
0640 #ifndef __TIXML__
0641
0642 Collection_t(Handle_t node, const XmlChar* tag);
0643 #endif
0644
0645 Collection_t(Handle_t node, const char* tag);
0646
0647 Collection_t(NodeList children);
0648
0649 Collection_t& reset();
0650
0651 size_t size() const;
0652
0653 void operator++() const;
0654
0655 void operator++(int) const;
0656
0657 void operator--() const;
0658
0659 void operator--(int) const;
0660
0661 Elt_t current() const {
0662 return m_node;
0663 }
0664
0665 void throw_loop_exception(const std::exception& e) const;
0666
0667 template <class T> void for_each(T oper) const {
0668 try {
0669 for (const Collection_t& c = *this; c; ++c)
0670 oper(*this);
0671 }
0672 catch (const std::exception& e) {
0673 throw_loop_exception(e);
0674 }
0675 }
0676
0677 template <class T> void for_each(const XmlChar* tag_name, T oper) const {
0678 try {
0679 for (const Collection_t& c = *this; c; ++c)
0680 Collection_t(c.m_node, tag_name).for_each(oper);
0681 }
0682 catch (const std::exception& e) {
0683 throw_loop_exception(e);
0684 }
0685 }
0686 };
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697 class Document {
0698 public:
0699 typedef XmlDocument* DOC;
0700 DOC m_doc;
0701
0702
0703 Document() : m_doc(0) {}
0704
0705 Document(DOC d) : m_doc(d) {}
0706
0707 Document(const Document& d) = default;
0708
0709 Document& operator=(const Document& d) = default;
0710
0711 ~Document() = default;
0712
0713 operator DOC() const { return m_doc; }
0714
0715 DOC operator->() const { return m_doc; }
0716
0717 DOC ptr() const { return m_doc; }
0718
0719
0720 Handle_t root() const;
0721
0722 Handle_t createElt(const XmlChar* tag) const;
0723
0724 Handle_t clone(Handle_t source) const;
0725
0726 std::string uri() const;
0727 };
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741 class DocumentHolder : public Document {
0742 public:
0743
0744 DocumentHolder() = default;
0745
0746 DocumentHolder(const DocumentHolder& copy) = delete;
0747
0748 DocumentHolder(DOC d) : Document(d) { }
0749
0750 DocumentHolder& operator=(const DocumentHolder& copy) = delete;
0751
0752 DocumentHolder& assign(DOC d);
0753
0754 virtual ~DocumentHolder();
0755 };
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769 class Element {
0770 public:
0771
0772 typedef Handle_t::Elt_t Elt_t;
0773
0774
0775 Handle_t m_element;
0776
0777
0778 Element(const Handle_t& e) : m_element(e) { }
0779
0780 Element(const Element& e) : m_element(e.m_element) { }
0781
0782 Element(const Document& document, const XmlChar* type);
0783
0784 Document document() const;
0785
0786
0787 operator bool() const {
0788 return 0 != m_element.ptr();
0789 }
0790
0791 bool operator!() const {
0792 return 0 == m_element.ptr();
0793 }
0794
0795 Element& operator=(const Element& c) {
0796 m_element = c.m_element;
0797 return *this;
0798 }
0799
0800 Element& operator=(Handle_t handle) {
0801 m_element = handle;
0802 return *this;
0803 }
0804
0805 operator Handle_t() const {
0806 return m_element;
0807 }
0808
0809 operator Elt_t() const {
0810 return m_element;
0811 }
0812
0813 Elt_t ptr() const {
0814 return m_element;
0815 }
0816
0817 Handle_t parent() const {
0818 return m_element.parent();
0819 }
0820
0821 Elt_t parentElement() const;
0822
0823 std::string tag() const {
0824 return m_element.tag();
0825 }
0826
0827 const XmlChar* tagName() const {
0828 return m_element.rawTag();
0829 }
0830
0831 std::string text() const {
0832 return m_element.text();
0833 }
0834
0835 void text(const std::string value) const {
0836 return m_element.setText(value);
0837 }
0838
0839 void append(Handle_t handle) const {
0840 m_element.append(handle);
0841 }
0842
0843 Handle_t clone(const Document& new_doc) const {
0844 return new_doc.clone(m_element);
0845 }
0846
0847 bool hasAttr(const XmlChar* name) const {
0848 return m_element.hasAttr(name);
0849 }
0850
0851 template <class T> T attr(const XmlAttr* att) const {
0852 return m_element.attr<T>(att);
0853 }
0854
0855 template <class T> T attr(const XmlChar* tag_value) const {
0856 return m_element.attr<T>(tag_value);
0857 }
0858
0859 template <class T> T attr(const XmlChar* tag_value, T default_value) const {
0860 return m_element.attr<T>(tag_value, default_value);
0861 }
0862 #ifndef __TIXML__
0863
0864 template <class T> T attr(const char* name) const {
0865 return this->attr<T>(Strng_t(name));
0866 }
0867
0868 template <class T> T attr(const char* name, T default_value) const {
0869 return this->attr<T>(Strng_t(name), default_value);
0870 }
0871 #endif
0872
0873 const XmlChar* attr_name(const Attribute a) const {
0874 return m_element.attr_name(a);
0875 }
0876
0877 const XmlChar* attr_value(const Attribute a) const {
0878 return m_element.attr_value(a);
0879 }
0880
0881 size_t numChildren(const XmlChar* tag_value, bool exc = true) const {
0882 return m_element.numChildren(tag_value, exc);
0883 }
0884
0885 void setAttrs(Handle_t e) const {
0886 return m_element.setAttrs(e);
0887 }
0888
0889 void removeAttrs() const {
0890 m_element.removeAttrs();
0891 }
0892
0893 std::vector<Attribute> attributes() const {
0894 return m_element.attributes();
0895 }
0896
0897 Attribute getAttr(const XmlChar* name) const;
0898
0899 template <class T>
0900 Attribute setAttr(const XmlChar* nam, const T& val) const {
0901 return m_element.setAttr(nam, val);
0902 }
0903
0904 template <class T> void setValue(const T& val) const {
0905 m_element.setValue(val);
0906 }
0907
0908 Handle_t clone(Handle_t h) const;
0909
0910 Handle_t addChild(const XmlChar* tag) const;
0911
0912 Handle_t setChild(const XmlChar* tag) const;
0913
0914 Handle_t child(const Strng_t& tag_value, bool except = true) const {
0915 return m_element.child(tag_value, except);
0916 }
0917
0918 Handle_t remove(Handle_t node) const {
0919 return m_element.remove(node);
0920 }
0921
0922 bool hasChild(const XmlChar* tag_value) const {
0923 return m_element.hasChild(tag_value);
0924 }
0925
0926 Attribute setRef(const XmlChar* tag, const XmlChar* refname) const;
0927
0928 Attribute setRef(const XmlChar* tag, const std::string& refname) const;
0929
0930 const XmlChar* getRef(const XmlChar* tag) const;
0931 #ifndef __TIXML__
0932
0933 void addComment(const XmlChar* text) const;
0934 #endif
0935
0936 void addComment(const char* text) const;
0937
0938 void addComment(const std::string& text_value) const;
0939 };
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953 class RefElement : public Element {
0954 public:
0955
0956 Attribute m_name;
0957
0958 RefElement(const Handle_t& e);
0959
0960 RefElement(const RefElement& e);
0961
0962 RefElement(const Document& d, const XmlChar* type, const XmlChar* name);
0963
0964 RefElement& operator=(const RefElement& e);
0965
0966 const XmlChar* name() const;
0967
0968 const XmlChar* refName() const;
0969
0970 void setName(const XmlChar* new_name);
0971 };
0972
0973 #undef INLINE
0974
0975
0976 class DocumentHandler;
0977
0978
0979 void dump_tree(Handle_t elt);
0980
0981 void dump_tree(Handle_t elt, std::ostream& os);
0982
0983 void dump_tree(Document doc);
0984
0985 void dump_tree(Document doc, std::ostream& os);
0986
0987 }
0988 }
0989 #endif