Browse Source

Fixes for 64-bit AUs and NamedValueSet.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
ea9a2c095d
6 changed files with 240 additions and 232 deletions
  1. +1
    -1
      extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm
  2. +3
    -2
      juce_amalgamated.cpp
  3. +10
    -7
      juce_amalgamated.h
  4. +7
    -5
      src/containers/juce_LinkedListPointer.h
  5. +216
    -215
      src/containers/juce_NamedValueSet.cpp
  6. +3
    -2
      src/gui/components/layout/juce_MarkerList.h

+ 1
- 1
extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm View File

@@ -41,7 +41,7 @@
#define BUILD_AU_CARBON_UI 1
#endif
#if JUCE_64BIT
#ifdef __LP64__
#undef BUILD_AU_CARBON_UI // (not possible in a 64-bit build)
#endif


+ 3
- 2
juce_amalgamated.cpp View File

@@ -4566,12 +4566,13 @@ const var NamedValueSet::getValueAt (const int index) const

void NamedValueSet::setFromXmlAttributes (const XmlElement& xml)
{
LinkedListPointer<NamedValue>::Appender appender (values.getLast());
clear();
LinkedListPointer<NamedValue>::Appender appender (values);

const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator..

for (int i = 0; i < numAtts; ++i)
set (xml.getAttributeName (i), var (xml.getAttributeValue (i)));
appender.append (new NamedValue (xml.getAttributeName (i), var (xml.getAttributeValue (i))));
}

void NamedValueSet::copyToXmlAttributes (XmlElement& xml) const


+ 10
- 7
juce_amalgamated.h View File

@@ -6412,12 +6412,14 @@ public:
*/
ObjectType* removeNext() throw()
{
if (item == 0)
return 0;

ObjectType* const oldItem = item;
oldItem->nextListItem = 0;
item = item->nextListItem;

if (oldItem != 0)
{
item = oldItem->nextListItem;
oldItem->nextListItem = 0;
}

return oldItem;
}

@@ -54042,6 +54044,7 @@ public:
public:
ValueTreeWrapper (const ValueTree& state);

ValueTree& getState() throw() { return state; }
int getNumMarkers() const;
const ValueTree getMarkerState (int index) const;
const ValueTree getMarkerState (const String& name) const;
@@ -54053,10 +54056,10 @@ public:
void applyTo (MarkerList& markerList);
void readFrom (const MarkerList& markerList, UndoManager* undoManager);

static const Identifier markerTag, nameProperty, posProperty;

private:
ValueTree state;

static const Identifier markerTag, nameProperty, posProperty;
};

private:


+ 7
- 5
src/containers/juce_LinkedListPointer.h View File

@@ -237,12 +237,14 @@ public:
*/
ObjectType* removeNext() throw()
{
if (item == 0)
return 0;
ObjectType* const oldItem = item;
oldItem->nextListItem = 0;
item = item->nextListItem;
if (oldItem != 0)
{
item = oldItem->nextListItem;
oldItem->nextListItem = 0;
}
return oldItem;
}


+ 216
- 215
src/containers/juce_NamedValueSet.cpp View File

@@ -1,215 +1,216 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-10 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#include "../core/juce_StandardHeader.h"
BEGIN_JUCE_NAMESPACE
#include "juce_NamedValueSet.h"
#include "../text/juce_XmlElement.h"
//==============================================================================
NamedValueSet::NamedValue::NamedValue() throw()
{
}
inline NamedValueSet::NamedValue::NamedValue (const Identifier& name_, const var& value_)
: name (name_), value (value_)
{
}
bool NamedValueSet::NamedValue::operator== (const NamedValueSet::NamedValue& other) const throw()
{
return name == other.name && value == other.value;
}
//==============================================================================
NamedValueSet::NamedValueSet() throw()
{
}
NamedValueSet::NamedValueSet (const NamedValueSet& other)
{
values.addCopyOfList (other.values);
}
NamedValueSet& NamedValueSet::operator= (const NamedValueSet& other)
{
clear();
values.addCopyOfList (other.values);
return *this;
}
NamedValueSet::~NamedValueSet()
{
clear();
}
void NamedValueSet::clear()
{
values.deleteAll();
}
bool NamedValueSet::operator== (const NamedValueSet& other) const
{
const NamedValue* i1 = values;
const NamedValue* i2 = other.values;
while (i1 != 0 && i2 != 0)
{
if (! (*i1 == *i2))
return false;
i1 = i1->nextListItem;
i2 = i2->nextListItem;
}
return true;
}
bool NamedValueSet::operator!= (const NamedValueSet& other) const
{
return ! operator== (other);
}
int NamedValueSet::size() const throw()
{
return values.size();
}
const var& NamedValueSet::operator[] (const Identifier& name) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
if (i->name == name)
return i->value;
return var::null;
}
const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const
{
const var* v = getVarPointer (name);
return v != 0 ? *v : defaultReturnValue;
}
var* NamedValueSet::getVarPointer (const Identifier& name) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
if (i->name == name)
return &(i->value);
return 0;
}
bool NamedValueSet::set (const Identifier& name, const var& newValue)
{
LinkedListPointer<NamedValue>* i = &values;
while (i->get() != 0)
{
NamedValue* const v = i->get();
if (v->name == name)
{
if (v->value == newValue)
return false;
v->value = newValue;
return true;
}
i = &(v->nextListItem);
}
i->insertNext (new NamedValue (name, newValue));
return true;
}
bool NamedValueSet::contains (const Identifier& name) const
{
return getVarPointer (name) != 0;
}
bool NamedValueSet::remove (const Identifier& name)
{
LinkedListPointer<NamedValue>* i = &values;
for (;;)
{
NamedValue* const v = i->get();
if (v == 0)
break;
if (v->name == name)
{
delete i->removeNext();
return true;
}
i = &(v->nextListItem);
}
return false;
}
const Identifier NamedValueSet::getName (const int index) const
{
const NamedValue* const v = values[index];
jassert (v != 0);
return v->name;
}
const var NamedValueSet::getValueAt (const int index) const
{
const NamedValue* const v = values[index];
jassert (v != 0);
return v->value;
}
void NamedValueSet::setFromXmlAttributes (const XmlElement& xml)
{
LinkedListPointer<NamedValue>::Appender appender (values.getLast());
const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator..
for (int i = 0; i < numAtts; ++i)
set (xml.getAttributeName (i), var (xml.getAttributeValue (i)));
}
void NamedValueSet::copyToXmlAttributes (XmlElement& xml) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
{
jassert (! i->value.isObject()); // DynamicObjects can't be stored as XML!
xml.setAttribute (i->name.toString(),
i->value.toString());
}
}
END_JUCE_NAMESPACE
/*
==============================================================================

This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-10 by Raw Material Software Ltd.

------------------------------------------------------------------------------

JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.

JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

------------------------------------------------------------------------------

To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.

==============================================================================
*/

#include "../core/juce_StandardHeader.h"

BEGIN_JUCE_NAMESPACE

#include "juce_NamedValueSet.h"
#include "../text/juce_XmlElement.h"


//==============================================================================
NamedValueSet::NamedValue::NamedValue() throw()
{
}

inline NamedValueSet::NamedValue::NamedValue (const Identifier& name_, const var& value_)
: name (name_), value (value_)
{
}

bool NamedValueSet::NamedValue::operator== (const NamedValueSet::NamedValue& other) const throw()
{
return name == other.name && value == other.value;
}

//==============================================================================
NamedValueSet::NamedValueSet() throw()
{
}

NamedValueSet::NamedValueSet (const NamedValueSet& other)
{
values.addCopyOfList (other.values);
}

NamedValueSet& NamedValueSet::operator= (const NamedValueSet& other)
{
clear();
values.addCopyOfList (other.values);
return *this;
}

NamedValueSet::~NamedValueSet()
{
clear();
}

void NamedValueSet::clear()
{
values.deleteAll();
}

bool NamedValueSet::operator== (const NamedValueSet& other) const
{
const NamedValue* i1 = values;
const NamedValue* i2 = other.values;

while (i1 != 0 && i2 != 0)
{
if (! (*i1 == *i2))
return false;

i1 = i1->nextListItem;
i2 = i2->nextListItem;
}

return true;
}

bool NamedValueSet::operator!= (const NamedValueSet& other) const
{
return ! operator== (other);
}

int NamedValueSet::size() const throw()
{
return values.size();
}

const var& NamedValueSet::operator[] (const Identifier& name) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
if (i->name == name)
return i->value;

return var::null;
}

const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const
{
const var* v = getVarPointer (name);
return v != 0 ? *v : defaultReturnValue;
}

var* NamedValueSet::getVarPointer (const Identifier& name) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
if (i->name == name)
return &(i->value);

return 0;
}

bool NamedValueSet::set (const Identifier& name, const var& newValue)
{
LinkedListPointer<NamedValue>* i = &values;

while (i->get() != 0)
{
NamedValue* const v = i->get();

if (v->name == name)
{
if (v->value == newValue)
return false;

v->value = newValue;
return true;
}

i = &(v->nextListItem);
}

i->insertNext (new NamedValue (name, newValue));
return true;
}

bool NamedValueSet::contains (const Identifier& name) const
{
return getVarPointer (name) != 0;
}

bool NamedValueSet::remove (const Identifier& name)
{
LinkedListPointer<NamedValue>* i = &values;

for (;;)
{
NamedValue* const v = i->get();

if (v == 0)
break;

if (v->name == name)
{
delete i->removeNext();
return true;
}

i = &(v->nextListItem);
}

return false;
}

const Identifier NamedValueSet::getName (const int index) const
{
const NamedValue* const v = values[index];
jassert (v != 0);
return v->name;
}

const var NamedValueSet::getValueAt (const int index) const
{
const NamedValue* const v = values[index];
jassert (v != 0);
return v->value;
}

void NamedValueSet::setFromXmlAttributes (const XmlElement& xml)
{
clear();
LinkedListPointer<NamedValue>::Appender appender (values);

const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator..

for (int i = 0; i < numAtts; ++i)
appender.append (new NamedValue (xml.getAttributeName (i), var (xml.getAttributeValue (i))));
}

void NamedValueSet::copyToXmlAttributes (XmlElement& xml) const
{
for (NamedValue* i = values; i != 0; i = i->nextListItem)
{
jassert (! i->value.isObject()); // DynamicObjects can't be stored as XML!

xml.setAttribute (i->name.toString(),
i->value.toString());
}
}


END_JUCE_NAMESPACE

+ 3
- 2
src/gui/components/layout/juce_MarkerList.h View File

@@ -112,6 +112,7 @@ public:
public:
ValueTreeWrapper (const ValueTree& state);
ValueTree& getState() throw() { return state; }
int getNumMarkers() const;
const ValueTree getMarkerState (int index) const;
const ValueTree getMarkerState (const String& name) const;
@@ -123,10 +124,10 @@ public:
void applyTo (MarkerList& markerList);
void readFrom (const MarkerList& markerList, UndoManager* undoManager);
static const Identifier markerTag, nameProperty, posProperty;
private:
ValueTree state;
static const Identifier markerTag, nameProperty, posProperty;
};
private:


Loading…
Cancel
Save