Browse Source

Cleanup water, put main code inside namespace

tags/1.9.8
falkTX 8 years ago
parent
commit
ab546cce60
85 changed files with 529 additions and 1131 deletions
  1. +3
    -0
      source/modules/water/buffers/juce_AudioSampleBuffer.h
  2. +2
    -0
      source/modules/water/containers/juce_Array.h
  3. +2
    -0
      source/modules/water/containers/juce_ArrayAllocationBase.h
  4. +2
    -4
      source/modules/water/containers/juce_ElementComparator.h
  5. +2
    -0
      source/modules/water/containers/juce_LinkedListPointer.h
  6. +4
    -0
      source/modules/water/containers/juce_NamedValueSet.cpp
  7. +3
    -1
      source/modules/water/containers/juce_NamedValueSet.h
  8. +2
    -0
      source/modules/water/containers/juce_OwnedArray.h
  9. +2
    -0
      source/modules/water/containers/juce_ReferenceCountedArray.h
  10. +3
    -3
      source/modules/water/containers/juce_SortedSet.h
  11. +4
    -0
      source/modules/water/containers/juce_Variant.cpp
  12. +9
    -7
      source/modules/water/containers/juce_Variant.h
  13. +4
    -0
      source/modules/water/files/juce_DirectoryIterator.cpp
  14. +4
    -1
      source/modules/water/files/juce_DirectoryIterator.h
  15. +5
    -1
      source/modules/water/files/juce_File.cpp
  16. +6
    -8
      source/modules/water/files/juce_File.h
  17. +4
    -0
      source/modules/water/files/juce_FileOutputStream.cpp
  18. +4
    -1
      source/modules/water/files/juce_FileOutputStream.h
  19. +4
    -0
      source/modules/water/files/juce_TemporaryFile.cpp
  20. +4
    -1
      source/modules/water/files/juce_TemporaryFile.h
  21. +4
    -1
      source/modules/water/maths/juce_MathsFunctions.h
  22. +2
    -59
      source/modules/water/maths/juce_Random.cpp
  23. +3
    -21
      source/modules/water/maths/juce_Random.h
  24. +3
    -0
      source/modules/water/memory/juce_Atomic.h
  25. +7
    -15
      source/modules/water/memory/juce_ByteOrder.h
  26. +3
    -0
      source/modules/water/memory/juce_HeapBlock.h
  27. +7
    -3
      source/modules/water/memory/juce_Memory.h
  28. +4
    -0
      source/modules/water/memory/juce_MemoryBlock.cpp
  29. +3
    -1
      source/modules/water/memory/juce_MemoryBlock.h
  30. +4
    -2
      source/modules/water/memory/juce_ReferenceCountedObject.h
  31. +2
    -0
      source/modules/water/memory/juce_SharedResourcePointer.h
  32. +4
    -0
      source/modules/water/midi/juce_MidiBuffer.cpp
  33. +4
    -2
      source/modules/water/midi/juce_MidiBuffer.h
  34. +4
    -0
      source/modules/water/midi/juce_MidiFile.cpp
  35. +3
    -1
      source/modules/water/midi/juce_MidiFile.h
  36. +4
    -0
      source/modules/water/midi/juce_MidiMessage.cpp
  37. +4
    -1
      source/modules/water/midi/juce_MidiMessage.h
  38. +4
    -0
      source/modules/water/midi/juce_MidiMessageSequence.cpp
  39. +3
    -1
      source/modules/water/midi/juce_MidiMessageSequence.h
  40. +4
    -0
      source/modules/water/misc/juce_Result.cpp
  41. +3
    -1
      source/modules/water/misc/juce_Result.h
  42. +4
    -2
      source/modules/water/processors/juce_AudioPlayHead.h
  43. +3
    -1
      source/modules/water/processors/juce_AudioProcessor.cpp
  44. +3
    -2
      source/modules/water/processors/juce_AudioProcessor.h
  45. +3
    -1
      source/modules/water/processors/juce_AudioProcessorGraph.cpp
  46. +6
    -5
      source/modules/water/processors/juce_AudioProcessorGraph.h
  47. +4
    -0
      source/modules/water/streams/juce_FileInputSource.cpp
  48. +3
    -1
      source/modules/water/streams/juce_FileInputSource.h
  49. +4
    -0
      source/modules/water/streams/juce_FileInputStream.cpp
  50. +3
    -1
      source/modules/water/streams/juce_FileInputStream.h
  51. +4
    -0
      source/modules/water/streams/juce_FileOutputStream.cpp
  52. +4
    -1
      source/modules/water/streams/juce_FileOutputStream.h
  53. +3
    -1
      source/modules/water/streams/juce_InputSource.h
  54. +4
    -0
      source/modules/water/streams/juce_InputStream.cpp
  55. +4
    -1
      source/modules/water/streams/juce_InputStream.h
  56. +5
    -1
      source/modules/water/streams/juce_MemoryOutputStream.cpp
  57. +4
    -2
      source/modules/water/streams/juce_MemoryOutputStream.h
  58. +13
    -9
      source/modules/water/streams/juce_OutputStream.cpp
  59. +12
    -10
      source/modules/water/streams/juce_OutputStream.h
  60. +4
    -0
      source/modules/water/text/juce_CharPointer_UTF8.h
  61. +4
    -0
      source/modules/water/text/juce_CharacterFunctions.cpp
  62. +4
    -1
      source/modules/water/text/juce_CharacterFunctions.h
  63. +4
    -0
      source/modules/water/text/juce_Identifier.cpp
  64. +3
    -1
      source/modules/water/text/juce_Identifier.h
  65. +3
    -1
      source/modules/water/text/juce_NewLine.h
  66. +42
    -43
      source/modules/water/text/juce_String.cpp
  67. +36
    -34
      source/modules/water/text/juce_String.h
  68. +4
    -0
      source/modules/water/text/juce_StringArray.cpp
  69. +3
    -1
      source/modules/water/text/juce_StringArray.h
  70. +4
    -0
      source/modules/water/text/juce_StringPool.cpp
  71. +3
    -1
      source/modules/water/text/juce_StringPool.h
  72. +6
    -3
      source/modules/water/text/juce_StringRef.h
  73. +4
    -0
      source/modules/water/threads/juce_ChildProcess.cpp
  74. +3
    -1
      source/modules/water/threads/juce_ChildProcess.h
  75. +15
    -13
      source/modules/water/threads/juce_Process.h
  76. +2
    -0
      source/modules/water/threads/juce_ScopedLock.h
  77. +3
    -1
      source/modules/water/threads/juce_SpinLock.h
  78. +19
    -532
      source/modules/water/time/juce_Time.cpp
  79. +4
    -273
      source/modules/water/time/juce_Time.h
  80. +3
    -3
      source/modules/water/water.cpp
  81. +75
    -16
      source/modules/water/water.h
  82. +4
    -0
      source/modules/water/xml/juce_XmlDocument.cpp
  83. +3
    -1
      source/modules/water/xml/juce_XmlDocument.h
  84. +33
    -32
      source/modules/water/xml/juce_XmlElement.cpp
  85. +3
    -1
      source/modules/water/xml/juce_XmlElement.h

+ 3
- 0
source/modules/water/buffers/juce_AudioSampleBuffer.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED #ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED
#define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED #define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
A multi-channel buffer of floating point audio samples. A multi-channel buffer of floating point audio samples.
@@ -1094,5 +1096,6 @@ private:
JUCE_LEAK_DETECTOR (AudioSampleBuffer) JUCE_LEAK_DETECTOR (AudioSampleBuffer)
}; };
}
#endif // JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED #endif // JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED

+ 2
- 0
source/modules/water/containers/juce_Array.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_ARRAY_H_INCLUDED #ifndef JUCE_ARRAY_H_INCLUDED
#define JUCE_ARRAY_H_INCLUDED #define JUCE_ARRAY_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -1151,5 +1152,6 @@ private:
} }
}; };
}
#endif // JUCE_ARRAY_H_INCLUDED #endif // JUCE_ARRAY_H_INCLUDED

+ 2
- 0
source/modules/water/containers/juce_ArrayAllocationBase.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_ARRAYALLOCATIONBASE_H_INCLUDED #ifndef JUCE_ARRAYALLOCATIONBASE_H_INCLUDED
#define JUCE_ARRAYALLOCATIONBASE_H_INCLUDED #define JUCE_ARRAYALLOCATIONBASE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -136,5 +137,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (ArrayAllocationBase) JUCE_DECLARE_NON_COPYABLE (ArrayAllocationBase)
}; };
}
#endif // JUCE_ARRAYALLOCATIONBASE_H_INCLUDED #endif // JUCE_ARRAYALLOCATIONBASE_H_INCLUDED

+ 2
- 4
source/modules/water/containers/juce_ElementComparator.h View File

@@ -31,7 +31,7 @@
#ifndef JUCE_ELEMENTCOMPARATOR_H_INCLUDED #ifndef JUCE_ELEMENTCOMPARATOR_H_INCLUDED
#define JUCE_ELEMENTCOMPARATOR_H_INCLUDED #define JUCE_ELEMENTCOMPARATOR_H_INCLUDED
#ifndef DOXYGEN
namespace water {
/** This is an internal helper class which converts a juce ElementComparator style /** This is an internal helper class which converts a juce ElementComparator style
class (using a "compareElements" method) into a class that's compatible with class (using a "compareElements" method) into a class that's compatible with
@@ -50,9 +50,6 @@ private:
SortFunctionConverter& operator= (const SortFunctionConverter&) JUCE_DELETED_FUNCTION; SortFunctionConverter& operator= (const SortFunctionConverter&) JUCE_DELETED_FUNCTION;
}; };
#endif
//============================================================================== //==============================================================================
/** /**
Sorts a range of elements in an array. Sorts a range of elements in an array.
@@ -193,5 +190,6 @@ public:
} }
}; };
}
#endif // JUCE_ELEMENTCOMPARATOR_H_INCLUDED #endif // JUCE_ELEMENTCOMPARATOR_H_INCLUDED

+ 2
- 0
source/modules/water/containers/juce_LinkedListPointer.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_LINKEDLISTPOINTER_H_INCLUDED #ifndef JUCE_LINKEDLISTPOINTER_H_INCLUDED
#define JUCE_LINKEDLISTPOINTER_H_INCLUDED #define JUCE_LINKEDLISTPOINTER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -369,5 +370,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (LinkedListPointer) JUCE_DECLARE_NON_COPYABLE (LinkedListPointer)
}; };
}
#endif // JUCE_LINKEDLISTPOINTER_H_INCLUDED #endif // JUCE_LINKEDLISTPOINTER_H_INCLUDED

+ 4
- 0
source/modules/water/containers/juce_NamedValueSet.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
//============================================================================== //==============================================================================
NamedValueSet::NamedValueSet() noexcept NamedValueSet::NamedValueSet() noexcept
{ {
@@ -207,3 +209,5 @@ var* NamedValueSet::getVarPointerAt (int index) const noexcept
return nullptr; return nullptr;
} }
}

+ 3
- 1
source/modules/water/containers/juce_NamedValueSet.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_NAMEDVALUESET_H_INCLUDED #ifndef JUCE_NAMEDVALUESET_H_INCLUDED
#define JUCE_NAMEDVALUESET_H_INCLUDED #define JUCE_NAMEDVALUESET_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** Holds a set of named var objects. /** Holds a set of named var objects.
@@ -38,7 +39,7 @@
This can be used as a basic structure to hold a set of var object, which can This can be used as a basic structure to hold a set of var object, which can
be retrieved by using their identifier. be retrieved by using their identifier.
*/ */
class JUCE_API NamedValueSet
class NamedValueSet
{ {
public: public:
/** Creates an empty set. */ /** Creates an empty set. */
@@ -184,5 +185,6 @@ private:
Array<NamedValue> values; Array<NamedValue> values;
}; };
}
#endif // JUCE_NAMEDVALUESET_H_INCLUDED #endif // JUCE_NAMEDVALUESET_H_INCLUDED

+ 2
- 0
source/modules/water/containers/juce_OwnedArray.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_OWNEDARRAY_H_INCLUDED #ifndef JUCE_OWNEDARRAY_H_INCLUDED
#define JUCE_OWNEDARRAY_H_INCLUDED #define JUCE_OWNEDARRAY_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** An array designed for holding objects. /** An array designed for holding objects.
@@ -837,5 +838,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray)
}; };
}
#endif // JUCE_OWNEDARRAY_H_INCLUDED #endif // JUCE_OWNEDARRAY_H_INCLUDED

+ 2
- 0
source/modules/water/containers/juce_ReferenceCountedArray.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED #ifndef JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED
#define JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED #define JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -852,5 +853,6 @@ private:
} }
}; };
}
#endif // JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED #endif // JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED

+ 3
- 3
source/modules/water/containers/juce_SortedSet.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_SORTEDSET_H_INCLUDED #ifndef JUCE_SORTEDSET_H_INCLUDED
#define JUCE_SORTEDSET_H_INCLUDED #define JUCE_SORTEDSET_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
Holds a set of unique primitive objects, such as ints or doubles. Holds a set of unique primitive objects, such as ints or doubles.
@@ -462,8 +464,6 @@ private:
Array<ElementType> data; Array<ElementType> data;
}; };
#if JUCE_MSVC
#pragma warning (pop)
#endif
}
#endif // JUCE_SORTEDSET_H_INCLUDED #endif // JUCE_SORTEDSET_H_INCLUDED

+ 4
- 0
source/modules/water/containers/juce_Variant.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
enum VariantStreamMarkers enum VariantStreamMarkers
{ {
varMarker_Int = 1, varMarker_Int = 1,
@@ -322,3 +324,5 @@ var var::clone() const noexcept
{ {
return type->clone (*this); return type->clone (*this);
} }
}

+ 9
- 7
source/modules/water/containers/juce_Variant.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_VARIANT_H_INCLUDED #ifndef JUCE_VARIANT_H_INCLUDED
#define JUCE_VARIANT_H_INCLUDED #define JUCE_VARIANT_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -45,7 +46,7 @@
@see JSON, DynamicObject @see JSON, DynamicObject
*/ */
class JUCE_API var
class var
{ {
public: public:
//============================================================================== //==============================================================================
@@ -151,13 +152,13 @@ private:
}; };
/** Compares the values of two var objects, using the var::equals() comparison. */ /** Compares the values of two var objects, using the var::equals() comparison. */
JUCE_API bool operator== (const var&, const var&) noexcept;
bool operator== (const var&, const var&) noexcept;
/** Compares the values of two var objects, using the var::equals() comparison. */ /** Compares the values of two var objects, using the var::equals() comparison. */
JUCE_API bool operator!= (const var&, const var&) noexcept;
JUCE_API bool operator== (const var&, const String&);
JUCE_API bool operator!= (const var&, const String&);
JUCE_API bool operator== (const var&, const char*);
JUCE_API bool operator!= (const var&, const char*);
bool operator!= (const var&, const var&) noexcept;
bool operator== (const var&, const String&);
bool operator!= (const var&, const String&);
bool operator== (const var&, const char*);
bool operator!= (const var&, const char*);
//============================================================================== //==============================================================================
/** This template-overloaded class can be used to convert between var and custom types. */ /** This template-overloaded class can be used to convert between var and custom types. */
@@ -176,5 +177,6 @@ struct VariantConverter<String>
static var toVar (const String& s) { return s; } static var toVar (const String& s) { return s; }
}; };
}
#endif // JUCE_VARIANT_H_INCLUDED #endif // JUCE_VARIANT_H_INCLUDED

+ 4
- 0
source/modules/water/files/juce_DirectoryIterator.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
DirectoryIterator::DirectoryIterator (const File& directory, bool recursive, DirectoryIterator::DirectoryIterator (const File& directory, bool recursive,
const String& pattern, const int type) const String& pattern, const int type)
: wildCards (parseWildcards (pattern)), : wildCards (parseWildcards (pattern)),
@@ -166,3 +168,5 @@ float DirectoryIterator::getEstimatedProgress() const
return detailedIndex / totalNumFiles; return detailedIndex / totalNumFiles;
} }
}

+ 4
- 1
source/modules/water/files/juce_DirectoryIterator.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_DIRECTORYITERATOR_H_INCLUDED #ifndef JUCE_DIRECTORYITERATOR_H_INCLUDED
#define JUCE_DIRECTORYITERATOR_H_INCLUDED #define JUCE_DIRECTORYITERATOR_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -45,7 +46,7 @@
It also provides an estimate of its progress, using a (highly inaccurate!) algorithm. It also provides an estimate of its progress, using a (highly inaccurate!) algorithm.
*/ */
class JUCE_API DirectoryIterator
class DirectoryIterator
{ {
public: public:
//============================================================================== //==============================================================================
@@ -156,4 +157,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryIterator) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryIterator)
}; };
}
#endif // JUCE_DIRECTORYITERATOR_H_INCLUDED #endif // JUCE_DIRECTORYITERATOR_H_INCLUDED

+ 5
- 1
source/modules/water/files/juce_File.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
File::File (const String& fullPathName) File::File (const String& fullPathName)
: fullPath (parseAbsolutePath (fullPathName)) : fullPath (parseAbsolutePath (fullPathName))
{ {
@@ -1091,7 +1093,7 @@ bool File::isSymbolicLink() const
return (GetFileAttributes (fullPath.toUTF8()) & FILE_ATTRIBUTE_REPARSE_POINT) != 0; return (GetFileAttributes (fullPath.toUTF8()) & FILE_ATTRIBUTE_REPARSE_POINT) != 0;
} }
File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type)
File File::getSpecialLocation (const SpecialLocationType type)
{ {
int csidlType = 0; int csidlType = 0;
@@ -1699,3 +1701,5 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound,
{ {
return pimpl->next (filenameFound, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly); return pimpl->next (filenameFound, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
} }
}

+ 6
- 8
source/modules/water/files/juce_File.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_FILE_H_INCLUDED #ifndef JUCE_FILE_H_INCLUDED
#define JUCE_FILE_H_INCLUDED #define JUCE_FILE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -44,7 +45,7 @@
@see FileInputStream, FileOutputStream @see FileInputStream, FileOutputStream
*/ */
class JUCE_API File
class File
{ {
public: public:
//============================================================================== //==============================================================================
@@ -788,7 +789,7 @@ public:
@see SpecialLocationType @see SpecialLocationType
*/ */
static File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
static File getSpecialLocation (const SpecialLocationType type);
//============================================================================== //==============================================================================
/** Returns a temporary file in the system's temp directory. /** Returns a temporary file in the system's temp directory.
@@ -883,7 +884,7 @@ public:
#endif #endif
//============================================================================== //==============================================================================
#if JUCE_MAC || JUCE_IOS || DOXYGEN
#if JUCE_MAC
/** OSX ONLY - Finds the OSType of a file from the its resources. */ /** OSX ONLY - Finds the OSType of a file from the its resources. */
OSType getMacOSType() const; OSType getMacOSType() const;
@@ -891,11 +892,6 @@ public:
bool isBundle() const; bool isBundle() const;
#endif #endif
#if JUCE_MAC || DOXYGEN
/** OSX ONLY - Adds this file to the OSX dock */
void addToDock() const;
#endif
//============================================================================== //==============================================================================
struct NaturalFileComparator struct NaturalFileComparator
{ {
@@ -933,4 +929,6 @@ private:
bool setFileExecutableInternal (bool) const; bool setFileExecutableInternal (bool) const;
}; };
}
#endif // JUCE_FILE_H_INCLUDED #endif // JUCE_FILE_H_INCLUDED

+ 4
- 0
source/modules/water/files/juce_FileOutputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
int64 juce_fileSetPosition (void* handle, int64 pos); int64 juce_fileSetPosition (void* handle, int64 pos);
//============================================================================== //==============================================================================
@@ -134,3 +136,5 @@ bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes)
return OutputStream::writeRepeatedByte (byte, numBytes); return OutputStream::writeRepeatedByte (byte, numBytes);
} }
}

+ 4
- 1
source/modules/water/files/juce_FileOutputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED #ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED
#define JUCE_FILEOUTPUTSTREAM_H_INCLUDED #define JUCE_FILEOUTPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see OutputStream, FileInputStream, File::createOutputStream @see OutputStream, FileInputStream, File::createOutputStream
*/ */
class JUCE_API FileOutputStream : public OutputStream
class FileOutputStream : public OutputStream
{ {
public: public:
//============================================================================== //==============================================================================
@@ -119,4 +120,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream)
}; };
}
#endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED #endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED

+ 4
- 0
source/modules/water/files/juce_TemporaryFile.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
static File createTempFile (const File& parentDirectory, String name, static File createTempFile (const File& parentDirectory, String name,
const String& suffix, const int optionFlags) const String& suffix, const int optionFlags)
{ {
@@ -117,3 +119,5 @@ bool TemporaryFile::deleteTemporaryFile() const
return false; return false;
} }
}

+ 4
- 1
source/modules/water/files/juce_TemporaryFile.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_TEMPORARYFILE_H_INCLUDED #ifndef JUCE_TEMPORARYFILE_H_INCLUDED
#define JUCE_TEMPORARYFILE_H_INCLUDED #define JUCE_TEMPORARYFILE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -70,7 +71,7 @@
@see File, FileOutputStream @see File, FileOutputStream
*/ */
class JUCE_API TemporaryFile
class TemporaryFile
{ {
public: public:
//============================================================================== //==============================================================================
@@ -168,4 +169,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryFile) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryFile)
}; };
}
#endif // JUCE_TEMPORARYFILE_H_INCLUDED #endif // JUCE_TEMPORARYFILE_H_INCLUDED

+ 4
- 1
source/modules/water/maths/juce_MathsFunctions.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_MATHSFUNCTIONS_H_INCLUDED #ifndef JUCE_MATHSFUNCTIONS_H_INCLUDED
#define JUCE_MATHSFUNCTIONS_H_INCLUDED #define JUCE_MATHSFUNCTIONS_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/* /*
This file sets up some handy mathematical typdefs and functions. This file sets up some handy mathematical typdefs and functions.
@@ -548,7 +550,8 @@ namespace TypeHelpers
template <> struct SmallestFloatType <double> { typedef double type; }; template <> struct SmallestFloatType <double> { typedef double type; };
} }
//============================================================================== //==============================================================================
}
#endif // JUCE_MATHSFUNCTIONS_H_INCLUDED #endif // JUCE_MATHSFUNCTIONS_H_INCLUDED

+ 2
- 59
source/modules/water/maths/juce_Random.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
Random::Random (const int64 seedValue) noexcept : seed (seedValue) Random::Random (const int64 seedValue) noexcept : seed (seedValue)
{ {
} }
@@ -56,11 +58,7 @@ void Random::setSeedRandomly()
static int64 globalSeed = 0; static int64 globalSeed = 0;
combineSeed (globalSeed ^ (int64) (pointer_sized_int) this); combineSeed (globalSeed ^ (int64) (pointer_sized_int) this);
#if 0
combineSeed (Time::getMillisecondCounter()); combineSeed (Time::getMillisecondCounter());
combineSeed (Time::getHighResolutionTicks());
combineSeed (Time::getHighResolutionTicksPerSecond());
#endif
combineSeed (Time::currentTimeMillis()); combineSeed (Time::currentTimeMillis());
globalSeed ^= seed; globalSeed ^= seed;
} }
@@ -85,13 +83,6 @@ int Random::nextInt (const int maxValue) noexcept
return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32); return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32);
} }
#if 0
int Random::nextInt (Range<int> range) noexcept
{
return range.getStart() + nextInt (range.getLength());
}
#endif
int64 Random::nextInt64() noexcept int64 Random::nextInt64() noexcept
{ {
return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt(); return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt();
@@ -112,52 +103,4 @@ double Random::nextDouble() noexcept
return static_cast<uint32> (nextInt()) / (std::numeric_limits<uint32>::max() + 1.0); return static_cast<uint32> (nextInt()) / (std::numeric_limits<uint32>::max() + 1.0);
} }
#if 0
BigInteger Random::nextLargeNumber (const BigInteger& maximumValue)
{
BigInteger n;
do
{
fillBitsRandomly (n, 0, maximumValue.getHighestBit() + 1);
}
while (n >= maximumValue);
return n;
}
void Random::fillBitsRandomly (void* const buffer, size_t bytes)
{
int* d = static_cast<int*> (buffer);
for (; bytes >= sizeof (int); bytes -= sizeof (int))
*d++ = nextInt();
if (bytes > 0)
{
const int lastBytes = nextInt();
memcpy (d, &lastBytes, bytes);
}
}
void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits)
{
arrayToChange.setBit (startBit + numBits - 1, true); // to force the array to pre-allocate space
while ((startBit & 31) != 0 && numBits > 0)
{
arrayToChange.setBit (startBit++, nextBool());
--numBits;
}
while (numBits >= 32)
{
arrayToChange.setBitRangeAsInt (startBit, 32, (unsigned int) nextInt());
startBit += 32;
numBits -= 32;
}
while (--numBits >= 0)
arrayToChange.setBit (startBit + numBits, nextBool());
} }
#endif

+ 3
- 21
source/modules/water/maths/juce_Random.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_RANDOM_H_INCLUDED #ifndef JUCE_RANDOM_H_INCLUDED
#define JUCE_RANDOM_H_INCLUDED #define JUCE_RANDOM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
You can create a Random object and use it to generate a sequence of random numbers. You can create a Random object and use it to generate a sequence of random numbers.
*/ */
class JUCE_API Random
class Random
{ {
public: public:
//============================================================================== //==============================================================================
@@ -71,13 +72,6 @@ public:
*/ */
int nextInt (int maxValue) noexcept; int nextInt (int maxValue) noexcept;
#if 0
/** Returns the next random number, limited to a given range.
@returns a random integer between the range start (inclusive) and its end (exclusive).
*/
int nextInt (Range<int> range) noexcept;
#endif
/** Returns the next 64-bit random number. /** Returns the next 64-bit random number.
@returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff @returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff
*/ */
@@ -96,19 +90,6 @@ public:
/** Returns the next random boolean value. */ /** Returns the next random boolean value. */
bool nextBool() noexcept; bool nextBool() noexcept;
#if 0
/** Returns a BigInteger containing a random number.
@returns a random value in the range 0 to (maximumValue - 1).
*/
BigInteger nextLargeNumber (const BigInteger& maximumValue);
/** Fills a block of memory with random values. */
void fillBitsRandomly (void* bufferToFill, size_t sizeInBytes);
/** Sets a range of bits in a BigInteger to random values. */
void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
#endif
//============================================================================== //==============================================================================
/** Resets this Random object to a given seed value. */ /** Resets this Random object to a given seed value. */
void setSeed (int64 newSeed) noexcept; void setSeed (int64 newSeed) noexcept;
@@ -145,5 +126,6 @@ private:
JUCE_LEAK_DETECTOR (Random) JUCE_LEAK_DETECTOR (Random)
}; };
}
#endif // JUCE_RANDOM_H_INCLUDED #endif // JUCE_RANDOM_H_INCLUDED

+ 3
- 0
source/modules/water/memory/juce_Atomic.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_ATOMIC_H_INCLUDED #ifndef JUCE_ATOMIC_H_INCLUDED
#define JUCE_ATOMIC_H_INCLUDED #define JUCE_ATOMIC_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -245,4 +246,6 @@ inline void Atomic<Type>::memoryBarrier() noexcept
__sync_synchronize(); __sync_synchronize();
} }
}
#endif // JUCE_ATOMIC_H_INCLUDED #endif // JUCE_ATOMIC_H_INCLUDED

+ 7
- 15
source/modules/water/memory/juce_ByteOrder.h View File

@@ -31,12 +31,13 @@
#ifndef JUCE_BYTEORDER_H_INCLUDED #ifndef JUCE_BYTEORDER_H_INCLUDED
#define JUCE_BYTEORDER_H_INCLUDED #define JUCE_BYTEORDER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** Contains static methods for converting the byte order between different /** Contains static methods for converting the byte order between different
endiannesses. endiannesses.
*/ */
class JUCE_API ByteOrder
class ByteOrder
{ {
public: public:
//============================================================================== //==============================================================================
@@ -142,10 +143,6 @@ private:
//============================================================================== //==============================================================================
#if JUCE_MSVC && ! defined (__INTEL_COMPILER)
#pragma intrinsic (_byteswap_ulong)
#endif
inline uint16 ByteOrder::swap (uint16 n) noexcept inline uint16 ByteOrder::swap (uint16 n) noexcept
{ {
return static_cast<uint16> ((n << 8) | (n >> 8)); return static_cast<uint16> ((n << 8) | (n >> 8));
@@ -153,15 +150,11 @@ inline uint16 ByteOrder::swap (uint16 n) noexcept
inline uint32 ByteOrder::swap (uint32 n) noexcept inline uint32 ByteOrder::swap (uint32 n) noexcept
{ {
#if JUCE_MAC || JUCE_IOS
#if JUCE_MAC
return OSSwapInt32 (n); return OSSwapInt32 (n);
#elif (JUCE_GCC || JUCE_CLANG) && JUCE_INTEL && ! JUCE_NO_INLINE_ASM
#elif JUCE_INTEL && ! JUCE_NO_INLINE_ASM
asm("bswap %%eax" : "=a"(n) : "a"(n)); asm("bswap %%eax" : "=a"(n) : "a"(n));
return n; return n;
#elif JUCE_MSVC
return _byteswap_ulong (n);
#elif JUCE_ANDROID
return bswap_32 (n);
#else #else
return (n << 24) | (n >> 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8); return (n << 24) | (n >> 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8);
#endif #endif
@@ -169,10 +162,8 @@ inline uint32 ByteOrder::swap (uint32 n) noexcept
inline uint64 ByteOrder::swap (uint64 value) noexcept inline uint64 ByteOrder::swap (uint64 value) noexcept
{ {
#if JUCE_MAC || JUCE_IOS
#if JUCE_MAC
return OSSwapInt64 (value); return OSSwapInt64 (value);
#elif JUCE_MSVC
return _byteswap_uint64 (value);
#else #else
return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32)); return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
#endif #endif
@@ -194,7 +185,7 @@ inline uint64 ByteOrder::swap (uint64 value) noexcept
inline int16 ByteOrder::swapIfLittleEndian (const int16 v) noexcept { return static_cast<int16> (swap (static_cast<uint16> (v))); } inline int16 ByteOrder::swapIfLittleEndian (const int16 v) noexcept { return static_cast<int16> (swap (static_cast<uint16> (v))); }
inline int32 ByteOrder::swapIfLittleEndian (const int32 v) noexcept { return static_cast<int32> (swap (static_cast<uint32> (v))); } inline int32 ByteOrder::swapIfLittleEndian (const int32 v) noexcept { return static_cast<int32> (swap (static_cast<uint32> (v))); }
inline int64 ByteOrder::swapIfLittleEndian (const int64 v) noexcept { return static_cast<int64> (swap (static_cast<uint64> (v))); } inline int64 ByteOrder::swapIfLittleEndian (const int64 v) noexcept { return static_cast<int64> (swap (static_cast<uint64> (v))); }
inline float ByteOrder::swapIfLittleEndian (const float v) noexcept { union { uint32 asUInt; float asFloat; } n; n.asFloat = v; n.asUInt = ByteOrder::swap (n.asUInt); return n.asFloat; }
inline float ByteOrder::swapIfLittleEndian (const float v) noexcept { union { uint32 asUInt; float asFloat; } n; n.asFloat = v; n.asUInt = ByteOrder::swap (n.asUInt); return n.asFloat; }
inline double ByteOrder::swapIfLittleEndian (const double v) noexcept { union { uint64 asUInt; double asFloat; } n; n.asFloat = v; n.asUInt = ByteOrder::swap (n.asUInt); return n.asFloat; } inline double ByteOrder::swapIfLittleEndian (const double v) noexcept { union { uint64 asUInt; double asFloat; } n; n.asFloat = v; n.asUInt = ByteOrder::swap (n.asUInt); return n.asFloat; }
inline uint32 ByteOrder::littleEndianInt (const void* const bytes) noexcept { return *static_cast<const uint32*> (bytes); } inline uint32 ByteOrder::littleEndianInt (const void* const bytes) noexcept { return *static_cast<const uint32*> (bytes); }
@@ -237,5 +228,6 @@ inline int ByteOrder::bigEndian24Bit (const void* const bytes) noexcept
inline void ByteOrder::littleEndian24BitToChars (const int value, void* const destBytes) noexcept { static_cast<uint8*> (destBytes)[0] = (uint8) value; static_cast<uint8*> (destBytes)[1] = (uint8) (value >> 8); static_cast<uint8*> (destBytes)[2] = (uint8) (value >> 16); } inline void ByteOrder::littleEndian24BitToChars (const int value, void* const destBytes) noexcept { static_cast<uint8*> (destBytes)[0] = (uint8) value; static_cast<uint8*> (destBytes)[1] = (uint8) (value >> 8); static_cast<uint8*> (destBytes)[2] = (uint8) (value >> 16); }
inline void ByteOrder::bigEndian24BitToChars (const int value, void* const destBytes) noexcept { static_cast<uint8*> (destBytes)[0] = (uint8) (value >> 16); static_cast<uint8*> (destBytes)[1] = (uint8) (value >> 8); static_cast<uint8*> (destBytes)[2] = (uint8) value; } inline void ByteOrder::bigEndian24BitToChars (const int value, void* const destBytes) noexcept { static_cast<uint8*> (destBytes)[0] = (uint8) (value >> 16); static_cast<uint8*> (destBytes)[1] = (uint8) (value >> 8); static_cast<uint8*> (destBytes)[2] = (uint8) value; }
}
#endif // JUCE_BYTEORDER_H_INCLUDED #endif // JUCE_BYTEORDER_H_INCLUDED

+ 3
- 0
source/modules/water/memory/juce_HeapBlock.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_HEAPBLOCK_H_INCLUDED #ifndef JUCE_HEAPBLOCK_H_INCLUDED
#define JUCE_HEAPBLOCK_H_INCLUDED #define JUCE_HEAPBLOCK_H_INCLUDED
namespace water {
#if ! (defined (DOXYGEN) || JUCE_EXCEPTIONS_DISABLED) #if ! (defined (DOXYGEN) || JUCE_EXCEPTIONS_DISABLED)
namespace HeapBlockHelper namespace HeapBlockHelper
{ {
@@ -310,5 +312,6 @@ private:
#endif #endif
}; };
}
#endif // JUCE_HEAPBLOCK_H_INCLUDED #endif // JUCE_HEAPBLOCK_H_INCLUDED

+ 7
- 3
source/modules/water/memory/juce_Memory.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_MEMORY_H_INCLUDED #ifndef JUCE_MEMORY_H_INCLUDED
#define JUCE_MEMORY_H_INCLUDED #define JUCE_MEMORY_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** Fills a block of memory with zeros. */ /** Fills a block of memory with zeros. */
inline void zeromem (void* memory, size_t numBytes) noexcept { memset (memory, 0, numBytes); } inline void zeromem (void* memory, size_t numBytes) noexcept { memset (memory, 0, numBytes); }
@@ -85,12 +87,12 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept
} }
//============================================================================== //==============================================================================
#if JUCE_MAC || JUCE_IOS || DOXYGEN
#if JUCE_MAC
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII. /** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
You should use the JUCE_AUTORELEASEPOOL macro to create a local auto-release pool on the stack. You should use the JUCE_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
*/ */
class JUCE_API ScopedAutoReleasePool
class ScopedAutoReleasePool
{ {
public: public:
ScopedAutoReleasePool(); ScopedAutoReleasePool();
@@ -107,7 +109,7 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept
Because this may use the \@autoreleasepool syntax, you must follow the macro with Because this may use the \@autoreleasepool syntax, you must follow the macro with
a set of braces to mark the scope of the pool. a set of braces to mark the scope of the pool.
*/ */
#if (JUCE_COMPILER_SUPPORTS_ARC && defined (__OBJC__)) || DOXYGEN
#if (JUCE_COMPILER_SUPPORTS_ARC && defined (__OBJC__))
#define JUCE_AUTORELEASEPOOL @autoreleasepool #define JUCE_AUTORELEASEPOOL @autoreleasepool
#else #else
#define JUCE_AUTORELEASEPOOL const water::ScopedAutoReleasePool JUCE_JOIN_MACRO (autoReleasePool_, __LINE__); #define JUCE_AUTORELEASEPOOL const water::ScopedAutoReleasePool JUCE_JOIN_MACRO (autoReleasePool_, __LINE__);
@@ -117,4 +119,6 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept
#define JUCE_AUTORELEASEPOOL #define JUCE_AUTORELEASEPOOL
#endif #endif
}
#endif // JUCE_MEMORY_H_INCLUDED #endif // JUCE_MEMORY_H_INCLUDED

+ 4
- 0
source/modules/water/memory/juce_MemoryBlock.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
MemoryBlock::MemoryBlock() noexcept MemoryBlock::MemoryBlock() noexcept
: size (0) : size (0)
{ {
@@ -416,3 +418,5 @@ bool MemoryBlock::fromBase64Encoding (StringRef s)
} }
} }
} }
}

+ 3
- 1
source/modules/water/memory/juce_MemoryBlock.h View File

@@ -31,13 +31,14 @@
#ifndef JUCE_MEMORYBLOCK_H_INCLUDED #ifndef JUCE_MEMORYBLOCK_H_INCLUDED
#define JUCE_MEMORYBLOCK_H_INCLUDED #define JUCE_MEMORYBLOCK_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
A class to hold a resizable block of raw data. A class to hold a resizable block of raw data.
*/ */
class JUCE_API MemoryBlock
class MemoryBlock
{ {
public: public:
//============================================================================== //==============================================================================
@@ -259,5 +260,6 @@ private:
JUCE_LEAK_DETECTOR (MemoryBlock) JUCE_LEAK_DETECTOR (MemoryBlock)
}; };
}
#endif // JUCE_MEMORYBLOCK_H_INCLUDED #endif // JUCE_MEMORYBLOCK_H_INCLUDED

+ 4
- 2
source/modules/water/memory/juce_ReferenceCountedObject.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED #ifndef JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED
#define JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED #define JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -64,7 +65,7 @@
@see ReferenceCountedObjectPtr, ReferenceCountedArray, SingleThreadedReferenceCountedObject @see ReferenceCountedObjectPtr, ReferenceCountedArray, SingleThreadedReferenceCountedObject
*/ */
class JUCE_API ReferenceCountedObject
class ReferenceCountedObject
{ {
public: public:
//============================================================================== //==============================================================================
@@ -142,7 +143,7 @@ private:
@see ReferenceCountedObject, ReferenceCountedObjectPtr, ReferenceCountedArray @see ReferenceCountedObject, ReferenceCountedObjectPtr, ReferenceCountedArray
*/ */
class JUCE_API SingleThreadedReferenceCountedObject
class SingleThreadedReferenceCountedObject
{ {
public: public:
//============================================================================== //==============================================================================
@@ -419,5 +420,6 @@ bool operator!= (ReferenceCountedObjectClass* object1, const ReferenceCountedObj
return object1 != object2.get(); return object1 != object2.get();
} }
}
#endif // JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED #endif // JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED

+ 2
- 0
source/modules/water/memory/juce_SharedResourcePointer.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED #ifndef JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED
#define JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED #define JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -164,5 +165,6 @@ private:
JUCE_LEAK_DETECTOR (SharedResourcePointer) JUCE_LEAK_DETECTOR (SharedResourcePointer)
}; };
}
#endif // JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED #endif // JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED

+ 4
- 0
source/modules/water/midi/juce_MidiBuffer.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
namespace MidiBufferHelpers namespace MidiBufferHelpers
{ {
inline int getEventTime (const void* const d) noexcept inline int getEventTime (const void* const d) noexcept
@@ -233,3 +235,5 @@ bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, int& samplePositio
return true; return true;
} }
}

+ 4
- 2
source/modules/water/midi/juce_MidiBuffer.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_MIDIBUFFER_H_INCLUDED #ifndef JUCE_MIDIBUFFER_H_INCLUDED
#define JUCE_MIDIBUFFER_H_INCLUDED #define JUCE_MIDIBUFFER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -46,7 +47,7 @@
@see MidiMessage @see MidiMessage
*/ */
class JUCE_API MidiBuffer
class MidiBuffer
{ {
public: public:
//============================================================================== //==============================================================================
@@ -174,7 +175,7 @@ public:
@see MidiBuffer @see MidiBuffer
*/ */
class JUCE_API Iterator
class Iterator
{ {
public: public:
//============================================================================== //==============================================================================
@@ -237,5 +238,6 @@ private:
JUCE_LEAK_DETECTOR (MidiBuffer) JUCE_LEAK_DETECTOR (MidiBuffer)
}; };
}
#endif // JUCE_MIDIBUFFER_H_INCLUDED #endif // JUCE_MIDIBUFFER_H_INCLUDED

+ 4
- 0
source/modules/water/midi/juce_MidiFile.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
namespace MidiFileHelpers namespace MidiFileHelpers
{ {
static void writeVariableLengthInt (OutputStream& out, unsigned int v) static void writeVariableLengthInt (OutputStream& out, unsigned int v)
@@ -451,3 +453,5 @@ bool MidiFile::writeTrack (OutputStream& mainOut, const int trackNum)
return true; return true;
} }
}

+ 3
- 1
source/modules/water/midi/juce_MidiFile.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_MIDIFILE_H_INCLUDED #ifndef JUCE_MIDIFILE_H_INCLUDED
#define JUCE_MIDIFILE_H_INCLUDED #define JUCE_MIDIFILE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -45,7 +46,7 @@
@see MidiMessageSequence @see MidiMessageSequence
*/ */
class JUCE_API MidiFile
class MidiFile
{ {
public: public:
//============================================================================== //==============================================================================
@@ -188,5 +189,6 @@ private:
JUCE_LEAK_DETECTOR (MidiFile) JUCE_LEAK_DETECTOR (MidiFile)
}; };
}
#endif // JUCE_MIDIFILE_H_INCLUDED #endif // JUCE_MIDIFILE_H_INCLUDED

+ 4
- 0
source/modules/water/midi/juce_MidiMessage.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
namespace MidiHelpers namespace MidiHelpers
{ {
inline uint8 initialByte (const int type, const int channel) noexcept inline uint8 initialByte (const int type, const int channel) noexcept
@@ -1148,3 +1150,5 @@ const char* MidiMessage::getControllerName (const int n)
return isPositiveAndBelow (n, numElementsInArray (names)) ? names[n] : nullptr; return isPositiveAndBelow (n, numElementsInArray (names)) ? names[n] : nullptr;
} }
}

+ 4
- 1
source/modules/water/midi/juce_MidiMessage.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_MIDIMESSAGE_H_INCLUDED #ifndef JUCE_MIDIMESSAGE_H_INCLUDED
#define JUCE_MIDIMESSAGE_H_INCLUDED #define JUCE_MIDIMESSAGE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see MidiMessageSequence, MidiOutput, MidiInput @see MidiMessageSequence, MidiOutput, MidiInput
*/ */
class JUCE_API MidiMessage
class MidiMessage
{ {
public: public:
//============================================================================== //==============================================================================
@@ -937,4 +938,6 @@ private:
uint8* allocateSpace (int); uint8* allocateSpace (int);
}; };
}
#endif // JUCE_MIDIMESSAGE_H_INCLUDED #endif // JUCE_MIDIMESSAGE_H_INCLUDED

+ 4
- 0
source/modules/water/midi/juce_MidiMessageSequence.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
MidiMessageSequence::MidiMessageSequence() MidiMessageSequence::MidiMessageSequence()
{ {
} }
@@ -340,3 +342,5 @@ MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm)
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() MidiMessageSequence::MidiEventHolder::~MidiEventHolder()
{ {
} }
}

+ 3
- 1
source/modules/water/midi/juce_MidiMessageSequence.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED #ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED
#define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED #define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -41,7 +42,7 @@
@see MidiMessage, MidiFile @see MidiMessage, MidiFile
*/ */
class JUCE_API MidiMessageSequence
class MidiMessageSequence
{ {
public: public:
//============================================================================== //==============================================================================
@@ -288,5 +289,6 @@ private:
JUCE_LEAK_DETECTOR (MidiMessageSequence) JUCE_LEAK_DETECTOR (MidiMessageSequence)
}; };
}
#endif // JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED #endif // JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED

+ 4
- 0
source/modules/water/misc/juce_Result.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
Result::Result() noexcept {} Result::Result() noexcept {}
Result::Result (const String& message) noexcept Result::Result (const String& message) noexcept
@@ -83,3 +85,5 @@ bool Result::wasOk() const noexcept { return errorMessage.isEmpty(); }
Result::operator bool() const noexcept { return errorMessage.isEmpty(); } Result::operator bool() const noexcept { return errorMessage.isEmpty(); }
bool Result::failed() const noexcept { return errorMessage.isNotEmpty(); } bool Result::failed() const noexcept { return errorMessage.isNotEmpty(); }
bool Result::operator!() const noexcept { return errorMessage.isNotEmpty(); } bool Result::operator!() const noexcept { return errorMessage.isNotEmpty(); }
}

+ 3
- 1
source/modules/water/misc/juce_Result.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_RESULT_H_INCLUDED #ifndef JUCE_RESULT_H_INCLUDED
#define JUCE_RESULT_H_INCLUDED #define JUCE_RESULT_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -60,7 +61,7 @@
} }
@endcode @endcode
*/ */
class JUCE_API Result
class Result
{ {
public: public:
//============================================================================== //==============================================================================
@@ -123,5 +124,6 @@ private:
operator void*() const; operator void*() const;
}; };
}
#endif // JUCE_RESULT_H_INCLUDED #endif // JUCE_RESULT_H_INCLUDED

+ 4
- 2
source/modules/water/processors/juce_AudioPlayHead.h View File

@@ -25,6 +25,7 @@
#ifndef JUCE_AUDIOPLAYHEAD_H_INCLUDED #ifndef JUCE_AUDIOPLAYHEAD_H_INCLUDED
#define JUCE_AUDIOPLAYHEAD_H_INCLUDED #define JUCE_AUDIOPLAYHEAD_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -36,7 +37,7 @@
@see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead @see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead
*/ */
class JUCE_API AudioPlayHead
class AudioPlayHead
{ {
protected: protected:
//============================================================================== //==============================================================================
@@ -61,7 +62,7 @@ public:
//============================================================================== //==============================================================================
/** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method. /** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method.
*/ */
struct JUCE_API CurrentPositionInfo
struct CurrentPositionInfo
{ {
/** The tempo in BPM */ /** The tempo in BPM */
double bpm; double bpm;
@@ -140,5 +141,6 @@ public:
virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
}; };
}
#endif // JUCE_AUDIOPLAYHEAD_H_INCLUDED #endif // JUCE_AUDIOPLAYHEAD_H_INCLUDED

+ 3
- 1
source/modules/water/processors/juce_AudioProcessor.cpp View File

@@ -22,7 +22,7 @@
============================================================================== ==============================================================================
*/ */
// #include "juce_AudioProcessor.h"
namespace water {
AudioProcessor::AudioProcessor() AudioProcessor::AudioProcessor()
{ {
@@ -122,3 +122,5 @@ void AudioPlayHead::CurrentPositionInfo::resetToDefault()
timeSigDenominator = 4; timeSigDenominator = 4;
bpm = 120; bpm = 120;
} }
}

+ 3
- 2
source/modules/water/processors/juce_AudioProcessor.h View File

@@ -25,7 +25,7 @@
#ifndef JUCE_AUDIOPROCESSOR_H_INCLUDED #ifndef JUCE_AUDIOPROCESSOR_H_INCLUDED
#define JUCE_AUDIOPROCESSOR_H_INCLUDED #define JUCE_AUDIOPROCESSOR_H_INCLUDED
// #include "juce_AudioPlayHead.h"
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -41,7 +41,7 @@
you should implement a global function called createPluginFilter() which creates you should implement a global function called createPluginFilter() which creates
and returns a new instance of your subclass. and returns a new instance of your subclass.
*/ */
class JUCE_API AudioProcessor
class AudioProcessor
{ {
protected: protected:
//============================================================================== //==============================================================================
@@ -377,5 +377,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessor)
}; };
}
#endif // JUCE_AUDIOPROCESSOR_H_INCLUDED #endif // JUCE_AUDIOPROCESSOR_H_INCLUDED

+ 3
- 1
source/modules/water/processors/juce_AudioProcessorGraph.cpp View File

@@ -22,7 +22,7 @@
============================================================================== ==============================================================================
*/ */
#include "juce_AudioProcessorGraph.h"
namespace water {
const int AudioProcessorGraph::midiChannelIndex = 0x1000; const int AudioProcessorGraph::midiChannelIndex = 0x1000;
@@ -1540,3 +1540,5 @@ void AudioProcessorGraph::AudioGraphIOProcessor::setParentGraph (AudioProcessorG
getBlockSize()); getBlockSize());
} }
} }
}

+ 6
- 5
source/modules/water/processors/juce_AudioProcessorGraph.h View File

@@ -25,7 +25,7 @@
#ifndef JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED #ifndef JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED
#define JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED #define JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED
#include "juce_AudioProcessor.h"
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -41,7 +41,7 @@
To play back a graph through an audio device, you might want to use an To play back a graph through an audio device, you might want to use an
AudioProcessorPlayer object. AudioProcessorPlayer object.
*/ */
class JUCE_API AudioProcessorGraph : public AudioProcessor
class AudioProcessorGraph : public AudioProcessor
/* private AsyncUpdater*/ /* private AsyncUpdater*/
{ {
public: public:
@@ -59,7 +59,7 @@ public:
To create a node, call AudioProcessorGraph::addNode(). To create a node, call AudioProcessorGraph::addNode().
*/ */
class JUCE_API Node : public ReferenceCountedObject
class Node : public ReferenceCountedObject
{ {
public: public:
//============================================================================== //==============================================================================
@@ -104,7 +104,7 @@ public:
To create a connection, use AudioProcessorGraph::addConnection(). To create a connection, use AudioProcessorGraph::addConnection().
*/ */
struct JUCE_API Connection
struct Connection
{ {
public: public:
//============================================================================== //==============================================================================
@@ -273,7 +273,7 @@ public:
@see AudioProcessorGraph @see AudioProcessorGraph
*/ */
class JUCE_API AudioGraphIOProcessor : public AudioProcessor
class AudioGraphIOProcessor : public AudioProcessor
{ {
public: public:
/** Specifies the mode in which this processor will operate. /** Specifies the mode in which this processor will operate.
@@ -378,5 +378,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph)
}; };
}
#endif // JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED #endif // JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED

+ 4
- 0
source/modules/water/streams/juce_FileInputSource.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
FileInputSource::FileInputSource (const File& f, bool useFileTimeInHash) FileInputSource::FileInputSource (const File& f, bool useFileTimeInHash)
: file (f), useFileTimeInHashGeneration (useFileTimeInHash) : file (f), useFileTimeInHashGeneration (useFileTimeInHash)
{ {
@@ -58,3 +60,5 @@ int64 FileInputSource::hashCode() const
return h; return h;
} }
#endif #endif
}

+ 3
- 1
source/modules/water/streams/juce_FileInputSource.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_FILEINPUTSOURCE_H_INCLUDED #ifndef JUCE_FILEINPUTSOURCE_H_INCLUDED
#define JUCE_FILEINPUTSOURCE_H_INCLUDED #define JUCE_FILEINPUTSOURCE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see InputSource @see InputSource
*/ */
class JUCE_API FileInputSource : public InputSource
class FileInputSource : public InputSource
{ {
public: public:
//============================================================================== //==============================================================================
@@ -64,5 +65,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputSource) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputSource)
}; };
}
#endif // JUCE_FILEINPUTSOURCE_H_INCLUDED #endif // JUCE_FILEINPUTSOURCE_H_INCLUDED

+ 4
- 0
source/modules/water/streams/juce_FileInputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
int64 juce_fileSetPosition (void* handle, int64 pos); int64 juce_fileSetPosition (void* handle, int64 pos);
@@ -150,3 +152,5 @@ size_t FileInputStream::readInternal (void* const buffer, const size_t numBytes)
return (size_t) result; return (size_t) result;
} }
#endif #endif
}

+ 3
- 1
source/modules/water/streams/juce_FileInputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_FILEINPUTSTREAM_H_INCLUDED #ifndef JUCE_FILEINPUTSTREAM_H_INCLUDED
#define JUCE_FILEINPUTSTREAM_H_INCLUDED #define JUCE_FILEINPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see InputStream, FileOutputStream, File::createInputStream @see InputStream, FileOutputStream, File::createInputStream
*/ */
class JUCE_API FileInputStream : public InputStream
class FileInputStream : public InputStream
{ {
public: public:
//============================================================================== //==============================================================================
@@ -94,5 +95,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputStream) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputStream)
}; };
}
#endif // JUCE_FILEINPUTSTREAM_H_INCLUDED #endif // JUCE_FILEINPUTSTREAM_H_INCLUDED

+ 4
- 0
source/modules/water/streams/juce_FileOutputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
int64 juce_fileSetPosition (void* handle, int64 pos); int64 juce_fileSetPosition (void* handle, int64 pos);
//============================================================================== //==============================================================================
@@ -253,3 +255,5 @@ void FileOutputStream::flushInternal()
} }
} }
#endif #endif
}

+ 4
- 1
source/modules/water/streams/juce_FileOutputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED #ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED
#define JUCE_FILEOUTPUTSTREAM_H_INCLUDED #define JUCE_FILEOUTPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see OutputStream, FileInputStream, File::createOutputStream @see OutputStream, FileInputStream, File::createOutputStream
*/ */
class JUCE_API FileOutputStream : public OutputStream
class FileOutputStream : public OutputStream
{ {
public: public:
//============================================================================== //==============================================================================
@@ -119,4 +120,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream)
}; };
}
#endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED #endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED

+ 3
- 1
source/modules/water/streams/juce_InputSource.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_INPUTSOURCE_H_INCLUDED #ifndef JUCE_INPUTSOURCE_H_INCLUDED
#define JUCE_INPUTSOURCE_H_INCLUDED #define JUCE_INPUTSOURCE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -41,7 +42,7 @@
@see FileInputSource @see FileInputSource
*/ */
class JUCE_API InputSource
class InputSource
{ {
public: public:
//============================================================================== //==============================================================================
@@ -77,5 +78,6 @@ private:
JUCE_LEAK_DETECTOR (InputSource) JUCE_LEAK_DETECTOR (InputSource)
}; };
}
#endif // JUCE_INPUTSOURCE_H_INCLUDED #endif // JUCE_INPUTSOURCE_H_INCLUDED

+ 4
- 0
source/modules/water/streams/juce_InputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
int64 InputStream::getNumBytesRemaining() int64 InputStream::getNumBytesRemaining()
{ {
int64 len = getTotalLength(); int64 len = getTotalLength();
@@ -236,3 +238,5 @@ void InputStream::skipNextBytes (int64 numBytesToSkip)
numBytesToSkip -= read (temp, (int) jmin (numBytesToSkip, (int64) skipBufferSize)); numBytesToSkip -= read (temp, (int) jmin (numBytesToSkip, (int64) skipBufferSize));
} }
} }
}

+ 4
- 1
source/modules/water/streams/juce_InputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_INPUTSTREAM_H_INCLUDED #ifndef JUCE_INPUTSTREAM_H_INCLUDED
#define JUCE_INPUTSTREAM_H_INCLUDED #define JUCE_INPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** The base class for streams that read data. /** The base class for streams that read data.
@@ -40,7 +41,7 @@
@see OutputStream, MemoryInputStream, BufferedInputStream, FileInputStream @see OutputStream, MemoryInputStream, BufferedInputStream, FileInputStream
*/ */
class JUCE_API InputStream
class InputStream
{ {
public: public:
/** Destructor. */ /** Destructor. */
@@ -265,4 +266,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InputStream) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InputStream)
}; };
}
#endif // JUCE_INPUTSTREAM_H_INCLUDED #endif // JUCE_INPUTSTREAM_H_INCLUDED

+ 5
- 1
source/modules/water/streams/juce_MemoryOutputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
MemoryOutputStream::MemoryOutputStream (const size_t initialSize) MemoryOutputStream::MemoryOutputStream (const size_t initialSize)
: blockToUse (&internalBlock), externalData (nullptr), : blockToUse (&internalBlock), externalData (nullptr),
position (0), size (0), availableSize (0) position (0), size (0), availableSize (0)
@@ -205,7 +207,7 @@ String MemoryOutputStream::toString() const
return String::createStringFromData (getData(), (int) getDataSize()); return String::createStringFromData (getData(), (int) getDataSize());
} }
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryOutputStream& streamToRead)
OutputStream& operator<< (OutputStream& stream, const MemoryOutputStream& streamToRead)
{ {
const size_t dataSize = streamToRead.getDataSize(); const size_t dataSize = streamToRead.getDataSize();
@@ -214,3 +216,5 @@ OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryOutput
return stream; return stream;
} }
}

+ 4
- 2
source/modules/water/streams/juce_MemoryOutputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED #ifndef JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED
#define JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED #define JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -39,7 +40,7 @@
The data that was written into the stream can then be accessed later as The data that was written into the stream can then be accessed later as
a contiguous block of memory. a contiguous block of memory.
*/ */
class JUCE_API MemoryOutputStream : public OutputStream
class MemoryOutputStream : public OutputStream
{ {
public: public:
//============================================================================== //==============================================================================
@@ -135,7 +136,8 @@ private:
}; };
/** Copies all the data that has been written to a MemoryOutputStream into another stream. */ /** Copies all the data that has been written to a MemoryOutputStream into another stream. */
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryOutputStream& streamToRead);
OutputStream& operator<< (OutputStream& stream, const MemoryOutputStream& streamToRead);
}
#endif // JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED #endif // JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED

+ 13
- 9
source/modules/water/streams/juce_OutputStream.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
#if JUCE_DEBUG #if JUCE_DEBUG
struct DanglingStreamChecker struct DanglingStreamChecker
@@ -285,36 +287,36 @@ static void writeIntToStream (OutputStream& stream, IntegerType number)
stream.write (start, (size_t) (end - start - 1)); stream.write (start, (size_t) (end - start - 1));
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const int number)
OutputStream& operator<< (OutputStream& stream, const int number)
{ {
writeIntToStream (stream, number); writeIntToStream (stream, number);
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const int64 number)
OutputStream& operator<< (OutputStream& stream, const int64 number)
{ {
writeIntToStream (stream, number); writeIntToStream (stream, number);
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const double number)
OutputStream& operator<< (OutputStream& stream, const double number)
{ {
return stream << String (number); return stream << String (number);
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char character)
OutputStream& operator<< (OutputStream& stream, const char character)
{ {
stream.writeByte (character); stream.writeByte (character);
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* const text)
OutputStream& operator<< (OutputStream& stream, const char* const text)
{ {
stream.write (text, strlen (text)); stream.write (text, strlen (text));
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data)
OutputStream& operator<< (OutputStream& stream, const MemoryBlock& data)
{ {
if (data.getSize() > 0) if (data.getSize() > 0)
stream.write (data.getData(), data.getSize()); stream.write (data.getData(), data.getSize());
@@ -322,7 +324,7 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Mem
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileToRead)
OutputStream& operator<< (OutputStream& stream, const File& fileToRead)
{ {
FileInputStream in (fileToRead); FileInputStream in (fileToRead);
@@ -332,13 +334,15 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Fil
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, InputStream& streamToRead)
OutputStream& operator<< (OutputStream& stream, InputStream& streamToRead)
{ {
stream.writeFromInputStream (streamToRead, -1); stream.writeFromInputStream (streamToRead, -1);
return stream; return stream;
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const NewLine&)
OutputStream& operator<< (OutputStream& stream, const NewLine&)
{ {
return stream << stream.getNewLineString(); return stream << stream.getNewLineString();
} }
}

+ 12
- 10
source/modules/water/streams/juce_OutputStream.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_OUTPUTSTREAM_H_INCLUDED #ifndef JUCE_OUTPUTSTREAM_H_INCLUDED
#define JUCE_OUTPUTSTREAM_H_INCLUDED #define JUCE_OUTPUTSTREAM_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -41,7 +42,7 @@
@see InputStream, MemoryOutputStream, FileOutputStream @see InputStream, MemoryOutputStream, FileOutputStream
*/ */
class JUCE_API OutputStream
class OutputStream
{ {
protected: protected:
//============================================================================== //==============================================================================
@@ -243,28 +244,28 @@ private:
//============================================================================== //==============================================================================
/** Writes a number to a stream as 8-bit characters in the default system encoding. */ /** Writes a number to a stream as 8-bit characters in the default system encoding. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
OutputStream& operator<< (OutputStream& stream, int number);
/** Writes a number to a stream as 8-bit characters in the default system encoding. */ /** Writes a number to a stream as 8-bit characters in the default system encoding. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int64 number);
OutputStream& operator<< (OutputStream& stream, int64 number);
/** Writes a number to a stream as 8-bit characters in the default system encoding. */ /** Writes a number to a stream as 8-bit characters in the default system encoding. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
OutputStream& operator<< (OutputStream& stream, double number);
/** Writes a character to a stream. */ /** Writes a character to a stream. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
OutputStream& operator<< (OutputStream& stream, char character);
/** Writes a null-terminated text string to a stream. */ /** Writes a null-terminated text string to a stream. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
OutputStream& operator<< (OutputStream& stream, const char* text);
/** Writes a block of data from a MemoryBlock to a stream. */ /** Writes a block of data from a MemoryBlock to a stream. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data);
OutputStream& operator<< (OutputStream& stream, const MemoryBlock& data);
/** Writes the contents of a file to a stream. */ /** Writes the contents of a file to a stream. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileToRead);
OutputStream& operator<< (OutputStream& stream, const File& fileToRead);
/** Writes the complete contents of an input stream to an output stream. */ /** Writes the complete contents of an input stream to an output stream. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, InputStream& streamToRead);
OutputStream& operator<< (OutputStream& stream, InputStream& streamToRead);
/** Writes a new-line to a stream. /** Writes a new-line to a stream.
You can use the predefined symbol 'newLine' to invoke this, e.g. You can use the predefined symbol 'newLine' to invoke this, e.g.
@@ -273,7 +274,8 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, InputStre
@endcode @endcode
@see OutputStream::setNewLineString @see OutputStream::setNewLineString
*/ */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const NewLine&);
OutputStream& operator<< (OutputStream& stream, const NewLine&);
}
#endif // JUCE_OUTPUTSTREAM_H_INCLUDED #endif // JUCE_OUTPUTSTREAM_H_INCLUDED

+ 4
- 0
source/modules/water/text/juce_CharPointer_UTF8.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_CHARPOINTER_UTF8_H_INCLUDED #ifndef JUCE_CHARPOINTER_UTF8_H_INCLUDED
#define JUCE_CHARPOINTER_UTF8_H_INCLUDED #define JUCE_CHARPOINTER_UTF8_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
Wraps a pointer to a null-terminated UTF-8 character string, and provides Wraps a pointer to a null-terminated UTF-8 character string, and provides
@@ -566,4 +568,6 @@ private:
CharType* data; CharType* data;
}; };
}
#endif // JUCE_CHARPOINTER_UTF8_H_INCLUDED #endif // JUCE_CHARPOINTER_UTF8_H_INCLUDED

+ 4
- 0
source/modules/water/text/juce_CharacterFunctions.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
//============================================================================== //==============================================================================
juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) noexcept juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) noexcept
@@ -169,3 +171,5 @@ juce_wchar CharacterFunctions::getUnicodeCharFromWindows1252Codepage (const uint
return (juce_wchar) lookup[c - 0x80]; return (juce_wchar) lookup[c - 0x80];
} }
}

+ 4
- 1
source/modules/water/text/juce_CharacterFunctions.h View File

@@ -34,6 +34,8 @@
/** This macro will be set to 1 if the compiler's native wchar_t is an 8-bit type. */ /** This macro will be set to 1 if the compiler's native wchar_t is an 8-bit type. */
#define JUCE_NATIVE_WCHAR_IS_UTF8 1 #define JUCE_NATIVE_WCHAR_IS_UTF8 1
namespace water {
/** A platform-independent 32-bit unicode character type. */ /** A platform-independent 32-bit unicode character type. */
typedef uint32 juce_wchar; typedef uint32 juce_wchar;
@@ -46,7 +48,7 @@ typedef uint32 juce_wchar;
@see String, CharPointer_UTF8, CharPointer_UTF16, CharPointer_UTF32 @see String, CharPointer_UTF8, CharPointer_UTF16, CharPointer_UTF32
*/ */
class JUCE_API CharacterFunctions
class CharacterFunctions
{ {
public: public:
//============================================================================== //==============================================================================
@@ -616,5 +618,6 @@ private:
static double mulexp10 (const double value, int exponent) noexcept; static double mulexp10 (const double value, int exponent) noexcept;
}; };
}
#endif // JUCE_CHARACTERFUNCTIONS_H_INCLUDED #endif // JUCE_CHARACTERFUNCTIONS_H_INCLUDED

+ 4
- 0
source/modules/water/text/juce_Identifier.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
Identifier::Identifier() noexcept {} Identifier::Identifier() noexcept {}
Identifier::~Identifier() noexcept {} Identifier::~Identifier() noexcept {}
@@ -77,3 +79,5 @@ bool Identifier::isValidIdentifier (const String& possibleIdentifier) noexcept
return possibleIdentifier.isNotEmpty() return possibleIdentifier.isNotEmpty()
&& possibleIdentifier.containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-:#@$%"); && possibleIdentifier.containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-:#@$%");
} }
}

+ 3
- 1
source/modules/water/text/juce_Identifier.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_IDENTIFIER_H_INCLUDED #ifndef JUCE_IDENTIFIER_H_INCLUDED
#define JUCE_IDENTIFIER_H_INCLUDED #define JUCE_IDENTIFIER_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -42,7 +43,7 @@
@see NamedValueSet, ValueTree @see NamedValueSet, ValueTree
*/ */
class JUCE_API Identifier
class Identifier
{ {
public: public:
/** Creates a null identifier. */ /** Creates a null identifier. */
@@ -138,5 +139,6 @@ private:
String name; String name;
}; };
}
#endif // JUCE_IDENTIFIER_H_INCLUDED #endif // JUCE_IDENTIFIER_H_INCLUDED

+ 3
- 1
source/modules/water/text/juce_NewLine.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_NEWLINE_H_INCLUDED #ifndef JUCE_NEWLINE_H_INCLUDED
#define JUCE_NEWLINE_H_INCLUDED #define JUCE_NEWLINE_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** This class is used for represent a new-line character sequence. /** This class is used for represent a new-line character sequence.
@@ -43,7 +44,7 @@
The exact character sequence that will be used for the new-line can be set and The exact character sequence that will be used for the new-line can be set and
retrieved with OutputStream::setNewLineString() and OutputStream::getNewLineString(). retrieved with OutputStream::setNewLineString() and OutputStream::getNewLineString().
*/ */
class JUCE_API NewLine
class NewLine
{ {
public: public:
/** Returns the default new-line sequence that the library uses. /** Returns the default new-line sequence that the library uses.
@@ -86,5 +87,6 @@ inline String operator+ (const NewLine&, const NewLine&) { return String (New
inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); } inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); }
inline String operator+ (const NewLine&, const char* s2) { return String (NewLine::getDefault()) + s2; } inline String operator+ (const NewLine&, const char* s2) { return String (NewLine::getDefault()) + s2; }
}
#endif // JUCE_NEWLINE_H_INCLUDED #endif // JUCE_NEWLINE_H_INCLUDED

+ 42
- 43
source/modules/water/text/juce_String.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
NewLine newLine; NewLine newLine;
//============================================================================== //==============================================================================
@@ -535,18 +537,18 @@ int64 String::hashCode64() const noexcept { return HashGenerator<int64> ::cal
size_t String::hash() const noexcept { return HashGenerator<size_t> ::calculate (text); } size_t String::hash() const noexcept { return HashGenerator<size_t> ::calculate (text); }
//============================================================================== //==============================================================================
JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* s2) noexcept { return s1.compare (s2) == 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* s2) noexcept { return s1.compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) == 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) != 0; }
JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; }
JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; }
JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; }
JUCE_API bool JUCE_CALLTYPE operator<= (const String& s1, const String& s2) noexcept { return s1.compare (s2) <= 0; }
bool operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; }
bool operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; }
bool operator== (const String& s1, const char* s2) noexcept { return s1.compare (s2) == 0; }
bool operator!= (const String& s1, const char* s2) noexcept { return s1.compare (s2) != 0; }
bool operator== (const String& s1, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) == 0; }
bool operator!= (const String& s1, StringRef s2) noexcept { return s1.getCharPointer().compare (s2.text) != 0; }
bool operator== (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
bool operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
bool operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; }
bool operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; }
bool operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; }
bool operator<= (const String& s1, const String& s2) noexcept { return s1.compare (s2) <= 0; }
bool String::equalsIgnoreCase (const char* const t) const noexcept bool String::equalsIgnoreCase (const char* const t) const noexcept
{ {
@@ -753,37 +755,37 @@ String& String::operator+= (const int64 number) { return StringHelpers::o
String& String::operator+= (const uint64 number) { return StringHelpers::operationAddAssign<uint64> (*this, number); } String& String::operator+= (const uint64 number) { return StringHelpers::operationAddAssign<uint64> (*this, number); }
//============================================================================== //==============================================================================
JUCE_API String JUCE_CALLTYPE operator+ (const char* const s1, const String& s2) { String s (s1); return s += s2; }
JUCE_API String JUCE_CALLTYPE operator+ (const char s1, const String& s2) { return String::charToString ((juce_wchar) (uint8) s1) + s2; }
JUCE_API String JUCE_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; }
JUCE_API String JUCE_CALLTYPE operator+ (String s1, const char* const s2) { return s1 += s2; }
JUCE_API String JUCE_CALLTYPE operator+ (String s1, const char s2) { return s1 += s2; }
JUCE_API String JUCE_CALLTYPE operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; }
JUCE_API String JUCE_CALLTYPE operator+ (String s1, const juce_wchar s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const juce_wchar s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const char s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const char* const s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const String& s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, StringRef s2) { return s1 += s2; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const int number) { return s1 += number; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const short number) { return s1 += (int) number; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const unsigned short number) { return s1 += (uint64) number; }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const long number) { return s1 += String (number); }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const unsigned long number) { return s1 += String (number); }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const int64 number) { return s1 += String (number); }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const uint64 number) { return s1 += String (number); }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const float number) { return s1 += String (number); }
JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const double number) { return s1 += String (number); }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text)
String operator+ (const char* const s1, const String& s2) { String s (s1); return s += s2; }
String operator+ (const char s1, const String& s2) { return String::charToString ((juce_wchar) (uint8) s1) + s2; }
String operator+ (String s1, const String& s2) { return s1 += s2; }
String operator+ (String s1, const char* const s2) { return s1 += s2; }
String operator+ (String s1, const char s2) { return s1 += s2; }
String operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; }
String operator+ (String s1, const juce_wchar s2) { return s1 += s2; }
String& operator<< (String& s1, const juce_wchar s2) { return s1 += s2; }
String& operator<< (String& s1, const char s2) { return s1 += s2; }
String& operator<< (String& s1, const char* const s2) { return s1 += s2; }
String& operator<< (String& s1, const String& s2) { return s1 += s2; }
String& operator<< (String& s1, StringRef s2) { return s1 += s2; }
String& operator<< (String& s1, const int number) { return s1 += number; }
String& operator<< (String& s1, const short number) { return s1 += (int) number; }
String& operator<< (String& s1, const unsigned short number) { return s1 += (uint64) number; }
String& operator<< (String& s1, const long number) { return s1 += String (number); }
String& operator<< (String& s1, const unsigned long number) { return s1 += String (number); }
String& operator<< (String& s1, const int64 number) { return s1 += String (number); }
String& operator<< (String& s1, const uint64 number) { return s1 += String (number); }
String& operator<< (String& s1, const float number) { return s1 += String (number); }
String& operator<< (String& s1, const double number) { return s1 += String (number); }
OutputStream& operator<< (OutputStream& stream, const String& text)
{ {
return operator<< (stream, StringRef (text)); return operator<< (stream, StringRef (text));
} }
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef text)
OutputStream& operator<< (OutputStream& stream, StringRef text)
{ {
const size_t numBytes = CharPointer_UTF8::getBytesRequiredFor (text.text); const size_t numBytes = CharPointer_UTF8::getBytesRequiredFor (text.text);
@@ -1977,10 +1979,6 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
return String(); return String();
} }
#if JUCE_MSVC
#pragma warning (pop)
#endif
//============================================================================== //==============================================================================
StringRef::StringRef() noexcept : text ((const String::CharPointerType::CharType*) "\0\0\0") StringRef::StringRef() noexcept : text ((const String::CharPointerType::CharType*) "\0\0\0")
{ {
@@ -2014,5 +2012,6 @@ StringRef::StringRef (String::CharPointerType stringLiteral) noexcept : text (s
StringRef::StringRef (const String& string) noexcept : text (string.getCharPointer()) {} StringRef::StringRef (const String& string) noexcept : text (string.getCharPointer()) {}
}
//============================================================================== //==============================================================================

+ 36
- 34
source/modules/water/text/juce_String.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_STRING_H_INCLUDED #ifndef JUCE_STRING_H_INCLUDED
#define JUCE_STRING_H_INCLUDED #define JUCE_STRING_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -42,7 +43,7 @@
@see StringArray, StringPairArray @see StringArray, StringPairArray
*/ */
class JUCE_API String
class String
{ {
public: public:
//============================================================================== //==============================================================================
@@ -1064,7 +1065,7 @@ public:
void swapWith (String& other) noexcept; void swapWith (String& other) noexcept;
//============================================================================== //==============================================================================
#if JUCE_MAC || JUCE_IOS || DOXYGEN
#if JUCE_MAC
/** OSX ONLY - Creates a String from an OSX CFString. */ /** OSX ONLY - Creates a String from an OSX CFString. */
static String fromCFString (CFStringRef cfString); static String fromCFString (CFStringRef cfString);
@@ -1101,88 +1102,89 @@ private:
//============================================================================== //==============================================================================
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
String operator+ (const char* string1, const String& string2);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (char string1, const String& string2);
String operator+ (char string1, const String& string2);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
String operator+ (juce_wchar string1, const String& string2);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const String& string2);
String operator+ (String string1, const String& string2);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const char* string2);
String operator+ (String string1, const char* string2);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
String operator+ (String string1, char characterToAppend);
/** Concatenates two strings. */ /** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
String operator+ (String string1, juce_wchar characterToAppend);
//============================================================================== //==============================================================================
/** Appends a character at the end of a string. */ /** Appends a character at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
String& operator<< (String& string1, char characterToAppend);
/** Appends a character at the end of a string. */ /** Appends a character at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
String& operator<< (String& string1, juce_wchar characterToAppend);
/** Appends a string to the end of the first one. */ /** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
String& operator<< (String& string1, const char* string2);
/** Appends a string to the end of the first one. */ /** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
String& operator<< (String& string1, const String& string2);
/** Appends a string to the end of the first one. */ /** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, StringRef string2);
String& operator<< (String& string1, StringRef string2);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, short number);
String& operator<< (String& string1, short number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, int number);
String& operator<< (String& string1, int number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, long number);
String& operator<< (String& string1, long number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, int64 number);
String& operator<< (String& string1, int64 number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, uint64 number);
String& operator<< (String& string1, uint64 number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, float number);
String& operator<< (String& string1, float number);
/** Appends a decimal number at the end of a string. */ /** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, double number);
String& operator<< (String& string1, double number);
//============================================================================== //==============================================================================
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) noexcept;
bool operator== (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) noexcept;
bool operator== (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8 string2) noexcept;
bool operator== (const String& string1, const CharPointer_UTF8 string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept;
bool operator!= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) noexcept;
bool operator!= (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8 string2) noexcept;
bool operator!= (const String& string1, const CharPointer_UTF8 string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept;
bool operator> (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) noexcept;
bool operator< (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) noexcept;
bool operator>= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) noexcept;
bool operator<= (const String& string1, const String& string2) noexcept;
//============================================================================== //==============================================================================
/** This operator allows you to write a juce String directly to std output streams. /** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc. This is handy for writing strings to std::cout, std::cerr, etc.
*/ */
template <class traits> template <class traits>
std::basic_ostream <char, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <char, traits>& stream, const String& stringToWrite)
std::basic_ostream <char, traits>& operator<< (std::basic_ostream <char, traits>& stream, const String& stringToWrite)
{ {
return stream << stringToWrite.toRawUTF8(); return stream << stringToWrite.toRawUTF8();
} }
/** Writes a string to an OutputStream as UTF8. */ /** Writes a string to an OutputStream as UTF8. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& stringToWrite);
OutputStream& operator<< (OutputStream& stream, const String& stringToWrite);
/** Writes a string to an OutputStream as UTF8. */ /** Writes a string to an OutputStream as UTF8. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef stringToWrite);
OutputStream& operator<< (OutputStream& stream, StringRef stringToWrite);
}
#endif // JUCE_STRING_H_INCLUDED #endif // JUCE_STRING_H_INCLUDED

+ 4
- 0
source/modules/water/text/juce_StringArray.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
StringArray::StringArray() noexcept StringArray::StringArray() noexcept
{ {
} }
@@ -492,3 +494,5 @@ void StringArray::minimiseStorageOverheads()
{ {
strings.minimiseStorageOverheads(); strings.minimiseStorageOverheads();
} }
}

+ 3
- 1
source/modules/water/text/juce_StringArray.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_STRINGARRAY_H_INCLUDED #ifndef JUCE_STRINGARRAY_H_INCLUDED
#define JUCE_STRINGARRAY_H_INCLUDED #define JUCE_STRINGARRAY_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -38,7 +39,7 @@
@see String, StringPairArray @see String, StringPairArray
*/ */
class JUCE_API StringArray
class StringArray
{ {
public: public:
//============================================================================== //==============================================================================
@@ -424,5 +425,6 @@ private:
JUCE_LEAK_DETECTOR (StringArray) JUCE_LEAK_DETECTOR (StringArray)
}; };
}
#endif // JUCE_STRINGARRAY_H_INCLUDED #endif // JUCE_STRINGARRAY_H_INCLUDED

+ 4
- 0
source/modules/water/text/juce_StringPool.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
static const int minNumberOfStringsForGarbageCollection = 300; static const int minNumberOfStringsForGarbageCollection = 300;
static const uint32 garbageCollectionInterval = 30000; static const uint32 garbageCollectionInterval = 30000;
@@ -166,3 +168,5 @@ StringPool& StringPool::getGlobalPool() noexcept
static StringPool pool; static StringPool pool;
return pool; return pool;
} }
}

+ 3
- 1
source/modules/water/text/juce_StringPool.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_STRINGPOOL_H_INCLUDED #ifndef JUCE_STRINGPOOL_H_INCLUDED
#define JUCE_STRINGPOOL_H_INCLUDED #define JUCE_STRINGPOOL_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -43,7 +44,7 @@
compare two pooled strings for equality, as you can simply compare their pointers. It compare two pooled strings for equality, as you can simply compare their pointers. It
also cuts down on storage if you're using many copies of the same string. also cuts down on storage if you're using many copies of the same string.
*/ */
class JUCE_API StringPool
class StringPool
{ {
public: public:
//============================================================================== //==============================================================================
@@ -94,5 +95,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (StringPool) JUCE_DECLARE_NON_COPYABLE (StringPool)
}; };
}
#endif // JUCE_STRINGPOOL_H_INCLUDED #endif // JUCE_STRINGPOOL_H_INCLUDED

+ 6
- 3
source/modules/water/text/juce_StringRef.h View File

@@ -31,6 +31,8 @@
#ifndef JUCE_STRINGREF_H_INCLUDED #ifndef JUCE_STRINGREF_H_INCLUDED
#define JUCE_STRINGREF_H_INCLUDED #define JUCE_STRINGREF_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
A simple class for holding temporary references to a string literal or String. A simple class for holding temporary references to a string literal or String.
@@ -64,7 +66,7 @@
@see String @see String
*/ */
class JUCE_API StringRef
class StringRef
{ {
public: public:
/** Creates a StringRef from a raw string literal. /** Creates a StringRef from a raw string literal.
@@ -123,14 +125,15 @@ public:
//============================================================================== //==============================================================================
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, StringRef string2) noexcept;
bool operator== (const String& string1, StringRef string2) noexcept;
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, StringRef string2) noexcept;
bool operator!= (const String& string1, StringRef string2) noexcept;
inline String operator+ (String s1, StringRef s2) { return s1 += String (s2.text); } inline String operator+ (String s1, StringRef s2) { return s1 += String (s2.text); }
inline String operator+ (StringRef s1, const String& s2) { return String (s1.text) + s2; } inline String operator+ (StringRef s1, const String& s2) { return String (s1.text) + s2; }
inline String operator+ (const char* s1, StringRef s2) { return String (s1) + String (s2.text); } inline String operator+ (const char* s1, StringRef s2) { return String (s1) + String (s2.text); }
inline String operator+ (StringRef s1, const char* s2) { return String (s1.text) + String (s2); } inline String operator+ (StringRef s1, const char* s2) { return String (s1.text) + String (s2); }
}
#endif // JUCE_STRINGREF_H_INCLUDED #endif // JUCE_STRINGREF_H_INCLUDED

+ 4
- 0
source/modules/water/threads/juce_ChildProcess.cpp View File

@@ -30,6 +30,8 @@
#define JUCE_USE_VFORK 1 #define JUCE_USE_VFORK 1
namespace water {
#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
//===================================================================================================================== //=====================================================================================================================
class ChildProcess::ActiveProcess class ChildProcess::ActiveProcess
@@ -397,3 +399,5 @@ bool ChildProcess::start (const StringArray& args, int streamFlags)
return activeProcess != nullptr; return activeProcess != nullptr;
} }
#endif #endif
}

+ 3
- 1
source/modules/water/threads/juce_ChildProcess.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_CHILDPROCESS_H_INCLUDED #ifndef JUCE_CHILDPROCESS_H_INCLUDED
#define JUCE_CHILDPROCESS_H_INCLUDED #define JUCE_CHILDPROCESS_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -39,7 +40,7 @@
This class lets you launch an executable, and read its output. You can also This class lets you launch an executable, and read its output. You can also
use it to check whether the child process has finished. use it to check whether the child process has finished.
*/ */
class JUCE_API ChildProcess
class ChildProcess
{ {
public: public:
//============================================================================== //==============================================================================
@@ -118,5 +119,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcess) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcess)
}; };
}
#endif // JUCE_CHILDPROCESS_H_INCLUDED #endif // JUCE_CHILDPROCESS_H_INCLUDED

+ 15
- 13
source/modules/water/threads/juce_Process.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_PROCESS_H_INCLUDED #ifndef JUCE_PROCESS_H_INCLUDED
#define JUCE_PROCESS_H_INCLUDED #define JUCE_PROCESS_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** Represents the current executable's process. /** Represents the current executable's process.
@@ -40,7 +41,7 @@
@see Thread, JUCEApplicationBase @see Thread, JUCEApplicationBase
*/ */
class JUCE_API Process
class Process
{ {
public: public:
//============================================================================== //==============================================================================
@@ -57,7 +58,7 @@ public:
@param priority the process priority, where @param priority the process priority, where
0=low, 1=normal, 2=high, 3=realtime 0=low, 1=normal, 2=high, 3=realtime
*/ */
static void JUCE_CALLTYPE setPriority (const ProcessPriority priority);
static void setPriority (const ProcessPriority priority);
/** Kills the current process immediately. /** Kills the current process immediately.
@@ -67,21 +68,21 @@ public:
@see JUCEApplicationBase::quit @see JUCEApplicationBase::quit
*/ */
static void JUCE_CALLTYPE terminate();
static void terminate();
//============================================================================== //==============================================================================
/** Returns true if this application process is the one that the user is /** Returns true if this application process is the one that the user is
currently using. currently using.
*/ */
static bool JUCE_CALLTYPE isForegroundProcess();
static bool isForegroundProcess();
/** Attempts to make the current process the active one. /** Attempts to make the current process the active one.
(This is not possible on some platforms). (This is not possible on some platforms).
*/ */
static void JUCE_CALLTYPE makeForegroundProcess();
static void makeForegroundProcess();
/** Hides the application (on an OS that supports this, e.g. OSX) */ /** Hides the application (on an OS that supports this, e.g. OSX) */
static void JUCE_CALLTYPE hide();
static void hide();
//============================================================================== //==============================================================================
/** Raises the current process's privilege level. /** Raises the current process's privilege level.
@@ -89,26 +90,26 @@ public:
Does nothing if this isn't supported by the current OS, or if process Does nothing if this isn't supported by the current OS, or if process
privilege level is fixed. privilege level is fixed.
*/ */
static void JUCE_CALLTYPE raisePrivilege();
static void raisePrivilege();
/** Lowers the current process's privilege level. /** Lowers the current process's privilege level.
Does nothing if this isn't supported by the current OS, or if process Does nothing if this isn't supported by the current OS, or if process
privilege level is fixed. privilege level is fixed.
*/ */
static void JUCE_CALLTYPE lowerPrivilege();
static void lowerPrivilege();
//============================================================================== //==============================================================================
/** Returns true if this process is being hosted by a debugger. */ /** Returns true if this process is being hosted by a debugger. */
static bool JUCE_CALLTYPE isRunningUnderDebugger() noexcept;
static bool isRunningUnderDebugger() noexcept;
//============================================================================== //==============================================================================
/** Tries to launch the OS's default reader application for a given file or URL. */ /** Tries to launch the OS's default reader application for a given file or URL. */
static bool JUCE_CALLTYPE openDocument (const String& documentURL, const String& parameters);
static bool openDocument (const String& documentURL, const String& parameters);
/** Tries to launch the OS's default email application to let the user create a message. */ /** Tries to launch the OS's default email application to let the user create a message. */
static bool JUCE_CALLTYPE openEmailWithAttachments (const String& targetEmailAddress,
static bool openEmailWithAttachments (const String& targetEmailAddress,
const String& emailSubject, const String& emailSubject,
const String& bodyText, const String& bodyText,
const StringArray& filesToAttach); const StringArray& filesToAttach);
@@ -128,7 +129,7 @@ public:
to provide the correct module handle in your DllMain() function, because to provide the correct module handle in your DllMain() function, because
the system relies on the correct instance handle when opening windows. the system relies on the correct instance handle when opening windows.
*/ */
static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() noexcept;
static void* getCurrentModuleInstanceHandle() noexcept;
/** WINDOWS ONLY - Sets a new module handle to be used by the library. /** WINDOWS ONLY - Sets a new module handle to be used by the library.
@@ -137,7 +138,7 @@ public:
@see getCurrentModuleInstanceHandle() @see getCurrentModuleInstanceHandle()
*/ */
static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) noexcept;
static void setCurrentModuleInstanceHandle (void* newHandle) noexcept;
#endif #endif
private: private:
@@ -145,5 +146,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (Process) JUCE_DECLARE_NON_COPYABLE (Process)
}; };
}
#endif // JUCE_PROCESS_H_INCLUDED #endif // JUCE_PROCESS_H_INCLUDED

+ 2
- 0
source/modules/water/threads/juce_ScopedLock.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_SCOPEDLOCK_H_INCLUDED #ifndef JUCE_SCOPEDLOCK_H_INCLUDED
#define JUCE_SCOPEDLOCK_H_INCLUDED #define JUCE_SCOPEDLOCK_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -235,5 +236,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (GenericScopedTryLock) JUCE_DECLARE_NON_COPYABLE (GenericScopedTryLock)
}; };
}
#endif // JUCE_SCOPEDLOCK_H_INCLUDED #endif // JUCE_SCOPEDLOCK_H_INCLUDED

+ 3
- 1
source/modules/water/threads/juce_SpinLock.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_SPINLOCK_H_INCLUDED #ifndef JUCE_SPINLOCK_H_INCLUDED
#define JUCE_SPINLOCK_H_INCLUDED #define JUCE_SPINLOCK_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -45,7 +46,7 @@
@see CriticalSection @see CriticalSection
*/ */
class JUCE_API SpinLock
class SpinLock
{ {
public: public:
inline SpinLock() noexcept {} inline SpinLock() noexcept {}
@@ -106,5 +107,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (SpinLock) JUCE_DECLARE_NON_COPYABLE (SpinLock)
}; };
}
#endif // JUCE_SPINLOCK_H_INCLUDED #endif // JUCE_SPINLOCK_H_INCLUDED

+ 19
- 532
source/modules/water/time/juce_Time.cpp View File

@@ -28,162 +28,23 @@
============================================================================== ==============================================================================
*/ */
namespace TimeHelpers
{
#if 0
static std::tm millisToLocal (int64 millis) noexcept
{
#if JUCE_WINDOWS && JUCE_MINGW
time_t now = (time_t) (millis / 1000);
return *localtime (&now);
#elif JUCE_WINDOWS
std::tm result;
millis /= 1000;
if (_localtime64_s (&result, &millis) != 0)
zerostruct (result);
return result;
#else
std::tm result;
time_t now = (time_t) (millis / 1000);
if (localtime_r (&now, &result) == nullptr)
zerostruct (result);
return result;
#endif
}
static std::tm millisToUTC (int64 millis) noexcept
{
#if JUCE_WINDOWS && JUCE_MINGW
time_t now = (time_t) (millis / 1000);
return *gmtime (&now);
#elif JUCE_WINDOWS
std::tm result;
millis /= 1000;
if (_gmtime64_s (&result, &millis) != 0)
zerostruct (result);
return result;
#else
std::tm result;
time_t now = (time_t) (millis / 1000);
if (gmtime_r (&now, &result) == nullptr)
zerostruct (result);
return result;
#endif
}
static int getUTCOffsetSeconds (const int64 millis) noexcept
{
std::tm utc = millisToUTC (millis);
utc.tm_isdst = -1; // Treat this UTC time as local to find the offset
return (int) ((millis / 1000) - (int64) mktime (&utc));
}
static int extendedModulo (const int64 value, const int modulo) noexcept
{
return (int) (value >= 0 ? (value % modulo)
: (value - ((value / modulo) + 1) * modulo));
}
static inline String formatString (const String& format, const std::tm* const tm)
{
#if JUCE_ANDROID
typedef CharPointer_UTF8 StringType;
#elif JUCE_WINDOWS
typedef CharPointer_UTF16 StringType;
#else
typedef CharPointer_UTF32 StringType;
#endif
namespace water {
#ifdef JUCE_MSVC
if (tm->tm_year < -1900 || tm->tm_year > 8099)
return String(); // Visual Studio's library can only handle 0 -> 9999 AD
#endif
for (size_t bufferSize = 256; ; bufferSize += 256)
{
HeapBlock<StringType::CharType> buffer (bufferSize);
const size_t numChars =
#if JUCE_ANDROID
strftime (buffer, bufferSize - 1, format.toUTF8(), tm);
#elif JUCE_WINDOWS
wcsftime (buffer, bufferSize - 1, format.toWideCharPointer(), tm);
#else
wcsftime (buffer, bufferSize - 1, format.toUTF32(), tm);
#endif
if (numChars > 0 || format.isEmpty())
return String (StringType (buffer),
StringType (buffer) + (int) numChars);
}
}
//==============================================================================
static inline bool isLeapYear (int year) noexcept
{
return (year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0));
}
static inline int daysFromJan1 (int year, int month) noexcept
{
const short dayOfYear[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
return dayOfYear [(isLeapYear (year) ? 12 : 0) + month];
}
static inline int64 daysFromYear0 (int year) noexcept
{
--year;
return 365 * year + (year / 400) - (year / 100) + (year / 4);
}
static inline int64 daysFrom1970 (int year) noexcept
{
return daysFromYear0 (year) - daysFromYear0 (1970);
}
static inline int64 daysFrom1970 (int year, int month) noexcept
{
if (month > 11)
{
year += month / 12;
month %= 12;
}
else if (month < 0)
{
const int numYears = (11 - month) / 12;
year -= numYears;
month += 12 * numYears;
}
return daysFrom1970 (year) + daysFromJan1 (year, month);
}
//==============================================================================
static uint32 juce_millisecondsSinceStartup() noexcept
{
#ifdef CARLA_OS_WIN
return (uint32) timeGetTime();
#else
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
// There's no posix function that does a UTC version of mktime,
// so annoyingly we need to implement this manually..
static inline int64 mktime_utc (const std::tm& t) noexcept
{
return 24 * 3600 * (daysFrom1970 (t.tm_year + 1900, t.tm_mon) + (t.tm_mday - 1))
+ 3600 * t.tm_hour
+ 60 * t.tm_min
+ t.tm_sec;
}
return (uint32) (t.tv_sec * 1000 + t.tv_nsec / 1000000);
#endif #endif
}
namespace TimeHelpers
{
static uint32 lastMSCounterValue = 0; static uint32 lastMSCounterValue = 0;
} }
@@ -200,31 +61,6 @@ Time::Time (const int64 ms) noexcept : millisSinceEpoch (ms)
{ {
} }
#if 0
Time::Time (const int year,
const int month,
const int day,
const int hours,
const int minutes,
const int seconds,
const int milliseconds,
const bool useLocalTime) noexcept
{
std::tm t;
t.tm_year = year - 1900;
t.tm_mon = month;
t.tm_mday = day;
t.tm_hour = hours;
t.tm_min = minutes;
t.tm_sec = seconds;
t.tm_isdst = -1;
millisSinceEpoch = 1000 * (useLocalTime ? (int64) mktime (&t)
: TimeHelpers::mktime_utc (t))
+ milliseconds;
}
#endif
Time::~Time() noexcept Time::~Time() noexcept
{ {
} }
@@ -236,6 +72,12 @@ Time& Time::operator= (const Time& other) noexcept
} }
//============================================================================== //==============================================================================
Time Time::getCurrentTime() noexcept
{
return Time (currentTimeMillis());
}
int64 Time::currentTimeMillis() noexcept int64 Time::currentTimeMillis() noexcept
{ {
struct timeval tv; struct timeval tv;
@@ -243,27 +85,8 @@ int64 Time::currentTimeMillis() noexcept
return ((int64) tv.tv_sec) * 1000 + tv.tv_usec / 1000; return ((int64) tv.tv_sec) * 1000 + tv.tv_usec / 1000;
} }
#if 0
Time JUCE_CALLTYPE Time::getCurrentTime() noexcept
{
return Time (currentTimeMillis());
}
#endif
//============================================================================== //==============================================================================
static uint32 juce_millisecondsSinceStartup() noexcept
{
#ifdef CARLA_OS_WIN
return (uint32) timeGetTime();
#else
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return (uint32) (t.tv_sec * 1000 + t.tv_nsec / 1000000);
#endif
}
uint32 Time::getMillisecondCounter() noexcept uint32 Time::getMillisecondCounter() noexcept
{ {
const uint32 now = juce_millisecondsSinceStartup(); const uint32 now = juce_millisecondsSinceStartup();
@@ -292,340 +115,4 @@ uint32 Time::getApproximateMillisecondCounter() noexcept
return TimeHelpers::lastMSCounterValue; return TimeHelpers::lastMSCounterValue;
} }
#if 0
void Time::waitForMillisecondCounter (const uint32 targetTime) noexcept
{
for (;;)
{
const uint32 now = getMillisecondCounter();
if (now >= targetTime)
break;
const int toWait = (int) (targetTime - now);
if (toWait > 2)
{
Thread::sleep (jmin (20, toWait >> 1));
}
else
{
// xxx should consider using mutex_pause on the mac as it apparently
// makes it seem less like a spinlock and avoids lowering the thread pri.
for (int i = 10; --i >= 0;)
Thread::yield();
}
}
}
//==============================================================================
double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept
{
return ticks / (double) getHighResolutionTicksPerSecond();
} }
int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept
{
return (int64) (seconds * (double) getHighResolutionTicksPerSecond());
}
//==============================================================================
String Time::toString (const bool includeDate,
const bool includeTime,
const bool includeSeconds,
const bool use24HourClock) const noexcept
{
String result;
if (includeDate)
{
result << getDayOfMonth() << ' '
<< getMonthName (true) << ' '
<< getYear();
if (includeTime)
result << ' ';
}
if (includeTime)
{
const int mins = getMinutes();
result << (use24HourClock ? getHours() : getHoursInAmPmFormat())
<< (mins < 10 ? ":0" : ":") << mins;
if (includeSeconds)
{
const int secs = getSeconds();
result << (secs < 10 ? ":0" : ":") << secs;
}
if (! use24HourClock)
result << (isAfternoon() ? "pm" : "am");
}
return result.trimEnd();
}
String Time::formatted (const String& format) const
{
std::tm t (TimeHelpers::millisToLocal (millisSinceEpoch));
return TimeHelpers::formatString (format, &t);
}
//==============================================================================
int Time::getYear() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_year + 1900; }
int Time::getMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mon; }
int Time::getDayOfYear() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_yday; }
int Time::getDayOfMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mday; }
int Time::getDayOfWeek() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_wday; }
int Time::getHours() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_hour; }
int Time::getMinutes() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_min; }
int Time::getSeconds() const noexcept { return TimeHelpers::extendedModulo (millisSinceEpoch / 1000, 60); }
int Time::getMilliseconds() const noexcept { return TimeHelpers::extendedModulo (millisSinceEpoch, 1000); }
int Time::getHoursInAmPmFormat() const noexcept
{
const int hours = getHours();
if (hours == 0) return 12;
if (hours <= 12) return hours;
return hours - 12;
}
bool Time::isAfternoon() const noexcept
{
return getHours() >= 12;
}
bool Time::isDaylightSavingTime() const noexcept
{
return TimeHelpers::millisToLocal (millisSinceEpoch).tm_isdst != 0;
}
String Time::getTimeZone() const noexcept
{
String zone[2];
#if JUCE_WINDOWS
#if JUCE_MSVC || JUCE_CLANG
_tzset();
for (int i = 0; i < 2; ++i)
{
char name[128] = { 0 };
size_t length;
_get_tzname (&length, name, 127, i);
zone[i] = name;
}
#else
#warning "Can't find a replacement for tzset on mingw - ideas welcome!"
#endif
#else
tzset();
const char** const zonePtr = (const char**) tzname;
zone[0] = zonePtr[0];
zone[1] = zonePtr[1];
#endif
if (isDaylightSavingTime())
{
zone[0] = zone[1];
if (zone[0].length() > 3
&& zone[0].containsIgnoreCase ("daylight")
&& zone[0].contains ("GMT"))
zone[0] = "BST";
}
return zone[0].substring (0, 3);
}
int Time::getUTCOffsetSeconds() const noexcept
{
return TimeHelpers::getUTCOffsetSeconds (millisSinceEpoch);
}
String Time::getUTCOffsetString (bool includeSemiColon) const
{
if (int seconds = getUTCOffsetSeconds())
{
const int minutes = seconds / 60;
return String::formatted (includeSemiColon ? "%+03d:%02d"
: "%+03d%02d",
minutes / 60,
minutes % 60);
}
return "Z";
}
String Time::toISO8601 (bool includeDividerCharacters) const
{
return String::formatted (includeDividerCharacters ? "%04d-%02d-%02dT%02d:%02d:%06.03f"
: "%04d%02d%02dT%02d%02d%06.03f",
getYear(),
getMonth() + 1,
getDayOfMonth(),
getHours(),
getMinutes(),
getSeconds() + getMilliseconds() / 1000.0)
+ getUTCOffsetString (includeDividerCharacters);
}
static int parseFixedSizeIntAndSkip (String::CharPointerType& t, int numChars, char charToSkip) noexcept
{
int n = 0;
for (int i = numChars; --i >= 0;)
{
const int digit = (int) (*t - '0');
if (! isPositiveAndBelow (digit, 10))
return -1;
++t;
n = n * 10 + digit;
}
if (charToSkip != 0 && *t == (juce_wchar) charToSkip)
++t;
return n;
}
Time Time::fromISO8601 (StringRef iso) noexcept
{
String::CharPointerType t = iso.text;
const int year = parseFixedSizeIntAndSkip (t, 4, '-');
if (year < 0)
return Time();
const int month = parseFixedSizeIntAndSkip (t, 2, '-');
if (month < 0)
return Time();
const int day = parseFixedSizeIntAndSkip (t, 2, 0);
if (day < 0)
return Time();
int hours = 0, minutes = 0, milliseconds = 0;
if (*t == 'T')
{
++t;
hours = parseFixedSizeIntAndSkip (t, 2, ':');
if (hours < 0)
return Time();
minutes = parseFixedSizeIntAndSkip (t, 2, ':');
if (minutes < 0)
return Time();
milliseconds = (int) (1000.0 * CharacterFunctions::readDoubleValue (t));
}
const juce_wchar nextChar = t.getAndAdvance();
if (nextChar == '-' || nextChar == '+')
{
const int offsetHours = parseFixedSizeIntAndSkip (t, 2, ':');
if (offsetHours < 0)
return Time();
const int offsetMinutes = parseFixedSizeIntAndSkip (t, 2, 0);
if (offsetMinutes < 0)
return Time();
const int offsetMs = (offsetHours * 60 + offsetMinutes) * 60 * 1000;
milliseconds += nextChar == '-' ? offsetMs : -offsetMs; // NB: this seems backwards but is correct!
}
else if (nextChar != 0 && nextChar != 'Z')
{
return Time();
}
return Time (year, month - 1, day, hours, minutes, 0, milliseconds, false);
}
String Time::getMonthName (const bool threeLetterVersion) const
{
return getMonthName (getMonth(), threeLetterVersion);
}
String Time::getWeekdayName (const bool threeLetterVersion) const
{
return getWeekdayName (getDayOfWeek(), threeLetterVersion);
}
static const char* const shortMonthNames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
static const char* const longMonthNames[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
String Time::getMonthName (int monthNumber, const bool threeLetterVersion)
{
monthNumber %= 12;
return TRANS (threeLetterVersion ? shortMonthNames [monthNumber]
: longMonthNames [monthNumber]);
}
String Time::getWeekdayName (int day, const bool threeLetterVersion)
{
static const char* const shortDayNames[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char* const longDayNames[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
day %= 7;
return TRANS (threeLetterVersion ? shortDayNames [day]
: longDayNames [day]);
}
//==============================================================================
Time& Time::operator+= (RelativeTime delta) noexcept { millisSinceEpoch += delta.inMilliseconds(); return *this; }
Time& Time::operator-= (RelativeTime delta) noexcept { millisSinceEpoch -= delta.inMilliseconds(); return *this; }
Time operator+ (Time time, RelativeTime delta) noexcept { Time t (time); return t += delta; }
Time operator- (Time time, RelativeTime delta) noexcept { Time t (time); return t -= delta; }
Time operator+ (RelativeTime delta, Time time) noexcept { Time t (time); return t += delta; }
const RelativeTime operator- (Time time1, Time time2) noexcept { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); }
bool operator== (Time time1, Time time2) noexcept { return time1.toMilliseconds() == time2.toMilliseconds(); }
bool operator!= (Time time1, Time time2) noexcept { return time1.toMilliseconds() != time2.toMilliseconds(); }
bool operator< (Time time1, Time time2) noexcept { return time1.toMilliseconds() < time2.toMilliseconds(); }
bool operator> (Time time1, Time time2) noexcept { return time1.toMilliseconds() > time2.toMilliseconds(); }
bool operator<= (Time time1, Time time2) noexcept { return time1.toMilliseconds() <= time2.toMilliseconds(); }
bool operator>= (Time time1, Time time2) noexcept { return time1.toMilliseconds() >= time2.toMilliseconds(); }
static int getMonthNumberForCompileDate (const String& m) noexcept
{
for (int i = 0; i < 12; ++i)
if (m.equalsIgnoreCase (shortMonthNames[i]))
return i;
// If you hit this because your compiler has an unusual __DATE__
// format, let us know so we can add support for it!
jassertfalse;
return 0;
}
Time Time::getCompilationDate()
{
StringArray dateTokens, timeTokens;
dateTokens.addTokens (__DATE__, true);
dateTokens.removeEmptyStrings (true);
timeTokens.addTokens (__TIME__, ":", StringRef());
return Time (dateTokens[2].getIntValue(),
getMonthNumberForCompileDate (dateTokens[0]),
dateTokens[1].getIntValue(),
timeTokens[0].getIntValue(),
timeTokens[1].getIntValue());
}
#endif

+ 4
- 273
source/modules/water/time/juce_Time.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_TIME_H_INCLUDED #ifndef JUCE_TIME_H_INCLUDED
#define JUCE_TIME_H_INCLUDED #define JUCE_TIME_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -40,7 +41,7 @@
@see RelativeTime @see RelativeTime
*/ */
class JUCE_API Time
class Time
{ {
public: public:
//============================================================================== //==============================================================================
@@ -65,27 +66,6 @@ public:
*/ */
explicit Time (int64 millisecondsSinceEpoch) noexcept; explicit Time (int64 millisecondsSinceEpoch) noexcept;
/** Creates a time from a set of date components.
@param year the year, in 4-digit format, e.g. 2004
@param month the month, in the range 0 to 11
@param day the day of the month, in the range 1 to 31
@param hours hours in 24-hour clock format, 0 to 23
@param minutes minutes 0 to 59
@param seconds seconds 0 to 59
@param milliseconds milliseconds 0 to 999
@param useLocalTime if true, assume input is in this machine's local timezone
if false, assume input is in UTC.
*/
Time (int year,
int month,
int day,
int hours,
int minutes,
int seconds = 0,
int milliseconds = 0,
bool useLocalTime = true) noexcept;
/** Creates a copy of another Time object. */ /** Creates a copy of another Time object. */
Time (const Time& other) noexcept; Time (const Time& other) noexcept;
@@ -103,191 +83,7 @@ public:
@see currentTimeMillis @see currentTimeMillis
*/ */
static Time JUCE_CALLTYPE getCurrentTime() noexcept;
/** Returns the time as a number of milliseconds.
@returns the number of milliseconds this Time object represents, since
midnight Jan 1st 1970 UTC.
@see getMilliseconds
*/
int64 toMilliseconds() const noexcept { return millisSinceEpoch; }
/** Returns the year (in this machine's local timezone).
A 4-digit format is used, e.g. 2004.
*/
int getYear() const noexcept;
/** Returns the number of the month (in this machine's local timezone).
The value returned is in the range 0 to 11.
@see getMonthName
*/
int getMonth() const noexcept;
/** Returns the name of the month (in this machine's local timezone).
@param threeLetterVersion if true, it'll be a 3-letter abbreviation, e.g. "Jan"; if false
it'll return the long form, e.g. "January"
@see getMonth
*/
String getMonthName (bool threeLetterVersion) const;
/** Returns the day of the month (in this machine's local timezone).
The value returned is in the range 1 to 31.
*/
int getDayOfMonth() const noexcept;
/** Returns the number of the day of the week (in this machine's local timezone).
The value returned is in the range 0 to 6 (0 = sunday, 1 = monday, etc).
*/
int getDayOfWeek() const noexcept;
/** Returns the number of the day of the year (in this machine's local timezone).
The value returned is in the range 0 to 365.
*/
int getDayOfYear() const noexcept;
/** Returns the name of the weekday (in this machine's local timezone).
@param threeLetterVersion if true, it'll return a 3-letter abbreviation, e.g. "Tue"; if
false, it'll return the full version, e.g. "Tuesday".
*/
String getWeekdayName (bool threeLetterVersion) const;
/** Returns the number of hours since midnight (in this machine's local timezone).
This is in 24-hour clock format, in the range 0 to 23.
@see getHoursInAmPmFormat, isAfternoon
*/
int getHours() const noexcept;
/** Returns true if the time is in the afternoon (in this machine's local timezone).
@returns true for "PM", false for "AM".
@see getHoursInAmPmFormat, getHours
*/
bool isAfternoon() const noexcept;
/** Returns the hours in 12-hour clock format (in this machine's local timezone).
This will return a value 1 to 12 - use isAfternoon() to find out
whether this is in the afternoon or morning.
@see getHours, isAfternoon
*/
int getHoursInAmPmFormat() const noexcept;
/** Returns the number of minutes, 0 to 59 (in this machine's local timezone). */
int getMinutes() const noexcept;
/** Returns the number of seconds, 0 to 59. */
int getSeconds() const noexcept;
/** Returns the number of milliseconds, 0 to 999.
Unlike toMilliseconds(), this just returns the position within the
current second rather than the total number since the epoch.
@see toMilliseconds
*/
int getMilliseconds() const noexcept;
/** Returns true if the local timezone uses a daylight saving correction. */
bool isDaylightSavingTime() const noexcept;
//==============================================================================
/** Returns a 3-character string to indicate the local timezone. */
String getTimeZone() const noexcept;
/** Returns the local timezone offset from UTC in seconds. */
int getUTCOffsetSeconds() const noexcept;
/** Returns a string to indicate the offset of the local timezone from UTC.
@returns "+XX:XX", "-XX:XX" or "Z"
@param includeDividerCharacters whether to include or omit the ":" divider in the string
*/
String getUTCOffsetString (bool includeDividerCharacters) const;
//==============================================================================
/** Returns a string version of this date and time, using this machine's local timezone.
For a more powerful way of formatting the date and time, see the formatted() method.
@param includeDate whether to include the date in the string
@param includeTime whether to include the time in the string
@param includeSeconds if the time is being included, this provides an option not to include
the seconds in it
@param use24HourClock if the time is being included, sets whether to use am/pm or 24
hour notation.
@see formatted
*/
String toString (bool includeDate,
bool includeTime,
bool includeSeconds = true,
bool use24HourClock = false) const noexcept;
/** Converts this date/time to a string with a user-defined format.
This uses the C strftime() function to format this time as a string. To save you
looking it up, these are the escape codes that strftime uses (other codes might
work on some platforms and not others, but these are the common ones):
- %a is replaced by the locale's abbreviated weekday name.
- %A is replaced by the locale's full weekday name.
- %b is replaced by the locale's abbreviated month name.
- %B is replaced by the locale's full month name.
- %c is replaced by the locale's appropriate date and time representation.
- %d is replaced by the day of the month as a decimal number [01,31].
- %H is replaced by the hour (24-hour clock) as a decimal number [00,23].
- %I is replaced by the hour (12-hour clock) as a decimal number [01,12].
- %j is replaced by the day of the year as a decimal number [001,366].
- %m is replaced by the month as a decimal number [01,12].
- %M is replaced by the minute as a decimal number [00,59].
- %p is replaced by the locale's equivalent of either a.m. or p.m.
- %S is replaced by the second as a decimal number [00,61].
- %U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number [00,53].
- %w is replaced by the weekday as a decimal number [0,6], with 0 representing Sunday.
- %W is replaced by the week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Monday are considered to be in week 0.
- %x is replaced by the locale's appropriate date representation.
- %X is replaced by the locale's appropriate time representation.
- %y is replaced by the year without century as a decimal number [00,99].
- %Y is replaced by the year with century as a decimal number.
- %Z is replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists.
- %% is replaced by %.
@see toString
*/
String formatted (const String& format) const;
//==============================================================================
/** Returns a fully described string of this date and time in ISO-8601 format
(using the local timezone).
@param includeDividerCharacters whether to include or omit the "-" and ":"
dividers in the string
*/
String toISO8601 (bool includeDividerCharacters) const;
/** Parses an ISO-8601 string and returns it as a Time. */
static Time fromISO8601 (StringRef iso8601) noexcept;
//==============================================================================
/** Tries to set the computer's clock.
@returns true if this succeeds, although depending on the system, the
application might not have sufficient privileges to do this.
*/
bool setSystemTimeToThisTime() const;
//==============================================================================
/** Returns the name of a day of the week.
@param dayNumber the day, 0 to 6 (0 = sunday, 1 = monday, etc)
@param threeLetterVersion if true, it'll return a 3-letter abbreviation, e.g. "Tue"; if
false, it'll return the full version, e.g. "Tuesday".
*/
static String getWeekdayName (int dayNumber, bool threeLetterVersion);
/** Returns the name of one of the months.
@param monthNumber the month, 0 to 11
@param threeLetterVersion if true, it'll be a 3-letter abbreviation, e.g. "Jan"; if false
it'll return the long form, e.g. "January"
*/
static String getMonthName (int monthNumber, bool threeLetterVersion);
static Time getCurrentTime() noexcept;
//============================================================================== //==============================================================================
// Static methods for getting system timers directly.. // Static methods for getting system timers directly..
@@ -315,21 +111,6 @@ public:
*/ */
static uint32 getMillisecondCounter() noexcept; static uint32 getMillisecondCounter() noexcept;
/** Returns the number of millisecs since a fixed event (usually system startup).
This has the same function as getMillisecondCounter(), but returns a more accurate
value, using a higher-resolution timer if one is available.
@see getMillisecondCounter
*/
static double getMillisecondCounterHiRes() noexcept;
/** Waits until the getMillisecondCounter() reaches a given value.
This will make the thread sleep as efficiently as it can while it's waiting.
*/
static void waitForMillisecondCounter (uint32 targetTime) noexcept;
/** Less-accurate but faster version of getMillisecondCounter(). /** Less-accurate but faster version of getMillisecondCounter().
This will return the last value that getMillisecondCounter() returned, so doesn't This will return the last value that getMillisecondCounter() returned, so doesn't
@@ -341,61 +122,11 @@ public:
*/ */
static uint32 getApproximateMillisecondCounter() noexcept; static uint32 getApproximateMillisecondCounter() noexcept;
//==============================================================================
// High-resolution timers..
/** Returns the current high-resolution counter's tick-count.
This is a similar idea to getMillisecondCounter(), but with a higher
resolution.
@see getHighResolutionTicksPerSecond, highResolutionTicksToSeconds,
secondsToHighResolutionTicks
*/
static int64 getHighResolutionTicks() noexcept;
/** Returns the resolution of the high-resolution counter in ticks per second.
@see getHighResolutionTicks, highResolutionTicksToSeconds,
secondsToHighResolutionTicks
*/
static int64 getHighResolutionTicksPerSecond() noexcept;
/** Converts a number of high-resolution ticks into seconds.
@see getHighResolutionTicks, getHighResolutionTicksPerSecond,
secondsToHighResolutionTicks
*/
static double highResolutionTicksToSeconds (int64 ticks) noexcept;
/** Converts a number seconds into high-resolution ticks.
@see getHighResolutionTicks, getHighResolutionTicksPerSecond,
highResolutionTicksToSeconds
*/
static int64 secondsToHighResolutionTicks (double seconds) noexcept;
/** Returns a Time based on the value of the __DATE__ macro when this module was compiled */
static Time getCompilationDate();
private: private:
//============================================================================== //==============================================================================
int64 millisSinceEpoch; int64 millisSinceEpoch;
}; };
//==============================================================================
/** Compares two Time objects. */
JUCE_API bool operator== (Time time1, Time time2) noexcept;
/** Compares two Time objects. */
JUCE_API bool operator!= (Time time1, Time time2) noexcept;
/** Compares two Time objects. */
JUCE_API bool operator< (Time time1, Time time2) noexcept;
/** Compares two Time objects. */
JUCE_API bool operator<= (Time time1, Time time2) noexcept;
/** Compares two Time objects. */
JUCE_API bool operator> (Time time1, Time time2) noexcept;
/** Compares two Time objects. */
JUCE_API bool operator>= (Time time1, Time time2) noexcept;
}
#endif // JUCE_TIME_H_INCLUDED #endif // JUCE_TIME_H_INCLUDED

+ 3
- 3
source/modules/water/water.cpp View File

@@ -70,7 +70,7 @@ static int64 juce_fileSetPosition (void* handle, int64 pos)
static void* currentModuleHandle = nullptr; static void* currentModuleHandle = nullptr;
void* JUCE_CALLTYPE Process::getCurrentModuleInstanceHandle() noexcept
void* Process::getCurrentModuleInstanceHandle() noexcept
{ {
if (currentModuleHandle == nullptr) if (currentModuleHandle == nullptr)
currentModuleHandle = GetModuleHandleA (nullptr); currentModuleHandle = GetModuleHandleA (nullptr);
@@ -96,6 +96,8 @@ static int64 juce_fileSetPosition (void* handle, int64 pos)
} }
#endif #endif
}
#include "memory/juce_MemoryBlock.cpp" #include "memory/juce_MemoryBlock.cpp"
#include "text/juce_CharacterFunctions.cpp" #include "text/juce_CharacterFunctions.cpp"
@@ -134,5 +136,3 @@ static int64 juce_fileSetPosition (void* handle, int64 pos)
#include "xml/juce_XmlElement.cpp" #include "xml/juce_XmlElement.cpp"
#include "xml/juce_XmlDocument.cpp" #include "xml/juce_XmlDocument.cpp"
}

+ 75
- 16
source/modules/water/water.h View File

@@ -28,9 +28,6 @@
//============================================================================== //==============================================================================
#define JUCE_API
#define JUCE_CALLTYPE
#define jassertfalse carla_safe_assert("jassertfalse triggered", __FILE__, __LINE__); #define jassertfalse carla_safe_assert("jassertfalse triggered", __FILE__, __LINE__);
#define jassert(expression) CARLA_SAFE_ASSERT(expression) #define jassert(expression) CARLA_SAFE_ASSERT(expression)
@@ -44,17 +41,23 @@
#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes))) #define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
// FIXME
#if defined (__arm__) || defined (__arm64__)
#define JUCE_ARM 1
#else
#define JUCE_INTEL 1
#endif
//==============================================================================
#ifdef __clang__ #ifdef __clang__
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
#define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#define JUCE_DELETED_FUNCTION = delete
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#elif (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
#define JUCE_CLANG 1
#elif defined (__GNUC__)
#define JUCE_GCC 1
#else
#error unknown compiler
#endif
#if (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1 #define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
@@ -74,6 +77,61 @@
#endif #endif
#endif #endif
//==============================================================================
// Clang
#if JUCE_CLANG && defined (__has_feature)
#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)
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if __has_feature (cxx_deleted_functions)
#define JUCE_DELETED_FUNCTION = delete
#endif
#if __has_feature (cxx_lambdas) && (defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS))
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#if __has_feature (cxx_generalized_initializers) && (defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS))
#define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
#endif
#if __has_feature (cxx_variadic_templates)
#define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
#endif
#if __has_feature (cxx_static_assert)
#define JUCE_COMPILER_SUPPORTS_STATIC_ASSERT 1
#endif
#if __has_feature (cxx_override_control) && (! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL))
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_ARC
#define JUCE_COMPILER_SUPPORTS_ARC 1
#endif
#ifndef JUCE_EXCEPTIONS_DISABLED
#if ! __has_feature (cxx_exceptions)
#define JUCE_EXCEPTIONS_DISABLED 1
#endif
#endif
#endif
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#ifndef JUCE_DELETED_FUNCTION #ifndef JUCE_DELETED_FUNCTION
/** This macro can be placed after a method declaration to allow the use of /** This macro can be placed after a method declaration to allow the use of
the C++11 feature "= delete" on all compilers. the C++11 feature "= delete" on all compilers.
@@ -111,6 +169,7 @@
#define NEEDS_TRANS(x) (x) #define NEEDS_TRANS(x) (x)
//============================================================================== //==============================================================================
namespace water namespace water
{ {
@@ -126,6 +185,9 @@ class OutputStream;
class Result; class Result;
class StringRef; class StringRef;
class XmlElement; class XmlElement;
class AudioProcessor;
}
#include "memory/juce_Memory.h" #include "memory/juce_Memory.h"
#include "maths/juce_MathsFunctions.h" #include "maths/juce_MathsFunctions.h"
@@ -185,7 +247,6 @@ class XmlElement;
#include "midi/juce_MidiMessageSequence.h" #include "midi/juce_MidiMessageSequence.h"
#include "midi/juce_MidiFile.h" #include "midi/juce_MidiFile.h"
class AudioProcessor;
#include "processors/juce_AudioPlayHead.h" #include "processors/juce_AudioPlayHead.h"
#include "processors/juce_AudioProcessor.h" #include "processors/juce_AudioProcessor.h"
#include "processors/juce_AudioProcessorGraph.h" #include "processors/juce_AudioProcessorGraph.h"
@@ -196,6 +257,4 @@ class AudioProcessor;
#include "xml/juce_XmlElement.h" #include "xml/juce_XmlElement.h"
#include "xml/juce_XmlDocument.h" #include "xml/juce_XmlDocument.h"
}
#endif // WATER_H_INCLUDED #endif // WATER_H_INCLUDED

+ 4
- 0
source/modules/water/xml/juce_XmlDocument.cpp View File

@@ -28,6 +28,8 @@
============================================================================== ==============================================================================
*/ */
namespace water {
XmlDocument::XmlDocument (const String& documentText) XmlDocument::XmlDocument (const String& documentText)
: originalText (documentText), : originalText (documentText),
input (nullptr), input (nullptr),
@@ -879,3 +881,5 @@ String XmlDocument::getParameterEntity (const String& entity)
return entity; return entity;
} }
}

+ 3
- 1
source/modules/water/xml/juce_XmlDocument.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_XMLDOCUMENT_H_INCLUDED #ifndef JUCE_XMLDOCUMENT_H_INCLUDED
#define JUCE_XMLDOCUMENT_H_INCLUDED #define JUCE_XMLDOCUMENT_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** /**
@@ -68,7 +69,7 @@
@see XmlElement @see XmlElement
*/ */
class JUCE_API XmlDocument
class XmlDocument
{ {
public: public:
//============================================================================== //==============================================================================
@@ -179,5 +180,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (XmlDocument) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (XmlDocument)
}; };
}
#endif // JUCE_XMLDOCUMENT_H_INCLUDED #endif // JUCE_XMLDOCUMENT_H_INCLUDED

+ 33
- 32
source/modules/water/xml/juce_XmlElement.cpp View File

@@ -28,38 +28,37 @@
============================================================================== ==============================================================================
*/ */
namespace
{
inline bool isValidXmlNameStartCharacter (const juce_wchar character) noexcept
{
return character == ':'
|| character == '_'
|| (character >= 'a' && character <= 'z')
|| (character >= 'A' && character <= 'Z')
|| (character >= 0xc0 && character <= 0xd6)
|| (character >= 0xd8 && character <= 0xf6)
|| (character >= 0xf8 && character <= 0x2ff)
|| (character >= 0x370 && character <= 0x37d)
|| (character >= 0x37f && character <= 0x1fff)
|| (character >= 0x200c && character <= 0x200d)
|| (character >= 0x2070 && character <= 0x218f)
|| (character >= 0x2c00 && character <= 0x2fef)
|| (character >= 0x3001 && character <= 0xd7ff)
|| (character >= 0xf900 && character <= 0xfdcf)
|| (character >= 0xfdf0 && character <= 0xfffd)
|| (character >= 0x10000 && character <= 0xeffff);
}
inline bool isValidXmlNameBodyCharacter (const juce_wchar character) noexcept
{
return isValidXmlNameStartCharacter (character)
|| character == '-'
|| character == '.'
|| character == 0xb7
|| (character >= '0' && character <= '9')
|| (character >= 0x300 && character <= 0x036f)
|| (character >= 0x203f && character <= 0x2040);
}
namespace water {
inline bool isValidXmlNameStartCharacter (const juce_wchar character) noexcept
{
return character == ':'
|| character == '_'
|| (character >= 'a' && character <= 'z')
|| (character >= 'A' && character <= 'Z')
|| (character >= 0xc0 && character <= 0xd6)
|| (character >= 0xd8 && character <= 0xf6)
|| (character >= 0xf8 && character <= 0x2ff)
|| (character >= 0x370 && character <= 0x37d)
|| (character >= 0x37f && character <= 0x1fff)
|| (character >= 0x200c && character <= 0x200d)
|| (character >= 0x2070 && character <= 0x218f)
|| (character >= 0x2c00 && character <= 0x2fef)
|| (character >= 0x3001 && character <= 0xd7ff)
|| (character >= 0xf900 && character <= 0xfdcf)
|| (character >= 0xfdf0 && character <= 0xfffd)
|| (character >= 0x10000 && character <= 0xeffff);
}
inline bool isValidXmlNameBodyCharacter (const juce_wchar character) noexcept
{
return isValidXmlNameStartCharacter (character)
|| character == '-'
|| character == '.'
|| character == 0xb7
|| (character >= '0' && character <= '9')
|| (character >= 0x300 && character <= 0x036f)
|| (character >= 0x203f && character <= 0x2040);
} }
XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) noexcept XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) noexcept
@@ -936,3 +935,5 @@ void XmlElement::deleteAllTextElements() noexcept
child = next; child = next;
} }
} }
}

+ 3
- 1
source/modules/water/xml/juce_XmlElement.h View File

@@ -31,6 +31,7 @@
#ifndef JUCE_XMLELEMENT_H_INCLUDED #ifndef JUCE_XMLELEMENT_H_INCLUDED
#define JUCE_XMLELEMENT_H_INCLUDED #define JUCE_XMLELEMENT_H_INCLUDED
namespace water {
//============================================================================== //==============================================================================
/** A handy macro to make it easy to iterate all the child elements in an XmlElement. /** A handy macro to make it easy to iterate all the child elements in an XmlElement.
@@ -141,7 +142,7 @@
@see XmlDocument @see XmlDocument
*/ */
class JUCE_API XmlElement
class XmlElement
{ {
public: public:
//============================================================================== //==============================================================================
@@ -771,5 +772,6 @@ private:
JUCE_LEAK_DETECTOR (XmlElement) JUCE_LEAK_DETECTOR (XmlElement)
}; };
}
#endif // JUCE_XMLELEMENT_H_INCLUDED #endif // JUCE_XMLELEMENT_H_INCLUDED

Loading…
Cancel
Save