wxArt2D
|
for writing XML files. More...
#include <genxmlpars.h>
Public Member Functions | |
a2dIOHandlerXMLWrite () | |
Constructor. | |
~a2dIOHandlerXMLWrite () | |
Destructor. | |
virtual void | InitializeSave () |
Inits the IO handler for writing. More... | |
virtual void | ResetSave () |
Reset the object after saving. | |
int | GetDepth () |
Returns depth. | |
void | EndlWriteString (const wxString &string) |
Writes a userdefined string into document. More... | |
void | WriteStartDocument (const wxString &version, const wxString &encoding, bool standalone) |
Writes the XML header declaration. More... | |
void | WriteEndDocument () |
Checks if all open tags are closed. More... | |
void | WriteStartElement (const wxString &name, bool newLine=true) |
Writes start tag which has no attributes. More... | |
void | WriteStartElementAttributes (const wxString &name, bool newLine=true) |
Writes start tag which has attributes. More... | |
void | WriteStartElement (const a2dXMLTag &tag, bool newLine=true) |
Writes start tag. | |
void | WriteElement (const wxString &name, const wxString &content=wxT(""), bool newLine=true) |
Writes start and end tag. More... | |
template<typename w_TypeRef > | |
void | WriteAttribute (const wxString &name, const w_TypeRef &value) |
void | WriteAttribute (const wxString &name, const size_t &value) |
void | WriteAttributeEnt (const wxString &name, const wxString &value) |
void | WriteAttribute (const wxString &name, bool value, bool onlyIfTrue=false) |
Writes an attribute with boolean value. More... | |
void | WriteAttribute (const a2dNamedProperty &attribute) |
Writes an a2dXMLAttribute. | |
void | WriteEndAttributes (bool close=false) |
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket). More... | |
void | WriteEndElement (bool newLine=true) |
Writes correspondending end tag for the current start tag. More... | |
void | WriteContent (const wxString &content) |
Writes content between start and end tag. More... | |
void | WriteNewLine () |
Writes a new line and takes care of indentation. | |
void | SetIndentSize (int size) |
number of spaces in one indentation | |
virtual int | GetCurrentColumnNumber () |
virtual int | GetCurrentLineNumber () |
void | XmlEncodeStringToStream (const wxChar *string, size_t len=wxString::npos) |
void | SetFormat (const wxString &format) |
set the format for double to be this | |
virtual void | WriteDouble (double d) |
write a double number. | |
void | WriteStringEnt (const wxString &string) |
a2dIOHandlerXMLWrite & | operator<< (const wxInt16 &c) |
a2dIOHandlerXMLWrite & | operator<< (const wxInt32 &c) |
a2dIOHandlerXMLWrite & | operator<< (const wxInt64 &c) |
a2dIOHandlerXMLWrite & | operator<< (const wxUint16 &c) |
a2dIOHandlerXMLWrite & | operator<< (const wxUint32 &c) |
a2dIOHandlerXMLWrite & | operator<< (const wxUint64 &c) |
a2dIOHandlerXMLWrite & | operator<< (const double &f) |
a2dIOHandlerXMLWrite & | operator<< (const float &f) |
a2dIOHandlerXMLWrite & | operator<< (const wxChar *string) |
a2dIOHandlerXMLWrite & | operator<< (const wxString &string) |
a2dIOHandlerXMLWrite & | operator<< (char c) |
void | SetScale (double scale) |
double | GetScale () |
See GetScale() | |
void | SetIndent (int indent) |
int | GetIndent () |
![]() | |
a2dIOHandlerStrOut (wxMBConv &conv=wxConvUTF8) | |
constructor | |
~a2dIOHandlerStrOut () | |
destructor | |
virtual bool | CanSave (const wxObject *obj=NULL)=0 |
Should return true if the handler can write this document to a stream. More... | |
virtual bool | Save (a2dDocumentOutputStream &stream, const wxObject *obj)=0 |
Override to write to the stream and store (part of) of the document contents in the stream. More... | |
void | SetFileName (const wxFileName &filename) |
const wxFileName & | GetFileName () const |
![]() | |
a2dIOHandler () | |
constructor | |
~a2dIOHandler () | |
destructor | |
virtual wxObject * | CreateObject (const wxString &symbolicName) |
Creates an specific object by name. More... | |
![]() | |
a2dRefMap () | |
constructor | |
~a2dRefMap () | |
destructor | |
virtual void | Initialize () |
initialize mapping tables | |
a2dHashMapIntToObject & | GetObjectHashMap () |
This is used to find multiple referenced objects by id. | |
a2dHashMapCreateObject & | GetObjectCreateHashMap () |
has to map symbolic names to real classnames. | |
a2dResolveIdList & | GetResolveIdList () |
list of not resolved objects | |
bool | ResolveOrAdd (a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT("")) |
try to resolve the object that is in storedHere when it is a reference. More... | |
bool | ResolveOrAdd (a2dAutoZeroPtr< a2dObject > *storedHere, const wxString &id=wxT("")) |
try to resolve the object that is in storedHere when it is a reference. | |
bool | ResolveOrAddLink (a2dObject *obj, const wxString &id=wxT("")) |
try to resolve an object referenced by obj using the LinkReference function | |
void | ResolveInform (a2dObject *obj) |
call the objects LinkReference function (ptr=0) to inform it that links are done | |
void | SetLastObjectLoadedId (const wxString &lastid) |
set by RefObject when finding a reference id during loading. | |
virtual bool | LinkReferences (bool ignoreNonResolved=false) |
link references to their destination More... | |
bool | RemoveReference (const wxString &idToRemove) |
remove given reference if from reference map. | |
a2dError | GetLastError () const |
get last error encountered | |
void | SetLastError (a2dError error) |
set last error encountered | |
![]() | |
virtual bool | ProcessEvent (wxEvent &event) |
bool | SearchDynamicEventTable (wxEvent &event) |
void | Connect (int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL) |
bool | Disconnect (int winid, int lastId, wxEventType eventType, wxObjectEventFunction func=NULL, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL) |
void | ProcessConnectedEvent (wxEvent &event) |
wxCHECK_VERSION(2,9,0) More... | |
void | ConnectEvent (wxEventType type, wxEvtHandler *eventSink) |
bool | DisconnectEvent (wxEventType type, wxEvtHandler *eventSink) |
bool | DisconnectEventAll (wxEvtHandler *eventSink) |
Remove all dynamic events in classA, going to classB (eventSink) More... | |
a2dObject () | |
constructor | |
virtual | ~a2dObject () |
destructor | |
void | operator= (const a2dObject &other) |
assignment operator | |
int | GetOwnedBy () |
like it to be protected, but this does not work with wxList macros More... | |
virtual a2dObject * | SetNonDynamic () |
Call to mark this object as non-dynamic (static/local/auto) More... | |
void | CheckReferences () |
Check zero reference count and delete if count is 0. More... | |
a2dObject * | Clone (CloneOptions options, a2dRefMap *refs=NULL) const |
create an exact copy of this property | |
a2dObject (const a2dObject &other, CloneOptions options, a2dRefMap *refs) | |
virtual wxString | GetName () const |
Returns the name of this object, if no name is given the internal id will be returned. More... | |
virtual void | SetName (const wxString &name) |
Creates the a2dStringProperty PROPID_Name. More... | |
virtual bool | IsTemporary_DontSave () const |
Check if this is a temporary object, which should not be saved. | |
void | SaveAsDocument (a2dIOHandlerXmlSerOut &out) |
Save this object and all below as an XML document. More... | |
virtual void | Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite) |
write all needed to an XML type of file called the CVG format More... | |
void | LoadFromDocument (a2dIOHandlerXmlSerIn &parser) |
Load this object and all below from an XML document. More... | |
virtual void | Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser) |
load object from CVG file More... | |
wxInt64 | GetUniqueSerializationId () const |
return a unique id for this object More... | |
virtual bool | AlwaysWriteSerializationId () const |
If true, always write an id. More... | |
virtual bool | LinkReference (a2dObject *other) |
link a reference in the object to the given value More... | |
virtual void | ResolveInform () |
inform an object that reference resolution was done More... | |
void | Walker (wxObject *parent, a2dWalkerIOHandler &handler) |
This is used to recursively walk through an object tree. | |
void | SetCheck (bool check) |
general flag use at will. More... | |
bool | GetCheck () const |
general flag use at will. | |
void | SetRelease (bool value) |
set release flag More... | |
bool | GetRelease () const |
get release flag More... | |
a2dAutoZeroPtr< a2dObject > ** | GetAutoZeroPtrList () |
return the list head pointer for autozero pointers to this object More... | |
DECLARE_PROPERTIES () | |
a2dNamedProperty * | GetProperty (const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const |
get property on this object More... | |
void | SetProperty (a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none) |
Set the property to the this object. More... | |
void | SetProperty (const a2dNamedProperty &propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none) |
Set the property to the this object and if enabled, to all childs and object members. More... | |
virtual a2dNamedProperty * | FindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) |
Find a dynamic property with given id in the property list. More... | |
virtual const a2dNamedProperty * | FindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const |
Find a dynamic property with given id in the property list. More... | |
virtual bool | HasProperty (const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const |
Check if the object has a property with given id and string representation. More... | |
virtual void | OnPropertyChanged (const a2dPropertyId *id) |
This function is called after a property changed. More... | |
virtual bool | EditProperties (const a2dPropertyId *id, bool withUndo=true) |
edit properties of the object More... | |
void | TakeOverProperties (a2dObject *from, a2dPropertyIdList *listOfIds) |
Properties in the id list are taken from the given object, en set to this. More... | |
wxURI | GetURI () const |
quick way to get to PROPID_URI property More... | |
void | SetURI (const wxURI &url) |
quickly set a property PROPID_URI More... | |
const a2dNamedPropertyList & | GetPropertyList () const |
Get the Property List. More... | |
bool | HasDynamicProperties () const |
test if there are dynamic properties in the m_propertylist | |
virtual bool | RemoveProperty (const a2dPropertyId *id, bool all=true) |
This function is called by a2dPropertyId to remove a property from the list. More... | |
void | RemoveTemporaryProperties () |
remove all temporary properties | |
virtual bool | AddProperty (a2dNamedProperty *property) |
This function is called by a2dPropertyId to add a property to the list. More... | |
Protected Member Functions | |
void | WriteIndent () |
![]() | |
void | SetMode (wxEOL mode=wxEOL_NATIVE) |
define the line end mode for textual files | |
wxEOL | GetMode () |
get line end mode for textual files | |
void | Write32 (wxUint32 i) |
write a 32 bits integer | |
void | Write16 (wxUint16 i) |
write a 16 bits integer | |
void | Write8 (wxUint8 i) |
write a 8 bits integer | |
virtual void | WriteString (const wxString &string) |
write a string | |
bool | IsOk () const |
is the stream Oke to write | |
a2dIOHandlerStrOut & | PutChar (wxChar c) |
write on character | |
![]() | |
virtual bool | DoIgnoreIfNotMember (const a2dPropertyId *id) const |
used to decide if a property shall be ignored, if it is not a member More... | |
virtual void | DoWalker (wxObject *parent, a2dWalkerIOHandler &handler) |
iterate over this object and its children More... | |
Protected Attributes | |
wxString | m_format |
int | m_indent |
int | m_indentSize |
int | m_depth |
double | m_scale |
a2dSmrtPtrList< a2dXMLTag > | m_elements |
queue of begin and end elements tags not yet processed | |
a2dXMLTag * | m_startdoc |
a2dXMLTag * | m_enddoc |
a2dXMLTag * | m_current |
current XML tag | |
![]() | |
wxFileName | m_filename |
wxMBConv & | m_conv |
unicode conversion | |
a2dDocumentOutputStream * | m_streamo |
file or other string stream containing the format to output to. | |
wxEOL | m_mode |
end of line mode | |
![]() | |
a2dHashMapIntToObject | m_objecthashmap |
This is used to find multiple referenced objects by id. | |
a2dHashMapCreateObject | m_objectCreate |
This is used to find a classname using a symbolic name. | |
a2dResolveIdList | m_toResolve |
refernces to object which have not bin resolved yet ( e.g not read yet, but already referenced ) | |
wxString | m_lastObjectId |
a2dError | m_lastError |
set to last error found when parsing | |
![]() | |
a2dNamedPropertyList | m_propertylist |
properties | |
int | m_refcount |
how many references to this object do exist | |
bool | m_check: 1 |
used for linking multiple referenced objects when serializing | |
bool | m_release: 1 |
when set object is treated as being deleted, and wil be deleted in idle time. | |
bool | m_recursion_active: 1 |
this is used as a recursion stopper | |
bool | m_pendingDisconnects: 1 |
unsigned int | m_iteratorCount |
a2dAutoZeroPtr< a2dObject > * | m_autozeroptrlist |
this is a list of all a2dAutoZeroPtr object pointing to this object | |
Additional Inherited Members | |
![]() | |
enum | CloneOptions { clone_members = 0x00000001, clone_properties = 0x00000002, clone_childs = 0x00000004, clone_unused = 0x00000008, clone_setoriginal = 0x00000010, clone_seteditcopy = 0x00000020, clone_noReference = 0x00000040, clone_noCameleonRef = 0x00000080, clone_toDrag = 0x00000100, clone_flat = 0x00000000, clone_deep = clone_members | clone_properties | clone_childs } |
options for cloning More... | |
typedef a2dAutoZeroPtr< a2dObject > | TAutoZeroPtrListClass |
this is needed inside the smart pointer template code | |
![]() | |
static a2dPropertyIdBool * | PROPID_Check = NULL |
used for linking multiple referenced objects when serializing | |
static a2dPropertyIdUri * | PROPID_URI = NULL |
attach an URL to the object | |
static a2dPropertyIdString * | PROPID_Name = NULL |
Name property, to return name of this object. | |
static a2dPropertyIdVoidPtr * | PROPID_autozeroptrlist = NULL |
static const a2dSignal | sm_Edit_properties = wxNewId() |
edit properties event, see EditProperties() | |
![]() | |
enum | { refcount_nondynamic = 0x76543210 } |
special refcount value for non-dynamic objects | |
for writing XML files.
basic function for writing tags and attributes to a stream.
Definition at line 576 of file genxmlpars.h.
void a2dIOHandlerXMLWrite::EndlWriteString | ( | const wxString & | string | ) |
Writes a userdefined string into document.
The string might be a comment or a DTD declaration.
string | the string to write |
newLine is a line break before string
Definition at line 908 of file genxmlpars.cpp.
|
virtual |
Inits the IO handler for writing.
Reimplemented from a2dIOHandlerStrOut.
Definition at line 695 of file genxmlpars.cpp.
|
inline |
Scale factor to scale output numbers (int double etc. ) with this. This can be used by a derived IO handler to scale output numbers.
Definition at line 781 of file genxmlpars.h.
void a2dIOHandlerXMLWrite::WriteAttribute | ( | const wxString & | name, |
bool | value, | ||
bool | onlyIfTrue = false |
||
) |
Writes an attribute with boolean value.
The boolean value will be written lower-case ("true" / "false")
name | the attribute name |
value | the attribute value |
onlyIfTrue | if true the attribute is only written when value is true. |
Definition at line 806 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteContent | ( | const wxString & | content | ) |
Writes content between start and end tag.
content | the content of the current tag |
Definition at line 884 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteElement | ( | const wxString & | name, |
const wxString & | content = wxT( "" ) , |
||
bool | newLine = true |
||
) |
Writes start and end tag.
This method writes a complete set of tags
name | the tag name |
content | the content between the start an end tag |
newLine | true if there should be a line break before the tag, else false |
Definition at line 794 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteEndAttributes | ( | bool | close = false | ) |
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
close | If set to true a "/>" (short tag) will be written, else ">" |
Definition at line 837 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteEndDocument | ( | ) |
Checks if all open tags are closed.
This method does not write anything, but checks if there're open tags with no close tag and gives an ASSERT msg.
This method is very useful for debuging proposes and should be called.
Definition at line 730 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteEndElement | ( | bool | newLine = true | ) |
Writes correspondending end tag for the current start tag.
newLine | true if there should be a line break before the tag, else false |
Definition at line 862 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteStartDocument | ( | const wxString & | version, |
const wxString & | encoding, | ||
bool | standalone | ||
) |
Writes the XML header declaration.
Each XML document should begin with a XML header / prolog, which informes about the XML version and the document encoding.
version | the XML version (currently only "1.0" is valid) |
encoding | the encoding of the document |
standalone | true if it's a standalone xml doc, else false to indicate that it has an external DTD |
Definition at line 723 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteStartElement | ( | const wxString & | name, |
bool | newLine = true |
||
) |
Writes start tag which has no attributes.
name | the tag name |
newLine | true if there should be a line break before the tag, else false |
Definition at line 738 of file genxmlpars.cpp.
void a2dIOHandlerXMLWrite::WriteStartElementAttributes | ( | const wxString & | name, |
bool | newLine = true |
||
) |
Writes start tag which has attributes.
name | the tag name |
newLine | true if there should be a line break before the tag, else false |
Definition at line 757 of file genxmlpars.cpp.