39#ifndef BLOCXX_STRING_HPP_INCLUDE_GUARD_
40#define BLOCXX_STRING_HPP_INCLUDE_GUARD_
41#include "blocxx/BLOCXX_config.h"
80 explicit String(Int32 val);
87 explicit String(UInt32 val);
89#if defined(BLOCXX_INT32_IS_INT) && defined(BLOCXX_INT64_IS_LONG_LONG)
103 explicit String(
unsigned long val);
111 explicit String(Int64 val);
118 explicit String(UInt64 val);
125 explicit String(Real32 val);
132 explicit String(Real64 val);
165 explicit String(
const std::string& str);
182 explicit String(ETakeOwnershipFlag,
char* allocatedMemory,
size_t len);
191 explicit String(
const char* str,
size_t len);
219 char* allocateCString()
const;
223 size_t length()
const;
233 size_t UTF8Length()
const;
246 int format(
const char* fmt, ...);
272 StringArray tokenize(
const char* delims =
" \n\r\t\v",
273 EReturnDelimitersFlag returnDelimitersAsTokens = E_DISCARD_DELIMITERS,
274 EEmptyTokenReturnFlag returnEmptyTokens = E_SKIP_EMPTY_TOKENS )
const;
279 const char* c_str()
const;
291 char charAt(
size_t ndx)
const;
299 int compareTo(
const String& arg)
const;
307 int compareTo(
const char* arg)
const;
315 int compareToIgnoreCase(
const String& arg)
const;
323 int compareToIgnoreCase(
const char* arg)
const;
329 String& concat(
const char* arg);
360 bool endsWith(
const char* arg, EIgnoreCaseFlag ignoreCase = E_CASE_SENSITIVE)
const;
382 bool endsWith(
char arg)
const;
391 bool equals(
const String& arg)
const;
399 bool equals(
const char* arg)
const;
408 bool equalsIgnoreCase(
const String& arg)
const;
417 bool equalsIgnoreCase(
const char* arg)
const;
421 UInt32 hashCode()
const;
430 size_t indexOf(
char ch,
size_t fromIndex=0)
const;
438 size_t indexOf(
const char* arg,
size_t fromIndex=0)
const;
459 size_t lastIndexOf(
char ch,
size_t fromIndex=npos)
const;
468 size_t lastIndexOf(
const char* arg,
size_t fromIndex=npos)
const;
490 bool startsWith(
const char* arg, EIgnoreCaseFlag ignoreCase = E_CASE_SENSITIVE)
const;
509 bool startsWith(
char arg)
const;
519 String substring(
size_t beginIndex,
520 size_t length=npos)
const;
525 bool isSpaces()
const;
571 String& erase(
size_t idx,
size_t len = npos );
586 const char& operator[] (
size_t ndx)
const;
587 char& operator[] (
size_t ndx);
615 void readObject(std::streambuf & istrm);
621 void writeObject(std::streambuf & ostrm)
const;
631 Char16 toChar16() const BLOCXX_DEPRECATED;
636 Real32 toReal32() const;
641 Real64 toReal64() const;
652 UInt8 toUInt8(
int base=10) const;
657 Int8 toInt8(
int base=10) const;
662 UInt16 toUInt16(
int base=10) const;
667 Int16 toInt16(
int base=10) const;
672 UInt32 toUInt32(
int base=10) const;
677 Int32 toInt32(
int base=10) const;
682 UInt64 toUInt64(
int base=10) const;
687 Int64 toInt64(
int base=10) const;
692 unsigned int toUnsignedInt(
int base=10) const;
697 int toInt(
int base=10) const;
708 static
unsigned long long int strtoull(const
char* nptr,
char** endptr,
720 static
long long int strtoll(const
char* nptr,
char** endptr,
int base);
728 static const
char* strchr(const
char* theStr,
int c);
739#if defined(BLOCXX_AIX)
740 static const size_t npos;
742 static const size_t npos = size_t(~0);
746#pragma warning (push)
747#pragma warning (disable: 4251)
811 return (
String(p).compareTo(s) < 0);
826 return (
String(p).compareTo(s) <= 0);
841 return (
String(p).compareTo(s) > 0);
856 return (
String(p).compareTo(s) >= 0);
#define BLOCXX_DECLARE_APIEXCEPTION(NAME, LINKAGE_SPEC)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability.
The Bool class is an abstraction for the boolean data type.
COWIntrusiveReference A smart pointer that uses intrusive reference counting.
The Char16 class is an abstraction for a double byte character.
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
bool startsWith(const String &arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const
Determine if this String object starts with a given substring.
String & concat(const char *arg)
Append a C string to this String object.
String()
Create a new String object with a length of 0.
bool endsWith(const String &arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const
Determine if this String object ends with the same string represented by another String object.
String & concat(const String &arg)
Append another String object to this String object.
size_t indexOf(const String &arg, size_t fromIndex=0) const
Find the first occurence of a string in this String object.
bool startsWith(const char *arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const
Determine if this String object starts with a given substring.
size_t lastIndexOf(const String &arg, size_t fromIndex=npos) const
Find the last occurence of a string in this String object.
BLOCXX_DEPRECATED const char * getBytes() const
DEPRECATED in favor of c_str() in 3.1.0.
size_t indexOf(char ch, size_t fromIndex=0) const
Find the first occurence of a given character in this String object.
size_t lastIndexOf(char ch, size_t fromIndex=npos) const
Find the last occurence of a character in this String object.
COWIntrusiveReference< ByteBuf > buf_t
int compareTo(const String &arg) const
Compare another String object with this one.
bool endsWith(const char *arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const
Determine if this String object ends with given C string.
Char16 operator+(const Char16 &arg1, const Char16 &arg2)
Array< Char16 > Char16Array
bool operator<(const Array< T > &x, const Array< T > &y)
bool operator<=(const Array< T > &x, const Array< T > &y)
Determine if one Array is less than or equal to another.
Array< String > StringArray
bool operator>(const Array< T > &x, const Array< T > &y)
Determine if one Array is greater than another.
bool operator==(const Array< T > &x, const Array< T > &y)
ostream & operator<<(ostream &ostrm, const Bool &arg)
bool operator>=(const Array< T > &x, const Array< T > &y)
Determine if one Array is greater than or equal to another.
BLOCXX_EXPORT_TEMPLATE(BLOCXX_COMMON_API, Array, Bool)
bool operator!=(const Array< T > &x, const Array< T > &y)
Determine two Arrays are not equal.
void swap(Array< T > &x, Array< T > &y)