23#if ! defined (DOXYGEN) && (JUCE_MAC || JUCE_IOS)
26 #if __has_attribute(objc_bridge)
27 #define JUCE_CF_BRIDGED_TYPE(T) __attribute__((objc_bridge(T)))
29 #define JUCE_CF_BRIDGED_TYPE(T)
32 typedef const struct JUCE_CF_BRIDGED_TYPE(NSString) __CFString * CFStringRef;
34 #undef JUCE_CF_BRIDGED_TYPE
108 String (
const wchar_t*
text,
size_t maxChars);
145 String (
const std::string&);
169 #if (JUCE_STRING_UTF_TYPE == 32)
171 #elif (JUCE_STRING_UTF_TYPE == 16)
173 #elif (DOXYGEN || JUCE_STRING_UTF_TYPE == 8)
176 #error "You must set the value of JUCE_STRING_UTF_TYPE to be either 8, 16, or 32!"
187 size_t hash()
const noexcept;
190 int length()
const noexcept;
204 String& operator+= (
const char* textToAppend);
206 String& operator+= (
const wchar_t* textToAppend);
210 String& operator+= (
int numberToAppend);
212 String& operator+= (
long numberToAppend);
218 String& operator+= (
char characterToAppend);
220 String& operator+= (
wchar_t characterToAppend);
221 #if ! JUCE_NATIVE_WCHAR_IS_UTF32
231 void append (
const String& textToAppend,
size_t maxCharsToTake);
239 CharPointerType endOfTextToAppend);
246 template <
class CharPo
inter>
248 CharPointer endOfTextToAppend)
250 jassert (startOfTextToAppend.getAddress() !=
nullptr && endOfTextToAppend.getAddress() !=
nullptr);
252 size_t extraBytesNeeded = 0, numChars = 1;
254 for (
auto t = startOfTextToAppend;
t != endOfTextToAppend && !
t.isEmpty(); ++numChars)
255 extraBytesNeeded += CharPointerType::getBytesRequiredFor (
t.getAndAdvance());
257 if (extraBytesNeeded > 0)
263 .writeWithCharLimit (startOfTextToAppend, (
int) numChars);
268 void appendCharPointer (CharPointerType textToAppend);
275 template <
class CharPo
inter>
278 if (textToAppend.getAddress() !=
nullptr)
280 size_t extraBytesNeeded = 0, numChars = 1;
282 for (
auto t = textToAppend; numChars <= maxCharsToTake && !
t.isEmpty(); ++numChars)
283 extraBytesNeeded += CharPointerType::getBytesRequiredFor (
t.getAndAdvance());
285 if (extraBytesNeeded > 0)
291 .writeWithCharLimit (textToAppend, (
int) numChars);
297 template <
class CharPo
inter>
519 int indexOfAnyOf (
StringRef charactersToLookFor,
587 int lastIndexOfAnyOf (
StringRef charactersToLookFor,
644 String dropLastCharacters (
int numberToDrop)
const;
653 String getLastCharacters (
int numCharacters)
const;
672 bool includeSubStringInResult,
673 bool ignoreCase)
const;
684 bool includeSubStringInResult,
685 bool ignoreCase)
const;
701 bool includeSubStringInResult,
702 bool ignoreCase)
const;
712 bool includeSubStringInResult,
713 bool ignoreCase)
const;
764 String replaceSection (
int startIndex,
765 int numCharactersToReplace,
851 bool isQuotedString()
const;
886 int numberOfTimesToRepeat);
919 template <typename... Args>
949 CharPointerType
end()
const {
return begin().findTerminatingNull(); }
957 explicit String (
int decimalInteger);
962 explicit String (
unsigned int decimalInteger);
967 explicit String (
short decimalInteger);
972 explicit String (
unsigned short decimalInteger);
987 explicit String (
long decimalInteger);
992 explicit String (
unsigned long decimalInteger);
998 explicit String (
float floatValue);
1004 explicit String (
double doubleValue);
1016 String (
float floatValue,
int numberOfDecimalPlaces,
bool useScientificNotation =
false);
1027 String (
double doubleValue,
int numberOfDecimalPlaces,
bool useScientificNotation =
false);
1096 template <typename IntegerType>
1108 static String toHexString (
const void*
data,
int size,
int groupSize = 1);
1115 template <
typename DecimalType>
1118 jassert (numberOfSignificantFigures > 0);
1122 if (numberOfSignificantFigures > 1)
1126 for (
int i = 2;
i < numberOfSignificantFigures; ++
i)
1135 auto numDigitsBeforePoint = (
int) std::ceil (std::log10 (number < 0 ? -number : number));
1137 auto shift = numberOfSignificantFigures - numDigitsBeforePoint;
1138 auto factor = std::pow (10.0, shift);
1139 auto rounded = std::round (number * factor) / factor;
1141 std::stringstream
ss;
1142 ss << std::fixed << std::setprecision (std::max (shift, 0)) << rounded;
1179 const char* toRawUTF8()
const;
1216 const wchar_t* toWideCharPointer()
const;
1219 std::string toStdString()
const;
1225 static String fromUTF8 (
const char* utf8buffer,
int bufferSizeBytes = -1);
1300 void preallocateBytes (
size_t numBytesNeeded);
1308 #if JUCE_MAC || JUCE_IOS || DOXYGEN
1310 static String fromCFString (CFStringRef cfString);
1316 CFStringRef toCFString()
const;
1320 String convertToPrecomposedUnicode()
const;
1329 #if JUCE_ALLOW_STATIC_NULL_VARIABLES && ! defined (DOXYGEN)
1330 [[deprecated (
"This was a static empty string object, but is now deprecated as it's too easy to accidentally "
1331 "use it indirectly during a static constructor, leading to hard-to-find order-of-initialisation "
1332 "problems. If you need an empty String object, just use String() or {}. For returning an empty "
1333 "String from a function by reference, use a function-local static String object and return that.")]]
1334 static const String empty;
1357 static String formattedRaw (
const char*, ...);
1364 template <
typename Type>
1377#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1394#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1404#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1476template <
class traits>
1479 return stream << stringToWrite.
toRawUTF8();
1485template <
class traits>
1504 size_t operator() (
const juce::String&
s)
const noexcept {
return s.hash(); }
#define juce
Definition AppConfig.h:25
#define noexcept
Definition DistrhoDefines.h:72
#define final
Definition DistrhoDefines.h:74
ostream & operator<<(ostream &out, const MidiEvent &ev)
Definition InMgr.cpp:9
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
uint8_t uint8
Definition basics.h:86
int64_t int64
Definition basics.h:91
uint64_t uint64
Definition basics.h:92
Definition juce_CharPointer_ASCII.h:38
Definition juce_CharPointer_UTF16.h:35
Definition juce_CharPointer_UTF32.h:35
Definition juce_CharPointer_UTF8.h:35
Definition juce_String.h:53
CharPointerType getCharPointer() const noexcept
Definition juce_String.h:1153
CharPointerType begin() const
Definition juce_String.h:923
bool isEmpty() const noexcept
Definition juce_String.h:310
String() noexcept
Definition juce_String.cpp:234
void append(const String &textToAppend, size_t maxCharsToTake)
Definition juce_String.cpp:706
float getFloatValue() const noexcept
Definition juce_String.cpp:1873
const char * toRawUTF8() const
Definition juce_String.cpp:2074
static String toDecimalStringWithSignificantFigures(DecimalType number, int numberOfSignificantFigures)
Definition juce_String.h:1116
int64 hashCode64() const noexcept
Definition juce_String.cpp:550
void appendCharPointer(CharPointer startOfTextToAppend, CharPointer endOfTextToAppend)
Definition juce_String.h:247
void appendCharPointer(CharPointerType startOfTextToAppend, CharPointerType endOfTextToAppend)
Definition juce_String.cpp:717
static String createHex(Type n)
Definition juce_String.h:1365
size_t getByteOffsetOfEnd() const noexcept
Definition juce_String.cpp:521
void preallocateBytes(size_t numBytesNeeded)
Definition juce_String.cpp:284
size_t hash() const noexcept
Definition juce_String.cpp:551
static String formatted(const String &formatStr, Args... args)
Definition juce_String.h:920
CharPointerType end() const
Definition juce_String.h:949
double getDoubleValue() const noexcept
Definition juce_String.cpp:1874
int getTrailingIntValue() const noexcept
Definition juce_String.cpp:1876
static String toHexString(IntegerType number)
Definition juce_String.h:1097
static String createHex(uint8)
Definition juce_String.cpp:1920
const wchar_t * toWideCharPointer() const
Definition juce_String.cpp:2079
static String formattedRaw(const char *,...)
Definition juce_String.cpp:1823
void appendCharPointer(CharPointer textToAppend, size_t maxCharsToTake)
Definition juce_String.h:276
void appendCharPointer(CharPointer textToAppend)
Definition juce_String.h:298
static String charToString(juce_wchar character)
Definition juce_String.cpp:359
int hashCode() const noexcept
Definition juce_String.cpp:549
int64 getLargeIntValue() const noexcept
Definition juce_String.cpp:1872
CharPointerType text
Definition juce_String.h:1339
int64 getHexValue64() const noexcept
Definition juce_String.cpp:1954
int getIntValue() const noexcept
Definition juce_String.cpp:1871
bool isNotEmpty() const noexcept
Definition juce_String.h:316
int getHexValue32() const noexcept
Definition juce_String.cpp:1953
Definition juce_StringRef.h:62
struct huft * t
Definition inflate.c:943
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
virtual ASIOError start()=0
JSAMPIMAGE data
Definition jpeglib.h:945
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
unsigned short uint16
Definition juce_MathsFunctions.h:41
unsigned long long uint64
Definition juce_MathsFunctions.h:56
unsigned int uint32
Definition juce_MathsFunctions.h:45
long long int64
Definition juce_MathsFunctions.h:54
wchar_t juce_wchar
Definition juce_CharacterFunctions.h:42
Type * addBytesToPointer(Type *basePointer, IntegerType bytes) noexcept
Definition juce_Memory.h:111
static String substring(const String &text, Range< int > range)
Definition juce_TextLayout.cpp:29
unsigned char uint8
Definition juce_MathsFunctions.h:37
static int compare(const var &v1, const var &v2)
Definition juce_Variant.cpp:654
#define false
Definition ordinals.h:83
png_uint_32 length
Definition png.c:2247
Definition juce_String.h:1343
PreallocationBytes(size_t) noexcept
Definition juce_String.cpp:277
size_t numBytes
Definition juce_String.h:1345
Definition juce_MathsFunctions.h:668
const char * text
Definition swell-functions.h:167
int n
Definition crypt.c:458
int result
Definition process.c:1455
typedef int(UZ_EXP MsgFn)()
ss
Definition zipinfo.c:2292
#define const
Definition zconf.h:137