5 const char *
get_ptr()
const {
return "";}
6 void add_string(
const char * p_string,
t_size p_length = ~0) {
throw exception_not_implemented();}
7 void set_string(
const char * p_string,
t_size p_length = ~0) {
throw exception_not_implemented();}
29 string(t_data
const & p_source) : m_content(p_source) {}
31 template<
typename TSource>
string(
const TSource & p_source);
33 string(
const string& other) : m_content(other.m_content) {}
34 string(
string&& other) : m_content(
std::move(other.m_content)) {}
37 const string&
operator=(
string&& other) {m_content = std::move(other.m_content);
return *
this;}
40 string const &
toString()
const {
return *
this;}
44 t_dataImpl impl; impl.
new_t();
45 char * buffer = impl->lock_buffer(len1+len2);
48 impl->unlock_buffer();
49 return string(t_data(impl));
56 return g_concatenateRaw(ptr(),
length(),p_item2,strlen(p_item2));
59 template<
typename TSource>
string operator+(
const TSource & p_item2)
const;
61 template<
typename TSource>
63 *
this = *
this + p_item;
68 if (base >
length())
throw exception_overflow();
69 return string(ptr() + base);
72 return string(ptr() + base,count);
78 return string(temp.get_ptr());
83 return string(temp.get_ptr());
101 bool contains(
char c)
const;
102 bool contains(
stringp s)
const;
104 bool containsAnyChar(
stringp s)
const;
106 bool startsWith(
char c)
const;
107 bool startsWith(
string s)
const;
108 bool endsWith(
char c)
const;
109 bool endsWith(
string s)
const;
111 char firstChar()
const;
112 char lastChar()
const;
116 static int g_compare(
const string & p_item1,
const string & p_item2) {
return strcmp(p_item1.
ptr(),p_item2.
ptr());}
117 bool operator==(
const string& p_other)
const {
return g_compare(*
this,p_other) == 0;}
118 bool operator!=(
const string& p_other)
const {
return g_compare(*
this,p_other) != 0;}
119 bool operator<(
const string& p_other)
const {
return g_compare(*
this,p_other) < 0;}
120 bool operator>(
const string& p_other)
const {
return g_compare(*
this,p_other) > 0;}
121 bool operator<=(
const string& p_other)
const {
return g_compare(*
this,p_other) <= 0;}
122 bool operator>=(
const string& p_other)
const {
return g_compare(*
this,p_other) >= 0;}
124 const char *
ptr()
const {
return m_content->get_ptr();}
125 const char *
get_ptr()
const {
return m_content->get_ptr();}
137 PFC_ASSERT(p_index <=
length());
138 return ptr()[p_index];
146 PFC_ASSERT(!
"Should never get here");
throw exception_invalid_params();
152 template<
typename T1,
typename T2>
153 static int compare(T1
const& v1, T2
const& v2) {
157 return strcmp(myStringToPtr(v1),myStringToPtr(v2));
169 template<
typename T1,
typename T2>
170 static int compare(T1
const& v1, T2
const& v2) {
180 template<
typename T1,
typename T2>
181 static int compare(T1
const& v1, T2
const& v2) {
196 static bool g_equals(
const string & p_item1,
const string & p_item2) {
return p_item1 == p_item2;}
204 template<
typename T>
inline string toString(
T const& val) {
return val.toString();}
227 stringp(
string const &s) : m_ptr(s.ptr()), m_s(s._content()) {}
231 operator const char*()
const {
return m_ptr;}
232 const char *
ptr()
const {
return m_ptr;}
237 t_size length()
const {
return m_s.is_valid() ? m_s->length() : strlen(m_ptr);}
238 const char *
c_str()
const {
return ptr(); }
244 template<
typename TList>
246 typename TList::const_iterator iter = list.first();
248 if (iter.is_valid()) {
250 for(++iter; iter.is_valid(); ++iter) {
251 acc = acc + separator + *iter;
static int compare_ex(string_part_ref v1, string_part_ref v2)
string operator+(const string &p_item2) const
string(t_data const &p_source)
const string & operator+=(const TSource &p_item)
static const char * myStringToPtr(const T &val)
const char * stringToPtr(T const &val)
rcptr_t< string8 > t_dataImpl
string operator+(const char *p_item2) const
void set_string(const char *p_string, t_size p_length=~0)
string(const string &other)
static int compare(T1 const &v1, T2 const &v2)
string(char *p_source, t_size p_sourceLen)
string(const char *p_source)
int compare(t1 const &p1, t2 const &p2)
static int compare(T1 const &v1, T2 const &v2)
string const & toString() const
bool operator==(const string &p_other) const
const char * c_str() const
rcptr_t< string_base const > t_data
void add_string(const char *p_string, t_size p_length=~0)
int stricmp_ascii_ex(const char *const s1, t_size const len1, const char *const s2, t_size const len2)
string subString(t_size base) const
char operator[](t_size p_index) const
string stringCombineList(const TList &list, stringp separator)
int stringCompareCaseInsensitiveEx(string_part_ref s1, string_part_ref s2)
char * lock_buffer(t_size p_requested_length)
t_size get_length() const
static bool isNonTextChar(char c)
int strcmp_ex(const char *p1, t_size n1, const char *p2, t_size n2)
string(const char *p_source, t_size p_sourceLen)
bool operator<=(const string &p_other) const
"String parameter" helper class, to use in function parameters, allowing functions to take any type o...
void stringToLowerAppend(string_base &out, const char *src, t_size len)
t_size get_length() const
static const char * myStringToPtr(string_part_ref)
const string & operator=(const string &other)
const string & operator=(string &&other)
static int compare_ex(const char *v1, t_size l1, const char *v2, t_size l2)
bool operator>=(const string &p_other) const
static int compare_ex(string_part_ref v1, string_part_ref v2)
void stringToUpperAppend(string_base &out, const char *src, t_size len)
rcptr_t< t_object > rcnew_t()
string subString(t_size base, t_size count) const
bool operator<(const string &p_other) const
static int compare(T1 const &v1, T2 const &v2)
const char * get_ptr() const
const char * toString() const
string toString(T const &val)
const char * get_ptr() const
int stringCompareCaseInsensitive(const char *s1, const char *s2)
static int compare_ex(const char *v1, t_size l1, const char *v2, t_size l2)
int stricmp_ascii(const char *s1, const char *s2)
const char * get_ptr() const
New EXPERIMENTAL string class, allowing efficient copies and returning from functions. Does not implement the string_base interface so you still need string8 in many cases. Safe to pass between DLLs, but since a reference is used, objects possibly created by other DLLs must be released before owning DLLs are unloaded.
static bool g_equalsCaseInsensitive(const string &p_item1, const string &p_item2)
static bool g_equals(const string &p_item1, const string &p_item2)
void memcpy_t(t_dst *p_dst, const t_src *p_src, t_size p_count)
static string g_concatenateRaw(const char *item1, t_size len1, const char *item2, t_size len2)
bool operator>(const string &p_other) const
string(string_part_ref source)
void truncate(t_size len)
stringp(string_base const &s)
static int g_compare(const string &p_item1, const string &p_item2)
bool operator!=(const string &p_other) const
void set_string(const char *ptr, t_size len=~0)
string8_t< pfc::alloc_fast_aggressive > string8_fastalloc
static string_part_ref stringToRef(T const &val)
const char * c_str() const
t_size length() const
For compatibility with old conventions.