0669678204
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15570 c028cbd2-c16b-5b4b-a496-9718f37d4682
72 lines
2.0 KiB
C++
Executable File
72 lines
2.0 KiB
C++
Executable File
#ifndef __XML_H
|
|
#define __XML_H
|
|
|
|
class TXmlItem;
|
|
|
|
typedef bool (*XmlItemCallback)(TXmlItem& item, void* jolly);
|
|
|
|
class TXmlItem : public wxObject
|
|
{
|
|
DECLARE_DYNAMIC_CLASS(TXmlItem);
|
|
|
|
wxString m_strTag, m_strText;
|
|
wxHashTable* m_Attributes;
|
|
wxList* m_Children;
|
|
|
|
protected:
|
|
wxString GetWord(wxInputStream& input) const;
|
|
int ReadTag(wxInputStream& input);
|
|
|
|
TXmlItem& AddChild(TXmlItem* pItem);
|
|
|
|
public:
|
|
const wxString& GetTag() const { return m_strTag; }
|
|
void SetTag(const wxChar* strTag) { m_strTag = strTag; }
|
|
|
|
const wxString& GetText() const { return m_strText; }
|
|
void SetText(const wxChar* str) { m_strText = str; }
|
|
|
|
TXmlItem& AddEnclosedText(const wxChar* str);
|
|
wxString GetEnclosedText() const;
|
|
|
|
TXmlItem& SetAttr(const wxChar* strAttr, const wxChar* strVal);
|
|
wxString GetAttr(const wxChar* strAttr) const;
|
|
TXmlItem& SetAttr(const wxChar* strAttr, long nVal);
|
|
|
|
TXmlItem& AddChild(const wxChar* strTag);
|
|
TXmlItem& AddSoapString(const wxChar* name, const wxChar* value, bool typized = false);
|
|
TXmlItem& AddSoapInt(const wxChar* name, int value, bool typized = false);
|
|
wxString GetSoapString(const wxChar* name, const wxChar* def = "") const;
|
|
long GetSoapInt(const wxChar* name, long def = 0) const;
|
|
|
|
int GetChildren() const;
|
|
TXmlItem* GetChild(size_t n) const;
|
|
void RemoveLastChild();
|
|
|
|
bool Read(wxInputStream& input);
|
|
void Write(wxOutputStream& output, int nTab) const;
|
|
wxString AsString() const;
|
|
|
|
void Save(const wxChar* strFilename) const;
|
|
|
|
TXmlItem* ForEach(XmlItemCallback cb, void* jolly = NULL);
|
|
TXmlItem* FindFirst(const wxChar* strTag) const;
|
|
|
|
TXmlItem();
|
|
~TXmlItem();
|
|
};
|
|
|
|
TXmlItem& operator<<(TXmlItem& item, const wxChar* str);
|
|
|
|
wxOutputStream& operator<<(wxOutputStream& outf, const wxChar* str);
|
|
wxOutputStream& operator<<(wxOutputStream& outf, wxString str);
|
|
wxInputStream& operator>>(wxInputStream& inf, wxString& str);
|
|
void Spaces(wxOutputStream& outf, int nSpaces);
|
|
void WriteXmlString(wxOutputStream& outf, const wxChar* str);
|
|
int hex2int(const wxChar* str);
|
|
|
|
#define endl "\r\n";
|
|
|
|
#endif
|
|
|