123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- #pragma once
- #include "Array.h"
- #include "ReferenceCounter.h"
- #include <functional>
- namespace Framework
- {
- class Text;
- namespace XML
- {
- class Editor;
-
- class Element : public virtual ReferenceCounter
- {
- private:
- RCArray< Element > *children;
- RCArray< Text > *attributes;
- RCArray< Text > *attributeValues;
- Text *name;
- Text *text;
- Element *parent;
- public:
-
-
- DLLEXPORT Element( Text string );
-
-
-
- DLLEXPORT Element( Text string, Element *zParent );
- DLLEXPORT ~Element();
-
-
-
- DLLEXPORT void setAttribute( Text attribut, Text value );
-
-
- DLLEXPORT void removeAttribute( Text attribut );
-
-
- DLLEXPORT void addChild( Element *child );
-
-
- DLLEXPORT void addChildAtFront( Element *child );
-
-
- DLLEXPORT void removeChild( Element *child );
-
-
- DLLEXPORT void removeChild( int i );
-
- DLLEXPORT void removeAllChilds();
-
-
- DLLEXPORT void removeChilds( RCArray<Element> *childs );
-
- DLLEXPORT void remove();
-
-
- DLLEXPORT void setText( Text text );
-
- DLLEXPORT Text getText() const;
-
- DLLEXPORT int getChildCount() const;
-
- DLLEXPORT Element *getChild( int i ) const;
-
- DLLEXPORT Element *zChild( int i ) const;
-
- DLLEXPORT Element *getParent() const;
-
- DLLEXPORT Element *zParent() const;
-
- DLLEXPORT Iterator< Element* > getChilds() const;
-
- DLLEXPORT Editor selectChildren() const;
-
-
- DLLEXPORT Editor selectChildsByName( Text name ) const;
-
-
- DLLEXPORT Editor selectChildsByAttribute( Text attribute ) const;
-
-
-
- DLLEXPORT Editor selectChildsByAttribute( Text attribute, Text value ) const;
-
- DLLEXPORT bool hasAttribute( Text name ) const;
-
- DLLEXPORT int getAttributeCount() const;
-
- DLLEXPORT Text getAttributeName( int i ) const;
-
- DLLEXPORT Text getAttributeValue( int i ) const;
-
-
- DLLEXPORT Text getAttributeValue( Text attribut ) const;
-
- DLLEXPORT Iterator< Text* > getAttributeNames() const;
-
- DLLEXPORT Iterator< Text* > getAttributeValues() const;
-
- DLLEXPORT Text getName() const;
-
- DLLEXPORT Text toString() const;
-
- DLLEXPORT Element *dublicate() const;
- friend Editor;
- };
-
- class Editor : public virtual ReferenceCounter
- {
- private:
- RCArray< Element > *elements;
- public:
-
- DLLEXPORT Editor( RCArray< Element > *elements );
- DLLEXPORT Editor( const Editor &e );
- DLLEXPORT ~Editor();
-
-
-
- DLLEXPORT void setAttribute( Text attribut, Text value );
-
-
- DLLEXPORT void removeAttribute( Text attribut );
-
-
- DLLEXPORT void addChild( Element *child );
-
-
- DLLEXPORT void removeChild( Element *child );
-
-
- DLLEXPORT void removeChild( int i );
-
- DLLEXPORT void removeAllChilds();
-
-
- DLLEXPORT void removeChilds( RCArray<Element> *childs );
-
- DLLEXPORT void remove();
-
-
- DLLEXPORT void setText( Text text );
-
- DLLEXPORT Iterator<Element *> getIterator();
-
- DLLEXPORT Editor selectChildren() const;
-
- DLLEXPORT Editor selectParents() const;
-
-
- DLLEXPORT Editor whereNameEquals( Text name ) const;
-
-
- DLLEXPORT Editor whereChildWithNameExists( Text name ) const;
-
-
- DLLEXPORT Editor whereChildWithAttributeExists( Text attribute ) const;
-
-
-
- DLLEXPORT Editor whereChildWithAttributeExists( Text attribute, Text value ) const;
-
-
- DLLEXPORT Editor whereAttributeExists( Text attribute ) const;
-
-
-
- DLLEXPORT Editor whereAttributeEquals( Text attribute, Text value ) const;
-
-
- DLLEXPORT Editor without( Editor e ) const;
-
-
- DLLEXPORT void forEach( std::function< void( Element * ) > f ) const;
- };
- }
- }
|