1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00
This commit is contained in:
jules 2007-06-17 19:02:15 +00:00
parent 6264cdcc2b
commit 653a347dd2
8 changed files with 112 additions and 112 deletions

View file

@ -176,7 +176,7 @@ void Thread::sleep (int millisecs) throw()
}
//==============================================================================
CriticalSection::CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::CriticalSection() throw()
{
pthread_mutexattr_t atts;
pthread_mutexattr_init (&atts);
@ -184,22 +184,22 @@ CriticalSection::CriticalSection() throw()
pthread_mutex_init (&internal, &atts);
}
CriticalSection::~CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::~CriticalSection() throw()
{
pthread_mutex_destroy (&internal);
}
void CriticalSection::enter() const throw()
void JUCE_CALLTYPE CriticalSection::enter() const throw()
{
pthread_mutex_lock (&internal);
}
bool CriticalSection::tryEnter() const throw()
bool JUCE_CALLTYPE CriticalSection::tryEnter() const throw()
{
return pthread_mutex_trylock (&internal) == 0;
}
void CriticalSection::exit() const throw()
void JUCE_CALLTYPE CriticalSection::exit() const throw()
{
pthread_mutex_unlock (&internal);
}

View file

@ -47,7 +47,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
CriticalSection::CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::CriticalSection() throw()
{
pthread_mutexattr_t atts;
pthread_mutexattr_init (&atts);
@ -55,22 +55,22 @@ CriticalSection::CriticalSection() throw()
pthread_mutex_init (&internal, &atts);
}
CriticalSection::~CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::~CriticalSection() throw()
{
pthread_mutex_destroy (&internal);
}
void CriticalSection::enter() const throw()
void JUCE_CALLTYPE CriticalSection::enter() const throw()
{
pthread_mutex_lock (&internal);
}
bool CriticalSection::tryEnter() const throw()
bool JUCE_CALLTYPE CriticalSection::tryEnter() const throw()
{
return pthread_mutex_trylock (&internal) == 0;
}
void CriticalSection::exit() const throw()
void JUCE_CALLTYPE CriticalSection::exit() const throw()
{
pthread_mutex_unlock (&internal);
}

View file

@ -57,7 +57,7 @@ extern HWND juce_messageWindowHandle;
//==============================================================================
CriticalSection::CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::CriticalSection() throw()
{
// (just to check the MS haven't changed this structure and broken things...)
#if _MSC_VER >= 1400
@ -69,22 +69,22 @@ CriticalSection::CriticalSection() throw()
InitializeCriticalSection ((CRITICAL_SECTION*) internal);
}
CriticalSection::~CriticalSection() throw()
JUCE_CALLTYPE CriticalSection::~CriticalSection() throw()
{
DeleteCriticalSection ((CRITICAL_SECTION*) internal);
}
void CriticalSection::enter() const throw()
void JUCE_CALLTYPE CriticalSection::enter() const throw()
{
EnterCriticalSection ((CRITICAL_SECTION*) internal);
}
bool CriticalSection::tryEnter() const throw()
bool JUCE_CALLTYPE CriticalSection::tryEnter() const throw()
{
return TryEnterCriticalSection ((CRITICAL_SECTION*) internal) != FALSE;
}
void CriticalSection::exit() const throw()
void JUCE_CALLTYPE CriticalSection::exit() const throw()
{
LeaveCriticalSection ((CRITICAL_SECTION*) internal);
}

View file

@ -37,14 +37,14 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MemoryBlock::MemoryBlock() throw()
JUCE_CALLTYPE MemoryBlock::MemoryBlock() throw()
: data (0),
size (0)
{
}
MemoryBlock::MemoryBlock (const int initialSize,
const bool initialiseToZero) throw()
JUCE_CALLTYPE MemoryBlock::MemoryBlock (const int initialSize,
const bool initialiseToZero) throw()
{
if (initialSize > 0)
{
@ -62,7 +62,7 @@ MemoryBlock::MemoryBlock (const int initialSize,
}
}
MemoryBlock::MemoryBlock (const MemoryBlock& other) throw()
JUCE_CALLTYPE MemoryBlock::MemoryBlock (const MemoryBlock& other) throw()
: data (0),
size (other.size)
{
@ -74,8 +74,8 @@ MemoryBlock::MemoryBlock (const MemoryBlock& other) throw()
}
}
MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom,
const int sizeInBytes) throw()
JUCE_CALLTYPE MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom,
const int sizeInBytes) throw()
: data (0),
size (jmax (0, sizeInBytes))
{
@ -92,7 +92,7 @@ MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom,
}
}
MemoryBlock::~MemoryBlock() throw()
JUCE_CALLTYPE MemoryBlock::~MemoryBlock() throw()
{
jassert (size >= 0); // should never happen
jassert (size == 0 || data != 0); // non-zero size but no data allocated?
@ -100,7 +100,7 @@ MemoryBlock::~MemoryBlock() throw()
juce_free (data);
}
const MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw()
const MemoryBlock& JUCE_CALLTYPE MemoryBlock::operator= (const MemoryBlock& other) throw()
{
if (this != &other)
{
@ -112,21 +112,21 @@ const MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw()
}
//==============================================================================
bool MemoryBlock::operator== (const MemoryBlock& other) const throw()
bool JUCE_CALLTYPE MemoryBlock::operator== (const MemoryBlock& other) const throw()
{
return (size == other.size)
&& (memcmp (data, other.data, size) == 0);
}
bool MemoryBlock::operator!= (const MemoryBlock& other) const throw()
bool JUCE_CALLTYPE MemoryBlock::operator!= (const MemoryBlock& other) const throw()
{
return ! operator== (other);
}
//==============================================================================
// this will resize the block to this size
void MemoryBlock::setSize (const int newSize,
const bool initialiseToZero) throw()
void JUCE_CALLTYPE MemoryBlock::setSize (const int newSize,
const bool initialiseToZero) throw()
{
if (size != newSize)
{
@ -158,21 +158,21 @@ void MemoryBlock::setSize (const int newSize,
}
}
void MemoryBlock::ensureSize (const int minimumSize,
const bool initialiseToZero) throw()
void JUCE_CALLTYPE MemoryBlock::ensureSize (const int minimumSize,
const bool initialiseToZero) throw()
{
if (size < minimumSize)
setSize (minimumSize, initialiseToZero);
}
//==============================================================================
void MemoryBlock::fillWith (const uint8 value) throw()
void JUCE_CALLTYPE MemoryBlock::fillWith (const uint8 value) throw()
{
memset (data, (int) value, size);
}
void MemoryBlock::append (const void* const srcData,
const int numBytes) throw()
void JUCE_CALLTYPE MemoryBlock::append (const void* const srcData,
const int numBytes) throw()
{
if (numBytes > 0)
{
@ -182,7 +182,7 @@ void MemoryBlock::append (const void* const srcData,
}
}
void MemoryBlock::copyFrom (const void* const src, int offset, int num) throw()
void JUCE_CALLTYPE MemoryBlock::copyFrom (const void* const src, int offset, int num) throw()
{
const char* d = (const char*) src;
@ -200,7 +200,7 @@ void MemoryBlock::copyFrom (const void* const src, int offset, int num) throw()
memcpy (data + offset, d, num);
}
void MemoryBlock::copyTo (void* const dst, int offset, int num) const throw()
void JUCE_CALLTYPE MemoryBlock::copyTo (void* const dst, int offset, int num) const throw()
{
char* d = (char*) dst;
@ -224,7 +224,7 @@ void MemoryBlock::copyTo (void* const dst, int offset, int num) const throw()
memcpy (d, data + offset, num);
}
void MemoryBlock::removeSection (int startByte, int numBytesToRemove) throw()
void JUCE_CALLTYPE MemoryBlock::removeSection (int startByte, int numBytesToRemove) throw()
{
if (startByte < 0)
{
@ -246,13 +246,13 @@ void MemoryBlock::removeSection (int startByte, int numBytesToRemove) throw()
}
}
const String MemoryBlock::toString() const throw()
const String JUCE_CALLTYPE MemoryBlock::toString() const throw()
{
return String (data, size);
}
//==============================================================================
int MemoryBlock::getBitRange (const int bitRangeStart, int numBits) const throw()
int JUCE_CALLTYPE MemoryBlock::getBitRange (const int bitRangeStart, int numBits) const throw()
{
int res = 0;
@ -276,7 +276,7 @@ int MemoryBlock::getBitRange (const int bitRangeStart, int numBits) const throw(
return res;
}
void MemoryBlock::setBitRange (const int bitRangeStart, int numBits, int bitsToSet) throw()
void JUCE_CALLTYPE MemoryBlock::setBitRange (const int bitRangeStart, int numBits, int bitsToSet) throw()
{
int byte = bitRangeStart >> 3;
int offsetInByte = bitRangeStart & 7;
@ -300,7 +300,7 @@ void MemoryBlock::setBitRange (const int bitRangeStart, int numBits, int bitsToS
}
//==============================================================================
void MemoryBlock::loadFromHexString (const String& hex) throw()
void JUCE_CALLTYPE MemoryBlock::loadFromHexString (const String& hex) throw()
{
ensureSize (hex.length() >> 1);
char* dest = data;
@ -349,7 +349,7 @@ void MemoryBlock::loadFromHexString (const String& hex) throw()
static const char* const encodingTable
= ".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+";
const String MemoryBlock::toBase64Encoding() const throw()
const String JUCE_CALLTYPE MemoryBlock::toBase64Encoding() const throw()
{
const int numChars = ((size << 3) + 5) / 6;
@ -368,7 +368,7 @@ const String MemoryBlock::toBase64Encoding() const throw()
return destString;
}
bool MemoryBlock::fromBase64Encoding (const String& s) throw()
bool JUCE_CALLTYPE MemoryBlock::fromBase64Encoding (const String& s) throw()
{
const int startPos = s.indexOfChar (T('.')) + 1;

View file

@ -45,48 +45,48 @@ class JUCE_API MemoryBlock
public:
//==============================================================================
/** Create an uninitialised block with 0 size. */
MemoryBlock() throw();
JUCE_CALLTYPE MemoryBlock() throw();
/** Creates a memory block with a given initial size.
@param initialSize the size of block to create
@param initialiseToZero whether to clear the memory or just leave it uninitialised
*/
MemoryBlock (const int initialSize,
const bool initialiseToZero = false) throw();
JUCE_CALLTYPE MemoryBlock (const int initialSize,
const bool initialiseToZero = false) throw();
/** Creates a copy of another memory block. */
MemoryBlock (const MemoryBlock& other) throw();
JUCE_CALLTYPE MemoryBlock (const MemoryBlock& other) throw();
/** Creates a memory block using a copy of a block of data.
@param dataToInitialiseFrom some data to copy into this block
@param sizeInBytes how much space to use
*/
MemoryBlock (const void* const dataToInitialiseFrom,
const int sizeInBytes) throw();
JUCE_CALLTYPE MemoryBlock (const void* const dataToInitialiseFrom,
const int sizeInBytes) throw();
/** Destructor. */
~MemoryBlock() throw();
JUCE_CALLTYPE ~MemoryBlock() throw();
/** Copies another memory block onto this one.
This block will be resized and copied to exactly match the other one.
*/
const MemoryBlock& operator= (const MemoryBlock& other) throw();
const MemoryBlock& JUCE_CALLTYPE operator= (const MemoryBlock& other) throw();
//==============================================================================
/** Compares two memory blocks.
@returns true only if the two blocks are the same size and have identical contents.
*/
bool operator== (const MemoryBlock& other) const throw();
bool JUCE_CALLTYPE operator== (const MemoryBlock& other) const throw();
/** Compares two memory blocks.
@returns true if the two blocks are different sizes or have different contents.
*/
bool operator!= (const MemoryBlock& other) const throw();
bool JUCE_CALLTYPE operator!= (const MemoryBlock& other) const throw();
//==============================================================================
/** Returns a pointer to the data, casting it to any type of primitive data required.
@ -95,25 +95,25 @@ public:
block is resized.
*/
template <class DataType>
operator DataType*() const throw() { return (DataType*) data; }
JUCE_CALLTYPE operator DataType*() const throw() { return (DataType*) data; }
/** Returns a void pointer to the data.
Note that the pointer returned will probably become invalid when the
block is resized.
*/
void* getData() const throw() { return data; }
void* JUCE_CALLTYPE getData() const throw() { return data; }
/** Returns a byte from the memory block.
This returns a reference, so you can also use it to set a byte.
*/
char& operator[] (const int offset) const throw() { return data [offset]; }
char& JUCE_CALLTYPE operator[] (const int offset) const throw() { return data [offset]; }
//==============================================================================
/** Returns the block's current allocated size, in bytes. */
int getSize() const throw() { return size; }
int JUCE_CALLTYPE getSize() const throw() { return size; }
/** Resizes the memory block.
@ -127,8 +127,8 @@ public:
uninitialised
@see ensureSize
*/
void setSize (const int newSize,
const bool initialiseNewSpaceToZero = false) throw();
void JUCE_CALLTYPE setSize (const int newSize,
const bool initialiseNewSpaceToZero = false) throw();
/** Increases the block's size only if it's smaller than a given size.
@ -139,22 +139,22 @@ public:
uninitialised
@see setSize
*/
void ensureSize (const int minimumSize,
const bool initialiseNewSpaceToZero = false) throw();
void JUCE_CALLTYPE ensureSize (const int minimumSize,
const bool initialiseNewSpaceToZero = false) throw();
//==============================================================================
/** Fills the entire memory block with a repeated byte value.
This is handy for clearing a block of memory to zero.
*/
void fillWith (const uint8 valueToUse) throw();
void JUCE_CALLTYPE fillWith (const uint8 valueToUse) throw();
/** Adds another block of data to the end of this one.
This block's size will be increased accordingly.
*/
void append (const void* const data,
const int numBytes) throw();
void JUCE_CALLTYPE append (const void* const data,
const int numBytes) throw();
//==============================================================================
/** Copies data into this MemoryBlock from a memory address.
@ -164,9 +164,9 @@ public:
@param numBytes how much to copy in (if this goes beyond the size of the memory block,
it will be clipped so not to do anything nasty)
*/
void copyFrom (const void* srcData,
int destinationOffset,
int numBytes) throw();
void JUCE_CALLTYPE copyFrom (const void* srcData,
int destinationOffset,
int numBytes) throw();
/** Copies data from this MemoryBlock to a memory address.
@ -175,9 +175,9 @@ public:
@param numBytes how much to copy (if this extends beyond the limits of the memory block,
zeros will be used for that portion of the data)
*/
void copyTo (void* destData,
int sourceOffset,
int numBytes) const throw();
void JUCE_CALLTYPE copyTo (void* destData,
int sourceOffset,
int numBytes) const throw();
/** Chops out a section of the block.
@ -186,12 +186,12 @@ public:
If the range specified goes beyond the size of the block, it will be clipped.
*/
void removeSection (int startByte, int numBytesToRemove) throw();
void JUCE_CALLTYPE removeSection (int startByte, int numBytesToRemove) throw();
//==============================================================================
/** Attempts to parse the contents of the block as a zero-terminated string of 8-bit
characters in the system's default encoding. */
const String toString() const throw();
const String JUCE_CALLTYPE toString() const throw();
//==============================================================================
/** Parses a string of hexadecimal numbers and writes this data into the memory block.
@ -201,17 +201,17 @@ public:
@see String::toHexString()
*/
void loadFromHexString (const String& sourceHexString) throw();
void JUCE_CALLTYPE loadFromHexString (const String& sourceHexString) throw();
//==============================================================================
/** Sets a number of bits in the memory block, treating it as a long binary sequence. */
void setBitRange (int bitRangeStart,
int numBits,
int binaryNumberToApply) throw();
void JUCE_CALLTYPE setBitRange (int bitRangeStart,
int numBits,
int binaryNumberToApply) throw();
/** Reads a number of bits from the memory block, treating it as one long binary sequence */
int getBitRange (int bitRangeStart,
int numBitsToRead) const throw();
int JUCE_CALLTYPE getBitRange (int bitRangeStart,
int numBitsToRead) const throw();
//==============================================================================
/** Returns a string of characters that represent the binary contents of this block.
@ -221,7 +221,7 @@ public:
@see fromBase64Encoding
*/
const String toBase64Encoding() const throw();
const String JUCE_CALLTYPE toBase64Encoding() const throw();
/** Takes a string of encoded characters and turns it into binary data.
@ -230,7 +230,7 @@ public:
@see toBase64Encoding
*/
bool fromBase64Encoding (const String& encodedString) throw();
bool JUCE_CALLTYPE fromBase64Encoding (const String& encodedString) throw();
//==============================================================================

View file

@ -53,24 +53,24 @@ class SparseSet
public:
//==============================================================================
/** Creates a new empty set. */
SparseSet() throw()
JUCE_CALLTYPE SparseSet() throw()
{
}
/** Creates a copy of another SparseSet. */
SparseSet (const SparseSet<Type>& other) throw()
JUCE_CALLTYPE SparseSet (const SparseSet<Type>& other) throw()
: values (other.values)
{
}
/** Destructor. */
~SparseSet() throw()
JUCE_CALLTYPE ~SparseSet() throw()
{
}
//==============================================================================
/** Clears the set. */
void clear() throw()
void JUCE_CALLTYPE clear() throw()
{
values.clear();
}
@ -79,7 +79,7 @@ public:
This is much quicker than using (size() == 0).
*/
bool isEmpty() const throw()
bool JUCE_CALLTYPE isEmpty() const throw()
{
return values.size() == 0;
}
@ -90,7 +90,7 @@ public:
are a lot of items in the set. Use isEmpty() for a quick test of whether there
are any items.
*/
Type size() const throw()
Type JUCE_CALLTYPE size() const throw()
{
Type num = 0;
@ -105,7 +105,7 @@ public:
@param index the index of the value to retrieve, in the range 0 to (size() - 1).
@returns the value at this index, or 0 if it's out-of-range
*/
Type operator[] (int index) const throw()
Type JUCE_CALLTYPE operator[] (int index) const throw()
{
for (int i = 0; i < values.size(); i += 2)
{
@ -122,7 +122,7 @@ public:
}
/** Checks whether a particular value is in the set. */
bool contains (const Type valueToLookFor) const throw()
bool JUCE_CALLTYPE contains (const Type valueToLookFor) const throw()
{
bool on = false;
@ -142,7 +142,7 @@ public:
@see getRange
*/
int getNumRanges() const throw()
int JUCE_CALLTYPE getNumRanges() const throw()
{
return values.size() >> 1;
}
@ -156,9 +156,9 @@ public:
@see getTotalRange
*/
bool getRange (const int rangeIndex,
Type& startValue,
Type& numValues) const throw()
bool JUCE_CALLTYPE getRange (const int rangeIndex,
Type& startValue,
Type& numValues) const throw()
{
if (rangeIndex >= 0 && rangeIndex < getNumRanges())
{
@ -175,8 +175,8 @@ public:
@see getRange
*/
bool getTotalRange (Type& lowestValue,
Type& highestValue) const throw()
bool JUCE_CALLTYPE getTotalRange (Type& lowestValue,
Type& highestValue) const throw()
{
if (values.size() > 0)
{
@ -196,8 +196,8 @@ public:
@param firstValue the start of the range of values to add
@param numValuesToAdd how many values to add
*/
void addRange (const Type firstValue,
const Type numValuesToAdd) throw()
void JUCE_CALLTYPE addRange (const Type firstValue,
const Type numValuesToAdd) throw()
{
jassert (numValuesToAdd >= 0);
@ -220,8 +220,8 @@ public:
@param firstValue the start of the range of values to remove
@param numValuesToRemove how many values to remove
*/
void removeRange (const Type firstValue,
const Type numValuesToRemove) throw()
void JUCE_CALLTYPE removeRange (const Type firstValue,
const Type numValuesToRemove) throw()
{
jassert (numValuesToRemove >= 0);
@ -258,8 +258,8 @@ public:
}
/** Does an XOR of the values in a given range. */
void invertRange (const Type firstValue,
const Type numValues)
void JUCE_CALLTYPE invertRange (const Type firstValue,
const Type numValues)
{
SparseSet newItems;
newItems.addRange (firstValue, numValues);
@ -285,8 +285,8 @@ public:
}
/** Checks whether any part of a given range overlaps any part of this one. */
bool overlapsRange (const Type firstValue,
const Type numValues) throw()
bool JUCE_CALLTYPE overlapsRange (const Type firstValue,
const Type numValues) throw()
{
jassert (numValues >= 0);
@ -306,8 +306,8 @@ public:
}
/** Checks whether the whole of a given range is contained within this one. */
bool containsRange (const Type firstValue,
const Type numValues) throw()
bool JUCE_CALLTYPE containsRange (const Type firstValue,
const Type numValues) throw()
{
jassert (numValues >= 0);
@ -328,12 +328,12 @@ public:
}
//==============================================================================
bool operator== (const SparseSet<Type>& other) throw()
bool JUCE_CALLTYPE operator== (const SparseSet<Type>& other) throw()
{
return values == other.values;
}
bool operator!= (const SparseSet<Type>& other) throw()
bool JUCE_CALLTYPE operator!= (const SparseSet<Type>& other) throw()
{
return values != other.values;
}
@ -345,7 +345,7 @@ private:
// alternating start/end values of ranges of values that are present.
Array<Type> values;
void simplify() throw()
void JUCE_CALLTYPE simplify() throw()
{
jassert ((values.size() & 1) == 0);

View file

@ -46,14 +46,14 @@ public:
/**
Creates a CriticalSection object
*/
CriticalSection() throw();
JUCE_CALLTYPE CriticalSection() throw();
/** Destroys a CriticalSection object.
If the critical section is deleted whilst locked, its subsequent behaviour
is unpredictable.
*/
~CriticalSection() throw();
JUCE_CALLTYPE ~CriticalSection() throw();
//==============================================================================
/** Locks this critical section.
@ -65,7 +65,7 @@ public:
@see exit, ScopedLock
*/
void enter() const throw();
void JUCE_CALLTYPE enter() const throw();
/** Attempts to lock this critical section without blocking.
@ -75,7 +75,7 @@ public:
@returns false if the lock is currently held by another thread, true otherwise.
@see enter
*/
bool tryEnter() const throw();
bool JUCE_CALLTYPE tryEnter() const throw();
/** Releases the lock.
@ -87,7 +87,7 @@ public:
@see enter, ScopedLock
*/
void exit() const throw();
void JUCE_CALLTYPE exit() const throw();
//==============================================================================

View file

@ -72,7 +72,7 @@ public:
otherwise there are no guarantees what will happen! Best just to use it
as a local stack object, rather than creating one with the new() operator.
*/
inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
inline JUCE_CALLTYPE ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
/** Destructor.
@ -81,7 +81,7 @@ public:
Make sure this object is created and deleted by the same thread,
otherwise there are no guarantees what will happen!
*/
inline ~ScopedReadLock() throw() { lock_.exitRead(); }
inline JUCE_CALLTYPE ~ScopedReadLock() throw() { lock_.exitRead(); }
private: