sources/mystring.h

Wed, 27 Jan 2021 13:02:51 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 27 Jan 2021 13:02:51 +0200
changeset 179
7fc34735178e
parent 158
de7574d292ad
child 182
20ca0a6be175
permissions
-rw-r--r--

start cleaning up unused code

1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
109
e4966d7e615d Happy new year 2016
Teemu Piippo <crimsondusk64@gmail.com>
parents: 107
diff changeset
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
179
7fc34735178e start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
40 using StringList = std::vector<class String>;
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 class String
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 {
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 public:
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
45 typedef std::string::iterator Iterator;
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
46 typedef std::string::const_iterator ConstIterator;
69
eb4c25284a19 Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents: 66
diff changeset
47
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
48 String();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
49 String(char a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
50 String(const char* data);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
51 String(const std::string& data);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
52 String(const Vector<char>& data);
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
54 void append(const char* text);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
55 void append(char character);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
56 void append(const String& text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
57 ConstIterator begin() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
58 Iterator begin();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
59 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
60 int count(char character) const;
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
61 const char* chars() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
62 void clear();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
63 ConstIterator end() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
64 Iterator end();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
65 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
66 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
67 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
68 int indexDifference(int a, int b);
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
69 void insert(int position, char character);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
70 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
71 bool isEmpty() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
72 bool isNumeric() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
73 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
74 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
75 int length() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
76 bool maskAgainst(const String &pattern) const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
77 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
78 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
79 void normalize(int(*filter)(int) = &isspace);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
80 String normalized(int(*filter)(int) = &isspace) const;
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
81 void prepend(String text);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
82 void remove(int position, int length);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
83 void removeAt(int position);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
84 void removeFromEnd(int length);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
85 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
86 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
87 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
88 String right(int length) const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
89 void shrinkToFit();
179
7fc34735178e start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
90 StringList split(const String &delimeter) const;
7fc34735178e start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
91 StringList split(char delimeter) const;
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
92 void __cdecl sprintf(const char* fmtstr, ...);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
93 bool startsWith(const String &other) const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
94 const std::string& stdString() const;
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
95 const unsigned char* toBytes() const;
145
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 vsprintf(const char* fmtstr, va_list args);
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
103 static String fromNumber(short int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
104 static String fromNumber(int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
105 static String fromNumber(long int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
106 static String fromNumber(unsigned short int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
107 static String fromNumber(unsigned int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
108 static String fromNumber(unsigned long int a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
109 static String fromNumber(double a);
158
de7574d292ad Added the ByteArray typedef for Vector<unsigned char>
Teemu Piippo <teemu@compsta2.com>
parents: 157
diff changeset
110 static String fromBytes(const ByteArray& bytes);
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
179
7fc34735178e start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
136 String join_string_list(const StringList& strings, const String& delim);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
137
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
138 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
139 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
140
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
141 // --------------------------------------------------------------------------------------------------------------------
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
142
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
143 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
144 * \brief Constructs an empty string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
145 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
146 inline String::String() {}
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
147
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
148 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
149 * \brief Constructs a string from a single character.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
150 * \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
151 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
152 inline String::String(char character)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
153 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
154 char buffer[2] = { character, '\0' };
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
155 m_string = buffer;
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
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 char-array.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
160 * \param string char-array to convert.
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(const char* string) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
163 m_string(string) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
164
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
165 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
166 * \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
167 * \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
168 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
169 inline String::String(const std::string& string) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
170 m_string(string) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
171
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
172 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
173 * \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
174 * \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
175 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
176 inline String::String(const Vector<char>& charVector) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
177 m_string(charVector.data(), charVector.size()) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
178
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
179 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
180 * \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
181 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
182 inline String::ConstIterator String::begin() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
183 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
184 return m_string.cbegin();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
185 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
186
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
187 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
188 * \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
189 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
190 inline const char* String::chars() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
191 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
192 return m_string.c_str();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
195 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
196 * \returns the string's constant end-iterator.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
197 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
198 inline String::ConstIterator String::end() const
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 return m_string.end();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
203 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
204 * \returns whether or not the string is empty.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
205 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
206 inline bool String::isEmpty() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
207 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
208 return m_string[0] == '\0';
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
211 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
212 * \returns the length of the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
213 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
214 inline int String::length() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
215 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
216 return m_string.length();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
219 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
220 * \returns the underlying \c std::string .
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
221 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
222 inline const std::string& String::stdString() const
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 return m_string;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
227 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
228 * \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
229 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
230 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
231 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
232 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
233 m_string.append(text);
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
236 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
237 * \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
238 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
239 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
240 inline void String::append(char character)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
241 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
242 m_string.push_back(character);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
243 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
244
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
245 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
246 * \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
247 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
248 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
249 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
250 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
251 m_string.append(text.chars());
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
254 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
255 * \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
256 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
257 inline String::Iterator String::begin()
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
258 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
259 return m_string.begin();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
262 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
263 * \brief Clears the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
264 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
265 inline void String::clear()
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 m_string.clear();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
270 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
271 * \returns the string's mutable end-iterator.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
272 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
273 inline String::Iterator String::end()
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 return m_string.end();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
278 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
279 * \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
280 * \param a First index to compare
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
281 * \param b Second index to compare
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
282 * \returns the difference of two indices.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
283 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
284 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
285 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
286 modifyIndex(a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
287 modifyIndex(b);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
288 return b - a;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
291 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
292 * \brief Inserts a character into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
293 * \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
294 * \param character Character to insert into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
295 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
296 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
297 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
298 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
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 substring 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 substring.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
304 * \param string Substring to insert.
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, const char* string)
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(position, string);
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 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
313 * 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
314 * -2 to the second last, etc.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
315 * \param index Index to translate.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
316 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
317 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
318 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
319 if (index < 0)
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
320 index = length() - index;
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
323 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
324 * \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
325 * \param text Text to prepend.
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::prepend(String text)
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 m_string = (text + m_string).stdString();
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
330 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
331
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
332 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
333 * \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
334 * \param position Position where to start removing text.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
335 * \param length Amount of characters to remove.
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::remove(int position, int length)
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.replace(position, length, "");
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 single character from the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
344 * \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
345 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
346 inline void String::removeAt(int position)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
347 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
348 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
349 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
350
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
351 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
352 * \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
353 * \param length Amount of characters to remove.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
354 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
355 inline void String::removeFromEnd(int length)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
356 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
357 remove(this->length() - length, length);
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
360 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
361 * \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
362 * \param length Amount of characters to remove.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
363 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
364 inline void String::removeFromStart(int length)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
365 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
366 remove(0, length);
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
369 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
370 * \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
371 * \param position Position where to start replacing text.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
372 * \param amount Amount of characters to replace.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
373 * \param text Replacement string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
374 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
375 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
376 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
377 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
378 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
379
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
380 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
381 * \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
382 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
383 inline void String::shrinkToFit()
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 m_string.shrink_to_fit();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
388 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
389 * \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
390 * \param number Number to convert and append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
391 * \returns the resulting string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
392 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
393 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
394 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
395 return *this + String::fromNumber(number);
145
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 Appends text into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
400 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
401 * \returns a reference to this 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+=(const String& text)
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 append(text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
406 return *this;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
407 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
408
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
409 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
410 * \brief Appends text into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
411 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
412 * \returns a reference to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
413 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
414 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
415 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
416 append(text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
417 return *this;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
420 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
421 * \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
422 * \param number The number to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
423 * \returns a refence to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
424 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
425 inline String& String::operator+=(int number)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
426 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
427 return operator+=(String::fromNumber(number));
145
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 Appends a character into this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
432 * \param character The character to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
433 * \return a reference 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+=(char character)
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 append(character);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
438 return *this;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
439 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
440
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
441 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
442 * \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
443 * \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
444 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
445 inline char& String::operator[](int index)
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 return m_string[index];
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
448 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
449
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
450 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
451 * \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
452 * \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
453 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
454 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
455 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
456 return m_string[index];
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
457 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
458
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
459 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
460 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
461 * \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
462 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
463 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
464 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
465 return stdString() == other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
466 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
467
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
468 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
469 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
470 * \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
471 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
472 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
473 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
474 return m_string == other;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
475 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
476
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
477 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
478 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
479 * \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
480 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
481 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
482 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
483 return stdString() != other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
484 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
485
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
486 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
487 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
488 * \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
489 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
490 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
491 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
492 return m_string != other;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
493 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
494
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
495 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
496 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
497 * \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
498 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
499 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
500 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
501 return stdString() > other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
502 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
503
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
504 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
505 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
506 * \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
507 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
508 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
509 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
510 return stdString() < other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
511 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
512
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
513 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
514 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
515 * \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
516 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
517 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
518 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
519 return stdString() >= other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
520 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
521
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
522 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
523 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
524 * \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
525 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
526 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
527 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
528 return stdString() <= other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
529 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
530
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
531 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
532 * \returns a char-array representation of this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
533 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
534 inline String::operator const char*() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
535 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
536 return chars();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
539 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
540 * \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
541 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
542 inline String::operator const std::string&() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
543 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
544 return stdString();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
547 /*!
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
548 * \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
549 */
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
550 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
551 {
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
552 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
553 }
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
554
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
555 /*!
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
556 * \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
557 * with a \c String.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
558 * \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
559 * \param other A string to compare.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
560 * \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
561 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
562 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
563 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
564 return other == one;
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
565 }
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
566
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
567 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
568 * \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
569 * with a \c String.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
570 * \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
571 * \param other A string to catenate.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
572 * \returns the catenated string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
573 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
574 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
575 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
576 return String(one) + other;
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
577 }
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
578
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
579
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
580 END_ZFC_NAMESPACE

mercurial