1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

New class: NamedValueSet, which is a simple container for named var objects. Removed the clunky get/setComponentProperty methods and replaced them a single method Component::getProperties(), which returns a NamedValueSet for that component - if you've used component properties in your code you might need to change your syntax, but this is a cleaner solution, and using var objects for the data is more powerful than the old, string-based implementation. Also fixed a Mac image rendering bug.

This commit is contained in:
Julian Storer 2010-01-29 10:31:12 +00:00
parent 773c7d7407
commit 63d3d8a77e
39 changed files with 1630 additions and 1601 deletions

View file

@ -69,15 +69,6 @@ XmlElement::XmlElement (int /*dummy*/) throw()
{
}
XmlElement::XmlElement (const tchar* const tagName_,
const int nameLen) throw()
: tagName (tagName_, nameLen),
firstChildElement (0),
nextElement (0),
attributes (0)
{
}
XmlElement::XmlElement (const XmlElement& other) throw()
: tagName (other.tagName),
firstChildElement (0),
@ -383,7 +374,7 @@ void XmlElement::writeElementAsText (OutputStream& outputStream,
const String XmlElement::createDocument (const String& dtdToUse,
const bool allOnOneLine,
const bool includeXmlHeader,
const tchar* const encodingType,
const String& encodingType,
const int lineWrapLength) const throw()
{
MemoryOutputStream mem (2048, 4096);
@ -396,7 +387,7 @@ void XmlElement::writeToStream (OutputStream& output,
const String& dtdToUse,
const bool allOnOneLine,
const bool includeXmlHeader,
const tchar* const encodingType,
const String& encodingType,
const int lineWrapLength) const throw()
{
if (includeXmlHeader)
@ -424,7 +415,7 @@ void XmlElement::writeToStream (OutputStream& output,
bool XmlElement::writeToFile (const File& file,
const String& dtdToUse,
const tchar* const encodingType,
const String& encodingType,
const int lineWrapLength) const throw()
{
if (file.hasWriteAccess())
@ -445,7 +436,7 @@ bool XmlElement::writeToFile (const File& file,
}
//==============================================================================
bool XmlElement::hasTagName (const tchar* const tagNameWanted) const throw()
bool XmlElement::hasTagName (const String& tagNameWanted) const throw()
{
#ifdef JUCE_DEBUG
// if debugging, check that the case is actually the same, because
@ -465,7 +456,7 @@ bool XmlElement::hasTagName (const tchar* const tagNameWanted) const throw()
#endif
}
XmlElement* XmlElement::getNextElementWithTagName (const tchar* const requiredTagName) const
XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName) const
{
XmlElement* e = nextElement;
@ -525,7 +516,7 @@ const String& XmlElement::getAttributeValue (const int index) const throw()
return String::empty;
}
bool XmlElement::hasAttribute (const tchar* const attributeName) const throw()
bool XmlElement::hasAttribute (const String& attributeName) const throw()
{
const XmlAttributeNode* att = attributes;
@ -541,8 +532,8 @@ bool XmlElement::hasAttribute (const tchar* const attributeName) const throw()
}
//==============================================================================
const String XmlElement::getStringAttribute (const tchar* const attributeName,
const tchar* const defaultReturnValue) const throw()
const String XmlElement::getStringAttribute (const String& attributeName,
const String& defaultReturnValue) const throw()
{
const XmlAttributeNode* att = attributes;
@ -557,7 +548,7 @@ const String XmlElement::getStringAttribute (const tchar* const attributeName,
return defaultReturnValue;
}
int XmlElement::getIntAttribute (const tchar* const attributeName,
int XmlElement::getIntAttribute (const String& attributeName,
const int defaultReturnValue) const throw()
{
const XmlAttributeNode* att = attributes;
@ -573,7 +564,7 @@ int XmlElement::getIntAttribute (const tchar* const attributeName,
return defaultReturnValue;
}
double XmlElement::getDoubleAttribute (const tchar* const attributeName,
double XmlElement::getDoubleAttribute (const String& attributeName,
const double defaultReturnValue) const throw()
{
const XmlAttributeNode* att = attributes;
@ -589,7 +580,7 @@ double XmlElement::getDoubleAttribute (const tchar* const attributeName,
return defaultReturnValue;
}
bool XmlElement::getBoolAttribute (const tchar* const attributeName,
bool XmlElement::getBoolAttribute (const String& attributeName,
const bool defaultReturnValue) const throw()
{
const XmlAttributeNode* att = attributes;
@ -616,8 +607,8 @@ bool XmlElement::getBoolAttribute (const tchar* const attributeName,
return defaultReturnValue;
}
bool XmlElement::compareAttribute (const tchar* const attributeName,
const tchar* const stringToCompareAgainst,
bool XmlElement::compareAttribute (const String& attributeName,
const String& stringToCompareAgainst,
const bool ignoreCase) const throw()
{
const XmlAttributeNode* att = attributes;
@ -639,7 +630,7 @@ bool XmlElement::compareAttribute (const tchar* const attributeName,
}
//==============================================================================
void XmlElement::setAttribute (const tchar* const attributeName,
void XmlElement::setAttribute (const String& attributeName,
const String& value) throw()
{
#ifdef JUCE_DEBUG
@ -681,25 +672,19 @@ void XmlElement::setAttribute (const tchar* const attributeName,
}
}
void XmlElement::setAttribute (const tchar* const attributeName,
const tchar* const text) throw()
{
setAttribute (attributeName, String (text));
}
void XmlElement::setAttribute (const tchar* const attributeName,
void XmlElement::setAttribute (const String& attributeName,
const int number) throw()
{
setAttribute (attributeName, String (number));
}
void XmlElement::setAttribute (const tchar* const attributeName,
void XmlElement::setAttribute (const String& attributeName,
const double number) throw()
{
setAttribute (attributeName, String (number));
}
void XmlElement::removeAttribute (const tchar* const attributeName) throw()
void XmlElement::removeAttribute (const String& attributeName) throw()
{
XmlAttributeNode* att = attributes;
XmlAttributeNode* lastAtt = 0;
@ -761,7 +746,7 @@ XmlElement* XmlElement::getChildElement (const int index) const throw()
return child;
}
XmlElement* XmlElement::getChildByName (const tchar* const childName) const throw()
XmlElement* XmlElement::getChildByName (const String& childName) const throw()
{
XmlElement* child = firstChildElement;
@ -995,7 +980,7 @@ void XmlElement::deleteAllChildElements() throw()
}
}
void XmlElement::deleteAllChildElementsWithTagName (const tchar* const name) throw()
void XmlElement::deleteAllChildElementsWithTagName (const String& name) throw()
{
XmlElement* child = firstChildElement;
@ -1122,7 +1107,7 @@ const String XmlElement::getAllSubText() const throw()
return result;
}
const String XmlElement::getChildElementAllSubText (const tchar* const childTagName,
const String XmlElement::getChildElementAllSubText (const String& childTagName,
const String& defaultReturnValue) const throw()
{
const XmlElement* const child = getChildByName (childTagName);