Audacity 3.2.0
XMLFileReader.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 XMLFileReader.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10
11#include <vector>
12struct XML_ParserStruct;
13typedef struct XML_ParserStruct *XML_Parser;
14
15#include "XMLTagHandler.h"
16#include "Internat.h" // for TranslatableString
17#include "MemoryStream.h"
18
19class XML_API XMLFileReader final {
20 public:
23
24 bool Parse(XMLTagHandler *baseHandler,
25 const FilePath &fname);
26 bool ParseString(XMLTagHandler *baseHandler,
27 const wxString &xmldata);
28
29 bool ParseMemoryStream(XMLTagHandler* baseHandler, const MemoryStream& xmldata);
30
31 const TranslatableString &GetErrorStr() const;
32 const TranslatableString &GetLibraryErrorStr() const;
33
34 // Callback functions for expat
35
36 static void startElement(void *userData, const char *name,
37 const char **atts);
38
39 static void endElement(void *userData, const char *name);
40
41 static void charHandler(void *userData, const char *s, int len);
42
43 private:
44 bool ParseBuffer(
45 XMLTagHandler* baseHandler, const char* buffer, size_t len, bool isFinal);
46
49 using Handlers = std::vector<XMLTagHandler*>;
53
54 //Used for memory allocation optimization purpose
56};
const TranslatableString name
Definition: Distortion.cpp:82
wxString FilePath
Definition: Project.h:20
struct XML_ParserStruct * XML_Parser
Definition: XMLFileReader.h:13
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
A low overhead memory stream with O(1) append, low heap fragmentation and a linear memory view.
Definition: MemoryStream.h:31
Holds a msgid for the translation catalog; may also bind format arguments.
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:19
std::vector< XMLTagHandler * > Handlers
Definition: XMLFileReader.h:49
Handlers mHandler
Definition: XMLFileReader.h:50
TranslatableString mErrorStr
Definition: XMLFileReader.h:51
XML_Parser mParser
Definition: XMLFileReader.h:47
AttributesList mCurrentTagAttributes
Definition: XMLFileReader.h:55
XMLTagHandler * mBaseHandler
Definition: XMLFileReader.h:48
TranslatableString mLibraryErrorStr
Definition: XMLFileReader.h:52
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42