sources/mystring.h

Wed, 20 Jul 2016 16:52:00 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Wed, 20 Jul 2016 16:52:00 +0300
changeset 146
81357dcd3da4
parent 145
d0aedc9be448
child 147
12c93c4a137c
permissions
-rw-r--r--

Added doxygen documentation to mystring.h

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
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 class String
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 {
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 public:
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
44 typedef std::string::iterator Iterator;
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
45 typedef std::string::const_iterator ConstIterator;
69
eb4c25284a19 Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents: 66
diff changeset
46
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
47 String();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
48 String(char a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
49 String(const char* data);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
50 String(const std::string& data);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
51 String(const Vector<char>& data);
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
53 void append(const char* text);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
54 void append(char character);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
55 void append(const String& text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
56 ConstIterator begin() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
57 Iterator begin();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
58 int compare(const String &other) const;
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);
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
68 void insert(int position, char character);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
69 void insert(int position, const char* string);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
70 bool isEmpty() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
71 bool isNumeric() const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
72 void modifyIndex(int &a) const;
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;
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
80 void prepend(String text);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
81 void remove(int position, int length);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
82 void removeAt(int position);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
83 void removeFromEnd(int length);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
84 void removeFromStart(int length);
145
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);
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
86 void replace(int position, int amount, const String &text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
87 String right(int length) const;
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
88 void shrinkToFit();
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:
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
140 StringList();
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
141 StringList(int numvalues);
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
142 StringList(const List<String>& other);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
143 String join(const String& delim);
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 };
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
146
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
147 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
148 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
149
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
150 // --------------------------------------------------------------------------------------------------------------------
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
151
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
152 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
153 * \brief Constructs an empty string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
154 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
155 inline String::String() {}
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
156
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
157 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
158 * \brief Constructs a string from a single character.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
159 * \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
160 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
161 inline String::String(char character)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
162 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
163 char buffer[2] = { character, '\0' };
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
164 m_string = buffer;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
167 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
168 * \brief Constructs a string from a char-array.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
169 * \param string char-array to convert.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
170 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
171 inline String::String(const char* string) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
172 m_string(string) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
173
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
174 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
175 * \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
176 * \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
177 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
178 inline String::String(const std::string& string) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
179 m_string(string) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
180
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
181 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
182 * \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
183 * \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
184 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
185 inline String::String(const Vector<char>& charVector) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
186 m_string(charVector.data(), charVector.size()) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
187
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
188 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
189 * \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
190 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
191 inline String::ConstIterator String::begin() const
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 return m_string.cbegin();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
196 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
197 * \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
198 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
199 inline const char* String::chars() const
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 return m_string.c_str();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
204 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
205 * \returns the string's constant end-iterator.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
206 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
207 inline String::ConstIterator String::end() 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.end();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
212 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
213 * \returns whether or not the string is empty.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
214 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
215 inline bool String::isEmpty() const
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 return m_string[0] == '\0';
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
220 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
221 * \returns the length of the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
222 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
223 inline int String::length() const
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 return m_string.length();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
228 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
229 * \returns the underlying \c std::string .
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
230 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
231 inline const std::string& String::stdString() const
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 return m_string;
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 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
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(const char* text)
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.append(text);
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 to the end of the 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(char character)
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.push_back(character);
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 * \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
256 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
257 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
258 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
259 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
260 m_string.append(text.chars());
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
263 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
264 * \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
265 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
266 inline String::Iterator String::begin()
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 return m_string.begin();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
269 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
270
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
271 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
272 * \brief Clears the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
273 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
274 inline void String::clear()
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
275 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
276 m_string.clear();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
277 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
278
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
279 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
280 * \returns the string's mutable end-iterator.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
281 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
282 inline String::Iterator String::end()
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 return m_string.end();
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
287 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
288 * \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
289 * \param a First index to compare
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
290 * \param b Second index to compare
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
291 * \returns the difference of two indices.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
292 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
293 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
294 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
295 modifyIndex(a);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
296 modifyIndex(b);
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
297 return b - a;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
300 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
301 * \brief Inserts a character into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
302 * \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
303 * \param character Character to insert into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
304 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
305 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
306 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
307 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
308 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
309
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
310 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
311 * \brief Inserts a substring into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
312 * \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
313 * \param string Substring to insert.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
314 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
315 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
316 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
317 m_string.insert(position, string);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
318 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
319
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
320 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
321 * \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
322 * 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
323 * -2 to the second last, etc.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
324 * \param index Index to translate.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
325 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
326 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
327 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
328 if (index < 0)
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
329 index = length() - index;
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 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
334 * \param text Text to prepend.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
335 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
336 inline void String::prepend(String text)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
337 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
338 m_string = (text + m_string).stdString();
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
339 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
340
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
341 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
342 * \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
343 * \param position Position where to start removing text.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
344 * \param length Amount of characters to remove.
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::remove(int position, int length)
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.replace(position, length, "");
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 single character from the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
353 * \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
354 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
355 inline void String::removeAt(int position)
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 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
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 end 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::removeFromEnd(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(this->length() - length, 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 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
371 * \param length Amount of characters to remove.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
372 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
373 inline void String::removeFromStart(int length)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
374 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
375 remove(0, length);
145
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
378 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
379 * \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
380 * \param position Position where to start replacing text.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
381 * \param amount Amount of characters to replace.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
382 * \param text Replacement string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
383 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
384 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
385 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
386 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
387 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
388
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
389 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
390 * \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
391 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
392 inline void String::shrinkToFit()
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
393 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
394 m_string.shrink_to_fit();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
395 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
396
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
397 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
398 * \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
399 * \param number Number to convert and append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
400 * \returns the resulting string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
401 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
402 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
403 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
404 return *this + String::fromNumber(number);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
405 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
406
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
407 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
408 * \brief Appends text into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
409 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
410 * \returns a reference to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
411 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
412 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
413 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
414 append(text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
415 return *this;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
418 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
419 * \brief Appends text into the string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
420 * \param text Text to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
421 * \returns a reference to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
422 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
423 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
424 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
425 append(text);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
426 return *this;
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
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
429 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
430 * \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
431 * \param number The number to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
432 * \returns a refence to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
433 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
434 inline String& String::operator+=(int number)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
435 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
436 return operator+=(String::fromNumber(number));
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
437 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
438
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
439 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
440 * \brief Appends a character into this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
441 * \param character The character to append.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
442 * \return a reference to this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
443 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
444 inline String& String::operator+=(char character)
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
445 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
446 append(character);
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
447 return *this;
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 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
453 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
454 inline char& String::operator[](int index)
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 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
461 * \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
462 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
463 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
464 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
465 return m_string[index];
145
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 String& 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 stdString() == other.stdString();
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 the same as 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 char* 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 m_string == other;
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 String& 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 stdString() != other.stdString();
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 * \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
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 char* 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 m_string != other;
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 greater 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 lesser than 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 least 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 * \param other String to compare with.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
533 * \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
534 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
535 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
536 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
537 return stdString() <= other.stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
538 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
539
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
540 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
541 * \returns a char-array representation of this string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
542 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
543 inline String::operator const char*() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
544 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
545 return chars();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
546 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
547
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
548 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
549 * \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
550 */
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
551 inline String::operator const std::string&() const
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
552 {
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
553 return stdString();
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
554 }
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
555
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
556 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
557 * \brief Constructs an empty string list.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
558 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
559 StringList::StringList() {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
560
146
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 * \brief Constructs a string list containing \c numvalues empty strings.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
563 * \param numvalues Amount of empty strings to fill.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
564 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
565 StringList::StringList(int numvalues) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
566 List<String>(numvalues) {}
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
567
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
568 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
569 * \brief Constructs a string list from another list of strings.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
570 * \param other The list of strings to use for construction.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
571 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
572 StringList::StringList(const List<String>& other) :
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
573 List<String>(other) {}
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
574
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
575 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
576 * \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
577 * with a \c String.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
578 * \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
579 * \param other A string to compare.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
580 * \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
581 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
582 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
583 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
584 return other == one;
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
585 }
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
586
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
587 /*!
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
588 * \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
589 * with a \c String.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
590 * \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
591 * \param other A string to catenate.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
592 * \returns the catenated string.
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
593 */
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
594 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
595 {
146
81357dcd3da4 Added doxygen documentation to mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 145
diff changeset
596 return String(one) + other;
1
4dd5bde4e777 - a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
597 }
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
598
145
d0aedc9be448 Renamed String methods, and reformatted mystring.h
Teemu Piippo <teemu@compsta2.com>
parents: 129
diff changeset
599
88
08ccaf26cffd Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents: 87
diff changeset
600 END_ZFC_NAMESPACE

mercurial