OpenShot Audio Library | OpenShotAudio: juce_XmlDocument.h Source File

OpenShot Audio Library | OpenShotAudio 0.6.0

Loading...
Searching...
No Matches
juce_XmlDocument.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
63 class JUCE_API XmlDocument
64{
65public:
66 //==============================================================================
70 XmlDocument (const String& documentText);
71
75 XmlDocument (const File& file);
76
78 ~XmlDocument();
79
80 //==============================================================================
99 std::unique_ptr<XmlElement> getDocumentElement (bool onlyReadOuterDocumentElement = false);
100
105 std::unique_ptr<XmlElement> getDocumentElementIfTagMatches (StringRef requiredTag);
106
110 const String& getLastParseError() const noexcept;
111
123 void setInputSource (InputSource* newSource) noexcept;
124
132 void setEmptyTextElementsIgnored (bool shouldBeIgnored) noexcept;
133
134 //==============================================================================
139 static std::unique_ptr<XmlElement> parse (const File& file);
140
145 static std::unique_ptr<XmlElement> parse (const String& xmlData);
146
147
148 //==============================================================================
149private:
150 String originalText;
151 String::CharPointerType input { nullptr };
152 bool outOfData = false, errorOccurred = false;
153 String lastError, dtdText;
154 StringArray tokenisedDTD;
155 bool needToLoadDTD = false, ignoreEmptyTextElements = true;
156 std::unique_ptr<InputSource> inputSource;
157
158 std::unique_ptr<XmlElement> parseDocumentElement (String::CharPointerType, bool outer);
159 void setLastError (const String&, bool carryOn);
160 bool parseHeader();
161 bool parseDTD();
162 void skipNextWhiteSpace();
163 juce_wchar readNextChar() noexcept;
164 XmlElement* readNextElement (bool alsoParseSubElements);
165 void readChildElements (XmlElement&);
166 void readQuotedString (String&);
167 void readEntity (String&);
168
169 String getFileContents (const String&) const;
170 String expandEntity (const String&);
171 String expandExternalEntity (const String&);
172 String getParameterEntity (const String&);
173
174 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (XmlDocument)
175};
176
177//==============================================================================
183std::unique_ptr<XmlElement> parseXML (const String& textToParse);
184
190std::unique_ptr<XmlElement> parseXML (const File& fileToParse);
191
197std::unique_ptr<XmlElement> parseXMLIfTagMatches (const String& textToParse, StringRef requiredTag);
198
204std::unique_ptr<XmlElement> parseXMLIfTagMatches (const File& fileToParse, StringRef requiredTag);
205
206
207} // namespace juce
juce::File
Definition juce_File.h:45
juce::InputSource
Definition juce_InputSource.h:38
juce::StringArray
Definition juce_StringArray.h:35
juce::StringRef
Definition juce_StringRef.h:62
juce::String
Definition juce_String.h:53
juce::XmlDocument::getLastParseError
const String & getLastParseError() const noexcept
Definition juce_XmlDocument.cpp:159
juce::XmlDocument::getDocumentElementIfTagMatches
std::unique_ptr< XmlElement > getDocumentElementIfTagMatches(StringRef requiredTag)
Definition juce_XmlDocument.cpp:150
juce::XmlDocument::getDocumentElement
std::unique_ptr< XmlElement > getDocumentElement(bool onlyReadOuterDocumentElement=false)
Definition juce_XmlDocument.cpp:110
juce::XmlDocument::XmlDocument
XmlDocument(const String &documentText)
Definition juce_XmlDocument.cpp:26
juce::XmlDocument::parse
static std::unique_ptr< XmlElement > parse(const File &file)
Definition juce_XmlDocument.cpp:31
juce::XmlDocument::setInputSource
void setInputSource(InputSource *newSource) noexcept
Definition juce_XmlDocument.cpp:61
juce::XmlDocument::setEmptyTextElementsIgnored
void setEmptyTextElementsIgnored(bool shouldBeIgnored) noexcept
Definition juce_XmlDocument.cpp:66
juce::XmlElement
Definition juce_XmlElement.h:83