1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a typo in the introjucer. C++0x fixes.

This commit is contained in:
Julian Storer 2011-08-22 16:40:37 +01:00
parent ffc2f5d40e
commit d55b7419ec
14 changed files with 83 additions and 43 deletions

View file

@ -118,7 +118,7 @@ public:
and the buffer.
*/
void read (AudioSampleBuffer* buffer,
int startSample,
int startSampleInDestBuffer,
int numSamples,
int64 readerStartSample,
bool useReaderLeftChan,

View file

@ -88,6 +88,7 @@ public:
: data (static_cast <ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data)),
numUsed (other.numUsed)
{
other.numUsed = 0;
}
#endif
@ -141,14 +142,7 @@ public:
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
Array& operator= (Array&& other) noexcept
{
if (this != &other)
{
deleteAllElements();
data = static_cast <ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data);
numUsed = other.numUsed;
}
swapWithArray (other);
return *this;
}
#endif

View file

@ -322,6 +322,12 @@ public:
*destArray++ = i;
}
/** Swaps this pointer with another one */
void swapWith (LinkedListPointer& other) noexcept
{
std::swap (item, other.item);
}
//==============================================================================
/**
Allows efficient repeated insertions into a list.

View file

@ -94,9 +94,7 @@ NamedValueSet::NamedValueSet (NamedValueSet&& other) noexcept
NamedValueSet& NamedValueSet::operator= (NamedValueSet&& other) noexcept
{
if (this != &other)
values = static_cast <LinkedListPointer<NamedValue>&&> (other.values);
other.values.swapWith (values);
return *this;
}
#endif

View file

@ -421,14 +421,7 @@ var::var (var&& other) noexcept
var& var::operator= (var&& other) noexcept
{
if (this != &other)
{
type->cleanUp (value);
type = other.type;
value = other.value;
other.type = &VariantType_Void::instance;
}
swapWith (other);
return *this;
}
#endif

View file

@ -577,7 +577,7 @@ BigInteger& BigInteger::operator&= (const BigInteger& other)
int n = (int) numValues;
while (n > other.numValues)
while (n > (int) other.numValues)
values[--n] = 0;
while (--n >= 0)

View file

@ -270,16 +270,21 @@
#endif
//==============================================================================
// Here, we'll check for C++2011 compiler support, and if it's not available, define
// a few workarounds, so that we can still use a few of the newer language features.
// Here, we'll check for C++11 compiler support, and if it's not available, define
// a few workarounds, so that we can still use some of the newer language features.
#if defined (__GXX_EXPERIMENTAL_CXX0X__) && defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#define JUCE_COMPILER_SUPPORTS_CXX2011 1
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if defined (__clang__) && defined (__has_feature)
#if __has_feature (cxx_noexcept) // (NB: do not add this test to the previous line)
#define JUCE_COMPILER_SUPPORTS_CXX2011 1
#if __has_feature (cxx_nullptr)
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#endif
#if __has_feature (cxx_noexcept)
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#endif
#if __has_feature (cxx_rvalue_references)
@ -288,13 +293,19 @@
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1600
//#define JUCE_COMPILER_SUPPORTS_CXX2011 1
//#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 0
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_CXX2011)
#define noexcept throw() // for c++98 compilers, we can fake these newer language features.
#define nullptr (0)
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT)
#define noexcept throw()
#endif
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NULLPTR)
#define nullptr (0)
#endif
#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__

View file

@ -47,6 +47,19 @@ RectangleList& RectangleList::operator= (const RectangleList& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
RectangleList::RectangleList (RectangleList&& other) noexcept
: rects (static_cast <Array <Rectangle<int> >&&> (other.rects))
{
}
RectangleList& RectangleList::operator= (RectangleList&& other) noexcept
{
rects = static_cast <Array <Rectangle<int> >&&> (other.rects);
return *this;
}
#endif
RectangleList::~RectangleList()
{
}

View file

@ -56,6 +56,11 @@ public:
/** Copies this list from another one. */
RectangleList& operator= (const RectangleList& other);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
RectangleList (RectangleList&& other) noexcept;
RectangleList& operator= (RectangleList&& other) noexcept;
#endif
/** Destructor. */
~RectangleList();

View file

@ -1749,7 +1749,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
{
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
}
#else
#elif JUCE_SUPPORT_CARBON
if (enableOrDisable)
{
SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
@ -1759,6 +1759,10 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
{
SetSystemUIMode (kUIModeNormal, 0);
}
#else
// If you're targeting OSes earlier than 10.6 and want to use this feature,
// you'll need to enable JUCE_SUPPORT_CARBON.
jassertfalse;
#endif
}

View file

@ -71,6 +71,19 @@ RelativeCoordinate& RelativeCoordinate::operator= (const RelativeCoordinate& oth
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
RelativeCoordinate::RelativeCoordinate (RelativeCoordinate&& other) noexcept
: term (static_cast <Expression&&> (other.term))
{
}
RelativeCoordinate& RelativeCoordinate::operator= (RelativeCoordinate&& other) noexcept
{
term = static_cast <Expression&&> (other.term);
return *this;
}
#endif
RelativeCoordinate::RelativeCoordinate (const double absoluteDistanceFromOrigin)
: term (absoluteDistanceFromOrigin)
{
@ -82,7 +95,7 @@ RelativeCoordinate::RelativeCoordinate (const String& s)
{
term = Expression (s);
}
catch (...)
catch (Expression::ParseError&)
{}
}
@ -109,7 +122,7 @@ double RelativeCoordinate::resolve (const Expression::Scope* scope) const
else
return term.evaluate();
}
catch (...)
catch (Expression::ParseError&)
{}
return 0.0;
@ -124,7 +137,7 @@ bool RelativeCoordinate::isRecursive (const Expression::Scope* scope) const
else
term.evaluate();
}
catch (...)
catch (Expression::ParseError&)
{
return true;
}
@ -146,7 +159,7 @@ void RelativeCoordinate::moveToAbsolute (double newPos, const Expression::Scope*
term = term.adjustedToGiveNewResult (newPos, defaultScope);
}
}
catch (...)
catch (Expression::ParseError&)
{}
}
@ -160,6 +173,4 @@ String RelativeCoordinate::toString() const
return term.toString();
}
END_JUCE_NAMESPACE

View file

@ -43,6 +43,11 @@ public:
RelativeCoordinate (const RelativeCoordinate& other);
RelativeCoordinate& operator= (const RelativeCoordinate& other);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
RelativeCoordinate (RelativeCoordinate&& other) noexcept;
RelativeCoordinate& operator= (RelativeCoordinate&& other) noexcept;
#endif
/** Creates an absolute position from the parent origin on either the X or Y axis.
@param absoluteDistanceFromOrigin the distance from the origin