LMMS
Loading...
Searching...
No Matches
water Namespace Reference

Namespaces

namespace  MidiBufferHelpers
namespace  MidiFileHelpers
namespace  MidiHelpers
namespace  TimeHelpers
namespace  Time
namespace  GraphRenderingOps
namespace  NumberToStringConverters
namespace  StringHelpers
namespace  TypeHelpers
namespace  XmlIdentifierChars
namespace  XmlOutputFunctions

Classes

class  ChildProcess
class  AudioSampleBuffer
class  Array
class  ArrayAllocationBase
struct  SortFunctionConverter
class  DefaultElementComparator
struct  DefaultHashFunctions
class  HashMap
class  LinkedListPointer
class  OwnedArray
class  ReferenceCountedArray
class  SortedSet
class  DirectoryIterator
class  File
class  FileInputStream
class  FileOutputStream
class  TemporaryFile
class  Random
class  Atomic
class  ByteOrder
class  HeapBlock
class  MemoryBlock
class  ReferenceCountedObject
class  SingleThreadedReferenceCountedObject
class  ReferenceCountedObjectPtr
class  SharedResourcePointer
class  MidiBuffer
class  MidiFile
class  MidiMessage
struct  MidiMessageSequenceSorter
class  MidiMessageSequence
class  Result
class  AudioProcessor
class  AudioProcessorGraph
class  FileInputSource
class  InputStream
class  MemoryInputStream
class  MemoryOutputStream
class  OutputStream
struct  VoiceAgeSorter
class  SynthesiserSound
class  SynthesiserVoice
class  Synthesiser
class  CharacterFunctions
class  CharPointer_UTF8
class  Identifier
class  NewLine
struct  EmptyString
class  StringHolder
struct  HashGenerator
struct  WildCardMatcher
class  StringCreationHelper
struct  StringEncodingConverter
struct  StringEncodingConverter< CharPointer_UTF8, CharPointer_UTF8 >
struct  StringCopier
class  String
struct  StartEndString
struct  InternalStringArrayComparator_CaseSensitive
struct  InternalStringArrayComparator_CaseInsensitive
struct  InternalStringArrayComparator_Natural
class  StringArray
class  StringRef
class  GenericScopedLock
class  GenericScopedUnlock
class  GenericScopedTryLock
class  SpinLock
class  XmlDocument
class  XmlElement

Typedefs

typedef uint32 water_uchar
typedef signed char int8
typedef unsigned char uint8
typedef signed short int16
typedef unsigned short uint16
typedef signed int int32
typedef unsigned int uint32
typedef long long int64
typedef unsigned long long uint64
typedef int pointer_sized_int
typedef unsigned int pointer_sized_uint

Functions

template<class ElementType, class ElementComparator>
static void sortArray (ElementComparator &comparator, ElementType *const array, int firstElement, int lastElement, const bool retainOrderOfEquivalentItems)
template<class ElementType, class ElementComparator>
static int findInsertIndexInSortedArray (ElementComparator &comparator, ElementType *const array, const ElementType newElement, int firstElement, int lastElement)
static String removeEllipsis (const String &path)
static int compareFilenames (const String &name1, const String &name2) noexcept
static int countNumberOfSeparators (CharPointer_UTF8 s)
File water_getExecutableFile ()
static String getLinkedFile (const String &file)
static int64 water_fileSetPosition (void *handle, int64 pos)
static File createTempFile (const File &parentDirectory, String name, const String &suffix, const int optionFlags)
template<typename Type>
Type jmax (const Type a, const Type b)
template<typename Type>
Type jmax (const Type a, const Type b, const Type c)
template<typename Type>
Type jmax (const Type a, const Type b, const Type c, const Type d)
template<typename Type>
Type jmin (const Type a, const Type b)
template<typename Type>
Type jmin (const Type a, const Type b, const Type c)
template<typename Type>
Type jmin (const Type a, const Type b, const Type c, const Type d)
template<typename Type>
Type jmap (Type value0To1, Type targetRangeMin, Type targetRangeMax)
template<typename Type>
Type jmap (Type sourceValue, Type sourceRangeMin, Type sourceRangeMax, Type targetRangeMin, Type targetRangeMax)
template<typename Type>
Type findMinimum (const Type *data, int numValues)
template<typename Type>
Type findMaximum (const Type *values, int numValues)
template<typename Type>
void findMinAndMax (const Type *values, int numValues, Type &lowest, Type &highest)
template<typename Type>
Type jlimit (const Type lowerLimit, const Type upperLimit, const Type valueToConstrain) noexcept
template<typename Type>
bool isPositiveAndBelow (Type valueToTest, Type upperLimit) noexcept
template<>
bool isPositiveAndBelow (const int valueToTest, const int upperLimit) noexcept
template<typename Type>
bool isPositiveAndNotGreaterThan (Type valueToTest, Type upperLimit) noexcept
template<>
bool isPositiveAndNotGreaterThan (const int valueToTest, const int upperLimit) noexcept
template<typename Type>
void swapVariables (Type &variable1, Type &variable2)
template<typename Type1>
void ignoreUnused (const Type1 &) noexcept
template<typename Type1, typename Type2>
void ignoreUnused (const Type1 &, const Type2 &) noexcept
template<typename Type1, typename Type2, typename Type3>
void ignoreUnused (const Type1 &, const Type2 &, const Type3 &) noexcept
template<typename Type1, typename Type2, typename Type3, typename Type4>
void ignoreUnused (const Type1 &, const Type2 &, const Type3 &, const Type4 &) noexcept
template<typename Type, size_t N>
size_t numElementsInArray (Type(&array)[N])
template<typename Type>
Type water_hypot (Type a, Type b) noexcept
template<>
float water_hypot (float a, float b) noexcept
int64 abs64 (const int64 n) noexcept
float degreesToRadians (float degrees) noexcept
double degreesToRadians (double degrees) noexcept
float radiansToDegrees (float radians) noexcept
double radiansToDegrees (double radians) noexcept
template<typename NumericType>
bool water_isfinite (NumericType) noexcept
template<>
bool water_isfinite (float value) noexcept
template<>
bool water_isfinite (double value) noexcept
template<typename FloatType>
int roundToInt (const FloatType value) noexcept
int roundToInt (int value) noexcept
int roundToIntAccurate (double value) noexcept
int roundDoubleToInt (double value) noexcept
int roundFloatToInt (float value) noexcept
template<typename IntegerType>
bool isPowerOfTwo (IntegerType value)
int nextPowerOfTwo (int n) noexcept
int findHighestSetBit (uint32 n) noexcept
int countNumberOfBits (uint32 n) noexcept
int countNumberOfBits (uint64 n) noexcept
template<typename IntegerType>
IntegerType negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept
template<typename NumericType>
NumericType square (NumericType n) noexcept
void writeLittleEndianBitsInBuffer (void *targetBuffer, uint32 startBit, uint32 numBits, uint32 value) noexcept
uint32 readLittleEndianBitsInBuffer (const void *sourceBuffer, uint32 startBit, uint32 numBits) noexcept
void zeromem (void *memory, size_t numBytes) noexcept
template<typename Type>
void zerostruct (Type &structure) noexcept
template<typename Type>
void deleteAndZero (Type &pointer)
template<typename Type, typename IntegerType>
Type * addBytesToPointer (Type *basePointer, IntegerType bytes) noexcept
template<typename Type1, typename Type2>
int getAddressDifference (Type1 *pointer1, Type2 *pointer2) noexcept
template<class Type>
Type * createCopyIfNotNull (const Type *objectToCopy)
template<typename Type>
Type readUnaligned (const void *srcPtr) noexcept
template<typename Type>
void writeUnaligned (void *dstPtr, Type value) noexcept
template<typename ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object1, ReferenceCountedObjectClass *const object2) noexcept
template<typename ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object1, const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object2) noexcept
template<typename ReferenceCountedObjectClass>
bool operator== (ReferenceCountedObjectClass *object1, const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object2) noexcept
template<typename ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object1, const ReferenceCountedObjectClass *object2) noexcept
template<typename ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object1, const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object2) noexcept
template<typename ReferenceCountedObjectClass>
bool operator!= (ReferenceCountedObjectClass *object1, const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > &object2) noexcept
static uint32 water_millisecondsSinceStartup () noexcept
static void deleteRenderOpArray (Array< void * > &ops)
OutputStreamoperator<< (OutputStream &stream, const MemoryOutputStream &streamToRead)
template<typename IntegerType>
static void writeIntToStream (OutputStream &stream, IntegerType number)
OutputStreamoperator<< (OutputStream &stream, const int number)
OutputStreamoperator<< (OutputStream &stream, const int64 number)
OutputStreamoperator<< (OutputStream &stream, const double number)
OutputStreamoperator<< (OutputStream &stream, const char character)
OutputStreamoperator<< (OutputStream &stream, const char *const text)
OutputStreamoperator<< (OutputStream &stream, const MemoryBlock &data)
OutputStreamoperator<< (OutputStream &stream, const File &fileToRead)
OutputStreamoperator<< (OutputStream &stream, InputStream &streamToRead)
OutputStreamoperator<< (OutputStream &stream, const NewLine &)
Stringoperator<< (String &string1, const NewLine &)
Stringoperator+= (String &s1, const NewLine &)
String operator+ (const NewLine &, const NewLine &)
String operator+ (String s1, const NewLine &)
String operator+ (const NewLine &, const char *s2)
static size_t findByteOffsetOfEnd (CharPointer_UTF8 text) noexcept
bool operator== (const String &s1, const String &s2) noexcept
bool operator!= (const String &s1, const String &s2) noexcept
bool operator== (const String &s1, const char *s2) noexcept
bool operator!= (const String &s1, const char *s2) noexcept
bool operator== (const String &s1, StringRef s2) noexcept
bool operator!= (const String &s1, StringRef s2) noexcept
bool operator== (const String &s1, const CharPointer_UTF8 s2) noexcept
bool operator!= (const String &s1, const CharPointer_UTF8 s2) noexcept
bool operator> (const String &s1, const String &s2) noexcept
bool operator< (const String &s1, const String &s2) noexcept
bool operator>= (const String &s1, const String &s2) noexcept
bool operator<= (const String &s1, const String &s2) noexcept
static int stringCompareRight (CharPointer_UTF8 s1, CharPointer_UTF8 s2) noexcept
static int stringCompareLeft (CharPointer_UTF8 s1, CharPointer_UTF8 s2) noexcept
static int naturalStringCompare (CharPointer_UTF8 s1, CharPointer_UTF8 s2, bool isCaseSensitive) noexcept
String operator+ (const char *const s1, const String &s2)
String operator+ (const char s1, const String &s2)
String operator+ (String s1, const String &s2)
String operator+ (String s1, const char *const s2)
String operator+ (String s1, const char s2)
String operator+ (const water_uchar s1, const String &s2)
String operator+ (String s1, const water_uchar s2)
Stringoperator<< (String &s1, const water_uchar s2)
Stringoperator<< (String &s1, const char s2)
Stringoperator<< (String &s1, const char *const s2)
Stringoperator<< (String &s1, const String &s2)
Stringoperator<< (String &s1, StringRef s2)
Stringoperator<< (String &s1, const int number)
Stringoperator<< (String &s1, const short number)
Stringoperator<< (String &s1, const unsigned short number)
Stringoperator<< (String &s1, const long number)
Stringoperator<< (String &s1, const unsigned long number)
Stringoperator<< (String &s1, const int64 number)
Stringoperator<< (String &s1, const uint64 number)
Stringoperator<< (String &s1, const float number)
Stringoperator<< (String &s1, const double number)
OutputStreamoperator<< (OutputStream &stream, const String &text)
OutputStreamoperator<< (OutputStream &stream, StringRef text)
static CharPointer_UTF8 findTrimmedEnd (const CharPointer_UTF8 start, CharPointer_UTF8 end)
static String getStringFromWindows1252Codepage (const char *data, size_t num)
template<typename Type>
static String hexToString (Type v)
template<class traits>
std::basic_ostream< char, traits > & operator<< (std::basic_ostream< char, traits > &stream, const String &stringToWrite)
String operator+ (String s1, StringRef s2)
String operator+ (StringRef s1, const String &s2)
String operator+ (const char *s1, StringRef s2)
String operator+ (StringRef s1, const char *s2)
bool isValidXmlNameStartCharacter (const water_uchar character) noexcept
bool isValidXmlNameBodyCharacter (const water_uchar character) noexcept
static const StringgetEmptyStringRef () noexcept
static const std::string & getEmptyStdStringRef () noexcept

Variables

const double double_Pi = 3.1415926535897932384626433832795
const float float_Pi = 3.14159265358979323846f
static const EmptyString emptyString = { 0x3fffffff, sizeof (CharPointer_UTF8::CharType), '\0' }
static const char hexDigits [] = "0123456789abcdef"
static const water_uchar emptyChar = 0
static const char *const water_xmltextContentAttributeName = "text"

Typedef Documentation

◆ int16

typedef signed short water::int16

A platform-independent 16-bit signed integer type.

◆ int32

typedef signed int water::int32

A platform-independent 32-bit signed integer type.

◆ int64

typedef long long water::int64

A platform-independent 64-bit integer type.

◆ int8

typedef signed char water::int8

A platform-independent 8-bit signed integer type.

◆ pointer_sized_int

A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.

◆ pointer_sized_uint

typedef unsigned int water::pointer_sized_uint

An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it.

◆ uint16

typedef unsigned short water::uint16

A platform-independent 16-bit unsigned integer type.

◆ uint32

typedef unsigned int water::uint32

A platform-independent 32-bit unsigned integer type.

◆ uint64

typedef unsigned long long water::uint64

A platform-independent 64-bit unsigned integer type.

◆ uint8

typedef unsigned char water::uint8

A platform-independent 8-bit unsigned integer type.

◆ water_uchar

A platform-independent 32-bit unicode character type.

Function Documentation

◆ abs64()

int64 water::abs64 ( const int64 n)
inlinenoexcept

64-bit abs function.

◆ addBytesToPointer()

template<typename Type, typename IntegerType>
Type * water::addBytesToPointer ( Type * basePointer,
IntegerType bytes )
inlinenoexcept

A handy function which adds a number of bytes to any type of pointer and returns the result. This can be useful to avoid casting pointers to a char* and back when you want to move them by a specific number of bytes,

◆ compareFilenames()

int water::compareFilenames ( const String & name1,
const String & name2 )
staticnoexcept

◆ countNumberOfBits() [1/2]

int water::countNumberOfBits ( uint32 n)
inlinenoexcept

Returns the number of bits in a 32-bit integer.

◆ countNumberOfBits() [2/2]

int water::countNumberOfBits ( uint64 n)
inlinenoexcept

Returns the number of bits in a 64-bit integer.

◆ countNumberOfSeparators()

int water::countNumberOfSeparators ( CharPointer_UTF8 s)
static

◆ createCopyIfNotNull()

template<class Type>
Type * water::createCopyIfNotNull ( const Type * objectToCopy)
inline

If a pointer is non-null, this returns a new copy of the object that it points to, or safely returns nullptr if the pointer is null.

◆ createTempFile()

File water::createTempFile ( const File & parentDirectory,
String name,
const String & suffix,
const int optionFlags )
static

◆ degreesToRadians() [1/2]

double water::degreesToRadians ( double degrees)
inlinenoexcept

Converts an angle in degrees to radians.

◆ degreesToRadians() [2/2]

float water::degreesToRadians ( float degrees)
inlinenoexcept

Converts an angle in degrees to radians.

◆ deleteAndZero()

template<typename Type>
void water::deleteAndZero ( Type & pointer)
inline

Delete an object pointer, and sets the pointer to null.

Remember that it's not good c++ practice to use delete directly - always try to use a ScopedPointer or other automatic lifetime-management system rather than resorting to deleting raw pointers!

◆ deleteRenderOpArray()

void water::deleteRenderOpArray ( Array< void * > & ops)
static

◆ findByteOffsetOfEnd()

size_t water::findByteOffsetOfEnd ( CharPointer_UTF8 text)
staticnoexcept

◆ findHighestSetBit()

int water::findHighestSetBit ( uint32 n)
noexcept

Returns the index of the highest set bit in a (non-zero) number. So for n=3 this would return 1, for n=7 it returns 2, etc. An input value of 0 is illegal!

◆ findInsertIndexInSortedArray()

template<class ElementType, class ElementComparator>
int water::findInsertIndexInSortedArray ( ElementComparator & comparator,
ElementType *const array,
const ElementType newElement,
int firstElement,
int lastElement )
static

Searches a sorted array of elements, looking for the index at which a specified value should be inserted for it to be in the correct order.

The comparator object that is passed-in must define a public method with the following signature:

int compareElements (ElementType first, ElementType second);

..and this method must return:

  • a value of < 0 if the first comes before the second
  • a value of 0 if the two objects are equivalent
  • a value of > 0 if the second comes before the first

To improve performance, the compareElements() method can be declared as static or const.

Parameters
comparatoran object which defines a compareElements() method
arraythe array to search
newElementthe value that is going to be inserted
firstElementthe index of the first element to search
lastElementthe index of the last element in the range (this is non-inclusive)

◆ findMaximum()

template<typename Type>
Type water::findMaximum ( const Type * values,
int numValues )

Scans an array of values, returning the maximum value that it contains.

◆ findMinAndMax()

template<typename Type>
void water::findMinAndMax ( const Type * values,
int numValues,
Type & lowest,
Type & highest )

Scans an array of values, returning the minimum and maximum values that it contains.

◆ findMinimum()

template<typename Type>
Type water::findMinimum ( const Type * data,
int numValues )

Scans an array of values, returning the minimum value that it contains.

◆ findTrimmedEnd()

CharPointer_UTF8 water::findTrimmedEnd ( const CharPointer_UTF8 start,
CharPointer_UTF8 end )
static

◆ getAddressDifference()

template<typename Type1, typename Type2>
int water::getAddressDifference ( Type1 * pointer1,
Type2 * pointer2 )
inlinenoexcept

A handy function which returns the difference between any two pointers, in bytes. The address of the second pointer is subtracted from the first, and the difference in bytes is returned.

◆ getEmptyStdStringRef()

const std::string & water::getEmptyStdStringRef ( )
staticnoexcept

◆ getEmptyStringRef()

const String & water::getEmptyStringRef ( )
staticnoexcept

◆ getLinkedFile()

String water::getLinkedFile ( const String & file)
static

◆ getStringFromWindows1252Codepage()

String water::getStringFromWindows1252Codepage ( const char * data,
size_t num )
static

◆ hexToString()

template<typename Type>
String water::hexToString ( Type v)
static

◆ ignoreUnused() [1/4]

template<typename Type1>
void water::ignoreUnused ( const Type1 & )
noexcept

Handy function for avoiding unused variables warning.

◆ ignoreUnused() [2/4]

template<typename Type1, typename Type2>
void water::ignoreUnused ( const Type1 & ,
const Type2 &  )
noexcept

◆ ignoreUnused() [3/4]

template<typename Type1, typename Type2, typename Type3>
void water::ignoreUnused ( const Type1 & ,
const Type2 & ,
const Type3 &  )
noexcept

◆ ignoreUnused() [4/4]

template<typename Type1, typename Type2, typename Type3, typename Type4>
void water::ignoreUnused ( const Type1 & ,
const Type2 & ,
const Type3 & ,
const Type4 &  )
noexcept

◆ isPositiveAndBelow() [1/2]

template<>
bool water::isPositiveAndBelow ( const int valueToTest,
const int upperLimit )
inlinenoexcept

◆ isPositiveAndBelow() [2/2]

template<typename Type>
bool water::isPositiveAndBelow ( Type valueToTest,
Type upperLimit )
noexcept

Returns true if a value is at least zero, and also below a specified upper limit. This is basically a quicker way to write:

valueToTest >= 0 && valueToTest < upperLimit

◆ isPositiveAndNotGreaterThan() [1/2]

template<>
bool water::isPositiveAndNotGreaterThan ( const int valueToTest,
const int upperLimit )
inlinenoexcept

◆ isPositiveAndNotGreaterThan() [2/2]

template<typename Type>
bool water::isPositiveAndNotGreaterThan ( Type valueToTest,
Type upperLimit )
noexcept

Returns true if a value is at least zero, and also less than or equal to a specified upper limit. This is basically a quicker way to write:

valueToTest >= 0 && valueToTest <= upperLimit

◆ isPowerOfTwo()

template<typename IntegerType>
bool water::isPowerOfTwo ( IntegerType value)

Returns true if the specified integer is a power-of-two.

◆ isValidXmlNameBodyCharacter()

bool water::isValidXmlNameBodyCharacter ( const water_uchar character)
inlinenoexcept

◆ isValidXmlNameStartCharacter()

bool water::isValidXmlNameStartCharacter ( const water_uchar character)
inlinenoexcept

◆ jlimit()

template<typename Type>
Type water::jlimit ( const Type lowerLimit,
const Type upperLimit,
const Type valueToConstrain )
noexcept

Constrains a value to keep it within a given range.

This will check that the specified value lies between the lower and upper bounds specified, and if not, will return the nearest value that would be in-range. Effectively, it's like calling jmax (lowerLimit, jmin (upperLimit, value)).

Note that it expects that lowerLimit <= upperLimit. If this isn't true, the results will be unpredictable.

Parameters
lowerLimitthe minimum value to return
upperLimitthe maximum value to return
valueToConstrainthe value to try to return
Returns
the closest value to valueToConstrain which lies between lowerLimit and upperLimit (inclusive)
See also
jmin, jmax, jmap

◆ jmap() [1/2]

template<typename Type>
Type water::jmap ( Type sourceValue,
Type sourceRangeMin,
Type sourceRangeMax,
Type targetRangeMin,
Type targetRangeMax )

Remaps a value from a source range to a target range.

◆ jmap() [2/2]

template<typename Type>
Type water::jmap ( Type value0To1,
Type targetRangeMin,
Type targetRangeMax )

Remaps a normalised value (between 0 and 1) to a target range. This effectively returns (targetRangeMin + value0To1 * (targetRangeMax - targetRangeMin)).

◆ jmax() [1/3]

template<typename Type>
Type water::jmax ( const Type a,
const Type b )

Returns the larger of two values.

◆ jmax() [2/3]

template<typename Type>
Type water::jmax ( const Type a,
const Type b,
const Type c )

Returns the larger of three values.

◆ jmax() [3/3]

template<typename Type>
Type water::jmax ( const Type a,
const Type b,
const Type c,
const Type d )

Returns the larger of four values.

◆ jmin() [1/3]

template<typename Type>
Type water::jmin ( const Type a,
const Type b )

Returns the smaller of two values.

◆ jmin() [2/3]

template<typename Type>
Type water::jmin ( const Type a,
const Type b,
const Type c )

Returns the smaller of three values.

◆ jmin() [3/3]

template<typename Type>
Type water::jmin ( const Type a,
const Type b,
const Type c,
const Type d )

Returns the smaller of four values.

◆ naturalStringCompare()

int water::naturalStringCompare ( CharPointer_UTF8 s1,
CharPointer_UTF8 s2,
bool isCaseSensitive )
staticnoexcept

◆ negativeAwareModulo()

template<typename IntegerType>
IntegerType water::negativeAwareModulo ( IntegerType dividend,
const IntegerType divisor )
noexcept

Performs a modulo operation, but can cope with the dividend being negative. The divisor must be greater than zero.

◆ nextPowerOfTwo()

int water::nextPowerOfTwo ( int n)
inlinenoexcept

Returns the smallest power-of-two which is equal to or greater than the given integer.

◆ numElementsInArray()

template<typename Type, size_t N>
size_t water::numElementsInArray ( Type(&) array[N])

Handy function for getting the number of elements in a simple const C array. E.g.

static size_t myArray[] = { 1, 2, 3 };
size_t numElements = numElementsInArray (myArray) // returns 3
size_t numElementsInArray(Type(&array)[N])
Definition MathsFunctions.h:257

◆ operator!=() [1/7]

template<typename ReferenceCountedObjectClass>
bool water::operator!= ( const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object1,
const ReferenceCountedObjectClass * object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator!=() [2/7]

template<typename ReferenceCountedObjectClass>
bool water::operator!= ( const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object1,
const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator!=() [3/7]

bool water::operator!= ( const String & string1,
const char * string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator!=() [4/7]

bool water::operator!= ( const String & string1,
const CharPointer_UTF8 string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator!=() [5/7]

bool water::operator!= ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator!=() [6/7]

bool water::operator!= ( const String & string1,
StringRef string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator!=() [7/7]

template<typename ReferenceCountedObjectClass>
bool water::operator!= ( ReferenceCountedObjectClass * object1,
const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator+() [1/14]

String water::operator+ ( const char * string1,
const String & string2 )

Concatenates two strings.

◆ operator+() [2/14]

String water::operator+ ( const char * s1,
StringRef s2 )
inline

◆ operator+() [3/14]

String water::operator+ ( char string1,
const String & string2 )

Concatenates two strings.

◆ operator+() [4/14]

String water::operator+ ( const NewLine & ,
const char * s2 )
inline

◆ operator+() [5/14]

String water::operator+ ( const NewLine & ,
const NewLine &  )
inline

◆ operator+() [6/14]

String water::operator+ ( water_uchar string1,
const String & string2 )

Concatenates two strings.

◆ operator+() [7/14]

String water::operator+ ( String string1,
const char * string2 )

Concatenates two strings.

◆ operator+() [8/14]

String water::operator+ ( String string1,
char characterToAppend )

Concatenates two strings.

◆ operator+() [9/14]

String water::operator+ ( String s1,
const NewLine &  )
inline

◆ operator+() [10/14]

String water::operator+ ( String string1,
const String & string2 )

Concatenates two strings.

◆ operator+() [11/14]

String water::operator+ ( String string1,
water_uchar characterToAppend )

Concatenates two strings.

◆ operator+() [12/14]

String water::operator+ ( String s1,
StringRef s2 )
inline

◆ operator+() [13/14]

String water::operator+ ( StringRef s1,
const char * s2 )
inline

◆ operator+() [14/14]

String water::operator+ ( StringRef s1,
const String & s2 )
inline

◆ operator+=()

String & water::operator+= ( String & s1,
const NewLine &  )
inline

◆ operator<()

bool water::operator< ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator<<() [1/28]

OutputStream & water::operator<< ( OutputStream & stream,
const char * text )

Writes a null-terminated text string to a stream.

◆ operator<<() [2/28]

OutputStream & water::operator<< ( OutputStream & stream,
char character )

Writes a character to a stream.

◆ operator<<() [3/28]

OutputStream & water::operator<< ( OutputStream & stream,
double number )

Writes a number to a stream as 8-bit characters in the default system encoding.

◆ operator<<() [4/28]

OutputStream & water::operator<< ( OutputStream & stream,
const File & fileToRead )

Writes the contents of a file to a stream.

◆ operator<<() [5/28]

OutputStream & water::operator<< ( OutputStream & stream,
int number )

Writes a number to a stream as 8-bit characters in the default system encoding.

◆ operator<<() [6/28]

OutputStream & water::operator<< ( OutputStream & stream,
int64 number )

Writes a number to a stream as 8-bit characters in the default system encoding.

◆ operator<<() [7/28]

OutputStream & water::operator<< ( OutputStream & stream,
const MemoryBlock & data )

Writes a block of data from a MemoryBlock to a stream.

◆ operator<<() [8/28]

OutputStream & water::operator<< ( OutputStream & stream,
const MemoryOutputStream & streamToRead )

Copies all the data that has been written to a MemoryOutputStream into another stream.

◆ operator<<() [9/28]

OutputStream & water::operator<< ( OutputStream & stream,
const NewLine &  )

Writes a new-line to a stream. You can use the predefined symbol 'newLine' to invoke this, e.g.

myOutputStream << "Hello World" << newLine << newLine;
See also
OutputStream::setNewLineString

◆ operator<<() [10/28]

OutputStream & water::operator<< ( OutputStream & stream,
const String & stringToWrite )

Writes a string to an OutputStream as UTF8.

◆ operator<<() [11/28]

OutputStream & water::operator<< ( OutputStream & stream,
InputStream & streamToRead )

Writes the complete contents of an input stream to an output stream.

◆ operator<<() [12/28]

OutputStream & water::operator<< ( OutputStream & stream,
StringRef stringToWrite )

Writes a string to an OutputStream as UTF8.

◆ operator<<() [13/28]

template<class traits>
std::basic_ostream< char, traits > & water::operator<< ( std::basic_ostream< char, traits > & stream,
const String & stringToWrite )

This operator allows you to write a water String directly to std output streams. This is handy for writing strings to std::cout, std::cerr, etc.

◆ operator<<() [14/28]

String & water::operator<< ( String & string1,
const char * string2 )

Appends a string to the end of the first one.

◆ operator<<() [15/28]

String & water::operator<< ( String & string1,
char characterToAppend )

Appends a character at the end of a string.

◆ operator<<() [16/28]

String & water::operator<< ( String & string1,
double number )

Appends a decimal number at the end of a string.

◆ operator<<() [17/28]

String & water::operator<< ( String & string1,
float number )

Appends a decimal number at the end of a string.

◆ operator<<() [18/28]

String & water::operator<< ( String & string1,
int number )

Appends a decimal number at the end of a string.

◆ operator<<() [19/28]

String & water::operator<< ( String & string1,
int64 number )

Appends a decimal number at the end of a string.

◆ operator<<() [20/28]

String & water::operator<< ( String & string1,
long number )

Appends a decimal number at the end of a string.

◆ operator<<() [21/28]

String & water::operator<< ( String & string1,
short number )

Appends a decimal number at the end of a string.

◆ operator<<() [22/28]

String & water::operator<< ( String & string1,
const String & string2 )

Appends a string to the end of the first one.

◆ operator<<() [23/28]

String & water::operator<< ( String & string1,
uint64 number )

Appends a decimal number at the end of a string.

◆ operator<<() [24/28]

String & water::operator<< ( String & s1,
const unsigned long number )

◆ operator<<() [25/28]

String & water::operator<< ( String & s1,
const unsigned short number )

◆ operator<<() [26/28]

String & water::operator<< ( String & string1,
water_uchar characterToAppend )

Appends a character at the end of a string.

◆ operator<<() [27/28]

String & water::operator<< ( String & string1,
StringRef string2 )

Appends a string to the end of the first one.

◆ operator<<() [28/28]

String & water::operator<< ( String & string1,
const NewLine &  )
inline

Writes a new-line sequence to a string. You can use the predefined object 'newLine' to invoke this, e.g.

myString << "Hello World" << newLine << newLine;

◆ operator<=()

bool water::operator<= ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator==() [1/7]

template<typename ReferenceCountedObjectClass>
bool water::operator== ( const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object1,
const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator==() [2/7]

template<typename ReferenceCountedObjectClass>
bool water::operator== ( const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object1,
ReferenceCountedObjectClass *const object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator==() [3/7]

bool water::operator== ( const String & string1,
const char * string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator==() [4/7]

bool water::operator== ( const String & string1,
const CharPointer_UTF8 string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator==() [5/7]

bool water::operator== ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator==() [6/7]

bool water::operator== ( const String & string1,
StringRef string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator==() [7/7]

template<typename ReferenceCountedObjectClass>
bool water::operator== ( ReferenceCountedObjectClass * object1,
const ReferenceCountedObjectPtr< ReferenceCountedObjectClass > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator>()

bool water::operator> ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ operator>=()

bool water::operator>= ( const String & string1,
const String & string2 )
noexcept

Case-sensitive comparison of two strings.

◆ radiansToDegrees() [1/2]

double water::radiansToDegrees ( double radians)
inlinenoexcept

Converts an angle in radians to degrees.

◆ radiansToDegrees() [2/2]

float water::radiansToDegrees ( float radians)
inlinenoexcept

Converts an angle in radians to degrees.

◆ readLittleEndianBitsInBuffer()

uint32 water::readLittleEndianBitsInBuffer ( const void * sourceBuffer,
uint32 startBit,
uint32 numBits )
noexcept

Reads a number of bits from a buffer at a given bit index. The buffer is treated as a sequence of 8-bit bytes, and the value is encoded in little-endian order, so for example if startBit = 10, and numBits = 11 then the lower 6 bits of the result would be read from bits 2-8 of sourceBuffer[1], and the upper 5 bits of the result from bits 0-5 of sourceBuffer[2].

See also
writeLittleEndianBitsInBuffer

◆ readUnaligned()

template<typename Type>
Type water::readUnaligned ( const void * srcPtr)
inlinenoexcept

A handy function to read un-aligned memory without a performance penalty or bus-error.

◆ removeEllipsis()

String water::removeEllipsis ( const String & path)
static

◆ roundDoubleToInt()

int water::roundDoubleToInt ( double value)
inlinenoexcept

Fast floating-point-to-integer conversion.

This is faster than using the normal c++ cast to convert a double to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.

Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently. For a more accurate conversion, see roundDoubleToIntAccurate().

◆ roundFloatToInt()

int water::roundFloatToInt ( float value)
inlinenoexcept

Fast floating-point-to-integer conversion.

This is faster than using the normal c++ cast to convert a float to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.

Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently.

◆ roundToInt() [1/2]

template<typename FloatType>
int water::roundToInt ( const FloatType value)
noexcept

Fast floating-point-to-integer conversion.

This is faster than using the normal c++ cast to convert a float to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.

Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently.

◆ roundToInt() [2/2]

int water::roundToInt ( int value)
inlinenoexcept

◆ roundToIntAccurate()

int water::roundToIntAccurate ( double value)
inlinenoexcept

Fast floating-point-to-integer conversion.

This is a slightly slower and slightly more accurate version of roundDoubleToInt(). It works fine for values above zero, but negative numbers are rounded the wrong way.

◆ sortArray()

template<class ElementType, class ElementComparator>
void water::sortArray ( ElementComparator & comparator,
ElementType *const array,
int firstElement,
int lastElement,
const bool retainOrderOfEquivalentItems )
static

Sorts a range of elements in an array.

The comparator object that is passed-in must define a public method with the following signature:

int compareElements (ElementType first, ElementType second);

..and this method must return:

  • a value of < 0 if the first comes before the second
  • a value of 0 if the two objects are equivalent
  • a value of > 0 if the second comes before the first

To improve performance, the compareElements() method can be declared as static or const.

Parameters
comparatoran object which defines a compareElements() method
arraythe array to sort
firstElementthe index of the first element of the range to be sorted
lastElementthe index of the last element in the range that needs sorting (this is inclusive)
retainOrderOfEquivalentItemsif true, the order of items that the comparator deems the same will be maintained - this will be a slower algorithm than if they are allowed to be moved around.
See also
sortArrayRetainingOrder

◆ square()

template<typename NumericType>
NumericType water::square ( NumericType n)
noexcept

Returns the square of its argument.

◆ stringCompareLeft()

int water::stringCompareLeft ( CharPointer_UTF8 s1,
CharPointer_UTF8 s2 )
staticnoexcept

◆ stringCompareRight()

int water::stringCompareRight ( CharPointer_UTF8 s1,
CharPointer_UTF8 s2 )
staticnoexcept

◆ swapVariables()

template<typename Type>
void water::swapVariables ( Type & variable1,
Type & variable2 )

Handy function to swap two values.

◆ water_fileSetPosition()

int64 water::water_fileSetPosition ( void * handle,
int64 pos )
static

◆ water_getExecutableFile()

File water::water_getExecutableFile ( )

◆ water_hypot() [1/2]

template<>
float water::water_hypot ( float a,
float b )
inlinenoexcept

◆ water_hypot() [2/2]

template<typename Type>
Type water::water_hypot ( Type a,
Type b )
noexcept

Using water_hypot is easier than dealing with the different types of hypot function that are provided by the various platforms and compilers.

◆ water_isfinite() [1/3]

template<>
bool water::water_isfinite ( double value)
inlinenoexcept

◆ water_isfinite() [2/3]

template<>
bool water::water_isfinite ( float value)
inlinenoexcept

◆ water_isfinite() [3/3]

template<typename NumericType>
bool water::water_isfinite ( NumericType )
noexcept

The isfinite() method seems to vary between platforms, so this is a platform-independent function for it.

◆ water_millisecondsSinceStartup()

uint32 water::water_millisecondsSinceStartup ( )
staticnoexcept

◆ writeIntToStream()

template<typename IntegerType>
void water::writeIntToStream ( OutputStream & stream,
IntegerType number )
static

◆ writeLittleEndianBitsInBuffer()

void water::writeLittleEndianBitsInBuffer ( void * targetBuffer,
uint32 startBit,
uint32 numBits,
uint32 value )
noexcept

Writes a number of bits into a memory buffer at a given bit index. The buffer is treated as a sequence of 8-bit bytes, and the value is encoded in little-endian order, so for example if startBit = 10, and numBits = 11 then the lower 6 bits of the value would be written into bits 2-8 of targetBuffer[1], and the upper 5 bits of value into bits 0-5 of targetBuffer[2].

See also
readLittleEndianBitsInBuffer

◆ writeUnaligned()

template<typename Type>
void water::writeUnaligned ( void * dstPtr,
Type value )
inlinenoexcept

A handy function to write un-aligned memory without a performance penalty or bus-error.

◆ zeromem()

void water::zeromem ( void * memory,
size_t numBytes )
inlinenoexcept

Fills a block of memory with zeros.

◆ zerostruct()

template<typename Type>
void water::zerostruct ( Type & structure)
inlinenoexcept

Overwrites a structure or object with zeros.

Variable Documentation

◆ double_Pi

const double water::double_Pi = 3.1415926535897932384626433832795

A predefined value for Pi, at double-precision.

See also
float_Pi

◆ emptyChar

const water_uchar water::emptyChar = 0
static

◆ emptyString

const EmptyString water::emptyString = { 0x3fffffff, sizeof (CharPointer_UTF8::CharType), '\0' }
static

◆ float_Pi

const float water::float_Pi = 3.14159265358979323846f

A predefined value for Pi, at single-precision.

See also
double_Pi

◆ hexDigits

const char water::hexDigits[] = "0123456789abcdef"
static

◆ water_xmltextContentAttributeName

const char* const water::water_xmltextContentAttributeName = "text"
static