Browse Source

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

tags/2021-05-28
Julian Storer 13 years ago
parent
commit
d55b7419ec
14 changed files with 83 additions and 43 deletions
  1. +4
    -4
      extras/Introjucer/Source/Application/jucer_Application.h
  2. +1
    -1
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
  3. +1
    -1
      modules/juce_audio_formats/format/juce_AudioFormatReader.h
  4. +2
    -8
      modules/juce_core/containers/juce_Array.h
  5. +6
    -0
      modules/juce_core/containers/juce_LinkedListPointer.h
  6. +1
    -3
      modules/juce_core/containers/juce_NamedValueSet.cpp
  7. +1
    -8
      modules/juce_core/containers/juce_Variant.cpp
  8. +1
    -1
      modules/juce_core/maths/juce_BigInteger.cpp
  9. +21
    -10
      modules/juce_core/system/juce_PlatformDefs.h
  10. +13
    -0
      modules/juce_graphics/geometry/juce_RectangleList.cpp
  11. +5
    -0
      modules/juce_graphics/geometry/juce_RectangleList.h
  12. +5
    -1
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  13. +17
    -6
      modules/juce_gui_basics/positioning/juce_RelativeCoordinate.cpp
  14. +5
    -0
      modules/juce_gui_basics/positioning/juce_RelativeCoordinate.h

+ 4
- 4
extras/Introjucer/Source/Application/jucer_Application.h View File

@@ -80,16 +80,16 @@ public:
if (mainWindows.size() == 0) if (mainWindows.size() == 0)
createNewMainWindow()->makeVisible(); createNewMainWindow()->makeVisible();
#if JUCE_MAC
#if JUCE_MAC
MenuBarModel::setMacMainMenu (menuModel); MenuBarModel::setMacMainMenu (menuModel);
#endif
#endif
} }
void shutdown() void shutdown()
{ {
#if JUCE_MAC
#if JUCE_MAC
MenuBarModel::setMacMainMenu (nullptr); MenuBarModel::setMacMainMenu (nullptr);
#endif
#endif
menuModel = nullptr; menuModel = nullptr;
StoredSettings::deleteInstance(); StoredSettings::deleteInstance();


+ 1
- 1
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp View File

@@ -232,7 +232,7 @@ private:
public: public:
MissingDependenciesComponent (Project& project_, ModuleList& moduleList_, const String& moduleID_) MissingDependenciesComponent (Project& project_, ModuleList& moduleList_, const String& moduleID_)
: PropertyComponent ("Dependencies", 100), : PropertyComponent ("Dependencies", 100),
project (project_), moduleList (moduleList), moduleID (moduleID_),
project (project_), moduleList (moduleList_), moduleID (moduleID_),
fixButton ("Enable Required Modules") fixButton ("Enable Required Modules")
{ {
const ModuleList::Module* module = moduleList.findModuleInfo (moduleID); const ModuleList::Module* module = moduleList.findModuleInfo (moduleID);


+ 1
- 1
modules/juce_audio_formats/format/juce_AudioFormatReader.h View File

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


+ 2
- 8
modules/juce_core/containers/juce_Array.h View File

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


+ 6
- 0
modules/juce_core/containers/juce_LinkedListPointer.h View File

@@ -322,6 +322,12 @@ public:
*destArray++ = i; *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. Allows efficient repeated insertions into a list.


+ 1
- 3
modules/juce_core/containers/juce_NamedValueSet.cpp View File

@@ -94,9 +94,7 @@ NamedValueSet::NamedValueSet (NamedValueSet&& other) noexcept
NamedValueSet& NamedValueSet::operator= (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; return *this;
} }
#endif #endif


+ 1
- 8
modules/juce_core/containers/juce_Variant.cpp View File

@@ -421,14 +421,7 @@ var::var (var&& other) noexcept
var& var::operator= (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; return *this;
} }
#endif #endif


+ 1
- 1
modules/juce_core/maths/juce_BigInteger.cpp View File

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


+ 21
- 10
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -270,16 +270,21 @@
#endif #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)) #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 #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif #endif
#if defined (__clang__) && defined (__has_feature) #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 #endif
#if __has_feature (cxx_rvalue_references) #if __has_feature (cxx_rvalue_references)
@@ -288,13 +293,19 @@
#endif #endif
#if defined (_MSC_VER) && _MSC_VER >= 1600 #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
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT)
#define noexcept throw()
#endif #endif
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_CXX2011)
#define noexcept throw() // for c++98 compilers, we can fake these newer language features.
#define nullptr (0)
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NULLPTR)
#define nullptr (0)
#endif #endif
#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__ #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__

+ 13
- 0
modules/juce_graphics/geometry/juce_RectangleList.cpp View File

@@ -47,6 +47,19 @@ RectangleList& RectangleList::operator= (const RectangleList& other)
return *this; 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() RectangleList::~RectangleList()
{ {
} }


+ 5
- 0
modules/juce_graphics/geometry/juce_RectangleList.h View File

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


+ 5
- 1
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -1749,7 +1749,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
{ {
[NSApp setPresentationOptions: NSApplicationPresentationDefault]; [NSApp setPresentationOptions: NSApplicationPresentationDefault];
} }
#else
#elif JUCE_SUPPORT_CARBON
if (enableOrDisable) if (enableOrDisable)
{ {
SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0); SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
@@ -1759,6 +1759,10 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
{ {
SetSystemUIMode (kUIModeNormal, 0); 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 #endif
} }


+ 17
- 6
modules/juce_gui_basics/positioning/juce_RelativeCoordinate.cpp View File

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

+ 5
- 0
modules/juce_gui_basics/positioning/juce_RelativeCoordinate.h View File

@@ -43,6 +43,11 @@ public:
RelativeCoordinate (const RelativeCoordinate& other); RelativeCoordinate (const RelativeCoordinate& other);
RelativeCoordinate& operator= (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. /** Creates an absolute position from the parent origin on either the X or Y axis.
@param absoluteDistanceFromOrigin the distance from the origin @param absoluteDistanceFromOrigin the distance from the origin


Loading…
Cancel
Save