mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Minor code clean-ups.
This commit is contained in:
parent
97e9095933
commit
af2137ecaa
11 changed files with 261 additions and 359 deletions
|
|
@ -10986,8 +10986,10 @@ int String::indexOfChar (const int startIndex,
|
|||
if (*t == character)
|
||||
return (int) (t - text);
|
||||
|
||||
if (*t++ == 0)
|
||||
if (*t == 0)
|
||||
return -1;
|
||||
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11120,7 +11122,18 @@ bool String::contains (const juce_wchar* const other) const throw()
|
|||
|
||||
bool String::containsChar (const juce_wchar character) const throw()
|
||||
{
|
||||
return indexOfChar (character) >= 0;
|
||||
const juce_wchar* t = text;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (*t == character)
|
||||
return true;
|
||||
|
||||
if (*t == 0)
|
||||
return false;
|
||||
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
bool String::containsIgnoreCase (const juce_wchar* const t) const throw()
|
||||
|
|
@ -12653,7 +12666,6 @@ int StringArray::addTokens (const String& text, const String& breakCharacters, c
|
|||
{
|
||||
bool insideQuotes = false;
|
||||
juce_wchar currentQuoteChar = 0;
|
||||
|
||||
int i = 0;
|
||||
int tokenStart = 0;
|
||||
|
||||
|
|
@ -12661,35 +12673,11 @@ int StringArray::addTokens (const String& text, const String& breakCharacters, c
|
|||
{
|
||||
const juce_wchar c = text[i];
|
||||
|
||||
bool isBreak = (c == 0);
|
||||
|
||||
if (! (insideQuotes || isBreak))
|
||||
{
|
||||
const juce_wchar* b = breakCharacters;
|
||||
while (*b != 0)
|
||||
{
|
||||
if (*b++ == c)
|
||||
{
|
||||
isBreak = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
const bool isBreak = (c == 0) || ((! insideQuotes) && breakCharacters.containsChar (c));
|
||||
|
||||
if (! isBreak)
|
||||
{
|
||||
bool isQuote = false;
|
||||
const juce_wchar* q = quoteCharacters;
|
||||
while (*q != 0)
|
||||
{
|
||||
if (*q++ == c)
|
||||
{
|
||||
isQuote = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isQuote)
|
||||
if (quoteCharacters.containsChar (c))
|
||||
{
|
||||
if (insideQuotes)
|
||||
{
|
||||
|
|
@ -12789,9 +12777,11 @@ void StringArray::removeDuplicates (const bool ignoreCase)
|
|||
|
||||
void StringArray::appendNumbersToDuplicates (const bool ignoreCase,
|
||||
const bool appendNumberToFirstInstance,
|
||||
const tchar* const preNumberString,
|
||||
const tchar* const postNumberString)
|
||||
const juce_wchar* const preNumberString,
|
||||
const juce_wchar* const postNumberString)
|
||||
{
|
||||
jassert (preNumberString != 0 && postNumberString != 0); // These strings can't be null pointers..
|
||||
|
||||
for (int i = 0; i < size() - 1; ++i)
|
||||
{
|
||||
String& s = strings.getReference(i);
|
||||
|
|
@ -12830,30 +12820,30 @@ END_JUCE_NAMESPACE
|
|||
/*** Start of inlined file: juce_StringPairArray.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
StringPairArray::StringPairArray (const bool ignoreCase_) throw()
|
||||
StringPairArray::StringPairArray (const bool ignoreCase_)
|
||||
: ignoreCase (ignoreCase_)
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray::StringPairArray (const StringPairArray& other) throw()
|
||||
StringPairArray::StringPairArray (const StringPairArray& other)
|
||||
: keys (other.keys),
|
||||
values (other.values),
|
||||
ignoreCase (other.ignoreCase)
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray::~StringPairArray() throw()
|
||||
StringPairArray::~StringPairArray()
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray& StringPairArray::operator= (const StringPairArray& other) throw()
|
||||
StringPairArray& StringPairArray::operator= (const StringPairArray& other)
|
||||
{
|
||||
keys = other.keys;
|
||||
values = other.values;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool StringPairArray::operator== (const StringPairArray& other) const throw()
|
||||
bool StringPairArray::operator== (const StringPairArray& other) const
|
||||
{
|
||||
for (int i = keys.size(); --i >= 0;)
|
||||
if (other [keys[i]] != values[i])
|
||||
|
|
@ -12862,12 +12852,12 @@ bool StringPairArray::operator== (const StringPairArray& other) const throw()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool StringPairArray::operator!= (const StringPairArray& other) const throw()
|
||||
bool StringPairArray::operator!= (const StringPairArray& other) const
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
const String& StringPairArray::operator[] (const String& key) const throw()
|
||||
const String& StringPairArray::operator[] (const String& key) const
|
||||
{
|
||||
return values [keys.indexOf (key, ignoreCase)];
|
||||
}
|
||||
|
|
@ -12882,8 +12872,7 @@ const String StringPairArray::getValue (const String& key, const String& default
|
|||
return defaultReturnValue;
|
||||
}
|
||||
|
||||
void StringPairArray::set (const String& key,
|
||||
const String& value) throw()
|
||||
void StringPairArray::set (const String& key, const String& value)
|
||||
{
|
||||
const int i = keys.indexOf (key, ignoreCase);
|
||||
|
||||
|
|
@ -12904,24 +12893,24 @@ void StringPairArray::addArray (const StringPairArray& other)
|
|||
set (other.keys[i], other.values[i]);
|
||||
}
|
||||
|
||||
void StringPairArray::clear() throw()
|
||||
void StringPairArray::clear()
|
||||
{
|
||||
keys.clear();
|
||||
values.clear();
|
||||
}
|
||||
|
||||
void StringPairArray::remove (const String& key) throw()
|
||||
void StringPairArray::remove (const String& key)
|
||||
{
|
||||
remove (keys.indexOf (key, ignoreCase));
|
||||
}
|
||||
|
||||
void StringPairArray::remove (const int index) throw()
|
||||
void StringPairArray::remove (const int index)
|
||||
{
|
||||
keys.remove (index);
|
||||
values.remove (index);
|
||||
}
|
||||
|
||||
void StringPairArray::setIgnoresCase (const bool shouldIgnoreCase) throw()
|
||||
void StringPairArray::setIgnoresCase (const bool shouldIgnoreCase)
|
||||
{
|
||||
ignoreCase = shouldIgnoreCase;
|
||||
}
|
||||
|
|
@ -12940,7 +12929,7 @@ const String StringPairArray::getDescription() const
|
|||
return s;
|
||||
}
|
||||
|
||||
void StringPairArray::minimiseStorageOverheads() throw()
|
||||
void StringPairArray::minimiseStorageOverheads()
|
||||
{
|
||||
keys.minimiseStorageOverheads();
|
||||
values.minimiseStorageOverheads();
|
||||
|
|
@ -12953,7 +12942,7 @@ END_JUCE_NAMESPACE
|
|||
/*** Start of inlined file: juce_XmlDocument.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
XmlDocument::XmlDocument (const String& documentText) throw()
|
||||
XmlDocument::XmlDocument (const String& documentText)
|
||||
: originalText (documentText),
|
||||
ignoreEmptyTextElements (true)
|
||||
{
|
||||
|
|
@ -12964,7 +12953,7 @@ XmlDocument::XmlDocument (const File& file)
|
|||
inputSource = new FileInputSource (file);
|
||||
}
|
||||
|
||||
XmlDocument::~XmlDocument() throw()
|
||||
XmlDocument::~XmlDocument()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -13061,7 +13050,7 @@ const String& XmlDocument::getLastParseError() const throw()
|
|||
return lastError;
|
||||
}
|
||||
|
||||
void XmlDocument::setLastError (const String& desc, const bool carryOn) throw()
|
||||
void XmlDocument::setLastError (const String& desc, const bool carryOn)
|
||||
{
|
||||
lastError = desc;
|
||||
errorOccurred = ! carryOn;
|
||||
|
|
@ -13104,7 +13093,7 @@ int XmlDocument::findNextTokenLength() throw()
|
|||
return len;
|
||||
}
|
||||
|
||||
void XmlDocument::skipHeader() throw()
|
||||
void XmlDocument::skipHeader()
|
||||
{
|
||||
const juce_wchar* const found = CharacterFunctions::find (input, T("<?xml"));
|
||||
|
||||
|
|
@ -13146,7 +13135,7 @@ void XmlDocument::skipHeader() throw()
|
|||
dtdText = String (docType, (int) (input - (docType + 1))).trim();
|
||||
}
|
||||
|
||||
void XmlDocument::skipNextWhiteSpace() throw()
|
||||
void XmlDocument::skipNextWhiteSpace()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -13196,7 +13185,7 @@ void XmlDocument::skipNextWhiteSpace() throw()
|
|||
}
|
||||
}
|
||||
|
||||
void XmlDocument::readQuotedString (String& result) throw()
|
||||
void XmlDocument::readQuotedString (String& result)
|
||||
{
|
||||
const juce_wchar quote = readNextChar();
|
||||
|
||||
|
|
@ -13246,7 +13235,7 @@ void XmlDocument::readQuotedString (String& result) throw()
|
|||
}
|
||||
}
|
||||
|
||||
XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw()
|
||||
XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements)
|
||||
{
|
||||
XmlElement* node = 0;
|
||||
|
||||
|
|
@ -13355,7 +13344,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw
|
|||
return node;
|
||||
}
|
||||
|
||||
void XmlDocument::readChildElements (XmlElement* parent) throw()
|
||||
void XmlDocument::readChildElements (XmlElement* parent)
|
||||
{
|
||||
XmlElement* lastChildNode = 0;
|
||||
|
||||
|
|
@ -13541,7 +13530,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw()
|
|||
}
|
||||
}
|
||||
|
||||
void XmlDocument::readEntity (String& result) throw()
|
||||
void XmlDocument::readEntity (String& result)
|
||||
{
|
||||
// skip over the ampersand
|
||||
++input;
|
||||
|
|
@ -13647,43 +13636,33 @@ void XmlDocument::readEntity (String& result) throw()
|
|||
const String XmlDocument::expandEntity (const String& ent)
|
||||
{
|
||||
if (ent.equalsIgnoreCase (T("amp")))
|
||||
{
|
||||
return T("&");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("quot")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("quot")))
|
||||
return T("\"");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("apos")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("apos")))
|
||||
return T("\'");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("lt")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("lt")))
|
||||
return T("<");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("gt")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("gt")))
|
||||
return T(">");
|
||||
}
|
||||
else if (ent[0] == T('#'))
|
||||
|
||||
if (ent[0] == T('#'))
|
||||
{
|
||||
if (ent[1] == T('x') || ent[1] == T('X'))
|
||||
{
|
||||
return String::charToString (static_cast <juce_wchar> (ent.substring (2).getHexValue32()));
|
||||
}
|
||||
else if (ent[1] >= T('0') && ent[1] <= T('9'))
|
||||
{
|
||||
|
||||
if (ent[1] >= T('0') && ent[1] <= T('9'))
|
||||
return String::charToString (static_cast <juce_wchar> (ent.substring (1).getIntValue()));
|
||||
}
|
||||
|
||||
setLastError ("illegal escape sequence", false);
|
||||
return T("&");
|
||||
}
|
||||
else
|
||||
{
|
||||
return expandExternalEntity (ent);
|
||||
}
|
||||
|
||||
return expandExternalEntity (ent);
|
||||
}
|
||||
|
||||
const String XmlDocument::expandExternalEntity (const String& entity)
|
||||
|
|
@ -13833,8 +13812,7 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) t
|
|||
{
|
||||
}
|
||||
|
||||
XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_,
|
||||
const String& value_) throw()
|
||||
XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const String& value_) throw()
|
||||
: name (name_),
|
||||
value (value_),
|
||||
next (0)
|
||||
|
|
@ -14157,24 +14135,11 @@ void XmlElement::writeToStream (OutputStream& output,
|
|||
const int lineWrapLength) const
|
||||
{
|
||||
if (includeXmlHeader)
|
||||
{
|
||||
output << "<?xml version=\"1.0\" encoding=\"" << encodingType;
|
||||
|
||||
if (allOnOneLine)
|
||||
output << "\"?> ";
|
||||
else
|
||||
output << "\"?>\r\n\r\n";
|
||||
}
|
||||
output << "<?xml version=\"1.0\" encoding=\"" << encodingType
|
||||
<< (allOnOneLine ? "\"?> " : "\"?>\r\n\r\n");
|
||||
|
||||
if (dtdToUse.isNotEmpty())
|
||||
{
|
||||
output << dtdToUse;
|
||||
|
||||
if (allOnOneLine)
|
||||
output << " ";
|
||||
else
|
||||
output << "\r\n";
|
||||
}
|
||||
output << dtdToUse << (allOnOneLine ? " " : "\r\n");
|
||||
|
||||
writeElementAsText (output, allOnOneLine ? -1 : 0, lineWrapLength);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3866,12 +3866,6 @@ private:
|
|||
#ifndef __JUCE_STRINGARRAY_JUCEHEADER__
|
||||
#define __JUCE_STRINGARRAY_JUCEHEADER__
|
||||
|
||||
#ifndef DOXYGEN
|
||||
// (used in StringArray::appendNumbersToDuplicates)
|
||||
static const tchar* const defaultPreNumberString = JUCE_T(" (");
|
||||
static const tchar* const defaultPostNumberString = JUCE_T(")");
|
||||
#endif
|
||||
|
||||
class JUCE_API StringArray
|
||||
{
|
||||
public:
|
||||
|
|
@ -3880,15 +3874,13 @@ public:
|
|||
|
||||
StringArray (const StringArray& other);
|
||||
|
||||
StringArray (const juce_wchar** const strings,
|
||||
const int numberOfStrings);
|
||||
StringArray (const juce_wchar** strings, int numberOfStrings);
|
||||
|
||||
StringArray (const char** const strings,
|
||||
const int numberOfStrings);
|
||||
StringArray (const char** strings, int numberOfStrings);
|
||||
|
||||
explicit StringArray (const juce_wchar** const strings);
|
||||
explicit StringArray (const juce_wchar** strings);
|
||||
|
||||
explicit StringArray (const char** const strings);
|
||||
explicit StringArray (const char** strings);
|
||||
|
||||
~StringArray();
|
||||
|
||||
|
|
@ -3903,26 +3895,26 @@ public:
|
|||
const String& operator[] (const int index) const throw();
|
||||
|
||||
bool contains (const String& stringToLookFor,
|
||||
const bool ignoreCase = false) const;
|
||||
bool ignoreCase = false) const;
|
||||
|
||||
int indexOf (const String& stringToLookFor,
|
||||
const bool ignoreCase = false,
|
||||
bool ignoreCase = false,
|
||||
int startIndex = 0) const;
|
||||
|
||||
void add (const String& stringToAdd);
|
||||
|
||||
void insert (const int index, const String& stringToAdd);
|
||||
void insert (int index, const String& stringToAdd);
|
||||
|
||||
void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
|
||||
void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
|
||||
|
||||
void set (const int index, const String& newString);
|
||||
void set (int index, const String& newString);
|
||||
|
||||
void addArray (const StringArray& other,
|
||||
int startIndex = 0,
|
||||
int numElementsToAdd = -1);
|
||||
|
||||
int addTokens (const String& stringToTokenise,
|
||||
const bool preserveQuotedStrings);
|
||||
bool preserveQuotedStrings);
|
||||
|
||||
int addTokens (const String& stringToTokenise,
|
||||
const String& breakCharacters,
|
||||
|
|
@ -3932,29 +3924,29 @@ public:
|
|||
|
||||
void clear();
|
||||
|
||||
void remove (const int index);
|
||||
void remove (int index);
|
||||
|
||||
void removeString (const String& stringToRemove,
|
||||
const bool ignoreCase = false);
|
||||
bool ignoreCase = false);
|
||||
|
||||
void removeDuplicates (const bool ignoreCase);
|
||||
void removeDuplicates (bool ignoreCase);
|
||||
|
||||
void removeEmptyStrings (const bool removeWhitespaceStrings = true);
|
||||
void removeEmptyStrings (bool removeWhitespaceStrings = true);
|
||||
|
||||
void move (const int currentIndex, int newIndex) throw();
|
||||
void move (int currentIndex, int newIndex) throw();
|
||||
|
||||
void trim();
|
||||
|
||||
void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
|
||||
const bool appendNumberToFirstInstance,
|
||||
const tchar* const preNumberString = defaultPreNumberString,
|
||||
const tchar* const postNumberString = defaultPostNumberString);
|
||||
void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
|
||||
bool appendNumberToFirstInstance,
|
||||
const juce_wchar* preNumberString = JUCE_T(" ("),
|
||||
const juce_wchar* postNumberString = JUCE_T(")"));
|
||||
|
||||
const String joinIntoString (const String& separatorString,
|
||||
int startIndex = 0,
|
||||
int numberOfElements = -1) const;
|
||||
|
||||
void sort (const bool ignoreCase);
|
||||
void sort (bool ignoreCase);
|
||||
|
||||
void minimiseStorageOverheads();
|
||||
|
||||
|
|
@ -3971,19 +3963,19 @@ class JUCE_API StringPairArray
|
|||
{
|
||||
public:
|
||||
|
||||
StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
|
||||
StringPairArray (bool ignoreCaseWhenComparingKeys = true);
|
||||
|
||||
StringPairArray (const StringPairArray& other) throw();
|
||||
StringPairArray (const StringPairArray& other);
|
||||
|
||||
~StringPairArray() throw();
|
||||
~StringPairArray();
|
||||
|
||||
StringPairArray& operator= (const StringPairArray& other) throw();
|
||||
StringPairArray& operator= (const StringPairArray& other);
|
||||
|
||||
bool operator== (const StringPairArray& other) const throw();
|
||||
bool operator== (const StringPairArray& other) const;
|
||||
|
||||
bool operator!= (const StringPairArray& other) const throw();
|
||||
bool operator!= (const StringPairArray& other) const;
|
||||
|
||||
const String& operator[] (const String& key) const throw();
|
||||
const String& operator[] (const String& key) const;
|
||||
|
||||
const String getValue (const String& key, const String& defaultReturnValue) const;
|
||||
|
||||
|
|
@ -3993,22 +3985,21 @@ public:
|
|||
|
||||
inline int size() const throw() { return keys.size(); };
|
||||
|
||||
void set (const String& key,
|
||||
const String& value) throw();
|
||||
void set (const String& key, const String& value);
|
||||
|
||||
void addArray (const StringPairArray& other);
|
||||
|
||||
void clear() throw();
|
||||
void clear();
|
||||
|
||||
void remove (const String& key) throw();
|
||||
void remove (const String& key);
|
||||
|
||||
void remove (const int index) throw();
|
||||
void remove (int index);
|
||||
|
||||
void setIgnoresCase (const bool shouldIgnoreCase) throw();
|
||||
void setIgnoresCase (bool shouldIgnoreCase);
|
||||
|
||||
const String getDescription() const;
|
||||
|
||||
void minimiseStorageOverheads() throw();
|
||||
void minimiseStorageOverheads();
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
|
|
@ -4479,26 +4470,26 @@ public:
|
|||
|
||||
~XmlElement() throw();
|
||||
|
||||
bool isEquivalentTo (const XmlElement* const other,
|
||||
const bool ignoreOrderOfAttributes) const throw();
|
||||
bool isEquivalentTo (const XmlElement* other,
|
||||
bool ignoreOrderOfAttributes) const throw();
|
||||
|
||||
const String createDocument (const String& dtdToUse,
|
||||
const bool allOnOneLine = false,
|
||||
const bool includeXmlHeader = true,
|
||||
bool allOnOneLine = false,
|
||||
bool includeXmlHeader = true,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
void writeToStream (OutputStream& output,
|
||||
const String& dtdToUse,
|
||||
const bool allOnOneLine = false,
|
||||
const bool includeXmlHeader = true,
|
||||
bool allOnOneLine = false,
|
||||
bool includeXmlHeader = true,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
bool writeToFile (const File& destinationFile,
|
||||
const String& dtdToUse,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
inline const String& getTagName() const throw() { return tagName; }
|
||||
|
||||
|
|
@ -4506,9 +4497,9 @@ public:
|
|||
|
||||
int getNumAttributes() const throw();
|
||||
|
||||
const String& getAttributeName (const int attributeIndex) const throw();
|
||||
const String& getAttributeName (int attributeIndex) const throw();
|
||||
|
||||
const String& getAttributeValue (const int attributeIndex) const throw();
|
||||
const String& getAttributeValue (int attributeIndex) const throw();
|
||||
|
||||
// Attribute-handling methods..
|
||||
|
||||
|
|
@ -4521,25 +4512,25 @@ public:
|
|||
|
||||
bool compareAttribute (const String& attributeName,
|
||||
const String& stringToCompareAgainst,
|
||||
const bool ignoreCase = false) const throw();
|
||||
bool ignoreCase = false) const throw();
|
||||
|
||||
int getIntAttribute (const String& attributeName,
|
||||
const int defaultReturnValue = 0) const;
|
||||
int defaultReturnValue = 0) const;
|
||||
|
||||
double getDoubleAttribute (const String& attributeName,
|
||||
const double defaultReturnValue = 0.0) const;
|
||||
double defaultReturnValue = 0.0) const;
|
||||
|
||||
bool getBoolAttribute (const String& attributeName,
|
||||
const bool defaultReturnValue = false) const;
|
||||
bool defaultReturnValue = false) const;
|
||||
|
||||
void setAttribute (const String& attributeName,
|
||||
const String& newValue);
|
||||
|
||||
void setAttribute (const String& attributeName,
|
||||
const int newValue);
|
||||
int newValue);
|
||||
|
||||
void setAttribute (const String& attributeName,
|
||||
const double newValue);
|
||||
double newValue);
|
||||
|
||||
void removeAttribute (const String& attributeName) throw();
|
||||
|
||||
|
|
@ -4555,22 +4546,22 @@ public:
|
|||
|
||||
int getNumChildElements() const throw();
|
||||
|
||||
XmlElement* getChildElement (const int index) const throw();
|
||||
XmlElement* getChildElement (int index) const throw();
|
||||
|
||||
XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
|
||||
|
||||
void addChildElement (XmlElement* const newChildElement) throw();
|
||||
|
||||
void insertChildElement (XmlElement* const newChildNode,
|
||||
void insertChildElement (XmlElement* newChildNode,
|
||||
int indexToInsertAt) throw();
|
||||
|
||||
XmlElement* createNewChildElement (const String& tagName);
|
||||
|
||||
bool replaceChildElement (XmlElement* const currentChildElement,
|
||||
XmlElement* const newChildNode) throw();
|
||||
bool replaceChildElement (XmlElement* currentChildElement,
|
||||
XmlElement* newChildNode) throw();
|
||||
|
||||
void removeChildElement (XmlElement* const childToRemove,
|
||||
const bool shouldDeleteTheChild) throw();
|
||||
void removeChildElement (XmlElement* childToRemove,
|
||||
bool shouldDeleteTheChild) throw();
|
||||
|
||||
void deleteAllChildElements() throw();
|
||||
|
||||
|
|
@ -4578,7 +4569,7 @@ public:
|
|||
|
||||
bool containsChildElement (const XmlElement* const possibleChild) const throw();
|
||||
|
||||
XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
|
||||
XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
|
||||
|
||||
template <class ElementComparator>
|
||||
void sortChildElements (ElementComparator& comparator,
|
||||
|
|
@ -4635,14 +4626,9 @@ private:
|
|||
|
||||
XmlAttributeNode* attributes;
|
||||
|
||||
XmlElement (int) throw(); // for internal use
|
||||
|
||||
XmlElement (int) throw();
|
||||
void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
|
||||
|
||||
void writeElementAsText (OutputStream& out,
|
||||
const int indentationLevel,
|
||||
const int lineWrapLength) const;
|
||||
|
||||
void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
|
||||
void getChildElementsAsArray (XmlElement**) const throw();
|
||||
void reorderChildElements (XmlElement** const, const int) throw();
|
||||
};
|
||||
|
|
@ -8527,11 +8513,11 @@ class JUCE_API XmlDocument
|
|||
{
|
||||
public:
|
||||
|
||||
XmlDocument (const String& documentText) throw();
|
||||
XmlDocument (const String& documentText);
|
||||
|
||||
XmlDocument (const File& file);
|
||||
|
||||
~XmlDocument() throw();
|
||||
~XmlDocument();
|
||||
|
||||
XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
|
||||
|
||||
|
|
@ -8554,15 +8540,15 @@ private:
|
|||
bool needToLoadDTD, ignoreEmptyTextElements;
|
||||
ScopedPointer <InputSource> inputSource;
|
||||
|
||||
void setLastError (const String& desc, const bool carryOn) throw();
|
||||
void skipHeader() throw();
|
||||
void skipNextWhiteSpace() throw();
|
||||
void setLastError (const String& desc, const bool carryOn);
|
||||
void skipHeader();
|
||||
void skipNextWhiteSpace();
|
||||
juce_wchar readNextChar() throw();
|
||||
XmlElement* readNextElement (const bool alsoParseSubElements) throw();
|
||||
void readChildElements (XmlElement* parent) throw();
|
||||
XmlElement* readNextElement (const bool alsoParseSubElements);
|
||||
void readChildElements (XmlElement* parent);
|
||||
int findNextTokenLength() throw();
|
||||
void readQuotedString (String& result) throw();
|
||||
void readEntity (String& result) throw();
|
||||
void readQuotedString (String& result);
|
||||
void readEntity (String& result);
|
||||
static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
|
||||
bool isXmlIdentifierChar (juce_wchar c) const throw();
|
||||
|
||||
|
|
|
|||
|
|
@ -825,8 +825,10 @@ int String::indexOfChar (const int startIndex,
|
|||
if (*t == character)
|
||||
return (int) (t - text);
|
||||
|
||||
if (*t++ == 0)
|
||||
if (*t == 0)
|
||||
return -1;
|
||||
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -959,7 +961,18 @@ bool String::contains (const juce_wchar* const other) const throw()
|
|||
|
||||
bool String::containsChar (const juce_wchar character) const throw()
|
||||
{
|
||||
return indexOfChar (character) >= 0;
|
||||
const juce_wchar* t = text;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (*t == character)
|
||||
return true;
|
||||
|
||||
if (*t == 0)
|
||||
return false;
|
||||
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
bool String::containsIgnoreCase (const juce_wchar* const t) const throw()
|
||||
|
|
|
|||
|
|
@ -340,7 +340,6 @@ int StringArray::addTokens (const String& text, const String& breakCharacters, c
|
|||
{
|
||||
bool insideQuotes = false;
|
||||
juce_wchar currentQuoteChar = 0;
|
||||
|
||||
int i = 0;
|
||||
int tokenStart = 0;
|
||||
|
||||
|
|
@ -348,35 +347,11 @@ int StringArray::addTokens (const String& text, const String& breakCharacters, c
|
|||
{
|
||||
const juce_wchar c = text[i];
|
||||
|
||||
bool isBreak = (c == 0);
|
||||
|
||||
if (! (insideQuotes || isBreak))
|
||||
{
|
||||
const juce_wchar* b = breakCharacters;
|
||||
while (*b != 0)
|
||||
{
|
||||
if (*b++ == c)
|
||||
{
|
||||
isBreak = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
const bool isBreak = (c == 0) || ((! insideQuotes) && breakCharacters.containsChar (c));
|
||||
|
||||
if (! isBreak)
|
||||
{
|
||||
bool isQuote = false;
|
||||
const juce_wchar* q = quoteCharacters;
|
||||
while (*q != 0)
|
||||
{
|
||||
if (*q++ == c)
|
||||
{
|
||||
isQuote = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isQuote)
|
||||
if (quoteCharacters.containsChar (c))
|
||||
{
|
||||
if (insideQuotes)
|
||||
{
|
||||
|
|
@ -477,9 +452,11 @@ void StringArray::removeDuplicates (const bool ignoreCase)
|
|||
|
||||
void StringArray::appendNumbersToDuplicates (const bool ignoreCase,
|
||||
const bool appendNumberToFirstInstance,
|
||||
const tchar* const preNumberString,
|
||||
const tchar* const postNumberString)
|
||||
const juce_wchar* const preNumberString,
|
||||
const juce_wchar* const postNumberString)
|
||||
{
|
||||
jassert (preNumberString != 0 && postNumberString != 0); // These strings can't be null pointers..
|
||||
|
||||
for (int i = 0; i < size() - 1; ++i)
|
||||
{
|
||||
String& s = strings.getReference(i);
|
||||
|
|
|
|||
|
|
@ -29,12 +29,6 @@
|
|||
#include "juce_String.h"
|
||||
#include "../containers/juce_Array.h"
|
||||
|
||||
#ifndef DOXYGEN
|
||||
// (used in StringArray::appendNumbersToDuplicates)
|
||||
static const tchar* const defaultPreNumberString = JUCE_T(" (");
|
||||
static const tchar* const defaultPostNumberString = JUCE_T(")");
|
||||
#endif
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
|
@ -58,8 +52,7 @@ public:
|
|||
treated as empty strings
|
||||
@param numberOfStrings how many items there are in the array
|
||||
*/
|
||||
StringArray (const juce_wchar** const strings,
|
||||
const int numberOfStrings);
|
||||
StringArray (const juce_wchar** strings, int numberOfStrings);
|
||||
|
||||
/** Creates a copy of an array of string literals.
|
||||
|
||||
|
|
@ -67,22 +60,21 @@ public:
|
|||
treated as empty strings
|
||||
@param numberOfStrings how many items there are in the array
|
||||
*/
|
||||
StringArray (const char** const strings,
|
||||
const int numberOfStrings);
|
||||
StringArray (const char** strings, int numberOfStrings);
|
||||
|
||||
/** Creates a copy of a null-terminated array of string literals.
|
||||
|
||||
Each item from the array passed-in is added, until it encounters a null pointer,
|
||||
at which point it stops.
|
||||
*/
|
||||
explicit StringArray (const juce_wchar** const strings);
|
||||
explicit StringArray (const juce_wchar** strings);
|
||||
|
||||
/** Creates a copy of a null-terminated array of string literals.
|
||||
|
||||
Each item from the array passed-in is added, until it encounters a null pointer,
|
||||
at which point it stops.
|
||||
*/
|
||||
explicit StringArray (const char** const strings);
|
||||
explicit StringArray (const char** strings);
|
||||
|
||||
/** Destructor. */
|
||||
~StringArray();
|
||||
|
|
@ -127,7 +119,7 @@ public:
|
|||
@returns true if the string is found inside the array
|
||||
*/
|
||||
bool contains (const String& stringToLookFor,
|
||||
const bool ignoreCase = false) const;
|
||||
bool ignoreCase = false) const;
|
||||
|
||||
/** Searches for a string in the array.
|
||||
|
||||
|
|
@ -140,7 +132,7 @@ public:
|
|||
or -1 if it isn't found.
|
||||
*/
|
||||
int indexOf (const String& stringToLookFor,
|
||||
const bool ignoreCase = false,
|
||||
bool ignoreCase = false,
|
||||
int startIndex = 0) const;
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -154,20 +146,20 @@ public:
|
|||
If the index is less than zero or greater than the size of the array,
|
||||
the new string will be added to the end of the array.
|
||||
*/
|
||||
void insert (const int index, const String& stringToAdd);
|
||||
void insert (int index, const String& stringToAdd);
|
||||
|
||||
/** Adds a string to the array as long as it's not already in there.
|
||||
|
||||
The search can optionally be case-insensitive.
|
||||
*/
|
||||
void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
|
||||
void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
|
||||
|
||||
/** Replaces one of the strings in the array with another one.
|
||||
|
||||
If the index is higher than the array's size, the new string will be
|
||||
added to the end of the array; if it's less than zero nothing happens.
|
||||
*/
|
||||
void set (const int index, const String& newString);
|
||||
void set (int index, const String& newString);
|
||||
|
||||
/** Appends some strings from another array to the end of this one.
|
||||
|
||||
|
|
@ -188,7 +180,7 @@ public:
|
|||
@returns the number of tokens added
|
||||
*/
|
||||
int addTokens (const String& stringToTokenise,
|
||||
const bool preserveQuotedStrings);
|
||||
bool preserveQuotedStrings);
|
||||
|
||||
/** Breaks up a string into tokens and adds them to this array.
|
||||
|
||||
|
|
@ -223,7 +215,7 @@ public:
|
|||
|
||||
If the index is out-of-range, no action will be taken.
|
||||
*/
|
||||
void remove (const int index);
|
||||
void remove (int index);
|
||||
|
||||
/** Finds a string in the array and removes it.
|
||||
|
||||
|
|
@ -231,7 +223,7 @@ public:
|
|||
comparison may be case-insensitive depending on the ignoreCase parameter.
|
||||
*/
|
||||
void removeString (const String& stringToRemove,
|
||||
const bool ignoreCase = false);
|
||||
bool ignoreCase = false);
|
||||
|
||||
/** Removes any duplicated elements from the array.
|
||||
|
||||
|
|
@ -240,14 +232,14 @@ public:
|
|||
|
||||
@param ignoreCase whether to use a case-insensitive comparison
|
||||
*/
|
||||
void removeDuplicates (const bool ignoreCase);
|
||||
void removeDuplicates (bool ignoreCase);
|
||||
|
||||
/** Removes empty strings from the array.
|
||||
|
||||
@param removeWhitespaceStrings if true, strings that only contain whitespace
|
||||
characters will also be removed
|
||||
*/
|
||||
void removeEmptyStrings (const bool removeWhitespaceStrings = true);
|
||||
void removeEmptyStrings (bool removeWhitespaceStrings = true);
|
||||
|
||||
/** Moves one of the strings to a different position.
|
||||
|
||||
|
|
@ -263,7 +255,7 @@ public:
|
|||
is less than zero, the value will be moved to the end
|
||||
of the array
|
||||
*/
|
||||
void move (const int currentIndex, int newIndex) throw();
|
||||
void move (int currentIndex, int newIndex) throw();
|
||||
|
||||
/** Deletes any whitespace characters from the starts and ends of all the strings. */
|
||||
void trim();
|
||||
|
|
@ -279,10 +271,10 @@ public:
|
|||
@param preNumberString when adding a number, this string is added before the number
|
||||
@param postNumberString this string is appended after any numbers that are added
|
||||
*/
|
||||
void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
|
||||
const bool appendNumberToFirstInstance,
|
||||
const tchar* const preNumberString = defaultPreNumberString,
|
||||
const tchar* const postNumberString = defaultPostNumberString);
|
||||
void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
|
||||
bool appendNumberToFirstInstance,
|
||||
const juce_wchar* preNumberString = JUCE_T(" ("),
|
||||
const juce_wchar* postNumberString = JUCE_T(")"));
|
||||
|
||||
//==============================================================================
|
||||
/** Joins the strings in the array together into one string.
|
||||
|
|
@ -306,7 +298,7 @@ public:
|
|||
|
||||
@param ignoreCase if true, the comparisons used will be case-sensitive.
|
||||
*/
|
||||
void sort (const bool ignoreCase);
|
||||
void sort (bool ignoreCase);
|
||||
|
||||
//==============================================================================
|
||||
/** Reduces the amount of storage being used by the array.
|
||||
|
|
|
|||
|
|
@ -32,30 +32,30 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
|
||||
//==============================================================================
|
||||
StringPairArray::StringPairArray (const bool ignoreCase_) throw()
|
||||
StringPairArray::StringPairArray (const bool ignoreCase_)
|
||||
: ignoreCase (ignoreCase_)
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray::StringPairArray (const StringPairArray& other) throw()
|
||||
StringPairArray::StringPairArray (const StringPairArray& other)
|
||||
: keys (other.keys),
|
||||
values (other.values),
|
||||
ignoreCase (other.ignoreCase)
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray::~StringPairArray() throw()
|
||||
StringPairArray::~StringPairArray()
|
||||
{
|
||||
}
|
||||
|
||||
StringPairArray& StringPairArray::operator= (const StringPairArray& other) throw()
|
||||
StringPairArray& StringPairArray::operator= (const StringPairArray& other)
|
||||
{
|
||||
keys = other.keys;
|
||||
values = other.values;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool StringPairArray::operator== (const StringPairArray& other) const throw()
|
||||
bool StringPairArray::operator== (const StringPairArray& other) const
|
||||
{
|
||||
for (int i = keys.size(); --i >= 0;)
|
||||
if (other [keys[i]] != values[i])
|
||||
|
|
@ -64,12 +64,12 @@ bool StringPairArray::operator== (const StringPairArray& other) const throw()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool StringPairArray::operator!= (const StringPairArray& other) const throw()
|
||||
bool StringPairArray::operator!= (const StringPairArray& other) const
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
const String& StringPairArray::operator[] (const String& key) const throw()
|
||||
const String& StringPairArray::operator[] (const String& key) const
|
||||
{
|
||||
return values [keys.indexOf (key, ignoreCase)];
|
||||
}
|
||||
|
|
@ -84,8 +84,7 @@ const String StringPairArray::getValue (const String& key, const String& default
|
|||
return defaultReturnValue;
|
||||
}
|
||||
|
||||
void StringPairArray::set (const String& key,
|
||||
const String& value) throw()
|
||||
void StringPairArray::set (const String& key, const String& value)
|
||||
{
|
||||
const int i = keys.indexOf (key, ignoreCase);
|
||||
|
||||
|
|
@ -106,24 +105,24 @@ void StringPairArray::addArray (const StringPairArray& other)
|
|||
set (other.keys[i], other.values[i]);
|
||||
}
|
||||
|
||||
void StringPairArray::clear() throw()
|
||||
void StringPairArray::clear()
|
||||
{
|
||||
keys.clear();
|
||||
values.clear();
|
||||
}
|
||||
|
||||
void StringPairArray::remove (const String& key) throw()
|
||||
void StringPairArray::remove (const String& key)
|
||||
{
|
||||
remove (keys.indexOf (key, ignoreCase));
|
||||
}
|
||||
|
||||
void StringPairArray::remove (const int index) throw()
|
||||
void StringPairArray::remove (const int index)
|
||||
{
|
||||
keys.remove (index);
|
||||
values.remove (index);
|
||||
}
|
||||
|
||||
void StringPairArray::setIgnoresCase (const bool shouldIgnoreCase) throw()
|
||||
void StringPairArray::setIgnoresCase (const bool shouldIgnoreCase)
|
||||
{
|
||||
ignoreCase = shouldIgnoreCase;
|
||||
}
|
||||
|
|
@ -142,7 +141,7 @@ const String StringPairArray::getDescription() const
|
|||
return s;
|
||||
}
|
||||
|
||||
void StringPairArray::minimiseStorageOverheads() throw()
|
||||
void StringPairArray::minimiseStorageOverheads()
|
||||
{
|
||||
keys.minimiseStorageOverheads();
|
||||
values.minimiseStorageOverheads();
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@ class JUCE_API StringPairArray
|
|||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty array */
|
||||
StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
|
||||
StringPairArray (bool ignoreCaseWhenComparingKeys = true);
|
||||
|
||||
/** Creates a copy of another array */
|
||||
StringPairArray (const StringPairArray& other) throw();
|
||||
StringPairArray (const StringPairArray& other);
|
||||
|
||||
/** Destructor. */
|
||||
~StringPairArray() throw();
|
||||
~StringPairArray();
|
||||
|
||||
/** Copies the contents of another string array into this one */
|
||||
StringPairArray& operator= (const StringPairArray& other) throw();
|
||||
StringPairArray& operator= (const StringPairArray& other);
|
||||
|
||||
//==============================================================================
|
||||
/** Compares two arrays.
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
@returns true only if the other array contains exactly the same strings with the same keys
|
||||
*/
|
||||
bool operator== (const StringPairArray& other) const throw();
|
||||
bool operator== (const StringPairArray& other) const;
|
||||
|
||||
/** Compares two arrays.
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
@returns false if the other array contains exactly the same strings with the same keys
|
||||
*/
|
||||
bool operator!= (const StringPairArray& other) const throw();
|
||||
bool operator!= (const StringPairArray& other) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Finds the value corresponding to a key string.
|
||||
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
@see getValue
|
||||
*/
|
||||
const String& operator[] (const String& key) const throw();
|
||||
const String& operator[] (const String& key) const;
|
||||
|
||||
/** Finds the value corresponding to a key string.
|
||||
|
||||
|
|
@ -92,13 +92,13 @@ public:
|
|||
|
||||
|
||||
/** Returns a list of all keys in the array. */
|
||||
const StringArray& getAllKeys() const throw() { return keys; }
|
||||
const StringArray& getAllKeys() const throw() { return keys; }
|
||||
|
||||
/** Returns a list of all values in the array. */
|
||||
const StringArray& getAllValues() const throw() { return values; }
|
||||
const StringArray& getAllValues() const throw() { return values; }
|
||||
|
||||
/** Returns the number of strings in the array */
|
||||
inline int size() const throw() { return keys.size(); };
|
||||
inline int size() const throw() { return keys.size(); };
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -107,8 +107,7 @@ public:
|
|||
If a value already exists with this key, its value will be overwritten,
|
||||
otherwise the key/value pair will be added to the array.
|
||||
*/
|
||||
void set (const String& key,
|
||||
const String& value) throw();
|
||||
void set (const String& key, const String& value);
|
||||
|
||||
/** Adds the items from another array to this one.
|
||||
|
||||
|
|
@ -118,24 +117,24 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Removes all elements from the array. */
|
||||
void clear() throw();
|
||||
void clear();
|
||||
|
||||
/** Removes a string from the array based on its key.
|
||||
|
||||
If the key isn't found, nothing will happen.
|
||||
*/
|
||||
void remove (const String& key) throw();
|
||||
void remove (const String& key);
|
||||
|
||||
/** Removes a string from the array based on its index.
|
||||
|
||||
If the index is out-of-range, no action will be taken.
|
||||
*/
|
||||
void remove (const int index) throw();
|
||||
void remove (int index);
|
||||
|
||||
//==============================================================================
|
||||
/** Indicates whether to use a case-insensitive search when looking up a key string.
|
||||
*/
|
||||
void setIgnoresCase (const bool shouldIgnoreCase) throw();
|
||||
void setIgnoresCase (bool shouldIgnoreCase);
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a descriptive string containing the items.
|
||||
|
|
@ -151,7 +150,7 @@ public:
|
|||
removing elements, they may have quite a lot of unused space allocated.
|
||||
This method will reduce the amount of allocated storage to a minimum.
|
||||
*/
|
||||
void minimiseStorageOverheads() throw();
|
||||
void minimiseStorageOverheads();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
|
||||
//==============================================================================
|
||||
XmlDocument::XmlDocument (const String& documentText) throw()
|
||||
XmlDocument::XmlDocument (const String& documentText)
|
||||
: originalText (documentText),
|
||||
ignoreEmptyTextElements (true)
|
||||
{
|
||||
|
|
@ -43,7 +43,7 @@ XmlDocument::XmlDocument (const File& file)
|
|||
inputSource = new FileInputSource (file);
|
||||
}
|
||||
|
||||
XmlDocument::~XmlDocument() throw()
|
||||
XmlDocument::~XmlDocument()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ const String& XmlDocument::getLastParseError() const throw()
|
|||
return lastError;
|
||||
}
|
||||
|
||||
void XmlDocument::setLastError (const String& desc, const bool carryOn) throw()
|
||||
void XmlDocument::setLastError (const String& desc, const bool carryOn)
|
||||
{
|
||||
lastError = desc;
|
||||
errorOccurred = ! carryOn;
|
||||
|
|
@ -183,7 +183,7 @@ int XmlDocument::findNextTokenLength() throw()
|
|||
return len;
|
||||
}
|
||||
|
||||
void XmlDocument::skipHeader() throw()
|
||||
void XmlDocument::skipHeader()
|
||||
{
|
||||
const juce_wchar* const found = CharacterFunctions::find (input, T("<?xml"));
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ void XmlDocument::skipHeader() throw()
|
|||
dtdText = String (docType, (int) (input - (docType + 1))).trim();
|
||||
}
|
||||
|
||||
void XmlDocument::skipNextWhiteSpace() throw()
|
||||
void XmlDocument::skipNextWhiteSpace()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -275,7 +275,7 @@ void XmlDocument::skipNextWhiteSpace() throw()
|
|||
}
|
||||
}
|
||||
|
||||
void XmlDocument::readQuotedString (String& result) throw()
|
||||
void XmlDocument::readQuotedString (String& result)
|
||||
{
|
||||
const juce_wchar quote = readNextChar();
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ void XmlDocument::readQuotedString (String& result) throw()
|
|||
}
|
||||
}
|
||||
|
||||
XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw()
|
||||
XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements)
|
||||
{
|
||||
XmlElement* node = 0;
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw
|
|||
return node;
|
||||
}
|
||||
|
||||
void XmlDocument::readChildElements (XmlElement* parent) throw()
|
||||
void XmlDocument::readChildElements (XmlElement* parent)
|
||||
{
|
||||
XmlElement* lastChildNode = 0;
|
||||
|
||||
|
|
@ -620,7 +620,7 @@ void XmlDocument::readChildElements (XmlElement* parent) throw()
|
|||
}
|
||||
}
|
||||
|
||||
void XmlDocument::readEntity (String& result) throw()
|
||||
void XmlDocument::readEntity (String& result)
|
||||
{
|
||||
// skip over the ampersand
|
||||
++input;
|
||||
|
|
@ -726,43 +726,33 @@ void XmlDocument::readEntity (String& result) throw()
|
|||
const String XmlDocument::expandEntity (const String& ent)
|
||||
{
|
||||
if (ent.equalsIgnoreCase (T("amp")))
|
||||
{
|
||||
return T("&");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("quot")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("quot")))
|
||||
return T("\"");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("apos")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("apos")))
|
||||
return T("\'");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("lt")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("lt")))
|
||||
return T("<");
|
||||
}
|
||||
else if (ent.equalsIgnoreCase (T("gt")))
|
||||
{
|
||||
|
||||
if (ent.equalsIgnoreCase (T("gt")))
|
||||
return T(">");
|
||||
}
|
||||
else if (ent[0] == T('#'))
|
||||
|
||||
if (ent[0] == T('#'))
|
||||
{
|
||||
if (ent[1] == T('x') || ent[1] == T('X'))
|
||||
{
|
||||
return String::charToString (static_cast <juce_wchar> (ent.substring (2).getHexValue32()));
|
||||
}
|
||||
else if (ent[1] >= T('0') && ent[1] <= T('9'))
|
||||
{
|
||||
|
||||
if (ent[1] >= T('0') && ent[1] <= T('9'))
|
||||
return String::charToString (static_cast <juce_wchar> (ent.substring (1).getIntValue()));
|
||||
}
|
||||
|
||||
setLastError ("illegal escape sequence", false);
|
||||
return T("&");
|
||||
}
|
||||
else
|
||||
{
|
||||
return expandExternalEntity (ent);
|
||||
}
|
||||
|
||||
return expandExternalEntity (ent);
|
||||
}
|
||||
|
||||
const String XmlDocument::expandExternalEntity (const String& entity)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public:
|
|||
The text doesn't actually get parsed until the getDocumentElement() method is
|
||||
called.
|
||||
*/
|
||||
XmlDocument (const String& documentText) throw();
|
||||
XmlDocument (const String& documentText);
|
||||
|
||||
/** Creates an XmlDocument from a file.
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
XmlDocument (const File& file);
|
||||
|
||||
/** Destructor. */
|
||||
~XmlDocument() throw();
|
||||
~XmlDocument();
|
||||
|
||||
/** Creates an XmlElement object to represent the main document node.
|
||||
|
||||
|
|
@ -140,15 +140,15 @@ private:
|
|||
bool needToLoadDTD, ignoreEmptyTextElements;
|
||||
ScopedPointer <InputSource> inputSource;
|
||||
|
||||
void setLastError (const String& desc, const bool carryOn) throw();
|
||||
void skipHeader() throw();
|
||||
void skipNextWhiteSpace() throw();
|
||||
void setLastError (const String& desc, const bool carryOn);
|
||||
void skipHeader();
|
||||
void skipNextWhiteSpace();
|
||||
juce_wchar readNextChar() throw();
|
||||
XmlElement* readNextElement (const bool alsoParseSubElements) throw();
|
||||
void readChildElements (XmlElement* parent) throw();
|
||||
XmlElement* readNextElement (const bool alsoParseSubElements);
|
||||
void readChildElements (XmlElement* parent);
|
||||
int findNextTokenLength() throw();
|
||||
void readQuotedString (String& result) throw();
|
||||
void readEntity (String& result) throw();
|
||||
void readQuotedString (String& result);
|
||||
void readEntity (String& result);
|
||||
static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
|
||||
bool isXmlIdentifierChar (juce_wchar c) const throw();
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) t
|
|||
{
|
||||
}
|
||||
|
||||
XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_,
|
||||
const String& value_) throw()
|
||||
XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const String& value_) throw()
|
||||
: name (name_),
|
||||
value (value_),
|
||||
next (0)
|
||||
|
|
@ -402,24 +401,11 @@ void XmlElement::writeToStream (OutputStream& output,
|
|||
const int lineWrapLength) const
|
||||
{
|
||||
if (includeXmlHeader)
|
||||
{
|
||||
output << "<?xml version=\"1.0\" encoding=\"" << encodingType;
|
||||
|
||||
if (allOnOneLine)
|
||||
output << "\"?> ";
|
||||
else
|
||||
output << "\"?>\r\n\r\n";
|
||||
}
|
||||
output << "<?xml version=\"1.0\" encoding=\"" << encodingType
|
||||
<< (allOnOneLine ? "\"?> " : "\"?>\r\n\r\n");
|
||||
|
||||
if (dtdToUse.isNotEmpty())
|
||||
{
|
||||
output << dtdToUse;
|
||||
|
||||
if (allOnOneLine)
|
||||
output << " ";
|
||||
else
|
||||
output << "\r\n";
|
||||
}
|
||||
output << dtdToUse << (allOnOneLine ? " " : "\r\n");
|
||||
|
||||
writeElementAsText (output, allOnOneLine ? -1 : 0, lineWrapLength);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ public:
|
|||
considered the same; if false, the attributes must
|
||||
be in the same order as well
|
||||
*/
|
||||
bool isEquivalentTo (const XmlElement* const other,
|
||||
const bool ignoreOrderOfAttributes) const throw();
|
||||
bool isEquivalentTo (const XmlElement* other,
|
||||
bool ignoreOrderOfAttributes) const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns an XML text document that represents this element.
|
||||
|
|
@ -190,10 +190,10 @@ public:
|
|||
@see writeToStream, writeToFile
|
||||
*/
|
||||
const String createDocument (const String& dtdToUse,
|
||||
const bool allOnOneLine = false,
|
||||
const bool includeXmlHeader = true,
|
||||
bool allOnOneLine = false,
|
||||
bool includeXmlHeader = true,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
/** Writes the document to a stream as UTF-8.
|
||||
|
||||
|
|
@ -212,10 +212,10 @@ public:
|
|||
*/
|
||||
void writeToStream (OutputStream& output,
|
||||
const String& dtdToUse,
|
||||
const bool allOnOneLine = false,
|
||||
const bool includeXmlHeader = true,
|
||||
bool allOnOneLine = false,
|
||||
bool includeXmlHeader = true,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
/** Writes the element to a file as an XML document.
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ public:
|
|||
bool writeToFile (const File& destinationFile,
|
||||
const String& dtdToUse,
|
||||
const String& encodingType = JUCE_T("UTF-8"),
|
||||
const int lineWrapLength = 60) const;
|
||||
int lineWrapLength = 60) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns this element's tag type name.
|
||||
|
|
@ -274,7 +274,7 @@ public:
|
|||
|
||||
@see getAttributeValue, getStringAttribute
|
||||
*/
|
||||
const String& getAttributeName (const int attributeIndex) const throw();
|
||||
const String& getAttributeName (int attributeIndex) const throw();
|
||||
|
||||
/** Returns the value of one of the elements attributes.
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ public:
|
|||
|
||||
@see getAttributeName, getStringAttribute
|
||||
*/
|
||||
const String& getAttributeValue (const int attributeIndex) const throw();
|
||||
const String& getAttributeValue (int attributeIndex) const throw();
|
||||
|
||||
//==============================================================================
|
||||
// Attribute-handling methods..
|
||||
|
|
@ -318,7 +318,7 @@ public:
|
|||
*/
|
||||
bool compareAttribute (const String& attributeName,
|
||||
const String& stringToCompareAgainst,
|
||||
const bool ignoreCase = false) const throw();
|
||||
bool ignoreCase = false) const throw();
|
||||
|
||||
/** Returns the value of a named attribute as an integer.
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ public:
|
|||
@see setAttribute
|
||||
*/
|
||||
int getIntAttribute (const String& attributeName,
|
||||
const int defaultReturnValue = 0) const;
|
||||
int defaultReturnValue = 0) const;
|
||||
|
||||
/** Returns the value of a named attribute as floating-point.
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ public:
|
|||
@see setAttribute
|
||||
*/
|
||||
double getDoubleAttribute (const String& attributeName,
|
||||
const double defaultReturnValue = 0.0) const;
|
||||
double defaultReturnValue = 0.0) const;
|
||||
|
||||
/** Returns the value of a named attribute as a boolean.
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ public:
|
|||
with this name
|
||||
*/
|
||||
bool getBoolAttribute (const String& attributeName,
|
||||
const bool defaultReturnValue = false) const;
|
||||
bool defaultReturnValue = false) const;
|
||||
|
||||
/** Adds a named attribute to the element.
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ public:
|
|||
@param newValue the value to set it to
|
||||
*/
|
||||
void setAttribute (const String& attributeName,
|
||||
const int newValue);
|
||||
int newValue);
|
||||
|
||||
/** Adds a named attribute to the element, setting it to a floating-point value.
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
@param newValue the value to set it to
|
||||
*/
|
||||
void setAttribute (const String& attributeName,
|
||||
const double newValue);
|
||||
double newValue);
|
||||
|
||||
/** Removes a named attribute from the element.
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ public:
|
|||
@returns the n'th child of this element, or 0 if the index is out-of-range
|
||||
@see getNextElement, isTextElement, getChildByName
|
||||
*/
|
||||
XmlElement* getChildElement (const int index) const throw();
|
||||
XmlElement* getChildElement (int index) const throw();
|
||||
|
||||
/** Returns the first sub-element with a given tag-name.
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ public:
|
|||
below zero, it will be added to the end of the list
|
||||
@see addChildElement, insertChildElement
|
||||
*/
|
||||
void insertChildElement (XmlElement* const newChildNode,
|
||||
void insertChildElement (XmlElement* newChildNode,
|
||||
int indexToInsertAt) throw();
|
||||
|
||||
/** Creates a new element with the given name and returns it, after adding it
|
||||
|
|
@ -538,8 +538,8 @@ public:
|
|||
existing element will be deleted, replaced with the new one, and it
|
||||
will return true.
|
||||
*/
|
||||
bool replaceChildElement (XmlElement* const currentChildElement,
|
||||
XmlElement* const newChildNode) throw();
|
||||
bool replaceChildElement (XmlElement* currentChildElement,
|
||||
XmlElement* newChildNode) throw();
|
||||
|
||||
/** Removes a child element.
|
||||
|
||||
|
|
@ -547,8 +547,8 @@ public:
|
|||
@param shouldDeleteTheChild if true, the child will be deleted, if false it'll
|
||||
just remove it
|
||||
*/
|
||||
void removeChildElement (XmlElement* const childToRemove,
|
||||
const bool shouldDeleteTheChild) throw();
|
||||
void removeChildElement (XmlElement* childToRemove,
|
||||
bool shouldDeleteTheChild) throw();
|
||||
|
||||
/** Deletes all the child elements in the element.
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ public:
|
|||
/** Recursively searches all sub-elements to find one that contains the specified
|
||||
child element.
|
||||
*/
|
||||
XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
|
||||
XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Sorts the child elements using a comparator.
|
||||
|
|
@ -706,14 +706,9 @@ private:
|
|||
|
||||
XmlAttributeNode* attributes;
|
||||
|
||||
XmlElement (int) throw(); // for internal use
|
||||
|
||||
XmlElement (int) throw();
|
||||
void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
|
||||
|
||||
void writeElementAsText (OutputStream& out,
|
||||
const int indentationLevel,
|
||||
const int lineWrapLength) const;
|
||||
|
||||
void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
|
||||
void getChildElementsAsArray (XmlElement**) const throw();
|
||||
void reorderChildElements (XmlElement** const, const int) throw();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue