mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
More ScopedPointer/unique_ptr compatibility work
This commit is contained in:
parent
48a5fbd333
commit
1a60fa9765
80 changed files with 404 additions and 368 deletions
|
|
@ -40,25 +40,25 @@ XmlElement* XmlDocument::parse (const String& xmlData)
|
|||
return doc.getDocumentElement();
|
||||
}
|
||||
|
||||
void XmlDocument::setInputSource (InputSource* const newSource) noexcept
|
||||
void XmlDocument::setInputSource (InputSource* newSource) noexcept
|
||||
{
|
||||
inputSource = newSource;
|
||||
inputSource.reset (newSource);
|
||||
}
|
||||
|
||||
void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) noexcept
|
||||
void XmlDocument::setEmptyTextElementsIgnored (bool shouldBeIgnored) noexcept
|
||||
{
|
||||
ignoreEmptyTextElements = shouldBeIgnored;
|
||||
}
|
||||
|
||||
namespace XmlIdentifierChars
|
||||
{
|
||||
static bool isIdentifierCharSlow (const juce_wchar c) noexcept
|
||||
static bool isIdentifierCharSlow (juce_wchar c) noexcept
|
||||
{
|
||||
return CharacterFunctions::isLetterOrDigit (c)
|
||||
|| c == '_' || c == '-' || c == ':' || c == '.';
|
||||
}
|
||||
|
||||
static bool isIdentifierChar (const juce_wchar c) noexcept
|
||||
static bool isIdentifierChar (juce_wchar c) noexcept
|
||||
{
|
||||
static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 };
|
||||
|
||||
|
|
@ -93,7 +93,9 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle
|
|||
{
|
||||
if (originalText.isEmpty() && inputSource != nullptr)
|
||||
{
|
||||
if (ScopedPointer<InputStream> in = inputSource->createInputStream())
|
||||
ScopedPointer<InputStream> in (inputSource->createInputStream());
|
||||
|
||||
if (in != nullptr)
|
||||
{
|
||||
MemoryOutputStream data;
|
||||
data.writeFromInputStream (*in, onlyReadOuterDocumentElement ? 8192 : -1);
|
||||
|
|
@ -141,8 +143,12 @@ void XmlDocument::setLastError (const String& desc, const bool carryOn)
|
|||
String XmlDocument::getFileContents (const String& filename) const
|
||||
{
|
||||
if (inputSource != nullptr)
|
||||
if (ScopedPointer<InputStream> in = inputSource->createInputStreamFor (filename.trim().unquoted()))
|
||||
{
|
||||
ScopedPointer<InputStream> in (inputSource->createInputStreamFor (filename.trim().unquoted()));
|
||||
|
||||
if (in != nullptr)
|
||||
return in->readEntireStreamAsString();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue