mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Refactored some String operators to bring them into line with c++ best practices. Removed the JUCE_STRINGS_ARE_UNICODE flag - all strings are now unicode by default. Removed the String class's implicit cast to const char* and copyToBuffer() method, replacing them with toCString(), toUTF8(), copyToCString(), copyToUnicode(), etc., so that it'll force users to think about the encoding they want to use in a particular context. Added the ability to pass a String directly to a std::ostream. Extended the juce version number to include a build number.
This commit is contained in:
parent
038886510a
commit
6b79430341
75 changed files with 1371 additions and 1576 deletions
|
|
@ -5,6 +5,11 @@ ifndef CONFIG
|
|||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
# (this disables dependency generation if multiple architectures are set)
|
||||
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
|
||||
|
||||
ifeq ($(CONFIG),Debug)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
//#define JUCE_SUPPORT_CARBON
|
||||
//#define JUCE_CHECK_MEMORY_LEAKS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_STRINGS_ARE_UNICODE
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static bool parseFile (const File& rootFolder,
|
|||
|
||||
if (lines.size() == 0)
|
||||
{
|
||||
std::cout << "!! ERROR - input file was empty: " << (const char*) file.getFullPathName();
|
||||
std::cout << "!! ERROR - input file was empty: " << file.getFullPathName();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin
|
|||
wildcards.trim();
|
||||
wildcards.removeEmptyStrings();
|
||||
|
||||
std::cout << "Building: " << (const char*) targetFile.getFullPathName() << "...\n";
|
||||
std::cout << "Building: " << targetFile.getFullPathName() << "...\n";
|
||||
|
||||
TemporaryFile temp (targetFile);
|
||||
ScopedPointer <FileOutputStream> out (temp.getFile().createOutputStream (1024 * 128));
|
||||
|
|
@ -276,7 +276,7 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin
|
|||
if (out == 0)
|
||||
{
|
||||
std::cout << "\n!! ERROR - couldn't write to the target file: "
|
||||
<< (const char*) temp.getFile().getFullPathName() << "\n\n";
|
||||
<< temp.getFile().getFullPathName() << "\n\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin
|
|||
if (! temp.overwriteTargetFileWithTemporary())
|
||||
{
|
||||
std::cout << "\n!! ERROR - couldn't write to the target file: "
|
||||
<< (const char*) targetFile.getFullPathName() << "\n\n";
|
||||
<< targetFile.getFullPathName() << "\n\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ ifndef CONFIG
|
|||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
# (this disables dependency generation if multiple architectures are set)
|
||||
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
|
||||
|
||||
ifeq ($(CONFIG),Debug)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
//#define JUCE_SUPPORT_CARBON
|
||||
//#define JUCE_CHECK_MEMORY_LEAKS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_STRINGS_ARE_UNICODE
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ private:
|
|||
|
||||
void GetNameOfLength (char* name, int maxLength, OSType inControllerType) const
|
||||
{
|
||||
juceFilter->getParameterName (index).copyToBuffer (name, maxLength);
|
||||
juceFilter->getParameterName (index).copyToCString (name, maxLength);
|
||||
}
|
||||
|
||||
long GetPriority() const { return kFicCooperativeTaskPriority; }
|
||||
|
|
@ -864,7 +864,7 @@ private:
|
|||
|
||||
void GetValueString (char* valueString, int maxLength, long value) const
|
||||
{
|
||||
juceFilter->getParameterText (index).copyToBuffer (valueString, maxLength);
|
||||
juceFilter->getParameterText (index).copyToCString (valueString, maxLength);
|
||||
}
|
||||
|
||||
Cmn_Bool IsAutomatable() const
|
||||
|
|
@ -890,7 +890,7 @@ public:
|
|||
JucePlugInGroup()
|
||||
{
|
||||
DefineManufacturerNamesAndID (JucePlugin_Manufacturer, JucePlugin_RTASManufacturerCode);
|
||||
DefinePlugInNamesAndVersion (createRTASName(), JucePlugin_VersionCode);
|
||||
DefinePlugInNamesAndVersion (createRTASName().toCString(), JucePlugin_VersionCode);
|
||||
|
||||
#ifndef JUCE_DEBUG
|
||||
AddGestalt (pluginGestalt_IsCacheable);
|
||||
|
|
@ -920,7 +920,7 @@ public:
|
|||
JucePlugin_RTASProductId,
|
||||
JucePlugin_RTASCategory);
|
||||
|
||||
type->DefineTypeNames (createRTASName());
|
||||
type->DefineTypeNames (createRTASName().toCString());
|
||||
type->DefineSampleRateSupport (eSupports48kAnd96kAnd192k);
|
||||
|
||||
type->DefineStemFormats (getFormatForChans (channelConfigs [i][0] != 0 ? channelConfigs [i][0] : channelConfigs [i][1]),
|
||||
|
|
|
|||
|
|
@ -479,13 +479,13 @@ public:
|
|||
//==============================================================================
|
||||
bool getEffectName (char* name)
|
||||
{
|
||||
String (JucePlugin_Name).copyToBuffer (name, 64);
|
||||
String (JucePlugin_Name).copyToCString (name, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool getVendorString (char* text)
|
||||
{
|
||||
String (JucePlugin_Manufacturer).copyToBuffer (text, 64);
|
||||
String (JucePlugin_Manufacturer).copyToCString (text, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -549,8 +549,8 @@ public:
|
|||
|
||||
const String name (filter->getInputChannelName ((int) index));
|
||||
|
||||
name.copyToBuffer (properties->label, kVstMaxLabelLen - 1);
|
||||
name.copyToBuffer (properties->shortLabel, kVstMaxShortLabelLen - 1);
|
||||
name.copyToCString (properties->label, kVstMaxLabelLen - 1);
|
||||
name.copyToCString (properties->shortLabel, kVstMaxShortLabelLen - 1);
|
||||
|
||||
if (speakerIn != kSpeakerArrEmpty)
|
||||
{
|
||||
|
|
@ -577,8 +577,8 @@ public:
|
|||
|
||||
const String name (filter->getOutputChannelName ((int) index));
|
||||
|
||||
name.copyToBuffer (properties->label, kVstMaxLabelLen - 1);
|
||||
name.copyToBuffer (properties->shortLabel, kVstMaxShortLabelLen - 1);
|
||||
name.copyToCString (properties->label, kVstMaxLabelLen - 1);
|
||||
name.copyToCString (properties->shortLabel, kVstMaxShortLabelLen - 1);
|
||||
|
||||
if (speakerOut != kSpeakerArrEmpty)
|
||||
{
|
||||
|
|
@ -938,14 +938,14 @@ public:
|
|||
void getProgramName (char* name)
|
||||
{
|
||||
if (filter != 0)
|
||||
filter->getProgramName (filter->getCurrentProgram()).copyToBuffer (name, 24);
|
||||
filter->getProgramName (filter->getCurrentProgram()).copyToCString (name, 24);
|
||||
}
|
||||
|
||||
bool getProgramNameIndexed (VstInt32 category, VstInt32 index, char* text)
|
||||
{
|
||||
if (filter != 0 && ((unsigned int) index) < (unsigned int) filter->getNumPrograms())
|
||||
{
|
||||
filter->getProgramName (index).copyToBuffer (text, 24);
|
||||
filter->getProgramName (index).copyToCString (text, 24);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -976,7 +976,7 @@ public:
|
|||
if (filter != 0)
|
||||
{
|
||||
jassert (((unsigned int) index) < (unsigned int) filter->getNumParameters());
|
||||
filter->getParameterText (index).copyToBuffer (text, 24); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
||||
filter->getParameterText (index).copyToCString (text, 24); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -985,7 +985,7 @@ public:
|
|||
if (filter != 0)
|
||||
{
|
||||
jassert (((unsigned int) index) < (unsigned int) filter->getNumParameters());
|
||||
filter->getParameterName (index).copyToBuffer (text, 16); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
||||
filter->getParameterName (index).copyToCString (text, 16); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1321,7 +1321,7 @@ public:
|
|||
if (editorComp != 0)
|
||||
{
|
||||
#if ! JUCE_LINUX // linux hosts shouldn't be trusted!
|
||||
if (! (canHostDo ("sizeWindow") && sizeWindow (newWidth, newHeight)))
|
||||
if (! (canHostDo (const_cast <char*> ("sizeWindow")) && sizeWindow (newWidth, newHeight)))
|
||||
#endif
|
||||
{
|
||||
// some hosts don't support the sizeWindow call, so do it manually..
|
||||
|
|
|
|||
|
|
@ -137,10 +137,10 @@ private:
|
|||
return String ((const WCHAR*) buffer, size);
|
||||
#elif JUCE_MAC
|
||||
_NSGetExecutablePath ((char*) buffer, &size);
|
||||
return String::fromUTF8 ((const JUCE_NAMESPACE::uint8*) buffer, size);
|
||||
return String::fromUTF8 (buffer, size);
|
||||
#elif JUCE_LINUX
|
||||
readlink ("/proc/self/exe", (char*) buffer, size);
|
||||
return String::fromUTF8 ((const JUCE_NAMESPACE::uint8*) buffer, size);
|
||||
return String::fromUTF8 (buffer, size);
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ ifndef CONFIG
|
|||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
# (this disables dependency generation if multiple architectures are set)
|
||||
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
|
||||
|
||||
ifeq ($(CONFIG),Debug)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
//#define JUCE_SUPPORT_CARBON
|
||||
//#define JUCE_CHECK_MEMORY_LEAKS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_STRINGS_ARE_UNICODE
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ ifndef CONFIG
|
|||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
# (this disables dependency generation if multiple architectures are set)
|
||||
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
|
||||
|
||||
ifeq ($(CONFIG),Debug)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
//#define JUCE_SUPPORT_CARBON
|
||||
//#define JUCE_CHECK_MEMORY_LEAKS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_STRINGS_ARE_UNICODE
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ ifndef CONFIG
|
|||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
# (this disables dependency generation if multiple architectures are set)
|
||||
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
|
||||
|
||||
ifeq ($(CONFIG),Debug)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
//#define JUCE_SUPPORT_CARBON
|
||||
//#define JUCE_CHECK_MEMORY_LEAKS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_STRINGS_ARE_UNICODE
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "BinaryData.h"
|
||||
|
||||
|
||||
const char* BinaryData::getNamedResource (const char* resourceName, int& numBytes) throw()
|
||||
const char* BinaryData::getNamedResource (const wchar_t* resourceName, int& numBytes) throw()
|
||||
{
|
||||
int hash = 0;
|
||||
while (*resourceName != 0)
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ namespace BinaryData
|
|||
|
||||
// If you provide the name of one of the binary resource variables above, this function will
|
||||
// return the corresponding data and its size (or a null pointer if the name isn't found).
|
||||
const char* getNamedResource (const char* resourceName, int& dataSizeInBytes) throw();
|
||||
const char* getNamedResource (const wchar_t* resourceName, int& dataSizeInBytes) throw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public:
|
|||
// The send button has been pressed, so write out the contents of the
|
||||
// text box to the socket or pipe, depending on which is active.
|
||||
const String text (sendText->getText());
|
||||
MemoryBlock messageData ((const char*) text, text.length());
|
||||
MemoryBlock messageData (text.toUTF8(), text.getNumBytesAsUTF8());
|
||||
|
||||
for (int i = activeConnections.size(); --i >= 0;)
|
||||
{
|
||||
|
|
|
|||
2
juce.h
2
juce.h
|
|
@ -165,7 +165,7 @@ END_JUCE_NAMESPACE
|
|||
#define START_JUCE_APPLICATION(AppClass) \
|
||||
int main (int argc, char* argv[]) \
|
||||
{ \
|
||||
return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
|
||||
return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
|
||||
}
|
||||
|
||||
#elif JUCE_WINDOWS
|
||||
|
|
|
|||
|
|
@ -266,13 +266,6 @@
|
|||
#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
||||
/** JUCE_STRINGS_ARE_UNICODE: If this macro is set, the Juce String class will use
|
||||
unicode as its internal representation. If disabled, it'll use ANSI.
|
||||
*/
|
||||
#ifndef JUCE_STRINGS_ARE_UNICODE
|
||||
#define JUCE_STRINGS_ARE_UNICODE 1
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// If only building the core classes, we can explicitly turn off some features to avoid including them:
|
||||
#if JUCE_ONLY_BUILD_CORE_LIBRARY
|
||||
|
|
|
|||
1163
juce_amalgamated.cpp
1163
juce_amalgamated.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -43,8 +43,9 @@
|
|||
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 51
|
||||
#define JUCE_BUILDNUMBER 0
|
||||
|
||||
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8))
|
||||
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_TargetPlatform.h ***/
|
||||
|
|
@ -303,10 +304,6 @@
|
|||
#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_STRINGS_ARE_UNICODE
|
||||
#define JUCE_STRINGS_ARE_UNICODE 1
|
||||
#endif
|
||||
|
||||
// If only building the core classes, we can explicitly turn off some features to avoid including them:
|
||||
#if JUCE_ONLY_BUILD_CORE_LIBRARY
|
||||
#undef JUCE_QUICKTIME
|
||||
|
|
@ -963,19 +960,8 @@ inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destB
|
|||
#ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
|
||||
#define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
|
||||
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
|
||||
#define JUCE_T(stringLiteral) (L##stringLiteral)
|
||||
typedef juce_wchar tchar;
|
||||
#define juce_tcharToWideChar(c) (c)
|
||||
|
||||
#else
|
||||
|
||||
#define JUCE_T(stringLiteral) (stringLiteral)
|
||||
typedef char tchar;
|
||||
#define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
|
||||
|
||||
#endif
|
||||
#define JUCE_T(stringLiteral) (L##stringLiteral)
|
||||
typedef juce_wchar tchar;
|
||||
|
||||
#if ! JUCE_DONT_DEFINE_MACROS
|
||||
|
||||
|
|
@ -1001,6 +987,8 @@ public:
|
|||
|
||||
static int compare (const char* const s1, const char* const s2) throw();
|
||||
static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
|
||||
static int compare (const juce_wchar* s1, const char* s2) throw();
|
||||
static int compare (const char* s1, const juce_wchar* s2) throw();
|
||||
|
||||
static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
|
||||
static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
|
||||
|
|
@ -1062,7 +1050,7 @@ public:
|
|||
static bool isLetterOrDigit (const char character) throw();
|
||||
static bool isLetterOrDigit (const juce_wchar character) throw();
|
||||
|
||||
static int getHexDigitValue (const tchar digit) throw();
|
||||
static int getHexDigitValue (const juce_wchar digit) throw();
|
||||
|
||||
static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
|
||||
static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
|
||||
|
|
@ -1092,7 +1080,7 @@ public:
|
|||
String (const juce_wchar* const unicodeText,
|
||||
const size_t maxChars) throw();
|
||||
|
||||
static const String charToString (const tchar character) throw();
|
||||
static const String charToString (const juce_wchar character) throw();
|
||||
|
||||
~String() throw();
|
||||
|
||||
|
|
@ -1106,37 +1094,17 @@ public:
|
|||
|
||||
// Assignment and concatenation operators..
|
||||
|
||||
const String& operator= (const tchar* const other) throw();
|
||||
|
||||
const String& operator= (const String& other) throw();
|
||||
|
||||
const String& operator+= (const tchar* const textToAppend) throw();
|
||||
const String& operator+= (const String& stringToAppend) throw();
|
||||
const String& operator+= (const char characterToAppend) throw();
|
||||
const String& operator+= (const juce_wchar characterToAppend) throw();
|
||||
String& operator+= (const tchar* const textToAppend);
|
||||
String& operator+= (const String& stringToAppend);
|
||||
String& operator+= (const char characterToAppend);
|
||||
String& operator+= (const juce_wchar characterToAppend);
|
||||
String& operator+= (const int numberToAppend);
|
||||
String& operator+= (const unsigned int numberToAppend);
|
||||
|
||||
void append (const tchar* const textToAppend,
|
||||
const int maxCharsToTake) throw();
|
||||
|
||||
const String operator+ (const String& stringToAppend) const throw();
|
||||
|
||||
const String operator+ (const tchar* const textToAppend) const throw();
|
||||
|
||||
const String operator+ (const tchar characterToAppend) const throw();
|
||||
|
||||
String& operator<< (const char n) throw();
|
||||
String& operator<< (const juce_wchar n) throw();
|
||||
String& operator<< (const char* const text) throw();
|
||||
String& operator<< (const juce_wchar* const text) throw();
|
||||
String& operator<< (const String& text) throw();
|
||||
|
||||
String& operator<< (const short number) throw();
|
||||
String& operator<< (const int number) throw();
|
||||
String& operator<< (const unsigned int number) throw();
|
||||
String& operator<< (const long number) throw();
|
||||
String& operator<< (const unsigned long number) throw();
|
||||
String& operator<< (const float number) throw();
|
||||
String& operator<< (const double number) throw();
|
||||
const int maxCharsToTake);
|
||||
|
||||
// Comparison methods..
|
||||
|
||||
|
|
@ -1144,26 +1112,18 @@ public:
|
|||
|
||||
inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
|
||||
|
||||
bool operator== (const String& other) const throw();
|
||||
bool operator== (const tchar* const other) const throw();
|
||||
|
||||
bool operator!= (const String& other) const throw();
|
||||
bool operator!= (const tchar* const other) const throw();
|
||||
|
||||
bool equalsIgnoreCase (const String& other) const throw();
|
||||
bool equalsIgnoreCase (const tchar* const other) const throw();
|
||||
|
||||
bool operator> (const String& other) const throw();
|
||||
bool operator< (const tchar* const other) const throw();
|
||||
int compare (const String& other) const throw();
|
||||
|
||||
bool operator>= (const String& other) const throw();
|
||||
bool operator<= (const tchar* const other) const throw();
|
||||
int compare (const char* other) const throw();
|
||||
|
||||
int compare (const tchar* const other) const throw();
|
||||
int compare (const juce_wchar* other) const throw();
|
||||
|
||||
int compareIgnoreCase (const tchar* const other) const throw();
|
||||
int compareIgnoreCase (const String& other) const throw();
|
||||
|
||||
int compareLexicographically (const tchar* const other) const throw();
|
||||
int compareLexicographically (const String& other) const throw();
|
||||
|
||||
bool startsWith (const tchar* const text) const throw();
|
||||
|
||||
|
|
@ -1234,11 +1194,11 @@ public:
|
|||
|
||||
No checks are made to see if the index is within a valid range, so be careful!
|
||||
*/
|
||||
inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
|
||||
inline const juce_wchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
|
||||
|
||||
tchar& operator[] (const int index) throw();
|
||||
juce_wchar& operator[] (const int index) throw();
|
||||
|
||||
tchar getLastCharacter() const throw();
|
||||
juce_wchar getLastCharacter() const throw();
|
||||
|
||||
const String substring (int startIndex,
|
||||
int endIndex) const throw();
|
||||
|
|
@ -1361,30 +1321,25 @@ public:
|
|||
const int size,
|
||||
const int groupSize = 1) throw();
|
||||
|
||||
// Casting to character arrays..
|
||||
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
operator const char*() const throw();
|
||||
|
||||
inline operator const juce_wchar*() const throw() { return text->text; }
|
||||
#else
|
||||
inline operator const char*() const throw() { return text->text; }
|
||||
|
||||
operator const juce_wchar*() const throw();
|
||||
#endif
|
||||
inline operator juce_wchar*() throw() { return text->text; }
|
||||
|
||||
void copyToBuffer (char* const destBuffer,
|
||||
const int maxCharsToCopy) const throw();
|
||||
const char* toUTF8() const;
|
||||
|
||||
void copyToBuffer (juce_wchar* const destBuffer,
|
||||
const int maxCharsToCopy) const throw();
|
||||
static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
|
||||
|
||||
int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
|
||||
int getNumBytesAsUTF8() const throw();
|
||||
|
||||
const char* toUTF8() const throw();
|
||||
int copyToUTF8 (char* destBuffer, const int maxBufferSizeBytes) const throw();
|
||||
|
||||
static const String fromUTF8 (const uint8* const utf8buffer,
|
||||
int bufferSizeBytes = -1) throw();
|
||||
const char* toCString() const;
|
||||
|
||||
int getNumBytesAsCString() const throw();
|
||||
|
||||
int copyToCString (char* destBuffer, const int maxBufferSizeBytes) const throw();
|
||||
|
||||
void copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw();
|
||||
|
||||
void preallocateStorage (const size_t numCharsNeeded) throw();
|
||||
|
||||
|
|
@ -1412,12 +1367,7 @@ private:
|
|||
{
|
||||
int refCount;
|
||||
int allocatedNumChars;
|
||||
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
wchar_t text[1];
|
||||
#else
|
||||
char text[1];
|
||||
#endif
|
||||
wchar_t text[1];
|
||||
};
|
||||
|
||||
InternalRefCountedStringHolder* text;
|
||||
|
|
@ -1433,11 +1383,47 @@ private:
|
|||
void dupeInternalIfMultiplyReferenced() throw();
|
||||
};
|
||||
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
|
||||
const String& string2) throw();
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const char* string1, const String& string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* string1, const String& string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (char string1, const String& string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (juce_wchar string1, const String& string2);
|
||||
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
|
||||
const String& string2) throw();
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const String& string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const char* string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const juce_wchar* string2);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, char characterToAppend);
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, juce_wchar characterToAppend);
|
||||
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char characterToAppend);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar characterToAppend);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char* const string2);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar* const string2);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const String& string2);
|
||||
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const short number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const int number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned int number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const long number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned long number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const float number);
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const double number);
|
||||
|
||||
template <class charT, class traits>
|
||||
std::basic_ostream <charT, traits>& operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
|
||||
{
|
||||
return stream << stringToWrite.toUTF8();
|
||||
}
|
||||
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const String& string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const char* string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const juce_wchar* string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const String& string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const char* string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const juce_wchar* string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator> (const String& string1, const String& string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator< (const String& string1, const String& string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator>= (const String& string1, const String& string2) throw();
|
||||
bool JUCE_PUBLIC_FUNCTION operator<= (const String& string1, const String& string2) throw();
|
||||
|
||||
#endif // __JUCE_STRING_JUCEHEADER__
|
||||
/*** End of inlined file: juce_String.h ***/
|
||||
|
|
@ -2864,8 +2850,6 @@ public:
|
|||
|
||||
virtual OutputStream& operator<< (const char* const text);
|
||||
|
||||
virtual OutputStream& operator<< (const juce_wchar* const text);
|
||||
|
||||
virtual OutputStream& operator<< (const String& text);
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
|
@ -3355,7 +3339,7 @@ public:
|
|||
{
|
||||
// Two ScopedPointers should never be able to refer to the same object - if
|
||||
// this happens, you must have done something dodgy!
|
||||
jassert (object != objectToTransferFrom.object);
|
||||
jassert (object == 0 || object != objectToTransferFrom.object);
|
||||
|
||||
ObjectType* const oldObject = object;
|
||||
object = objectToTransferFrom.object;
|
||||
|
|
@ -9161,6 +9145,8 @@ public:
|
|||
|
||||
Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
|
||||
|
||||
const Point operator-() const throw() { return Point (-x, -y); }
|
||||
|
||||
ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
|
||||
|
||||
void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
|
||||
|
|
@ -12900,7 +12886,7 @@ public:
|
|||
// These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
|
||||
|
||||
static int main (String& commandLine, JUCEApplication* const newApp);
|
||||
static int main (int argc, char* argv[], JUCEApplication* const newApp);
|
||||
static int main (int argc, const char* argv[], JUCEApplication* const newApp);
|
||||
|
||||
static void sendUnhandledException (const std::exception* const e,
|
||||
const char* const sourceFile,
|
||||
|
|
@ -28284,7 +28270,7 @@ END_JUCE_NAMESPACE
|
|||
#define START_JUCE_APPLICATION(AppClass) \
|
||||
int main (int argc, char* argv[]) \
|
||||
{ \
|
||||
return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
|
||||
return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
|
||||
}
|
||||
|
||||
#elif JUCE_WINDOWS
|
||||
|
|
|
|||
|
|
@ -272,15 +272,14 @@ int JUCEApplication::shutdownAppAndClearUp()
|
|||
}
|
||||
|
||||
#if JUCE_IPHONE
|
||||
extern int juce_IPhoneMain (int argc, char* argv[], JUCEApplication* app);
|
||||
extern int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app);
|
||||
#endif
|
||||
|
||||
#if ! JUCE_WINDOWS
|
||||
extern const char* juce_Argv0;
|
||||
#endif
|
||||
|
||||
int JUCEApplication::main (int argc, char* argv[],
|
||||
JUCEApplication* const newApp)
|
||||
int JUCEApplication::main (int argc, const char* argv[], JUCEApplication* const newApp)
|
||||
{
|
||||
#if ! JUCE_WINDOWS
|
||||
juce_Argv0 = argv[0];
|
||||
|
|
@ -297,7 +296,7 @@ int JUCEApplication::main (int argc, char* argv[],
|
|||
|
||||
String cmd;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
cmd << String::fromUTF8 ((const uint8*) argv[i]) << T(' ');
|
||||
cmd << argv[i] << ' ';
|
||||
|
||||
return JUCEApplication::main (cmd, newApp);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public:
|
|||
/** @internal */
|
||||
static int main (String& commandLine, JUCEApplication* const newApp);
|
||||
/** @internal */
|
||||
static int main (int argc, char* argv[], JUCEApplication* const newApp);
|
||||
static int main (int argc, const char* argv[], JUCEApplication* const newApp);
|
||||
|
||||
/** @internal */
|
||||
static void sendUnhandledException (const std::exception* const e,
|
||||
|
|
|
|||
|
|
@ -280,8 +280,7 @@ public:
|
|||
vorbis_comment_init (&vc);
|
||||
|
||||
if (JUCEApplication::getInstance() != 0)
|
||||
vorbis_comment_add_tag (&vc, "ENCODER",
|
||||
(char*) (const char*) JUCEApplication::getInstance()->getApplicationName());
|
||||
vorbis_comment_add_tag (&vc, "ENCODER", const_cast <char*> (JUCEApplication::getInstance()->getApplicationName().toUTF8()));
|
||||
|
||||
vorbis_analysis_init (&vd, &vi);
|
||||
vorbis_block_init (&vd, &vb);
|
||||
|
|
|
|||
|
|
@ -81,17 +81,17 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript
|
|||
|
||||
struct BWAVChunk
|
||||
{
|
||||
uint8 description [256];
|
||||
uint8 originator [32];
|
||||
uint8 originatorRef [32];
|
||||
uint8 originationDate [10];
|
||||
uint8 originationTime [8];
|
||||
char description [256];
|
||||
char originator [32];
|
||||
char originatorRef [32];
|
||||
char originationDate [10];
|
||||
char originationTime [8];
|
||||
uint32 timeRefLow;
|
||||
uint32 timeRefHigh;
|
||||
uint16 version;
|
||||
uint8 umid[64];
|
||||
uint8 reserved[190];
|
||||
uint8 codingHistory[1];
|
||||
char codingHistory[1];
|
||||
|
||||
void copyTo (StringPairArray& values) const
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@ struct BWAVChunk
|
|||
|
||||
static MemoryBlock createFrom (const StringPairArray& values)
|
||||
{
|
||||
const size_t sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (0) - 1;
|
||||
const size_t sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].getNumBytesAsUTF8();
|
||||
MemoryBlock data ((sizeNeeded + 3) & ~3);
|
||||
data.fillWith (0);
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ struct BWAVChunk
|
|||
b->timeRefLow = ByteOrder::swapIfBigEndian ((uint32) (time & 0xffffffff));
|
||||
b->timeRefHigh = ByteOrder::swapIfBigEndian ((uint32) (time >> 32));
|
||||
|
||||
values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (b->codingHistory);
|
||||
values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (b->codingHistory, 0x7fffffff);
|
||||
|
||||
if (b->description[0] != 0
|
||||
|| b->originator[0] != 0
|
||||
|
|
|
|||
|
|
@ -2040,7 +2040,7 @@ void VSTPluginInstance::setParamsInProgramBlock (fxProgram* const prog) throw()
|
|||
prog->fxVersion = vst_swap (getVersionNumber());
|
||||
prog->numParams = vst_swap (numParams);
|
||||
|
||||
getCurrentProgramName().copyToBuffer (prog->prgName, sizeof (prog->prgName) - 1);
|
||||
getCurrentProgramName().copyToCString (prog->prgName, sizeof (prog->prgName) - 1);
|
||||
|
||||
for (int i = 0; i < numParams; ++i)
|
||||
prog->params[i] = vst_swapFloat (getParameter (i));
|
||||
|
|
@ -2091,7 +2091,7 @@ bool VSTPluginInstance::saveToFXBFile (MemoryBlock& dest, bool isFXB, int maxSiz
|
|||
set->numPrograms = vst_swap (numPrograms);
|
||||
set->chunkSize = vst_swap ((long) chunk.getSize());
|
||||
|
||||
getCurrentProgramName().copyToBuffer (set->name, sizeof (set->name) - 1);
|
||||
getCurrentProgramName().copyToCString (set->name, sizeof (set->name) - 1);
|
||||
chunk.copyTo (set->chunk, 0, chunk.getSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -2275,7 +2275,7 @@ static VstIntPtr handleGeneralCallback (VstInt32 opcode, VstInt32 index, VstInt3
|
|||
if (JUCEApplication::getInstance() != 0)
|
||||
hostName = JUCEApplication::getInstance()->getApplicationName();
|
||||
|
||||
hostName.copyToBuffer ((char*) ptr, jmin (kVstMaxVendorStrLen, kVstMaxProductStrLen) - 1);
|
||||
hostName.copyToCString ((char*) ptr, jmin (kVstMaxVendorStrLen, kVstMaxProductStrLen) - 1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2373,7 +2373,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs
|
|||
#if JUCE_MAC
|
||||
return (VstIntPtr) (void*) &module->parentDirFSSpec;
|
||||
#else
|
||||
return (VstIntPtr) (pointer_sized_uint) (const char*) module->fullParentDirectoryPathName;
|
||||
return (VstIntPtr) (pointer_sized_uint) module->fullParentDirectoryPathName.toUTF8();
|
||||
#endif
|
||||
|
||||
case audioMasterGetAutomationState:
|
||||
|
|
@ -2621,7 +2621,7 @@ void VSTPluginInstance::createTempParameterStore (MemoryBlock& dest)
|
|||
dest.setSize (64 + 4 * getNumParameters());
|
||||
dest.fillWith (0);
|
||||
|
||||
getCurrentProgramName().copyToBuffer ((char*) dest.getData(), 63);
|
||||
getCurrentProgramName().copyToCString ((char*) dest.getData(), 63);
|
||||
|
||||
float* const p = (float*) (((char*) dest.getData()) + 64);
|
||||
for (int i = 0; i < getNumParameters(); ++i)
|
||||
|
|
@ -2671,7 +2671,7 @@ void VSTPluginInstance::changeProgramName (int index, const String& newName)
|
|||
if (index == getCurrentProgram())
|
||||
{
|
||||
if (getNumPrograms() > 0 && newName != getCurrentProgramName())
|
||||
dispatch (effSetProgramName, 0, 0, (void*) (const char*) newName.substring (0, 24), 0.0f);
|
||||
dispatch (effSetProgramName, 0, 0, (void*) newName.substring (0, 24).toCString(), 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ void AudioProcessor::copyXmlToBinary (const XmlElement& xml,
|
|||
JUCE_NAMESPACE::MemoryBlock& destData)
|
||||
{
|
||||
const String xmlString (xml.createDocument (String::empty, true, false));
|
||||
const int stringLength = xmlString.length();
|
||||
const int stringLength = xmlString.getNumBytesAsUTF8();
|
||||
|
||||
destData.setSize (stringLength + 10);
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ void AudioProcessor::copyXmlToBinary (const XmlElement& xml,
|
|||
*(uint32*) d = ByteOrder::swapIfBigEndian ((const uint32) magicXmlNumber);
|
||||
*(uint32*) (d + 4) = ByteOrder::swapIfBigEndian ((const uint32) stringLength);
|
||||
|
||||
xmlString.copyToBuffer (d + 8, stringLength);
|
||||
xmlString.copyToUTF8 (d + 8, stringLength + 1);
|
||||
}
|
||||
|
||||
XmlElement* AudioProcessor::getXmlFromBinary (const void* data,
|
||||
|
|
@ -283,8 +283,8 @@ XmlElement* AudioProcessor::getXmlFromBinary (const void* data,
|
|||
|
||||
if (stringLength > 0)
|
||||
{
|
||||
XmlDocument doc (String (((const char*) data) + 8,
|
||||
jmin ((sizeInBytes - 8), stringLength)));
|
||||
XmlDocument doc (String::fromUTF8 (((const char*) data) + 8,
|
||||
jmin ((sizeInBytes - 8), stringLength)));
|
||||
|
||||
return doc.getDocumentElement();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public:
|
|||
{
|
||||
// Two ScopedPointers should never be able to refer to the same object - if
|
||||
// this happens, you must have done something dodgy!
|
||||
jassert (object != objectToTransferFrom.object);
|
||||
jassert (object == 0 || object != objectToTransferFrom.object);
|
||||
|
||||
ObjectType* const oldObject = object;
|
||||
object = objectToTransferFrom.object;
|
||||
|
|
|
|||
|
|
@ -241,11 +241,11 @@ void var::writeToStream (OutputStream& output) const
|
|||
case doubleType: output.writeCompressedInt (9); output.writeByte (4); output.writeDouble (value.doubleValue); break;
|
||||
case stringType:
|
||||
{
|
||||
const int len = value.stringValue->copyToUTF8 (0);
|
||||
const int len = value.stringValue->getNumBytesAsUTF8() + 1;
|
||||
output.writeCompressedInt (len + 1);
|
||||
output.writeByte (5);
|
||||
HeapBlock <uint8> temp (len);
|
||||
value.stringValue->copyToUTF8 (temp);
|
||||
value.stringValue->copyToUTF8 (temp, len);
|
||||
output.write (temp, len);
|
||||
break;
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ const var var::readFromStream (InputStream& input)
|
|||
{
|
||||
MemoryBlock mb;
|
||||
input.readIntoMemoryBlock (mb, numBytes - 1);
|
||||
return var (String::fromUTF8 ((const uint8*) mb.getData(), (int) mb.getSize()));
|
||||
return var (String::fromUTF8 ((const char*) mb.getData(), (int) mb.getSize()));
|
||||
}
|
||||
|
||||
default: input.skipNextBytes (numBytes - 1); break;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 51
|
||||
#define JUCE_BUILDNUMBER 0
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
@ -42,7 +43,7 @@
|
|||
|
||||
See also SystemStats::getJUCEVersion() for a string version.
|
||||
*/
|
||||
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8))
|
||||
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -43,10 +43,11 @@ void juce_initialiseStrings();
|
|||
//==============================================================================
|
||||
const String SystemStats::getJUCEVersion() throw()
|
||||
{
|
||||
return "JUCE v" + String (JUCE_MAJOR_VERSION) + "." + String (JUCE_MINOR_VERSION);
|
||||
return "JUCE v" + String (JUCE_MAJOR_VERSION)
|
||||
+ "." + String (JUCE_MINOR_VERSION)
|
||||
+ "." + String (JUCE_BUILDNUMBER);
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
static bool juceInitialisedNonGUI = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
|
|||
}
|
||||
}
|
||||
|
||||
imageOffset = Point<int>() - clipped;
|
||||
imageOffset = -clipped;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ public:
|
|||
/** Subtracts another point's co-ordinates to this one. */
|
||||
Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
|
||||
|
||||
/** Returns the inverse of this point. */
|
||||
const Point operator-() const throw() { return Point (-x, -y); }
|
||||
|
||||
/** Returns the straight-line distance between this point and another one. */
|
||||
ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
|
||||
|
||||
|
|
|
|||
|
|
@ -158,10 +158,9 @@ static const String parseAbsolutePath (String path)
|
|||
else
|
||||
{
|
||||
// expand a name of type "~dave/abc"
|
||||
const String userName (path.substring (1)
|
||||
.upToFirstOccurrenceOf (T("/"), false, false));
|
||||
const String userName (path.substring (1).upToFirstOccurrenceOf (T("/"), false, false));
|
||||
|
||||
struct passwd* const pw = getpwnam (userName);
|
||||
struct passwd* const pw = getpwnam (userName.toUTF8());
|
||||
if (pw != 0)
|
||||
{
|
||||
String home (homeDir);
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ void ZipFile::init()
|
|||
break;
|
||||
|
||||
ZipEntryInfo* const zei = new ZipEntryInfo();
|
||||
zei->entry.filename = String::fromUTF8 ((const uint8*) buffer + 46, fileNameLen);
|
||||
zei->entry.filename = String::fromUTF8 (buffer + 46, fileNameLen);
|
||||
|
||||
const int time = ByteOrder::littleEndianShort (buffer + 12);
|
||||
const int date = ByteOrder::littleEndianShort (buffer + 14);
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ static bool connectSocket (int volatile& handle,
|
|||
const int portNumber,
|
||||
const int timeOutMillisecs) throw()
|
||||
{
|
||||
struct hostent* const hostEnt = gethostbyname (hostName);
|
||||
struct hostent* const hostEnt = gethostbyname (hostName.toUTF8());
|
||||
|
||||
if (hostEnt == 0)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ const String BufferedInputStream::readString()
|
|||
if (src[i] == 0)
|
||||
{
|
||||
position += i + 1;
|
||||
|
||||
return String::fromUTF8 ((const uint8*) src, i);
|
||||
return String::fromUTF8 (src, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ double InputStream::readDoubleBigEndian()
|
|||
const String InputStream::readString()
|
||||
{
|
||||
MemoryBlock buffer (256);
|
||||
uint8* data = (uint8*) buffer.getData();
|
||||
char* data = (char*) buffer.getData();
|
||||
size_t i = 0;
|
||||
|
||||
while ((data[i] = readByte()) != 0)
|
||||
|
|
@ -165,7 +165,7 @@ const String InputStream::readString()
|
|||
if (++i >= buffer.getSize())
|
||||
{
|
||||
buffer.setSize (buffer.getSize() + 512);
|
||||
data = (uint8*) buffer.getData();
|
||||
data = (char*) buffer.getData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ const String InputStream::readString()
|
|||
const String InputStream::readNextLine()
|
||||
{
|
||||
MemoryBlock buffer (256);
|
||||
uint8* data = (uint8*) buffer.getData();
|
||||
char* data = (char*) buffer.getData();
|
||||
size_t i = 0;
|
||||
|
||||
while ((data[i] = readByte()) != 0)
|
||||
|
|
@ -196,7 +196,7 @@ const String InputStream::readNextLine()
|
|||
if (++i >= buffer.getSize())
|
||||
{
|
||||
buffer.setSize (buffer.getSize() + 512);
|
||||
data = (uint8*) buffer.getData();
|
||||
data = (char*) buffer.getData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,11 +167,10 @@ void OutputStream::writeDoubleBigEndian (double value)
|
|||
|
||||
void OutputStream::writeString (const String& text)
|
||||
{
|
||||
const int numBytes = text.copyToUTF8 (0);
|
||||
const int numBytes = text.getNumBytesAsUTF8() + 1;
|
||||
HeapBlock <uint8> temp (numBytes);
|
||||
|
||||
text.copyToUTF8 (temp);
|
||||
write (temp, numBytes); // (numBytes includes the terminating null).
|
||||
text.copyToUTF8 (temp, numBytes);
|
||||
write (temp, numBytes);
|
||||
}
|
||||
|
||||
void OutputStream::printf (const char* pf, ...)
|
||||
|
|
@ -206,14 +205,14 @@ void OutputStream::printf (const char* pf, ...)
|
|||
OutputStream& OutputStream::operator<< (const int number)
|
||||
{
|
||||
const String s (number);
|
||||
write ((const char*) s, s.length());
|
||||
write (s.toUTF8(), s.getNumBytesAsUTF8());
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputStream& OutputStream::operator<< (const double number)
|
||||
{
|
||||
const String s (number);
|
||||
write ((const char*) s, s.length());
|
||||
write (s.toUTF8(), s.getNumBytesAsUTF8());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -229,18 +228,9 @@ OutputStream& OutputStream::operator<< (const char* const text)
|
|||
return *this;
|
||||
}
|
||||
|
||||
OutputStream& OutputStream::operator<< (const juce_wchar* const text)
|
||||
{
|
||||
const String s (text);
|
||||
write ((const char*) s, s.length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputStream& OutputStream::operator<< (const String& text)
|
||||
{
|
||||
write ((const char*) text,
|
||||
text.length());
|
||||
|
||||
write (text.toUTF8(), text.getNumBytesAsUTF8());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +257,7 @@ void OutputStream::writeText (const String& text,
|
|||
}
|
||||
else
|
||||
{
|
||||
const char* src = (const char*) text;
|
||||
const char* src = text.toUTF8();
|
||||
const char* t = src;
|
||||
|
||||
for (;;)
|
||||
|
|
|
|||
|
|
@ -235,14 +235,9 @@ public:
|
|||
/** Writes a null-terminated string to the stream. */
|
||||
virtual OutputStream& operator<< (const char* const text);
|
||||
|
||||
/** Writes a null-terminated unicode text string to the stream, converting it
|
||||
to 8-bit characters in the default system encoding. */
|
||||
virtual OutputStream& operator<< (const juce_wchar* const text);
|
||||
|
||||
/** Writes a string to the stream as 8-bit characters in the default system encoding. */
|
||||
/** Writes a null-terminated text string to the stream, converting it to UTF8. */
|
||||
virtual OutputStream& operator<< (const String& text);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ void NamedPipe::close()
|
|||
|
||||
if (intern->createdPipe)
|
||||
{
|
||||
unlink (intern->pipeInName);
|
||||
unlink (intern->pipeOutName);
|
||||
unlink (intern->pipeInName.toUTF8());
|
||||
unlink (intern->pipeOutName.toUTF8());
|
||||
}
|
||||
|
||||
delete intern;
|
||||
|
|
@ -104,8 +104,8 @@ bool NamedPipe::openInternal (const String& pipeName, const bool createPipe)
|
|||
|
||||
if (createPipe)
|
||||
{
|
||||
if ((mkfifo (intern->pipeInName, 0666) && errno != EEXIST)
|
||||
|| (mkfifo (intern->pipeOutName, 0666) && errno != EEXIST))
|
||||
if ((mkfifo (intern->pipeInName.toUTF8(), 0666) && errno != EEXIST)
|
||||
|| (mkfifo (intern->pipeOutName.toUTF8(), 0666) && errno != EEXIST))
|
||||
{
|
||||
delete intern;
|
||||
internal = 0;
|
||||
|
|
@ -129,9 +129,9 @@ int NamedPipe::read (void* destBuffer, int maxBytesToRead, int /*timeOutMillisec
|
|||
if (intern->pipeIn == -1)
|
||||
{
|
||||
if (intern->createdPipe)
|
||||
intern->pipeIn = ::open (intern->pipeInName, O_RDWR);
|
||||
intern->pipeIn = ::open (intern->pipeInName.toUTF8(), O_RDWR);
|
||||
else
|
||||
intern->pipeIn = ::open (intern->pipeOutName, O_RDWR);
|
||||
intern->pipeIn = ::open (intern->pipeOutName.toUTF8(), O_RDWR);
|
||||
|
||||
if (intern->pipeIn == -1)
|
||||
{
|
||||
|
|
@ -175,9 +175,9 @@ int NamedPipe::write (const void* sourceBuffer, int numBytesToWrite, int timeOut
|
|||
if (intern->pipeOut == -1)
|
||||
{
|
||||
if (intern->createdPipe)
|
||||
intern->pipeOut = ::open (intern->pipeOutName, O_WRONLY);
|
||||
intern->pipeOut = ::open (intern->pipeOutName.toUTF8(), O_WRONLY);
|
||||
else
|
||||
intern->pipeOut = ::open (intern->pipeInName, O_WRONLY);
|
||||
intern->pipeOut = ::open (intern->pipeInName.toUTF8(), O_WRONLY);
|
||||
|
||||
if (intern->pipeOut == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ const File File::getCurrentWorkingDirectory()
|
|||
bufferSize += 1024;
|
||||
}
|
||||
|
||||
return File (String::fromUTF8 ((const uint8*) cwd));
|
||||
return File (String::fromUTF8 (cwd));
|
||||
}
|
||||
|
||||
bool File::setAsCurrentWorkingDirectory() const
|
||||
|
|
@ -338,7 +338,7 @@ const File juce_getExecutableFile()
|
|||
{
|
||||
Dl_info exeInfo;
|
||||
dladdr ((const void*) juce_getExecutableFile, &exeInfo);
|
||||
return File (String::fromUTF8 ((const uint8*) exeInfo.dli_fname));
|
||||
return File (String::fromUTF8 (exeInfo.dli_fname));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -401,7 +401,7 @@ const String juce_getVolumeLabel (const String& filenameOnVolume,
|
|||
if (getattrlist ((const char*) f.getFullPathName().toUTF8(),
|
||||
&attrList, &attrBuf, sizeof(attrBuf), 0) == 0)
|
||||
{
|
||||
return String::fromUTF8 (((const uint8*) &attrBuf.mountPointRef) + attrBuf.mountPointRef.attr_dataoffset,
|
||||
return String::fromUTF8 (((const char*) &attrBuf.mountPointRef) + attrBuf.mountPointRef.attr_dataoffset,
|
||||
(int) attrBuf.mountPointRef.attr_length);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,31 +61,31 @@ static void getDeviceNumChannels (snd_pcm_t* handle, unsigned int* minChans, uns
|
|||
}
|
||||
}
|
||||
|
||||
static void getDeviceProperties (const String& id,
|
||||
static void getDeviceProperties (const String& deviceID,
|
||||
unsigned int& minChansOut,
|
||||
unsigned int& maxChansOut,
|
||||
unsigned int& minChansIn,
|
||||
unsigned int& maxChansIn,
|
||||
Array <int>& rates)
|
||||
{
|
||||
if (id.isEmpty())
|
||||
if (deviceID.isEmpty())
|
||||
return;
|
||||
|
||||
snd_ctl_t* handle;
|
||||
|
||||
if (snd_ctl_open (&handle, id.upToLastOccurrenceOf (T(","), false, false), SND_CTL_NONBLOCK) >= 0)
|
||||
if (snd_ctl_open (&handle, deviceID.upToLastOccurrenceOf (T(","), false, false).toUTF8(), SND_CTL_NONBLOCK) >= 0)
|
||||
{
|
||||
snd_pcm_info_t* info;
|
||||
snd_pcm_info_alloca (&info);
|
||||
|
||||
snd_pcm_info_set_stream (info, SND_PCM_STREAM_PLAYBACK);
|
||||
snd_pcm_info_set_device (info, id.fromLastOccurrenceOf (T(","), false, false).getIntValue());
|
||||
snd_pcm_info_set_device (info, deviceID.fromLastOccurrenceOf (T(","), false, false).getIntValue());
|
||||
snd_pcm_info_set_subdevice (info, 0);
|
||||
|
||||
if (snd_ctl_pcm_info (handle, info) >= 0)
|
||||
{
|
||||
snd_pcm_t* pcmHandle;
|
||||
if (snd_pcm_open (&pcmHandle, id, SND_PCM_STREAM_PLAYBACK, SND_PCM_ASYNC | SND_PCM_NONBLOCK ) >= 0)
|
||||
if (snd_pcm_open (&pcmHandle, deviceID.toUTF8(), SND_PCM_STREAM_PLAYBACK, SND_PCM_ASYNC | SND_PCM_NONBLOCK ) >= 0)
|
||||
{
|
||||
getDeviceNumChannels (pcmHandle, &minChansOut, &maxChansOut);
|
||||
getDeviceSampleRates (pcmHandle, rates);
|
||||
|
|
@ -99,7 +99,7 @@ static void getDeviceProperties (const String& id,
|
|||
if (snd_ctl_pcm_info (handle, info) >= 0)
|
||||
{
|
||||
snd_pcm_t* pcmHandle;
|
||||
if (snd_pcm_open (&pcmHandle, id, SND_PCM_STREAM_CAPTURE, SND_PCM_ASYNC | SND_PCM_NONBLOCK ) >= 0)
|
||||
if (snd_pcm_open (&pcmHandle, deviceID.toUTF8(), SND_PCM_STREAM_CAPTURE, SND_PCM_ASYNC | SND_PCM_NONBLOCK ) >= 0)
|
||||
{
|
||||
getDeviceNumChannels (pcmHandle, &minChansIn, &maxChansIn);
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ static void getDeviceProperties (const String& id,
|
|||
class ALSADevice
|
||||
{
|
||||
public:
|
||||
ALSADevice (const String& id,
|
||||
ALSADevice (const String& deviceID,
|
||||
const bool forInput)
|
||||
: handle (0),
|
||||
bitDepth (16),
|
||||
|
|
@ -126,7 +126,7 @@ public:
|
|||
isInput (forInput),
|
||||
sampleFormat (AudioDataConverters::int16LE)
|
||||
{
|
||||
failed (snd_pcm_open (&handle, id,
|
||||
failed (snd_pcm_open (&handle, deviceID.toUTF8(),
|
||||
forInput ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
|
||||
SND_PCM_ASYNC));
|
||||
}
|
||||
|
|
@ -861,7 +861,7 @@ public:
|
|||
if (cardNum < 0)
|
||||
break;
|
||||
|
||||
if (snd_ctl_open (&handle, T("hw:") + String (cardNum), SND_CTL_NONBLOCK) >= 0)
|
||||
if (snd_ctl_open (&handle, ("hw:" + String (cardNum)).toUTF8(), SND_CTL_NONBLOCK) >= 0)
|
||||
{
|
||||
if (snd_ctl_card_info (handle, info) >= 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static String juce_readWindowProperty (Window window, Atom prop,
|
|||
bool deleteAfterReading)
|
||||
{
|
||||
String returnData;
|
||||
uint8 *clipData;
|
||||
char* clipData;
|
||||
Atom actualType;
|
||||
int actualFormat;
|
||||
unsigned long numItems, bytesLeft;
|
||||
|
|
@ -69,7 +69,7 @@ static String juce_readWindowProperty (Window window, Atom prop,
|
|||
0L /* offset */, 1000000 /* length (max) */, False,
|
||||
AnyPropertyType /* format */,
|
||||
&actualType, &actualFormat, &numItems, &bytesLeft,
|
||||
&clipData) == Success)
|
||||
(unsigned char**) &clipData) == Success)
|
||||
{
|
||||
if (actualType == atom_UTF8_STRING && actualFormat == 8)
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ static String juce_readWindowProperty (Window window, Atom prop,
|
|||
}
|
||||
else if (actualType == XA_STRING && actualFormat == 8)
|
||||
{
|
||||
returnData = String ((const char*) clipData, numItems);
|
||||
returnData = String (clipData, numItems);
|
||||
}
|
||||
|
||||
if (clipData != 0)
|
||||
|
|
@ -162,17 +162,17 @@ void juce_handleSelectionRequest (XSelectionRequestEvent &evt)
|
|||
if (evt.target == XA_STRING)
|
||||
{
|
||||
// format data according to system locale
|
||||
numDataItems = localClipboardContent.length();
|
||||
data.calloc (numDataItems + 2);
|
||||
localClipboardContent.copyToBuffer ((char*) data, numDataItems + 1);
|
||||
numDataItems = localClipboardContent.getNumBytesAsCString() + 1;
|
||||
data.calloc (numDataItems + 1);
|
||||
localClipboardContent.copyToCString (data, numDataItems);
|
||||
propertyFormat = 8; // bits/item
|
||||
}
|
||||
else if (evt.target == atom_UTF8_STRING)
|
||||
{
|
||||
// translate to utf8
|
||||
numDataItems = localClipboardContent.copyToUTF8 (0);
|
||||
data.calloc (numDataItems + 2);
|
||||
localClipboardContent.copyToUTF8 (data, numDataItems + 1);
|
||||
numDataItems = localClipboardContent.getNumBytesAsUTF8() + 1;
|
||||
data.calloc (numDataItems + 1);
|
||||
localClipboardContent.copyToUTF8 (data, numDataItems);
|
||||
propertyFormat = 8; // bits/item
|
||||
}
|
||||
else if (evt.target == atom_TARGETS)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void FileChooser::showPlatformDialog (Array<File>& results,
|
|||
|
||||
if (status == 0)
|
||||
{
|
||||
String resultString (String::fromUTF8 ((const uint8*) result.getData(), result.getDataSize()));
|
||||
String resultString (String::fromUTF8 ((const char*) result.getData(), result.getDataSize()));
|
||||
StringArray tokens;
|
||||
|
||||
if (selectMultipleFiles)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
|
|||
homeDir = pw->pw_dir;
|
||||
}
|
||||
|
||||
return File (String::fromUTF8 ((const uint8*) homeDir));
|
||||
return File (String::fromUTF8 (homeDir));
|
||||
}
|
||||
|
||||
case userDocumentsDirectory:
|
||||
|
|
@ -223,7 +223,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
|
|||
|
||||
case invokedExecutableFile:
|
||||
if (juce_Argv0 != 0)
|
||||
return File (String::fromUTF8 ((const uint8*) juce_Argv0));
|
||||
return File (String::fromUTF8 (juce_Argv0));
|
||||
// deliberate fall-through...
|
||||
|
||||
case currentExecutableFile:
|
||||
|
|
@ -248,11 +248,11 @@ const String File::getVersion() const
|
|||
const File File::getLinkedTarget() const
|
||||
{
|
||||
char buffer [4096];
|
||||
size_t numChars = readlink ((const char*) getFullPathName().toUTF8(),
|
||||
size_t numChars = readlink (getFullPathName().toUTF8(),
|
||||
buffer, sizeof (buffer));
|
||||
|
||||
if (numChars > 0 && numChars <= sizeof (buffer))
|
||||
return File (String::fromUTF8 ((const uint8*) buffer, (int) numChars));
|
||||
return File (String::fromUTF8 (buffer, (int) numChars));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ struct FindFileStruct
|
|||
|
||||
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
|
||||
{
|
||||
result = String::fromUTF8 ((const uint8*) de->d_name);
|
||||
result = String::fromUTF8 (de->d_name);
|
||||
|
||||
const String path (parentDir + result);
|
||||
|
||||
|
|
|
|||
|
|
@ -178,10 +178,8 @@ public:
|
|||
|
||||
do
|
||||
{
|
||||
if (FT_New_Face (ftLib,
|
||||
possible.getFullPathName(),
|
||||
faceIndex,
|
||||
&face) == 0)
|
||||
if (FT_New_Face (ftLib, possible.getFullPathName().toUTF8(),
|
||||
faceIndex, &face) == 0)
|
||||
{
|
||||
if (faceIndex == 0)
|
||||
numFaces = face->num_faces;
|
||||
|
|
@ -276,7 +274,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (! FT_New_Face (ftLib, (const char*) fileName, faceIndex, &lastFace))
|
||||
if (! FT_New_Face (ftLib, fileName.toUTF8(), faceIndex, &lastFace))
|
||||
{
|
||||
face = lastFace;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ JUCE_DECL_JACK_FUNCTION (int, jack_port_connected_to, (const jack_port_t* port,
|
|||
#if JACK_LOGGING_ENABLED
|
||||
static void jack_Log (const String& s)
|
||||
{
|
||||
puts (s);
|
||||
std::cerr << s << std::endl;
|
||||
}
|
||||
|
||||
static void dumpJackErrorMessage (const jack_status_t status) throw()
|
||||
|
|
@ -148,9 +148,9 @@ public:
|
|||
for (int i = 0; i < inputChannels.size(); i++)
|
||||
{
|
||||
String inputName;
|
||||
inputName << "in_" << (++totalNumberOfInputChannels);
|
||||
inputName << "in_" << ++totalNumberOfInputChannels;
|
||||
|
||||
inputPorts.add (JUCE_NAMESPACE::jack_port_register (client, (const char*) inputName,
|
||||
inputPorts.add (JUCE_NAMESPACE::jack_port_register (client, inputName.toUTF8(),
|
||||
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0));
|
||||
}
|
||||
|
||||
|
|
@ -159,9 +159,9 @@ public:
|
|||
for (int i = 0; i < outputChannels.size (); i++)
|
||||
{
|
||||
String outputName;
|
||||
outputName << "out_" << (++totalNumberOfOutputChannels);
|
||||
outputName << "out_" << ++totalNumberOfOutputChannels;
|
||||
|
||||
outputPorts.add (JUCE_NAMESPACE::jack_port_register (client, (const char*) outputName,
|
||||
outputPorts.add (JUCE_NAMESPACE::jack_port_register (client, outputName.toUTF8(),
|
||||
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,12 +183,8 @@ static int errorHandler (Display* display, XErrorEvent* event)
|
|||
|
||||
XGetErrorText (display, event->error_code, errorStr, 64);
|
||||
|
||||
XGetErrorDatabaseText (display,
|
||||
"XRequest",
|
||||
(const char*) String (event->request_code),
|
||||
"Unknown",
|
||||
requestStr,
|
||||
64);
|
||||
XGetErrorDatabaseText (display, "XRequest", String (event->request_code).toCString(),
|
||||
"Unknown", requestStr, 64);
|
||||
|
||||
DBG (T("ERROR: X returned ") + String (errorStr) + T(" for operation ") + String (requestStr));
|
||||
#endif
|
||||
|
|
@ -279,9 +275,9 @@ void MessageManager::doPlatformSpecificInitialisation()
|
|||
// Try to connect to a display
|
||||
String displayName (getenv ("DISPLAY"));
|
||||
if (displayName.isEmpty())
|
||||
displayName = T(":0.0");
|
||||
displayName = ":0.0";
|
||||
|
||||
display = XOpenDisplay (displayName);
|
||||
display = XOpenDisplay (displayName.toCString());
|
||||
|
||||
if (display == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ static snd_seq_t* createDevice (const bool forInput,
|
|||
: SND_SEQ_OPEN_OUTPUT, 0) == 0)
|
||||
{
|
||||
snd_seq_set_client_name (seqHandle,
|
||||
(const char*) (forInput ? (deviceNameToOpen + T(" Input"))
|
||||
: (deviceNameToOpen + T(" Output"))));
|
||||
(deviceNameToOpen + (forInput ? " Input" : " Output")).toCString());
|
||||
|
||||
const int portId
|
||||
= snd_seq_create_simple_port (seqHandle,
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ private:
|
|||
numConsecutiveLFs = 0;
|
||||
}
|
||||
|
||||
const String header (String::fromUTF8 ((const uint8*) buffer.getData()));
|
||||
const String header (String::fromUTF8 ((const char*) buffer.getData()));
|
||||
|
||||
if (header.startsWithIgnoreCase (T("HTTP/")))
|
||||
return header.trimEnd();
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ const String SystemStats::getLogonName()
|
|||
user = pw->pw_name;
|
||||
}
|
||||
|
||||
return String::fromUTF8 ((const uint8*) user);
|
||||
return String::fromUTF8 (user);
|
||||
}
|
||||
|
||||
const String SystemStats::getFullUserName()
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ void PlatformUtilities::freeDynamicLibrary (void* handle)
|
|||
|
||||
void* PlatformUtilities::getProcedureEntryPoint (void* libraryHandle, const String& procedureName)
|
||||
{
|
||||
return dlsym (libraryHandle, (const char*) procedureName);
|
||||
return dlsym (libraryHandle, procedureName.toCString());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1162,7 +1162,7 @@ public:
|
|||
KeySym sym;
|
||||
XLookupString (keyEvent, utf8, sizeof (utf8), &sym, 0);
|
||||
|
||||
const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 ((const uint8*) utf8, sizeof (utf8) - 1);
|
||||
const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1);
|
||||
int keyCode = (int) unicodeChar;
|
||||
|
||||
if (keyCode < 0x20)
|
||||
|
|
@ -1667,7 +1667,7 @@ public:
|
|||
|
||||
String screenAtom ("_NET_SYSTEM_TRAY_S");
|
||||
screenAtom << screenNumber;
|
||||
Atom selectionAtom = XInternAtom (display, (const char*) screenAtom, false);
|
||||
Atom selectionAtom = XInternAtom (display, screenAtom.toUTF8(), false);
|
||||
|
||||
XGrabServer (display);
|
||||
Window managerWin = XGetSelectionOwner (display, selectionAtom);
|
||||
|
|
@ -2231,10 +2231,10 @@ private:
|
|||
return eventTimeOffset + thisMessageTime;
|
||||
}
|
||||
|
||||
static void setWindowTitle (Window xwin, const char* const title) throw()
|
||||
static void setWindowTitle (Window xwin, const String& title)
|
||||
{
|
||||
XTextProperty nameProperty;
|
||||
char* strings[] = { (char*) title };
|
||||
char* strings[] = { const_cast <char*> (title.toUTF8()) };
|
||||
ScopedXLock xlock;
|
||||
|
||||
if (XStringListToTextProperty (strings, 1, &nameProperty))
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ END_JUCE_NAMESPACE
|
|||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
int juce_IPhoneMain (int argc, char* argv[], JUCEApplication* app)
|
||||
int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app)
|
||||
{
|
||||
juce_intialisingApp = app;
|
||||
return UIApplicationMain (argc, argv, nil, @"JuceAppStartupDelegate");
|
||||
return UIApplicationMain (argc, const_cast<char**> (argv), nil, @"JuceAppStartupDelegate");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ END_JUCE_NAMESPACE
|
|||
|
||||
if ([err length] > 0)
|
||||
{
|
||||
*error = JUCE_NAMESPACE::String::fromUTF8 ((JUCE_NAMESPACE::uint8*) [err UTF8String]);
|
||||
*error = JUCE_NAMESPACE::String::fromUTF8 ([err UTF8String]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ const StringArray AudioCDBurner::findAvailableDevices()
|
|||
StringArray s;
|
||||
|
||||
for (unsigned int i = 0; i < [names count]; ++i)
|
||||
s.add (String::fromUTF8 ((JUCE_NAMESPACE::uint8*) [[names objectAtIndex: i] UTF8String]));
|
||||
s.add (String::fromUTF8 ([[names objectAtIndex: i] UTF8String]));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public:
|
|||
String name;
|
||||
|
||||
{
|
||||
uint8 channelName [256];
|
||||
char channelName [256];
|
||||
zerostruct (channelName);
|
||||
UInt32 nameSize = sizeof (channelName);
|
||||
UInt32 channelNum = chanNum + 1;
|
||||
|
|
@ -1160,7 +1160,7 @@ public:
|
|||
|
||||
if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name)))
|
||||
{
|
||||
const String nameString (String::fromUTF8 ((const uint8*) name, (int) strlen (name)));
|
||||
const String nameString (String::fromUTF8 (name, (int) strlen (name)));
|
||||
|
||||
if (! alreadyLogged)
|
||||
log (T("CoreAudio device: ") + nameString);
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
|
|||
|
||||
case invokedExecutableFile:
|
||||
if (juce_Argv0 != 0)
|
||||
return File (String::fromUTF8 ((const uint8*) juce_Argv0));
|
||||
return File (String::fromUTF8 (juce_Argv0));
|
||||
// deliberate fall-through...
|
||||
|
||||
case currentExecutableFile:
|
||||
|
|
@ -255,7 +255,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
|
|||
break;
|
||||
}
|
||||
|
||||
if (resultPath != 0)
|
||||
if (resultPath.isNotEmpty())
|
||||
return File (PlatformUtilities::convertToPrecomposedUnicode (resultPath));
|
||||
|
||||
return File::nonexistent;
|
||||
|
|
@ -421,7 +421,7 @@ void juce_findFileClose (void* handle)
|
|||
//==============================================================================
|
||||
bool juce_launchExecutable (const String& pathAndArguments)
|
||||
{
|
||||
const char* const argv[4] = { "/bin/sh", "-c", (const char*) pathAndArguments, 0 };
|
||||
const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), 0 };
|
||||
|
||||
const int cpid = fork();
|
||||
|
||||
|
|
@ -502,15 +502,13 @@ bool PlatformUtilities::makeFSRefFromPath (FSRef* destFSRef, const String& path)
|
|||
|
||||
const String PlatformUtilities::makePathFromFSRef (FSRef* file)
|
||||
{
|
||||
uint8 path [2048];
|
||||
zeromem (path, sizeof (path));
|
||||
|
||||
String result;
|
||||
char path [2048];
|
||||
zerostruct (path);
|
||||
|
||||
if (FSRefMakePath (file, (UInt8*) path, sizeof (path) - 1) == noErr)
|
||||
result = String::fromUTF8 (path);
|
||||
return PlatformUtilities::convertToPrecomposedUnicode (String::fromUTF8 (path));
|
||||
|
||||
return PlatformUtilities::convertToPrecomposedUnicode (result);
|
||||
return String::empty;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,6 @@
|
|||
#define JUCE_ObjCExtraSuffix 3
|
||||
#endif
|
||||
|
||||
#define appendMacro1(a, b, c, d) a ## _ ## b ## _ ## c ## _ ## d
|
||||
#define appendMacro2(a, b, c, d) appendMacro1(a, b, c, d)
|
||||
#define MakeObjCClassName(rootName) appendMacro2 (rootName, JUCE_MAJOR_VERSION, JUCE_MINOR_VERSION, JUCE_ObjCExtraSuffix)
|
||||
#define appendMacro1(a, b, c, d, e) a ## _ ## b ## _ ## c ## _ ## d ## _ ## e
|
||||
#define appendMacro2(a, b, c, d, e) appendMacro1(a, b, c, d, e)
|
||||
#define MakeObjCClassName(rootName) appendMacro2 (rootName, JUCE_MAJOR_VERSION, JUCE_MINOR_VERSION, JUCE_BUILDNUMBER, JUCE_ObjCExtraSuffix)
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@
|
|||
//==============================================================================
|
||||
static const String nsStringToJuce (NSString* s)
|
||||
{
|
||||
return String::fromUTF8 ((uint8*) [s UTF8String]);
|
||||
return String::fromUTF8 ([s UTF8String]);
|
||||
}
|
||||
|
||||
static NSString* juceStringToNS (const String& s)
|
||||
{
|
||||
return [NSString stringWithUTF8String: (const char*) s.toUTF8()];
|
||||
return [NSString stringWithUTF8String: s.toUTF8()];
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -56,18 +56,11 @@ const String PlatformUtilities::cfStringToJuceString (CFStringRef cfString)
|
|||
|
||||
if (cfString != 0)
|
||||
{
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
CFRange range = { 0, CFStringGetLength (cfString) };
|
||||
HeapBlock <UniChar> u (range.length + 1);
|
||||
CFStringGetCharacters (cfString, range, u);
|
||||
u[range.length] = 0;
|
||||
result = convertUTF16ToString (u);
|
||||
#else
|
||||
const int len = CFStringGetLength (cfString);
|
||||
HeapBlock <char> buffer (len + 1);
|
||||
CFStringGetCString (cfString, buffer, len + 1, CFStringGetSystemEncoding());
|
||||
result = buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -75,7 +68,6 @@ const String PlatformUtilities::cfStringToJuceString (CFStringRef cfString)
|
|||
|
||||
CFStringRef PlatformUtilities::juceStringToCFString (const String& s)
|
||||
{
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
const int len = s.length();
|
||||
const juce_wchar* t = (const juce_wchar*) s;
|
||||
HeapBlock <UniChar> temp (len + 2);
|
||||
|
|
@ -84,12 +76,6 @@ CFStringRef PlatformUtilities::juceStringToCFString (const String& s)
|
|||
temp[i] = t[i];
|
||||
|
||||
return CFStringCreateWithCharacters (kCFAllocatorDefault, temp, len);
|
||||
|
||||
#else
|
||||
return CFStringCreateWithCString (kCFAllocatorDefault,
|
||||
(const char*) s,
|
||||
CFStringGetSystemEncoding());
|
||||
#endif
|
||||
}
|
||||
|
||||
const String PlatformUtilities::convertToPrecomposedUnicode (const String& s)
|
||||
|
|
|
|||
|
|
@ -1843,38 +1843,30 @@ private:
|
|||
HKEY hk = 0;
|
||||
bool ok = false;
|
||||
|
||||
if (RegOpenKeyA (HKEY_CLASSES_ROOT, "clsid", &hk) == ERROR_SUCCESS)
|
||||
if (RegOpenKey (HKEY_CLASSES_ROOT, _T("clsid"), &hk) == ERROR_SUCCESS)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char buf [512];
|
||||
WCHAR buf [512];
|
||||
|
||||
if (RegEnumKeyA (hk, index++, buf, 512) == ERROR_SUCCESS)
|
||||
if (RegEnumKey (hk, index++, buf, 512) == ERROR_SUCCESS)
|
||||
{
|
||||
if (classId.equalsIgnoreCase (buf))
|
||||
{
|
||||
HKEY subKey, pathKey;
|
||||
|
||||
if (RegOpenKeyExA (hk, buf, 0, KEY_READ, &subKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyEx (hk, buf, 0, KEY_READ, &subKey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegOpenKeyExA (subKey, "InprocServer32", 0, KEY_READ, &pathKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyEx (subKey, _T("InprocServer32"), 0, KEY_READ, &pathKey) == ERROR_SUCCESS)
|
||||
{
|
||||
char pathName [600];
|
||||
WCHAR pathName [1024];
|
||||
DWORD dtype = REG_SZ;
|
||||
DWORD dsize = sizeof (pathName);
|
||||
|
||||
if (RegQueryValueExA (pathKey, 0, 0, &dtype,
|
||||
(LPBYTE) pathName, &dsize) == ERROR_SUCCESS)
|
||||
{
|
||||
OFSTRUCT of;
|
||||
zerostruct (of);
|
||||
|
||||
of.cBytes = sizeof (of);
|
||||
|
||||
ok = (OpenFile (String (pathName), &of, OF_EXIST) != 0);
|
||||
}
|
||||
if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS)
|
||||
ok = File (pathName).exists();
|
||||
|
||||
RegCloseKey (pathKey);
|
||||
}
|
||||
|
|
@ -1902,29 +1894,25 @@ private:
|
|||
{
|
||||
HKEY subKey;
|
||||
|
||||
if (RegOpenKeyExA (hk, keyName, 0, KEY_READ, &subKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyEx (hk, keyName, 0, KEY_READ, &subKey) == ERROR_SUCCESS)
|
||||
{
|
||||
char buf [256];
|
||||
WCHAR buf [256];
|
||||
zerostruct (buf);
|
||||
DWORD dtype = REG_SZ;
|
||||
DWORD dsize = sizeof (buf);
|
||||
zeromem (buf, dsize);
|
||||
|
||||
if (RegQueryValueExA (subKey, "clsid", 0, &dtype, (LPBYTE) buf, &dsize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx (subKey, _T("clsid"), 0, &dtype, (LPBYTE) buf, &dsize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (dsize > 0 && checkClassIsOk (buf))
|
||||
{
|
||||
wchar_t classIdStr [130];
|
||||
MultiByteToWideChar (CP_ACP, 0, buf, -1, classIdStr, 128);
|
||||
|
||||
String deviceName;
|
||||
CLSID classId;
|
||||
|
||||
if (CLSIDFromString ((LPOLESTR) classIdStr, &classId) == S_OK)
|
||||
if (CLSIDFromString ((LPOLESTR) buf, &classId) == S_OK)
|
||||
{
|
||||
dtype = REG_SZ;
|
||||
dsize = sizeof (buf);
|
||||
String deviceName;
|
||||
|
||||
if (RegQueryValueExA (subKey, "description", 0, &dtype, (LPBYTE) buf, &dsize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx (subKey, _T("description"), 0, &dtype, (LPBYTE) buf, &dsize) == ERROR_SUCCESS)
|
||||
deviceName = buf;
|
||||
else
|
||||
deviceName = keyName;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ DynamicLibraryLoader::~DynamicLibraryLoader()
|
|||
|
||||
void* DynamicLibraryLoader::findProcAddress (const String& functionName)
|
||||
{
|
||||
return (void*) GetProcAddress ((HMODULE) libHandle, functionName);
|
||||
return (void*) GetProcAddress ((HMODULE) libHandle, functionName.toCString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ void FileChooser::showPlatformDialog (Array<File>& results,
|
|||
}
|
||||
else
|
||||
{
|
||||
currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable);
|
||||
currentFileOrDirectory.getFileName().copyToUnicode (fname, numCharsAvailable);
|
||||
|
||||
initialDir = currentFileOrDirectory.getParentDirectory().getFullPathName();
|
||||
}
|
||||
|
|
@ -266,9 +266,9 @@ void FileChooser::showPlatformDialog (Array<File>& results,
|
|||
{
|
||||
WCHAR filters [1024];
|
||||
zeromem (filters, sizeof (filters));
|
||||
filter.copyToBuffer (filters, 1024);
|
||||
filter.copyToBuffer (filters + filter.length() + 1,
|
||||
1022 - filter.length());
|
||||
filter.copyToUnicode (filters, 1024);
|
||||
filter.copyToUnicode (filters + filter.length() + 1,
|
||||
1022 - filter.length());
|
||||
|
||||
OPENFILENAMEW of;
|
||||
zerostruct (of);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
|
|||
lf.lfPitchAndFamily = FF_DONTCARE;
|
||||
|
||||
const String fontName (lpelfe->elfLogFont.lfFaceName);
|
||||
fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1);
|
||||
fontName.copyToUnicode (lf.lfFaceName, LF_FACESIZE - 1);
|
||||
|
||||
HDC dc = CreateCompatibleDC (0);
|
||||
EnumFontFamiliesEx (dc, &lf,
|
||||
|
|
@ -179,7 +179,7 @@ public:
|
|||
lfw.lfQuality = PROOF_QUALITY;
|
||||
lfw.lfItalic = (BYTE) (italic ? TRUE : FALSE);
|
||||
lfw.lfWeight = bold ? FW_BOLD : FW_NORMAL;
|
||||
fontName.copyToBuffer (lfw.lfFaceName, LF_FACESIZE - 1);
|
||||
fontName.copyToUnicode (lfw.lfFaceName, LF_FACESIZE - 1);
|
||||
|
||||
lfw.lfHeight = size > 0 ? size : -256;
|
||||
HFONT standardSizedFont = CreateFontIndirect (&lfw);
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ void SystemClipboard::copyTextToClipboard (const String& text) throw()
|
|||
|
||||
if (bufH != 0)
|
||||
{
|
||||
wchar_t* const data = (wchar_t*) GlobalLock (bufH);
|
||||
text.copyToBuffer (data, len);
|
||||
WCHAR* const data = (WCHAR*) GlobalLock (bufH);
|
||||
text.copyToUnicode (data, len);
|
||||
GlobalUnlock (bufH);
|
||||
|
||||
SetClipboardData (CF_UNICODETEXT, bufH);
|
||||
|
|
|
|||
|
|
@ -444,8 +444,8 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd
|
|||
{
|
||||
MapiMessage message;
|
||||
zerostruct (message);
|
||||
message.lpszSubject = (LPSTR) (LPCSTR) emailSubject;
|
||||
message.lpszNoteText = (LPSTR) (LPCSTR) bodyText;
|
||||
message.lpszSubject = (LPSTR) emailSubject.toCString();
|
||||
message.lpszNoteText = (LPSTR) bodyText.toCString();
|
||||
|
||||
MapiRecipDesc recip;
|
||||
zerostruct (recip);
|
||||
|
|
@ -453,7 +453,7 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd
|
|||
String targetEmailAddress_ (targetEmailAddress);
|
||||
if (targetEmailAddress_.isEmpty())
|
||||
targetEmailAddress_ = " "; // (Windows Mail can't deal with a blank address)
|
||||
recip.lpszName = (LPSTR) (LPCSTR) targetEmailAddress_;
|
||||
recip.lpszName = (LPSTR) targetEmailAddress_.toCString();
|
||||
message.nRecipCount = 1;
|
||||
message.lpRecips = &recip;
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd
|
|||
for (int i = 0; i < filesToAttach.size(); ++i)
|
||||
{
|
||||
files[i].nPosition = (ULONG) -1;
|
||||
files[i].lpszPathName = (LPSTR) (LPCSTR) filesToAttach [i];
|
||||
files[i].lpszPathName = (LPSTR) filesToAttach[i].toCString();
|
||||
}
|
||||
|
||||
ok = (mapiSendMail (0, 0, &message, MAPI_DIALOG | MAPI_LOGON_UI, 0) == SUCCESS_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void juce_setCurrentThreadName (const String& name)
|
|||
} info;
|
||||
|
||||
info.dwType = 0x1000;
|
||||
info.szName = name;
|
||||
info.szName = name.toCString();
|
||||
info.dwThreadID = GetCurrentThreadId();
|
||||
info.dwFlags = 0;
|
||||
|
||||
|
|
@ -348,8 +348,7 @@ void PlatformUtilities::freeDynamicLibrary (void* h)
|
|||
|
||||
void* PlatformUtilities::getProcedureEntryPoint (void* h, const String& name)
|
||||
{
|
||||
return (h != 0) ? (void*) GetProcAddress ((HMODULE) h, name)
|
||||
: 0;
|
||||
return (h != 0) ? (void*) GetProcAddress ((HMODULE) h, name.toCString()) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -839,7 +839,7 @@ public:
|
|||
if (taskBarIcon != 0)
|
||||
{
|
||||
taskBarIcon->uFlags = NIF_TIP;
|
||||
toolTip.copyToBuffer (taskBarIcon->szTip, sizeof (taskBarIcon->szTip) - 1);
|
||||
toolTip.copyToUnicode (taskBarIcon->szTip, sizeof (taskBarIcon->szTip) - 1);
|
||||
Shell_NotifyIcon (NIM_MODIFY, taskBarIcon);
|
||||
}
|
||||
}
|
||||
|
|
@ -2561,8 +2561,8 @@ Image* juce_createIconForFile (const File& file)
|
|||
{
|
||||
Image* image = 0;
|
||||
|
||||
TCHAR filename [1024];
|
||||
file.getFullPathName().copyToBuffer (filename, 1023);
|
||||
WCHAR filename [1024];
|
||||
file.getFullPathName().copyToUnicode (filename, 1023);
|
||||
WORD iconNum = 0;
|
||||
|
||||
HICON icon = ExtractAssociatedIcon ((HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(),
|
||||
|
|
@ -3018,7 +3018,7 @@ static HDROP createHDrop (const StringArray& fileNames) throw()
|
|||
|
||||
for (int i = 0; i < fileNames.size(); ++i)
|
||||
{
|
||||
fileNames[i].copyToBuffer (fname, 2048);
|
||||
fileNames[i].copyToUnicode (fname, 2048);
|
||||
fname += fileNames[i].length() + 1;
|
||||
}
|
||||
|
||||
|
|
@ -3065,7 +3065,7 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text)
|
|||
medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR));
|
||||
char* d = (char*) GlobalLock (medium.hGlobal);
|
||||
|
||||
text.copyToBuffer ((WCHAR*) d, numChars + 1);
|
||||
text.copyToUnicode ((WCHAR*) d, numChars + 1);
|
||||
format.cfFormat = CF_UNICODETEXT;
|
||||
|
||||
GlobalUnlock (medium.hGlobal);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,31 @@ int CharacterFunctions::compare (const juce_wchar* s1, const juce_wchar* s2, int
|
|||
return wcsncmp (s1, s2, maxChars);
|
||||
}
|
||||
|
||||
int CharacterFunctions::compare (const juce_wchar* s1, const char* s2) throw()
|
||||
{
|
||||
jassert (s1 != 0 && s2 != 0);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const int diff = (int) (*s1 - (juce_wchar) (unsigned char) *s2);
|
||||
|
||||
if (diff != 0)
|
||||
return diff;
|
||||
else if (*s1 == 0)
|
||||
break;
|
||||
|
||||
++s1;
|
||||
++s2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CharacterFunctions::compare (const char* s1, const juce_wchar* s2) throw()
|
||||
{
|
||||
return -compare (s2, s1);
|
||||
}
|
||||
|
||||
int CharacterFunctions::compareIgnoreCase (const char* const s1, const char* const s2) throw()
|
||||
{
|
||||
jassert (s1 != 0 && s2 != 0);
|
||||
|
|
@ -481,7 +506,7 @@ double juce_atof (const CharType* const original) throw()
|
|||
}
|
||||
|
||||
if (*s == 'n' || *s == 'N' || *s == 'i' || *s == 'I')
|
||||
return atof (String (original)); // Let the c library deal with NAN and INF
|
||||
return atof (String (original).toUTF8()); // Let the c library deal with NAN and INF
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -734,14 +759,14 @@ bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) throw()
|
|||
return iswalnum (character) != 0;
|
||||
}
|
||||
|
||||
int CharacterFunctions::getHexDigitValue (const tchar digit) throw()
|
||||
int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw()
|
||||
{
|
||||
if (digit >= T('0') && digit <= T('9'))
|
||||
return digit - T('0');
|
||||
else if (digit >= T('a') && digit <= T('f'))
|
||||
return digit - (T('a') - 10);
|
||||
else if (digit >= T('A') && digit <= T('F'))
|
||||
return digit - (T('A') - 10);
|
||||
if (digit >= '0' && digit <= '9')
|
||||
return digit - '0';
|
||||
else if (digit >= 'a' && digit <= 'f')
|
||||
return digit - ('a' - 10);
|
||||
else if (digit >= 'A' && digit <= 'F')
|
||||
return digit - ('A' - 10);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,36 +28,16 @@
|
|||
|
||||
|
||||
//==============================================================================
|
||||
/* The String class can either use wchar_t unicode characters, or 8-bit characters
|
||||
(in the default system encoding) as its internal representation.
|
||||
#define JUCE_T(stringLiteral) (L##stringLiteral)
|
||||
typedef juce_wchar tchar;
|
||||
|
||||
To use unicode, define the JUCE_STRINGS_ARE_UNICODE macro in juce_Config.h
|
||||
|
||||
Be sure to use "tchar" for characters rather than "char", and always wrap string
|
||||
literals in the T("abcd") macro, so that it all works nicely either way round.
|
||||
*/
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
|
||||
#define JUCE_T(stringLiteral) (L##stringLiteral)
|
||||
typedef juce_wchar tchar;
|
||||
#define juce_tcharToWideChar(c) (c)
|
||||
|
||||
#else
|
||||
|
||||
#define JUCE_T(stringLiteral) (stringLiteral)
|
||||
typedef char tchar;
|
||||
#define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
|
||||
|
||||
#endif
|
||||
|
||||
#if ! JUCE_DONT_DEFINE_MACROS
|
||||
|
||||
/** The 'T' macro allows a literal string to be compiled using either 8-bit characters
|
||||
or unicode.
|
||||
/** The 'T' macro allows a literal string to be compiled as unicode.
|
||||
|
||||
If you write your string literals in the form T("xyz"), this will either be compiled
|
||||
as "xyz" for non-unicode builds, or L"xyz" for unicode builds, depending on whether the
|
||||
JUCE_STRINGS_ARE_UNICODE macro has been set in juce_Config.h
|
||||
If you write your string literals in the form T("xyz"), it will be compiled as L"xyz"
|
||||
or "xyz", depending on which representation is best for the String class to work with.
|
||||
|
||||
Because the 'T' symbol is occasionally used inside 3rd-party library headers which you
|
||||
may need to include after juce.h, you can use the juce_withoutMacros.h file (in
|
||||
|
|
@ -97,6 +77,8 @@ public:
|
|||
|
||||
static int compare (const char* const s1, const char* const s2) throw();
|
||||
static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
|
||||
static int compare (const juce_wchar* s1, const char* s2) throw();
|
||||
static int compare (const char* s1, const juce_wchar* s2) throw();
|
||||
|
||||
static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
|
||||
static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
|
||||
|
|
@ -163,7 +145,7 @@ public:
|
|||
/** Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legel
|
||||
hex digit.
|
||||
*/
|
||||
static int getHexDigitValue (const tchar digit) throw();
|
||||
static int getHexDigitValue (const juce_wchar digit) throw();
|
||||
|
||||
//==============================================================================
|
||||
static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -78,7 +78,7 @@ public:
|
|||
const size_t maxChars) throw();
|
||||
|
||||
/** Creates a string from a single character. */
|
||||
static const String charToString (const tchar character) throw();
|
||||
static const String charToString (const juce_wchar character) throw();
|
||||
|
||||
/** Destructor. */
|
||||
~String() throw();
|
||||
|
|
@ -104,20 +104,21 @@ public:
|
|||
//==============================================================================
|
||||
// Assignment and concatenation operators..
|
||||
|
||||
/** Replaces this string's contents with another string. */
|
||||
const String& operator= (const tchar* const other) throw();
|
||||
|
||||
/** Replaces this string's contents with another string. */
|
||||
const String& operator= (const String& other) throw();
|
||||
|
||||
/** Appends another string at the end of this one. */
|
||||
const String& operator+= (const tchar* const textToAppend) throw();
|
||||
String& operator+= (const tchar* const textToAppend);
|
||||
/** Appends another string at the end of this one. */
|
||||
const String& operator+= (const String& stringToAppend) throw();
|
||||
String& operator+= (const String& stringToAppend);
|
||||
/** Appends a character at the end of this string. */
|
||||
const String& operator+= (const char characterToAppend) throw();
|
||||
String& operator+= (const char characterToAppend);
|
||||
/** Appends a character at the end of this string. */
|
||||
const String& operator+= (const juce_wchar characterToAppend) throw();
|
||||
String& operator+= (const juce_wchar characterToAppend);
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator+= (const int numberToAppend);
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator+= (const unsigned int numberToAppend);
|
||||
|
||||
/** Appends a string at the end of this one.
|
||||
|
||||
|
|
@ -125,48 +126,7 @@ public:
|
|||
@param maxCharsToTake the maximum number of characters to take from the string passed in
|
||||
*/
|
||||
void append (const tchar* const textToAppend,
|
||||
const int maxCharsToTake) throw();
|
||||
|
||||
/** Appends a string at the end of this one.
|
||||
@returns the concatenated string
|
||||
*/
|
||||
const String operator+ (const String& stringToAppend) const throw();
|
||||
|
||||
/** Appends a string at the end of this one.
|
||||
@returns the concatenated string
|
||||
*/
|
||||
const String operator+ (const tchar* const textToAppend) const throw();
|
||||
|
||||
/** Appends a character at the end of this one.
|
||||
@returns the concatenated string
|
||||
*/
|
||||
const String operator+ (const tchar characterToAppend) const throw();
|
||||
|
||||
/** Appends a character at the end of this string. */
|
||||
String& operator<< (const char n) throw();
|
||||
/** Appends a character at the end of this string. */
|
||||
String& operator<< (const juce_wchar n) throw();
|
||||
/** Appends another string at the end of this one. */
|
||||
String& operator<< (const char* const text) throw();
|
||||
/** Appends another string at the end of this one. */
|
||||
String& operator<< (const juce_wchar* const text) throw();
|
||||
/** Appends another string at the end of this one. */
|
||||
String& operator<< (const String& text) throw();
|
||||
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const short number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const int number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const unsigned int number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const long number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const unsigned long number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const float number) throw();
|
||||
/** Appends a decimal number at the end of this string. */
|
||||
String& operator<< (const double number) throw();
|
||||
const int maxCharsToTake);
|
||||
|
||||
//==============================================================================
|
||||
// Comparison methods..
|
||||
|
|
@ -187,44 +147,38 @@ public:
|
|||
*/
|
||||
inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
|
||||
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator== (const String& other) const throw();
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator== (const tchar* const other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator!= (const String& other) const throw();
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator!= (const tchar* const other) const throw();
|
||||
|
||||
/** Case-insensitive comparison with another string. */
|
||||
bool equalsIgnoreCase (const String& other) const throw();
|
||||
/** Case-insensitive comparison with another string. */
|
||||
bool equalsIgnoreCase (const tchar* const other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator> (const String& other) const throw();
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator< (const tchar* const other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator>= (const String& other) const throw();
|
||||
/** Case-sensitive comparison with another string. */
|
||||
bool operator<= (const tchar* const other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string.
|
||||
@returns 0 if the two strings are identical; negative if this string
|
||||
comes before the other one alphabetically, or positive if it
|
||||
comes after it.
|
||||
*/
|
||||
int compare (const tchar* const other) const throw();
|
||||
int compare (const String& other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string.
|
||||
@returns 0 if the two strings are identical; negative if this string
|
||||
comes before the other one alphabetically, or positive if it
|
||||
comes after it.
|
||||
*/
|
||||
int compare (const char* other) const throw();
|
||||
|
||||
/** Case-sensitive comparison with another string.
|
||||
@returns 0 if the two strings are identical; negative if this string
|
||||
comes before the other one alphabetically, or positive if it
|
||||
comes after it.
|
||||
*/
|
||||
int compare (const juce_wchar* other) const throw();
|
||||
|
||||
/** Case-insensitive comparison with another string.
|
||||
@returns 0 if the two strings are identical; negative if this string
|
||||
comes before the other one alphabetically, or positive if it
|
||||
comes after it.
|
||||
*/
|
||||
int compareIgnoreCase (const tchar* const other) const throw();
|
||||
int compareIgnoreCase (const String& other) const throw();
|
||||
|
||||
/** Lexicographic comparison with another string.
|
||||
|
||||
|
|
@ -235,58 +189,49 @@ public:
|
|||
comes before the other one alphabetically, or positive if it
|
||||
comes after it.
|
||||
*/
|
||||
int compareLexicographically (const tchar* const other) const throw();
|
||||
int compareLexicographically (const String& other) const throw();
|
||||
|
||||
/** Tests whether the string begins with another string.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool startsWith (const tchar* const text) const throw();
|
||||
|
||||
/** Tests whether the string begins with a particular character.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool startsWithChar (const tchar character) const throw();
|
||||
|
||||
/** Tests whether the string begins with another string.
|
||||
|
||||
Uses a case-insensitive comparison.
|
||||
*/
|
||||
bool startsWithIgnoreCase (const tchar* const text) const throw();
|
||||
|
||||
/** Tests whether the string ends with another string.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool endsWith (const tchar* const text) const throw();
|
||||
|
||||
/** Tests whether the string ends with a particular character.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool endsWithChar (const tchar character) const throw();
|
||||
|
||||
/** Tests whether the string ends with another string.
|
||||
|
||||
Uses a case-insensitive comparison.
|
||||
*/
|
||||
bool endsWithIgnoreCase (const tchar* const text) const throw();
|
||||
|
||||
/** Tests whether the string contains another substring.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool contains (const tchar* const text) const throw();
|
||||
|
||||
/** Tests whether the string contains a particular character.
|
||||
|
||||
Uses a case-sensitive comparison.
|
||||
*/
|
||||
bool containsChar (const tchar character) const throw();
|
||||
|
||||
/** Tests whether the string contains another substring.
|
||||
|
||||
Uses a case-insensitive comparison.
|
||||
*/
|
||||
bool containsIgnoreCase (const tchar* const text) const throw();
|
||||
|
|
@ -488,7 +433,7 @@ public:
|
|||
|
||||
No checks are made to see if the index is within a valid range, so be careful!
|
||||
*/
|
||||
inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
|
||||
inline const juce_wchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
|
||||
|
||||
/** Returns a character from the string such that it can also be altered.
|
||||
|
||||
|
|
@ -497,13 +442,13 @@ public:
|
|||
Note that the index passed-in is not checked to see whether it's in-range, so
|
||||
be careful when using this.
|
||||
*/
|
||||
tchar& operator[] (const int index) throw();
|
||||
juce_wchar& operator[] (const int index) throw();
|
||||
|
||||
/** Returns the final character of the string.
|
||||
|
||||
If the string is empty this will return 0.
|
||||
*/
|
||||
tchar getLastCharacter() const throw();
|
||||
juce_wchar getLastCharacter() const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a subsection of the string.
|
||||
|
|
@ -962,63 +907,46 @@ public:
|
|||
const int groupSize = 1) throw();
|
||||
|
||||
//==============================================================================
|
||||
// Casting to character arrays..
|
||||
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
/** Returns a version of this string using the default 8-bit system encoding.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
*/
|
||||
operator const char*() const throw();
|
||||
|
||||
/** Returns a unicode version of this string.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
that is returned must not be stored anywhere, as it can become invalid whenever
|
||||
any string methods (even some const ones!) are called.
|
||||
*/
|
||||
inline operator const juce_wchar*() const throw() { return text->text; }
|
||||
#else
|
||||
/** Returns a version of this string using the default 8-bit system encoding.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
*/
|
||||
inline operator const char*() const throw() { return text->text; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a unicode version of this string.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
that is returned must not be stored anywhere, as it can become invalid whenever
|
||||
any string methods (even some const ones!) are called.
|
||||
*/
|
||||
operator const juce_wchar*() const throw();
|
||||
#endif
|
||||
|
||||
/** Copies the string to a buffer.
|
||||
|
||||
@param destBuffer the place to copy it to
|
||||
@param maxCharsToCopy the maximum number of characters to copy to the buffer,
|
||||
not including the tailing zero, so this shouldn't be
|
||||
larger than the size of your destination buffer - 1
|
||||
*/
|
||||
void copyToBuffer (char* const destBuffer,
|
||||
const int maxCharsToCopy) const throw();
|
||||
|
||||
/** Copies the string to a unicode buffer.
|
||||
|
||||
@param destBuffer the place to copy it to
|
||||
@param maxCharsToCopy the maximum number of characters to copy to the buffer,
|
||||
not including the tailing zero, so this shouldn't be
|
||||
larger than the size of your destination buffer - 1
|
||||
*/
|
||||
void copyToBuffer (juce_wchar* const destBuffer,
|
||||
const int maxCharsToCopy) const throw();
|
||||
inline operator juce_wchar*() throw() { return text->text; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a pointer to a UTF-8 version of this string.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
|
||||
@see getNumBytesAsUTF8, fromUTF8, copyToUTF8, toCString
|
||||
*/
|
||||
const char* toUTF8() const;
|
||||
|
||||
/** Creates a String from a UTF-8 encoded buffer.
|
||||
|
||||
If the size is < 0, it'll keep reading until it hits a zero.
|
||||
*/
|
||||
static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
|
||||
|
||||
/** Returns the number of bytes required to represent this string as UTF8.
|
||||
The number returned does NOT include the trailing zero.
|
||||
@see toUTF8, copyToUTF8
|
||||
*/
|
||||
int getNumBytesAsUTF8() const throw();
|
||||
|
||||
/** Copies the string to a buffer as UTF-8 characters.
|
||||
|
||||
Returns the number of bytes copied to the buffer, including the terminating null
|
||||
|
|
@ -1029,26 +957,48 @@ public:
|
|||
(including the terminating null character).
|
||||
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the
|
||||
string won't fit, it'll put in as many as it can while
|
||||
still allowing for a terminating null char at the end,
|
||||
and will return the number of bytes that were actually
|
||||
used. If this value is < 0, no limit is used.
|
||||
still allowing for a terminating null char at the end, and
|
||||
will return the number of bytes that were actually used.
|
||||
*/
|
||||
int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
|
||||
int copyToUTF8 (char* destBuffer, const int maxBufferSizeBytes) const throw();
|
||||
|
||||
/** Returns a pointer to a UTF-8 version of this string.
|
||||
//==============================================================================
|
||||
/** Returns a version of this string using the default 8-bit multi-byte system encoding.
|
||||
|
||||
Because it returns a reference to the string's internal data, the pointer
|
||||
that is returned must not be stored anywhere, as it can be deleted whenever the
|
||||
string changes.
|
||||
*/
|
||||
const char* toUTF8() const throw();
|
||||
|
||||
/** Creates a String from a UTF-8 encoded buffer.
|
||||
|
||||
If the size is < 0, it'll keep reading until it hits a zero.
|
||||
@see getNumBytesAsCString, copyToCString, toUTF8
|
||||
*/
|
||||
static const String fromUTF8 (const uint8* const utf8buffer,
|
||||
int bufferSizeBytes = -1) throw();
|
||||
const char* toCString() const;
|
||||
|
||||
/** Returns the number of bytes
|
||||
*/
|
||||
int getNumBytesAsCString() const throw();
|
||||
|
||||
/** Copies the string to a buffer.
|
||||
|
||||
@param destBuffer the place to copy it to; if this is a null pointer,
|
||||
the method just returns the number of bytes required
|
||||
(including the terminating null character).
|
||||
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the
|
||||
string won't fit, it'll put in as many as it can while
|
||||
still allowing for a terminating null char at the end, and
|
||||
will return the number of bytes that were actually used.
|
||||
*/
|
||||
int copyToCString (char* destBuffer, const int maxBufferSizeBytes) const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Copies the string to a unicode buffer.
|
||||
|
||||
@param destBuffer the place to copy it to
|
||||
@param maxCharsToCopy the maximum number of characters to copy to the buffer,
|
||||
not including the tailing zero, so this shouldn't be
|
||||
larger than the size of your destination buffer - 1
|
||||
*/
|
||||
void copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** Increases the string's internally allocated storage.
|
||||
|
|
@ -1102,12 +1052,7 @@ private:
|
|||
{
|
||||
int refCount;
|
||||
int allocatedNumChars;
|
||||
|
||||
#if JUCE_STRINGS_ARE_UNICODE
|
||||
wchar_t text[1];
|
||||
#else
|
||||
char text[1];
|
||||
#endif
|
||||
wchar_t text[1];
|
||||
};
|
||||
|
||||
InternalRefCountedStringHolder* text;
|
||||
|
|
@ -1125,25 +1070,81 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
/** Global operator to allow a String to be appended to a string literal.
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const char* string1, const String& string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* string1, const String& string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (char string1, const String& string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (juce_wchar string1, const String& string2);
|
||||
|
||||
This allows the use of expressions such as "abc" + String (x)
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const String& string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const char* string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, const juce_wchar* string2);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, char characterToAppend);
|
||||
/** Concatenates two strings. */
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (String string1, juce_wchar characterToAppend);
|
||||
|
||||
@see String
|
||||
*/
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
|
||||
const String& string2) throw();
|
||||
/** Appends a character at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char characterToAppend);
|
||||
/** Appends a character at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar characterToAppend);
|
||||
/** Appends a string to the end of the first one. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const char* const string2);
|
||||
/** Appends a string to the end of the first one. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const juce_wchar* const string2);
|
||||
/** Appends a string to the end of the first one. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const String& string2);
|
||||
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const short number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const int number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned int number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const long number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const unsigned long number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const float number);
|
||||
/** Appends a decimal number at the end of a string. */
|
||||
String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, const double number);
|
||||
|
||||
//==============================================================================
|
||||
/** Global operator to allow a String to be appended to a string literal.
|
||||
/** This streaming override allows you to pass a juce String directly into std output streams.
|
||||
This is very handy for writing strings to std::cout, std::cerr, etc.
|
||||
*/
|
||||
template <class charT, class traits>
|
||||
std::basic_ostream <charT, traits>& operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
|
||||
{
|
||||
return stream << stringToWrite.toUTF8();
|
||||
}
|
||||
|
||||
This allows the use of expressions such as "abc" + String (x)
|
||||
|
||||
@see String
|
||||
*/
|
||||
const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
|
||||
const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const char* string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator== (const String& string1, const juce_wchar* string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const char* string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator!= (const String& string1, const juce_wchar* string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator> (const String& string1, const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator< (const String& string1, const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator>= (const String& string1, const String& string2) throw();
|
||||
/** Case-sensitive comparison of two strings. */
|
||||
bool JUCE_PUBLIC_FUNCTION operator<= (const String& string1, const String& string2) throw();
|
||||
|
||||
|
||||
#endif // __JUCE_STRING_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ const String StringArray::joinIntoString (const String& separator, int start, in
|
|||
String result;
|
||||
result.preallocateStorage (charsNeeded);
|
||||
|
||||
tchar* dest = (tchar*) (const tchar*) result;
|
||||
juce_wchar* dest = (juce_wchar*) result;
|
||||
|
||||
while (start < last)
|
||||
{
|
||||
|
|
@ -311,13 +311,13 @@ const String StringArray::joinIntoString (const String& separator, int start, in
|
|||
|
||||
if (len > 0)
|
||||
{
|
||||
s.copyToBuffer (dest, len);
|
||||
s.copyToUnicode (dest, len);
|
||||
dest += len;
|
||||
}
|
||||
|
||||
if (++start < last && separatorLen > 0)
|
||||
{
|
||||
separator.copyToBuffer (dest, separatorLen);
|
||||
separator.copyToUnicode (dest, separatorLen);
|
||||
dest += separatorLen;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle
|
|||
}
|
||||
else
|
||||
{
|
||||
textToParse = String::fromUTF8 ((const uint8*) data.getData(), (int) data.getSize());
|
||||
textToParse = String::fromUTF8 ((const char*) data.getData(), (int) data.getSize());
|
||||
}
|
||||
|
||||
if (! onlyReadOuterDocumentElement)
|
||||
|
|
|
|||
|
|
@ -271,10 +271,9 @@ void XmlElement::writeElementAsText (OutputStream& outputStream,
|
|||
if (! isTextElement())
|
||||
{
|
||||
outputStream.writeByte ('<');
|
||||
const int nameLen = tagName.length();
|
||||
outputStream.write ((const char*) tagName, nameLen);
|
||||
outputStream << tagName;
|
||||
|
||||
const int attIndent = indentationLevel + nameLen + 1;
|
||||
const int attIndent = indentationLevel + tagName.length() + 1;
|
||||
int lineLen = 0;
|
||||
|
||||
const XmlAttributeNode* att = attributes;
|
||||
|
|
@ -287,13 +286,13 @@ void XmlElement::writeElementAsText (OutputStream& outputStream,
|
|||
lineLen = 0;
|
||||
}
|
||||
|
||||
const int attNameLen = att->name.length();
|
||||
const int64 startPos = outputStream.getPosition();
|
||||
outputStream.writeByte (' ');
|
||||
outputStream.write ((const char*) (att->name), attNameLen);
|
||||
outputStream << att->name;
|
||||
outputStream.write ("=\"", 2);
|
||||
escapeIllegalXmlChars (outputStream, att->value, true);
|
||||
outputStream.writeByte ('"');
|
||||
lineLen += 4 + attNameLen + att->value.length();
|
||||
lineLen += (int) (outputStream.getPosition() - startPos);
|
||||
|
||||
att = att->next;
|
||||
}
|
||||
|
|
@ -356,7 +355,7 @@ void XmlElement::writeElementAsText (OutputStream& outputStream,
|
|||
}
|
||||
|
||||
outputStream.write ("</", 2);
|
||||
outputStream.write ((const char*) tagName, nameLen);
|
||||
outputStream << tagName;
|
||||
|
||||
if (indentationLevel >= 0)
|
||||
outputStream.write (">\r\n", 3);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue