00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_XML_ELEMENT_H_
00028 #define CEYLAN_XML_ELEMENT_H_
00029
00030
00031 #include "CeylanVisitable.h"
00032 #include "CeylanSerializable.h"
00033 #include "CeylanTextDisplayable.h"
00034 #include "CeylanXML.h"
00035
00036
00037 #include <string>
00038
00039
00040
00041
00042 namespace Ceylan
00043 {
00044
00045
00046
00047 namespace XML
00048 {
00049
00050
00051
00057 class CEYLAN_DLL XMLElementException : public XMLException
00058 {
00059
00060 public:
00061
00062 explicit XMLElementException( const std::string & reason ) ;
00063
00064 virtual ~XMLElementException() throw() ;
00065
00066 } ;
00067
00068
00069
00070
00077 class CEYLAN_DLL XMLElement: public TextDisplayable,
00078 public Serializable, public Visitable
00079 {
00080
00081
00082 public:
00083
00084
00089 XMLElement() ;
00090
00091
00093 virtual ~XMLElement() throw() ;
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00114 virtual void saveTo( System::OutputStream & output ) const = 0 ;
00115
00116
00117
00118
00119 private:
00120
00121
00132 XMLElement( const XMLElement & source ) ;
00133
00134
00142 XMLElement & operator = ( const XMLElement & source ) ;
00143
00144
00145 } ;
00146
00147
00148
00149
00150
00152 class XMLVisitor ;
00153
00154
00155
00156
00167 class CEYLAN_DLL XMLMarkup: public XMLElement
00168 {
00169
00170 public:
00171
00172
00173
00178 XMLMarkup() ;
00179
00180
00188 explicit XMLMarkup( const MarkupName & name ) ;
00189
00190
00191
00193 virtual ~XMLMarkup() throw() ;
00194
00195
00196
00204 virtual MarkupName getMarkupName() const ;
00205
00206
00207
00215 virtual std::string getClosingMarkup() const ;
00216
00217
00218
00219
00230 virtual bool hasAttribute( const AttributeName & name ) const ;
00231
00232
00233
00244 virtual AttributeValue getAttribute(
00245 const AttributeName & name ) const ;
00246
00247
00248
00260 virtual AttributeValue getExistingAttribute(
00261 const AttributeName & name ) const ;
00262
00263
00264
00278 virtual void setAttribute( const AttributeName & name,
00279 const AttributeValue & value ) ;
00280
00281
00282
00290 virtual AttributeMap & getAttributes() ;
00291
00292
00293
00294
00295
00296
00297
00298
00299
00309 virtual void loadFrom( System::InputStream & input ) ;
00310
00311
00312
00323 virtual void accept( Visitor & visitor ) ;
00324
00325
00326
00339 virtual void saveTo( System::OutputStream & output ) const ;
00340
00341
00342
00354 virtual const std::string toString(
00355 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00356
00357
00358
00359 protected:
00360
00361
00363 MarkupName _name ;
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 #pragma warning( push )
00374 #pragma warning( disable: 4251 )
00375
00381 AttributeMap _attributes ;
00382
00383 #pragma warning( pop )
00384
00385
00386
00387 private:
00388
00389
00400 XMLMarkup( const XMLMarkup & source ) ;
00401
00402
00410 XMLMarkup & operator = ( const XMLMarkup & source ) ;
00411
00412
00413 } ;
00414
00415
00416
00417
00418
00419
00426 class CEYLAN_DLL XMLText : public XMLElement
00427 {
00428
00429 public:
00430
00431
00432
00437 XMLText() ;
00438
00439
00444 explicit XMLText( const std::string & text ) ;
00445
00446
00447
00449 virtual ~XMLText() throw() ;
00450
00451
00452
00463 virtual void accept( Visitor & visitor ) ;
00464
00465
00466
00471 virtual std::string getText() const ;
00472
00473
00474
00479 virtual void setText( const std::string & newText ) ;
00480
00481
00482
00483
00484
00485
00486
00487
00488
00501 virtual void saveTo( System::OutputStream & output ) const ;
00502
00503
00504
00514 virtual void loadFrom( System::InputStream & input ) ;
00515
00516
00517
00529 virtual const std::string toString(
00530 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00531
00532
00533
00534
00535 protected:
00536
00537
00539 std::string _text ;
00540
00541
00542
00543
00544 private:
00545
00546
00547
00558 XMLText( const XMLText & source ) ;
00559
00560
00561
00569 XMLText & operator = ( const XMLText & source ) ;
00570
00571
00572
00573 } ;
00574
00575
00576 }
00577
00578 }
00579
00580
00581
00582 #endif // CEYLAN_XML_ELEMENT_H_
00583