Wed, 27 Jan 2021 12:34:56 +0200
added packet queue as a new head
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
109 | 2 | Copyright 2014 - 2016 Teemu Piippo |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | All rights reserved. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | are met: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | 3. Neither the name of the copyright holder nor the names of its |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | contributors may be used to endorse or promote products derived from |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | this software without specific prior written permission. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | */ |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | #pragma once |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include <deque> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include <string> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | #include <stdarg.h> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | #include "basics.h" |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #include "list.h" |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
37 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
38 | BEGIN_ZFC_NAMESPACE |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | class String |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | public: |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
44 | typedef std::string::iterator Iterator; |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
45 | typedef std::string::const_iterator ConstIterator; |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
46 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
47 | String(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
48 | String(char a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
49 | String(const char* data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
50 | String(const std::string& data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
51 | String(const Vector<char>& data); |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
53 | void append(const char* text); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
54 | void append(char character); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
55 | void append(const String& text); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
56 | ConstIterator begin() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
57 | Iterator begin(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
58 | int compare(const String &other) const; |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
59 | int count(char character) const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
60 | const char* chars() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
61 | void clear(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
62 | ConstIterator end() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
63 | Iterator end(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
64 | bool endsWith(const String &other) const; |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
65 | int find(const char* subString, int startingPosition = 0) const; |
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
66 | int find(char character, int startingPosition = 0) const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
67 | int indexDifference(int a, int b); |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
68 | void insert(int position, char character); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
69 | void insert(int position, const char* string); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
70 | bool isEmpty() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
71 | bool isNumeric() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
72 | void modifyIndex(int &a) const; |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
73 | int findLast(const char* subString, int startingPosition = -1) const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
74 | int length() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
75 | bool maskAgainst(const String &pattern) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
76 | String md5() const; |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
77 | String mid(int rangeBegin, int rangeEnd) const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
78 | void normalize(int(*filter)(int) = &isspace); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
79 | String normalized(int(*filter)(int) = &isspace) const; |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
80 | void prepend(String text); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
81 | void remove(int position, int length); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
82 | void removeAt(int position); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
83 | void removeFromEnd(int length); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
84 | void removeFromStart(int length); |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
85 | void replace(const char* text, const char* replacement); |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
86 | void replace(int position, int amount, const String &text); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
87 | String right(int length) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
88 | void shrinkToFit(); |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
89 | class StringList split(const String &delimeter) const; |
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
90 | class StringList split(char delimeter) const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
91 | void __cdecl sprintf(const char* fmtstr, ...); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
92 | bool startsWith(const String &other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
93 | const std::string& stdString() const; |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
94 | void strip(char unwanted); |
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
95 | void strip(const List<char> &unwanted); |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
96 | const unsigned char* toBytes() const; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
97 | double toDouble(bool* ok = nullptr) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
98 | float toFloat(bool* ok = nullptr) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
99 | long toInt(bool* ok = nullptr, int base = 10) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
100 | String toLowerCase() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
101 | String toUpperCase() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
102 | void vsprintf(const char* fmtstr, va_list args); |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
104 | static String fromNumber(short int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
105 | static String fromNumber(int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
106 | static String fromNumber(long int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
107 | static String fromNumber(unsigned short int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
108 | static String fromNumber(unsigned int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
109 | static String fromNumber(unsigned long int a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
110 | static String fromNumber(double a); |
158
de7574d292ad
Added the ByteArray typedef for Vector<unsigned char>
Teemu Piippo <teemu@compsta2.com>
parents:
157
diff
changeset
|
111 | static String fromBytes(const ByteArray& bytes); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
112 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
113 | String operator+(const String& data) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
114 | String operator+(const char* data) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
115 | String operator+(int num) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
116 | String& operator+=(const String& data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
117 | String& operator+=(const char* data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
118 | String& operator+=(int num); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
119 | String& operator+=(char data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
120 | char& operator[](int i); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
121 | char operator[](int i) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
122 | bool operator==(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
123 | bool operator==(const char* other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
124 | bool operator!=(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
125 | bool operator!=(const char* other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
126 | bool operator>(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
127 | bool operator<(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
128 | bool operator>=(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
129 | bool operator<=(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
130 | operator const char*() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
131 | operator const std::string&() const; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | private: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | std::string m_string; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
137 | |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | class StringList : public List<String> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | public: |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
141 | StringList(); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
142 | StringList(int numvalues); |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
143 | StringList(const List<String>& other); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
144 | String join(const String& delim); |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
147 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
148 | inline bool operator==(const char* a, const String& b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
149 | inline String operator+(const char* a, const String& b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
150 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
151 | // -------------------------------------------------------------------------------------------------------------------- |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
152 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
153 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
154 | * \brief Constructs an empty string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
155 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
156 | inline String::String() {} |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
157 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
158 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
159 | * \brief Constructs a string from a single character. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
160 | * \param character Character to create a string out of. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
161 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
162 | inline String::String(char character) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
163 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
164 | char buffer[2] = { character, '\0' }; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
165 | m_string = buffer; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
166 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
167 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
168 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
169 | * \brief Constructs a string from a char-array. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
170 | * \param string char-array to convert. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
171 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
172 | inline String::String(const char* string) : |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
173 | m_string(string) {} |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
174 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
175 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
176 | * \brief Constructs a string out of a \c std::string . |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
177 | * \param string \c std::string to base the construction on. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
178 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
179 | inline String::String(const std::string& string) : |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
180 | m_string(string) {} |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
181 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
182 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
183 | * \brief Constructs a string out of a vector of characters. The vector does not have to be null-terminated. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
184 | * \param charVector Vector of characters to construct the string out of. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
185 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
186 | inline String::String(const Vector<char>& charVector) : |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
187 | m_string(charVector.data(), charVector.size()) {} |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
188 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
189 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
190 | * \returns a constant iterator to the beginning of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
191 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
192 | inline String::ConstIterator String::begin() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
193 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
194 | return m_string.cbegin(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
195 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
196 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
197 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
198 | * \returns the string's contents as a char-array. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
199 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
200 | inline const char* String::chars() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
201 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
202 | return m_string.c_str(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
203 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
204 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
205 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
206 | * \returns the string's constant end-iterator. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
207 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
208 | inline String::ConstIterator String::end() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
209 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
210 | return m_string.end(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
211 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
212 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
213 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
214 | * \returns whether or not the string is empty. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
215 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
216 | inline bool String::isEmpty() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
217 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
218 | return m_string[0] == '\0'; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
219 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
220 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
221 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
222 | * \returns the length of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
223 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
224 | inline int String::length() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
225 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
226 | return m_string.length(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
227 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
228 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
229 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
230 | * \returns the underlying \c std::string . |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
231 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
232 | inline const std::string& String::stdString() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
233 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
234 | return m_string; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
235 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
236 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
237 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
238 | * \brief Adds text from a char-array to the end of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
239 | * \param text Text to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
240 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
241 | inline void String::append(const char* text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
242 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
243 | m_string.append(text); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
244 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
245 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
246 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
247 | * \brief Adds text to the end of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
248 | * \param text Text to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
249 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
250 | inline void String::append(char character) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
251 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
252 | m_string.push_back(character); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
253 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
254 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
255 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
256 | * \brief Adds text from another string to the end of this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
257 | * \param text Text to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
258 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
259 | inline void String::append(const String& text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
260 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
261 | m_string.append(text.chars()); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
262 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
263 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
264 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
265 | * \returns a mutable iterator to the beginning of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
266 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
267 | inline String::Iterator String::begin() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
268 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
269 | return m_string.begin(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
270 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
271 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
272 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
273 | * \brief Clears the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
274 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
275 | inline void String::clear() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
276 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
277 | m_string.clear(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
278 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
279 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
280 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
281 | * \returns the string's mutable end-iterator. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
282 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
283 | inline String::Iterator String::end() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
284 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
285 | return m_string.end(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
286 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
287 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
288 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
289 | * \brief Compares two string indices, supporting negatives as offsets from the end of string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
290 | * \param a First index to compare |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
291 | * \param b Second index to compare |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
292 | * \returns the difference of two indices. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
293 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
294 | inline int String::indexDifference(int a, int b) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
295 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
296 | modifyIndex(a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
297 | modifyIndex(b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
298 | return b - a; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
299 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
300 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
301 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
302 | * \brief Inserts a character into the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
303 | * \param position Position in the string where to insert the character into. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
304 | * \param character Character to insert into the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
305 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
306 | inline void String::insert(int position, char character) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
307 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
308 | m_string.insert(m_string.begin() + position, character); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
309 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
310 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
311 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
312 | * \brief Inserts a substring into the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
313 | * \param position Position in the string where to insert the substring. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
314 | * \param string Substring to insert. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
315 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
316 | inline void String::insert(int position, const char* string) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
317 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
318 | m_string.insert(position, string); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
319 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
320 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
321 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
322 | * \brief Modifies the given index so that if it is negative, it is translated into a positive index starting from the |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
323 | * end of the string. For example, an index of -1 will be modified to point to the last character in the string, |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
324 | * -2 to the second last, etc. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
325 | * \param index Index to translate. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
326 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
327 | inline void String::modifyIndex(int& index) const |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
328 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
329 | if (index < 0) |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
330 | index = length() - index; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
331 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
332 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
333 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
334 | * \brief Prepends the given text to the beginning of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
335 | * \param text Text to prepend. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
336 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
337 | inline void String::prepend(String text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
338 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
339 | m_string = (text + m_string).stdString(); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
340 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
341 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
342 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
343 | * \brief Removes a range of text from the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
344 | * \param position Position where to start removing text. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
345 | * \param length Amount of characters to remove. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
346 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
347 | inline void String::remove(int position, int length) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
348 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
349 | m_string.replace(position, length, ""); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
350 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
351 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
352 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
353 | * \brief Removes a single character from the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
354 | * \param position Position of the character to remove string from. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
355 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
356 | inline void String::removeAt(int position) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
357 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
358 | m_string.erase(m_string.begin() + position); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
359 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
360 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
361 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
362 | * \brief Removes a number of characters from the end of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
363 | * \param length Amount of characters to remove. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
364 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
365 | inline void String::removeFromEnd(int length) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
366 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
367 | remove(this->length() - length, length); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
368 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
369 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
370 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
371 | * \brief Removes a number of characters from the beginning of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
372 | * \param length Amount of characters to remove. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
373 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
374 | inline void String::removeFromStart(int length) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
375 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
376 | remove(0, length); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
377 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
378 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
379 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
380 | * \brief Replaces a range of text in the string with another. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
381 | * \param position Position where to start replacing text. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
382 | * \param amount Amount of characters to replace. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
383 | * \param text Replacement string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
384 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
385 | inline void String::replace(int position, int amount, const String& text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
386 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
387 | m_string.replace(position, amount, text.chars()); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
388 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
389 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
390 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
391 | * \brief Shrinks the string so that it does not allocate more characters than necessary. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
392 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
393 | inline void String::shrinkToFit() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
394 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
395 | m_string.shrink_to_fit(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
396 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
397 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
398 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
399 | * \brief Converts a number into a string, and returns a new string with the number appended to the end of the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
400 | * \param number Number to convert and append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
401 | * \returns the resulting string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
402 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
403 | inline String String::operator+(int number) const |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
404 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
405 | return *this + String::fromNumber(number); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
406 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
407 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
408 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
409 | * \brief Appends text into the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
410 | * \param text Text to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
411 | * \returns a reference to this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
412 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
413 | inline String& String::operator+=(const String& text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
414 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
415 | append(text); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
416 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
417 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
418 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
419 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
420 | * \brief Appends text into the string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
421 | * \param text Text to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
422 | * \returns a reference to this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
423 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
424 | inline String& String::operator+=(const char* text) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
425 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
426 | append(text); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
427 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
428 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
429 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
430 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
431 | * \brief Converts a number into a string, and appends it into this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
432 | * \param number The number to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
433 | * \returns a refence to this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
434 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
435 | inline String& String::operator+=(int number) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
436 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
437 | return operator+=(String::fromNumber(number)); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
438 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
439 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
440 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
441 | * \brief Appends a character into this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
442 | * \param character The character to append. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
443 | * \return a reference to this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
444 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
445 | inline String& String::operator+=(char character) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
446 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
447 | append(character); |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
448 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
449 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
450 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
451 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
452 | * \param index Index referring to a character of this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
453 | * \returns an editable reference to the character pointed by the given index. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
454 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
455 | inline char& String::operator[](int index) |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
456 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
457 | return m_string[index]; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
458 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
459 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
460 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
461 | * \param index Index referring to a character of this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
462 | * \returns an const reference to the character pointed by the given index. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
463 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
464 | inline char String::operator[](int index) const |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
465 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
466 | return m_string[index]; |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
467 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
468 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
469 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
470 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
471 | * \returns whether or not this string is the same as the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
472 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
473 | inline bool String::operator==(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
474 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
475 | return stdString() == other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
476 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
477 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
478 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
479 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
480 | * \returns whether or not this string is the same as the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
481 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
482 | inline bool String::operator==(const char* other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
483 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
484 | return m_string == other; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
485 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
486 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
487 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
488 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
489 | * \returns whether or not this string is different than the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
490 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
491 | inline bool String::operator!=(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
492 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
493 | return stdString() != other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
494 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
495 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
496 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
497 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
498 | * \returns whether or not this string is different than the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
499 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
500 | inline bool String::operator!=(const char* other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
501 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
502 | return m_string != other; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
503 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
504 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
505 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
506 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
507 | * \return whether or not this string is lexicographically greater than the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
508 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
509 | inline bool String::operator>(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
510 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
511 | return stdString() > other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
512 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
513 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
514 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
515 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
516 | * \return whether or not this string is lexicographically lesser than the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
517 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
518 | inline bool String::operator<(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
519 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
520 | return stdString() < other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
521 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
522 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
523 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
524 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
525 | * \return whether or not this string is lexicographically at least as great as the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
526 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
527 | inline bool String::operator>=(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
528 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
529 | return stdString() >= other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
530 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
531 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
532 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
533 | * \param other String to compare with. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
534 | * \return whether or not this string is lexicographically at most as great as the other string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
535 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
536 | inline bool String::operator<=(const String& other) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
537 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
538 | return stdString() <= other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
539 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
540 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
541 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
542 | * \returns a char-array representation of this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
543 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
544 | inline String::operator const char*() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
545 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
546 | return chars(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
547 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
548 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
549 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
550 | * \returns the underlying \c std::string of this string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
551 | */ |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
552 | inline String::operator const std::string&() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
553 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
554 | return stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
555 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
556 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
557 | /*! |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
558 | * \returns the underlying char-array representation of this string, casted to unsigned chars. |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
559 | */ |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
560 | inline const unsigned char* String::toBytes() const |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
561 | { |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
562 | return reinterpret_cast<const unsigned char*>(chars()); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
563 | } |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
564 | |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
147
diff
changeset
|
565 | /*! |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
566 | * \brief Constructs an empty string list. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
567 | */ |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
568 | inline StringList::StringList() {} |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
569 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
570 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
571 | * \brief Constructs a string list containing \c numvalues empty strings. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
572 | * \param numvalues Amount of empty strings to fill. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
573 | */ |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
574 | inline StringList::StringList(int numvalues) : |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
575 | List<String>(numvalues) {} |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
576 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
577 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
578 | * \brief Constructs a string list from another list of strings. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
579 | * \param other The list of strings to use for construction. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
580 | */ |
147
12c93c4a137c
Documented mystring.cpp. String::trim removed as it does the same as String::removeFromEnd.
Teemu Piippo <teemu@compsta2.com>
parents:
146
diff
changeset
|
581 | inline StringList::StringList(const List<String>& other) : |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
582 | List<String>(other) {} |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
583 | |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
584 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
585 | * \brief An \c operator== implementation that allows a char-array to be at the left side of a string comparison |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
586 | * with a \c String. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
587 | * \param one A char-array representation of a string to compare. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
588 | * \param other A string to compare. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
589 | * \returns whether or not the two parameters are equal. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
590 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
591 | inline bool operator==(const char* one, const String& other) |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
592 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
593 | return other == one; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
594 | } |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
595 | |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
596 | /*! |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
597 | * \brief An \c operator+ implementation that allows a char-array to be at the left side of a string catenation |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
598 | * with a \c String. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
599 | * \param one A char-array representation of a string to catenate. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
600 | * \param other A string to catenate. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
601 | * \returns the catenated string. |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
602 | */ |
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
603 | inline String operator+(const char* one, const String& other) |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | { |
146
81357dcd3da4
Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
145
diff
changeset
|
605 | return String(one) + other; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
606 | } |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
607 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
608 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
609 | END_ZFC_NAMESPACE |