Wed, 20 Jul 2016 16:01:10 +0300
Renamed String methods, and reformatted mystring.h
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 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
53 | void append(const char* data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
54 | void append(char data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
55 | void append(const String& data); |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
59 | int count(char needle) const; |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
65 | int find(const char* c, int a = 0) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
66 | int find(char ch, int a = 0) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
67 | int indexDifference(int a, int b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
68 | void insert(int pos, char c); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
69 | void insert(int pos, const char* c); |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
73 | int findLast(const char*c, int a) const; |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
77 | String mid(int a, int b) const; |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
80 | void prepend(String a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
81 | void remove(int pos, int len); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
82 | void removeAt(int pos); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
83 | void removeFromEnd(int len); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
84 | void removeFromStart(int len); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
85 | void replace(const char* a, const char* b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
86 | void replace(int pos, int n, const String &a); |
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(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
89 | class StringList split(const String &del) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
90 | class StringList split(char del) const; |
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; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
94 | String strip(char unwanted) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
95 | String strip(const List<char> &unwanted) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
96 | double toDouble(bool* ok = nullptr) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
97 | float toFloat(bool* ok = nullptr) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
98 | 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
|
99 | String toLowerCase() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
100 | String toUpperCase() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
101 | void trim(int n); |
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); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
111 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
112 | String operator+(const String& data) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
113 | String operator+(const char* data) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
114 | String operator+(int num) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
115 | String& operator+=(const String& data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
116 | String& operator+=(const char* data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
117 | String& operator+=(int num); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
118 | String& operator+=(char data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
119 | char& operator[](int i); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
120 | char operator[](int i) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
121 | bool operator==(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
122 | bool operator==(const char* other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
123 | bool operator!=(const String& other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
124 | bool operator!=(const char* other) const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
125 | bool operator>(const String& 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 | operator const char*() const; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
130 | operator const std::string&() const; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | private: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | std::string m_string; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
136 | |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | class StringList : public List<String> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | public: |
87
53c2aecb9704
some work on MSVC support (still doesn't work yet...)
Teemu Piippo <tsapii@utu.fi>
parents:
83
diff
changeset
|
140 | typedef List<String> Super; |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
141 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
142 | StringList() {} |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
144 | StringList(int numvalues) : |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
145 | Super(numvalues) {} |
87
53c2aecb9704
some work on MSVC support (still doesn't work yet...)
Teemu Piippo <tsapii@utu.fi>
parents:
83
diff
changeset
|
146 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
147 | StringList(const Super& other) : |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
148 | Super(other) {} |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
149 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
150 | String join(const String& delim); |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
153 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
154 | 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
|
155 | 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
|
156 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
157 | // -------------------------------------------------------------------------------------------------------------------- |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
158 | // Inline implementations |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
159 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
160 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
161 | inline String::String() {} |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
162 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
163 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
164 | inline String::String(char a) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
165 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
166 | char buffer[2] = { a, '\0' }; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
167 | m_string = buffer; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
168 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
169 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
170 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
171 | inline String::String(const char* data) : |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
172 | m_string(data) {} |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
173 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
174 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
175 | inline String::String(const std::string& data) : |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
176 | m_string(data) {} |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
177 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
178 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
179 | inline String::String(const Vector<char>& data) : |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
180 | m_string(data.data(), data.size()) {} |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
181 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
182 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
183 | inline String::ConstIterator String::begin() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
184 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
185 | return m_string.cbegin(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
186 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
187 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
188 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
189 | inline const char* String::chars() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
190 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
191 | return m_string.c_str(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
192 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
195 | inline String::ConstIterator String::end() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
196 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
197 | return m_string.end(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
198 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
199 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
200 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
201 | inline bool String::isEmpty() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
202 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
203 | return m_string[0] == '\0'; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
204 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
205 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
206 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
207 | inline int String::length() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
208 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
209 | return m_string.length(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
210 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
213 | inline const std::string& String::stdString() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
214 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
215 | return m_string; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
216 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
219 | inline void String::append(const char* data) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
220 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
221 | m_string.append(data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
222 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
223 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
224 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
225 | inline void String::append(char data) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
226 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
227 | m_string.push_back(data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
228 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
229 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
230 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
231 | inline void String::append(const String& data) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
232 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
233 | m_string.append(data.chars()); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
234 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
237 | inline String::Iterator String::begin() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
238 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
239 | return m_string.begin(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
240 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
241 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
242 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
243 | inline void String::clear() |
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 | m_string.clear(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
246 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
247 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
248 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
249 | inline String::Iterator String::end() |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
250 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
251 | return m_string.end(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
252 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
255 | 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
|
256 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
257 | modifyIndex(a); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
258 | modifyIndex(b); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
259 | return b - a; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
260 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
261 | |
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 | inline void String::insert(int pos, char c) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
264 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
265 | m_string.insert(m_string.begin() + pos, c); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
266 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
267 | |
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 | inline void String::insert(int pos, const char* c) |
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 | m_string.insert(pos, c); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
272 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
273 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
274 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
275 | inline void String::modifyIndex(int& a) const |
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 | if (a < 0) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
278 | a = length() - a; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
279 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
280 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
281 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
282 | inline void String::prepend(String a) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
283 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
284 | m_string = (a + m_string).stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
285 | } |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
288 | inline void String::remove(int pos, int len) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
289 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
290 | m_string.replace(pos, len, ""); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
291 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
292 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
293 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
294 | inline void String::removeAt(int pos) |
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 | m_string.erase(m_string.begin() + pos); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
297 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
298 | |
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 | inline void String::removeFromEnd(int len) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
301 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
302 | remove(length() - len, len); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
303 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
304 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
305 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
306 | inline void String::removeFromStart(int len) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
307 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
308 | remove(0, len); |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
311 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
312 | inline void String::replace(int pos, int n, const String& a) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
313 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
314 | m_string.replace(pos, n, a.chars()); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
315 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
316 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
317 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
318 | inline void String::shrinkToFit() |
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 | m_string.shrink_to_fit(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
321 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
322 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
323 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
324 | inline String String::operator+(int num) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
325 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
326 | return *this + String::fromNumber(num); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
327 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
328 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
329 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
330 | inline String& String::operator+=(const String& data) |
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 | append(data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
333 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
334 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
335 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
336 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
337 | inline String& String::operator+=(const char* data) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
338 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
339 | append(data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
340 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
341 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
342 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
343 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
344 | inline String& String::operator+=(int num) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
345 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
346 | return operator+=(String::fromNumber(num)); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
347 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
348 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
349 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
350 | inline String& String::operator+=(char data) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
351 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
352 | append(data); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
353 | return *this; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
354 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
355 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
356 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
357 | inline char& String::operator[](int i) |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
358 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
359 | return m_string[i]; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
360 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
361 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
362 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
363 | inline char String::operator[](int i) const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
364 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
365 | return m_string[i]; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
366 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
367 | |
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 | 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
|
370 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
371 | return stdString() == other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
372 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
373 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
374 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
375 | 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
|
376 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
377 | return m_string == other; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
378 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
379 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
380 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
381 | 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
|
382 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
383 | return stdString() != other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
384 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
385 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
386 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
387 | 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
|
388 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
389 | return m_string != other; |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
390 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
391 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
392 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
393 | 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
|
394 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
395 | return stdString() > other.stdString(); |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
398 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
399 | 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
|
400 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
401 | return stdString() < other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
402 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
403 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
404 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
405 | 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
|
406 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
407 | return stdString() >= other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
408 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
409 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
410 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
411 | 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
|
412 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
413 | return stdString() <= other.stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
414 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
415 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
416 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
417 | inline String::operator const char*() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
418 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
419 | return chars(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
420 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
421 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
422 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
423 | inline String::operator const std::string&() const |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
424 | { |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
425 | return stdString(); |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
426 | } |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
427 | |
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 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
430 | inline bool operator==(const char* a, const String& b) |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
431 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
432 | return b == a; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
433 | } |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
434 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
435 | |
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
436 | inline String operator+(const char* a, const String& b) |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | { |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
438 | return String(a) + b; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
439 | } |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
440 | |
145
d0aedc9be448
Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents:
129
diff
changeset
|
441 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
442 | END_ZFC_NAMESPACE |