Audacity  2.2.2
Public Member Functions | List of all members
XMLTagHandler Class Referenceabstract

This class is an interface which should be implemented by classes which wish to be able to load and save themselves using XML files. More...

#include <XMLTagHandler.h>

Inheritance diagram for XMLTagHandler:
AudacityProject CommandManager DirManager EffectEqualization Envelope EnvPoint ImportXMLTagHandler RecordingRecoveryHandler Sequence Tags Track WaveClip

Public Member Functions

 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const wxChar *tag, const wxChar **attrs)=0
 
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
 
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const wxChar *tag)=0
 
bool ReadXMLTag (const char *tag, const char **attrs)
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 

Detailed Description

This class is an interface which should be implemented by classes which wish to be able to load and save themselves using XML files.

Definition at line 72 of file XMLTagHandler.h.

Constructor & Destructor Documentation

XMLTagHandler::XMLTagHandler ( )
inline

Definition at line 74 of file XMLTagHandler.h.

74 {};
virtual XMLTagHandler::~XMLTagHandler ( )
inlinevirtual

Definition at line 75 of file XMLTagHandler.h.

75 {};

Member Function Documentation

virtual XMLTagHandler* XMLTagHandler::HandleXMLChild ( const wxChar *  tag)
pure virtual
virtual void XMLTagHandler::HandleXMLContent ( const wxString &  WXUNUSEDcontent)
inlinevirtual

Definition at line 94 of file XMLTagHandler.h.

Referenced by ReadXMLContent().

94 {}
virtual void XMLTagHandler::HandleXMLEndTag ( const wxChar *  WXUNUSEDtag)
inlinevirtual

Definition at line 89 of file XMLTagHandler.h.

Referenced by ReadXMLEndTag().

89 {}
virtual bool XMLTagHandler::HandleXMLTag ( const wxChar *  tag,
const wxChar **  attrs 
)
pure virtual
XMLTagHandler * XMLTagHandler::ReadXMLChild ( const char *  tag)

Definition at line 224 of file XMLTagHandler.cpp.

References HandleXMLChild(), and UTF8CTOWX.

225 {
226  return HandleXMLChild(UTF8CTOWX(tag));
227 }
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
#define UTF8CTOWX(X)
Definition: Internat.h:179
void XMLTagHandler::ReadXMLContent ( const char *  s,
int  len 
)

Definition at line 219 of file XMLTagHandler.cpp.

References HandleXMLContent().

220 {
221  HandleXMLContent(wxString(s, wxConvUTF8, len));
222 }
virtual void HandleXMLContent(const wxString &WXUNUSED(content))
Definition: XMLTagHandler.h:94
void XMLTagHandler::ReadXMLEndTag ( const char *  tag)

Definition at line 214 of file XMLTagHandler.cpp.

References HandleXMLEndTag(), and UTF8CTOWX.

215 {
217 }
#define UTF8CTOWX(X)
Definition: Internat.h:179
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:89
bool XMLTagHandler::ReadXMLTag ( const char *  tag,
const char **  attrs 
)

Definition at line 190 of file XMLTagHandler.cpp.

References HandleXMLTag(), and UTF8CTOWX.

191 {
192  wxArrayString tmp_attrs;
193 
194  while (*attrs) {
195  const char *s = *attrs++;
196  tmp_attrs.Add(UTF8CTOWX(s));
197  }
198 
199 // JKC: Previously the next line was:
200 // const char **out_attrs = NEW char (const char *)[tmp_attrs.GetCount()+1];
201 // however MSVC doesn't like the constness in this position, so this is now
202 // added by a cast after creating the array of pointers-to-non-const chars.
203  auto out_attrs = std::make_unique<const wxChar *[]>(tmp_attrs.GetCount() + 1);
204  for (size_t i=0; i<tmp_attrs.GetCount(); i++) {
205  out_attrs[i] = tmp_attrs[i];
206  }
207  out_attrs[tmp_attrs.GetCount()] = 0;
208 
209  bool result = HandleXMLTag(UTF8CTOWX(tag), out_attrs.get());
210 
211  return result;
212 }
#define UTF8CTOWX(X)
Definition: Internat.h:179
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs)=0

The documentation for this class was generated from the following files: