mFrame
載入中...
搜尋中...
無符合項目
Strings.h
1
8#ifndef MFRAME_F115800B_0B0A_4795_ABFB_A37BD1DE2055
9#define MFRAME_F115800B_0B0A_4795_ABFB_A37BD1DE2055
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16#include "./../lang/Memory.h"
17#include "./../lang/Readable.h"
18
19/* ***************************************************************************************
20 * Namespace
21 */
22namespace mframe::lang {
23 class Strings;
24} // namespace mframe::lang
25
26/* ***************************************************************************************
27 * Class/Interface/Struct
28 */
30 /* *************************************************************************************
31 * Variable
32 */
33
34 /* *************************************************************************************
35 * Abstract Method
36 */
37
38 /* *************************************************************************************
39 * Construct Method
40 */
41 public:
48 Strings(void* pointer, int size);
49
55 Strings(const char* str);
56
63
70
75 virtual ~Strings(void) override;
76
77 /* *************************************************************************************
78 * Operator Method
79 */
80 public:
87 inline Strings& operator+=(const char ch) {
88 return this->append(ch);
89 }
90
97 inline Strings& operator+=(const char* str) {
98 return this->append(str);
99 }
100
108 return this->append(readable);
109 }
110
117 inline Strings& operator+=(int i) {
118 return this->append(i);
119 }
120
127 inline Strings& operator+=(double d) {
128 return this->append(d);
129 }
130
137 inline Strings& operator=(const char* str) {
138 this->set(str);
139 return *this;
140 }
141
148 inline char& operator[](int index) {
149 return *this->pointer<char>(index);
150 }
151
152 /* *************************************************************************************
153 * Public Method <Override> - mframe::lang::Data
154 */
155 public:
156 virtual int hashcode(void) const override;
157
158 /* *************************************************************************************
159 * Public Method <Override> - mframe::lang::Data
160 */
161 public:
162 virtual int hashdata(void) const override;
163
164 /* *************************************************************************************
165 * Public Method
166 */
167 public:
176 inline bool isEmpty(void) const {
177 return (this->size() == 0);
178 }
179
184 void clear(void);
185
191 int size(void) const;
192
200 int bufferSize(void);
201
209 int scanFormat(const char* format, ...);
210
218 int format(const char* format, va_list arg);
219
227 int format(const char* format, ...);
228
233 void convertUpper(void);
234
239 void convertLower(void);
240
246 Strings toUpper(void) const;
247
253 Strings toLower(void) const;
254
260 Strings clone(void) const;
261
268 Strings clone(int length) const;
269
276 Strings clone(int offset, int length) const;
277
285 int replace(char oldChar, char newChar);
286
293 Strings& append(const char c);
294
301 Strings& append(const char* str);
302
310
317 Strings& append(int value);
318
325 Strings& append(double value);
326
333 Strings& append(bool boolena);
334
341 Strings& set(const char* str);
342
349
356
357 /* *************************************************************************************
358 * Protected Method
359 */
360
361 /* *************************************************************************************
362 * Private Method
363 */
364
365 /* *************************************************************************************
366 * Static Variable
367 */
368
369 /* *************************************************************************************
370 * Static Method
371 */
372 public:
378 static Strings empty(void);
379
387 static Strings format(int bufferSize, const char* format, ...);
388
395 static int getLength(const char* src);
396
403 static int getHashcode(const char* src);
404};
405
406/* ***************************************************************************************
407 * End of file
408 */
409
410#endif /* MFRAME_F115800B_0B0A_4795_ABFB_A37BD1DE2055 */
int length(void) const
Definition Data.h:126
Definition Memory.h:29
E * pointer(void) const
模板方法,取得內部指標並轉換為指定型態(不指定偏移)
Definition Pointer.h:409
Definition Strings.h:29
Strings clone(int length) const
Strings & set(const char *str)
Strings(const char *str)
Construct a new Strings object.
Strings & operator+=(const char *str)
插入字串至尾端
Definition Strings.h:97
Strings(void *pointer, int size)
Construct a new Strings object.
int bufferSize(void)
取的字串原始空間大小
int replace(char oldChar, char newChar)
Strings & operator+=(mframe::lang::Readable &readable)
Definition Strings.h:107
int size(void) const
取得字串長度
static int getHashcode(const char *src)
Get the Hashcode object.
Strings & operator+=(const char ch)
插入字元至尾端
Definition Strings.h:87
void clear(void)
清除字串空間
Strings & operator=(const char *str)
Definition Strings.h:137
int format(const char *format,...)
Strings & operator+=(double d)
Definition Strings.h:127
Strings & append(mframe::lang::Readable &readable)
int format(const char *format, va_list arg)
virtual ~Strings(void) override
Destroy the Strings object.
virtual int hashdata(void) const override
Strings(int length)
Construct a new Strings object.
bool isEmpty(void) const
如果字串內為空
Definition Strings.h:176
static Strings format(int bufferSize, const char *format,...)
Strings & append(const char c)
串接字元
Strings & append(int value)
virtual int hashcode(void) const override
返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
Strings clone(void) const
static Strings empty(void)
int scanFormat(const char *format,...)
Strings & append(const char *str)
Strings(const mframe::lang::Memory &memory)
Construct a new Strings object.
char & operator[](int index)
Definition Strings.h:148
Strings & append(bool boolena)
Strings toUpper(void) const
Strings & append(double value)
Strings & operator+=(int i)
Definition Strings.h:117
Strings clone(int offset, int length) const
int hashcodeLowerCast(void)
以全小寫的形式取得哈希碼
Strings toLower(void) const
static int getLength(const char *src)
int hashcodeUpperCast(void)
以全大寫的形式取得哈希碼
Definition Appendable.h:23
Definition Readable.h:31