22 #ifndef COMMON_STRING_H 23 #define COMMON_STRING_H 25 #include "common/scummsys.h" 26 #include "common/str-enc.h" 27 #include "common/ustr.h" 28 #include "common/str-base.h" 92 String &operator=(
const char *str);
96 String &operator+=(
const char *str);
98 String &operator+=(
char c);
100 bool equalsIgnoreCase(
const String &x)
const;
101 int compareToIgnoreCase(
const String &x)
const;
103 bool equalsIgnoreCase(
const char *x)
const;
104 int compareToIgnoreCase(
const char *x)
const;
105 int compareDictionary(
const String &x)
const;
106 int compareDictionary(
const char *x)
const;
108 bool hasSuffix(
const String &x)
const;
109 bool hasSuffix(
const char *x)
const;
110 bool hasSuffixIgnoreCase(
const String &x)
const;
111 bool hasSuffixIgnoreCase(
const char *x)
const;
113 bool hasPrefix(
const String &x)
const;
114 bool hasPrefix(
const char *x)
const;
115 bool hasPrefixIgnoreCase(
const String &x)
const;
116 bool hasPrefixIgnoreCase(
const char *x)
const;
119 bool contains(
const String &x)
const;
120 bool contains(
const char *x)
const;
147 bool matchString(
const char *pat,
bool ignoreCase =
false,
const char *wildcardExclusions = NULL)
const;
148 bool matchString(
const String &pat,
bool ignoreCase =
false,
const char *wildcardExclusions = NULL)
const;
174 StringEncodingResult encodeUTF8(
const U32String &src,
char errorChar);
175 StringEncodingResult encodeWindows932(
const U32String &src,
char errorChar);
176 StringEncodingResult encodeWindows936(
const U32String &src,
char errorChar);
177 StringEncodingResult encodeWindows949(
const U32String &src,
char errorChar);
178 StringEncodingResult encodeWindows950(
const U32String &src,
bool translit,
char errorChar);
179 StringEncodingResult encodeJohab(
const U32String &src,
char errorChar);
180 StringEncodingResult encodeOneByte(
const U32String &src, CodePage page,
bool translit,
char errorChar);
181 StringEncodingResult encodeInternal(
const U32String &src, CodePage page,
char errorChar);
182 StringEncodingResult translitChar(U32String::value_type point,
char errorChar);
197 bool operator==(
const char *x,
const String &y);
198 bool operator!=(
const char *x,
const String &y);
201 extern char *ltrim(
char *t);
202 extern char *rtrim(
char *t);
203 extern char *
trim(
char *t);
274 bool matchString(
const char *str,
const char *pat,
bool ignoreCase =
false,
const char *wildcardExclusions = NULL);
307 void strcpy_s(
char *dst,
size_t size,
const char *src);
319 template<
typename T,
size_t N>
320 FORCEINLINE
void strcpy_s(T (&dst)[N],
const char *src) {
321 STATIC_ASSERT(
sizeof(T) ==
sizeof(
char), T_is_not_compatible_with_char);
337 void strcat_s(
char *dst,
size_t size,
const char *src);
350 template<
typename T,
size_t N>
351 FORCEINLINE
void strcat_s(T (&dst)[N],
const char *src) {
352 STATIC_ASSERT(
sizeof(T) ==
sizeof(
char), T_is_not_compatible_with_char);
372 template<
typename T,
size_t N>
374 STATIC_ASSERT(
sizeof(T) ==
sizeof(
char), T_is_not_compatible_with_char);
375 return vsprintf_s((
char *)dst, N, format, ap);
385 int sprintf_s(
char *dst,
size_t size, MSVC_PRINTF
const char *format, ...)
GCC_PRINTF(3, 4);
394 template<
typename T,
size_t N>
396 STATIC_ASSERT(
sizeof(T) ==
sizeof(
char), T_is_not_compatible_with_char);
399 va_start(ap, format);
420 size_t strlcpy(
char *dst,
const char *src,
size_t size);
440 size_t strlcat(
char *dst,
const char *src,
size_t size);
451 size_t strnlen(
const char *src,
size_t maxSize);
458 #define tag2str(x) Common::tag2string(x).c_str() 465 #define tag2strP(x) Common::tag2string(x, true).c_str() 486 extern int scumm_stricmp(
const char *s1,
const char *s2);
487 extern int scumm_strnicmp(
const char *s1,
const char *s2, uint n);
488 extern char *scumm_strdup(
const char *in);
490 extern int scumm_compareDictionary(
const char *s1,
const char *s2);
491 extern const char *scumm_skipArticle(
const char *s1);
493 extern const char *scumm_strcasestr(
const char *s,
const char *
find);
String percentEncodeString(const String &src)
String lastPathComponent(const String &path, const char sep)
String(String &&str)
Definition: str.h:84
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
bool matchString(const char *pat, bool ignoreCase=false, const char *wildcardExclusions=NULL) const
size_t strlcat(char *dst, const char *src, size_t size)
size_t strlcpy(char *dst, const char *src, size_t size)
constexpr String()
Definition: str.h:69
String forEachLine(String(*func)(const String, va_list args),...) const
uint32 find(value_type x, uint32 pos=0) const
Definition: str-base.h:32
int sprintf_s(char *dst, size_t size, MSVC_PRINTF const char *format,...) GCC_PRINTF(3
static String static String vformat(const char *fmt, va_list args)
String firstPathComponents(const String &path, const char sep)
int FORCEINLINE GCC_PRINTF(2, 0) int vsprintf_s(T(&dst)[N]
String toPrintable(const String &src, bool keepNewLines=true)
String normalizePath(const String &path, const char sep)
String(const char *str)
Definition: str.h:72
int vsprintf_s(char *dst, size_t size, const char *format, va_list ap) GCC_PRINTF(3
Definition: algorithm.h:29
String(const char *beginP, const char *endP)
Definition: str.h:78
DBCSString operator+(const DBCSString &x, const DBCSString &y)
String(const String &str)
Definition: str.h:81
String substr(size_t pos=0, size_t len=npos) const
String(const char *str, uint32 len)
Definition: str.h:75
void replace(uint32 pos, uint32 count, const BaseString &str)
String tag2string(uint32 tag, bool nonPrintable=false)
void strcpy_s(char *dst, size_t size, const char *src)
size_t strnlen(const char *src, size_t maxSize)
U32String decode(CodePage page=kUtf8) const
void strcat_s(char *dst, size_t size, const char *src)
unsigned char unsigned_type
Definition: str.h:66