Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIString.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIString.cpp
00003         created:        26/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Implements string class
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #include "CEGUIString.h"
00027 
00028 #include <iostream>
00029 
00030 // Start of CEGUI namespace section
00031 namespace CEGUI
00032 {
00033 
00034 // definition of 'no position' value
00035 const String::size_type String::npos = (String::size_type)(-1);
00036 
00037 
00038 
00040 // Comparison operators
00042 bool    operator==(const String& str1, const String& str2)
00043 {
00044         return (str1.compare(str2) == 0);
00045 }
00046 
00047 bool    operator==(const String& str, const std::string& std_str)
00048 {
00049         return (str.compare(std_str) == 0);
00050 }
00051 
00052 bool    operator==(const std::string& std_str, const String& str)
00053 {
00054         return (str.compare(std_str) == 0);
00055 }
00056 
00057 bool    operator==(const String& str, const utf8* utf8_str)
00058 {
00059         return (str.compare(utf8_str) == 0);
00060 }
00061 
00062 bool    operator==(const utf8* utf8_str, const String& str)
00063 {
00064         return (str.compare(utf8_str) == 0);
00065 }
00066 
00067 
00068 bool    operator!=(const String& str1, const String& str2)
00069 {
00070         return (str1.compare(str2) != 0);
00071 }
00072 
00073 bool    operator!=(const String& str, const std::string& std_str)
00074 {
00075         return (str.compare(std_str) != 0);
00076 }
00077 
00078 bool    operator!=(const std::string& std_str, const String& str)
00079 {
00080         return (str.compare(std_str) != 0);
00081 }
00082 
00083 bool    operator!=(const String& str, const utf8* utf8_str)
00084 {
00085         return (str.compare(utf8_str) != 0);
00086 }
00087 
00088 bool    operator!=(const utf8* utf8_str, const String& str)
00089 {
00090         return (str.compare(utf8_str) != 0);
00091 }
00092 
00093 
00094 bool    operator<(const String& str1, const String& str2)
00095 {
00096         return (str1.compare(str2) < 0);
00097 }
00098 
00099 bool    operator<(const String& str, const std::string& std_str)
00100 {
00101         return (str.compare(std_str) < 0);
00102 }
00103 
00104 bool    operator<(const std::string& std_str, const String& str)
00105 {
00106         return (str.compare(std_str) >= 0);
00107 }
00108 
00109 bool    operator<(const String& str, const utf8* utf8_str)
00110 {
00111         return (str.compare(utf8_str) < 0);
00112 }
00113 
00114 bool    operator<(const utf8* utf8_str, const String& str)
00115 {
00116         return (str.compare(utf8_str) >= 0);
00117 }
00118 
00119 
00120 bool    operator>(const String& str1, const String& str2)
00121 {
00122         return (str1.compare(str2) > 0);
00123 }
00124 
00125 bool    operator>(const String& str, const std::string& std_str)
00126 {
00127         return (str.compare(std_str) > 0);
00128 }
00129 
00130 bool    operator>(const std::string& std_str, const String& str)
00131 {
00132         return (str.compare(std_str) <= 0);
00133 }
00134 
00135 bool    operator>(const String& str, const utf8* utf8_str)
00136 {
00137         return (str.compare(utf8_str) > 0);
00138 }
00139 
00140 bool    operator>(const utf8* utf8_str, const String& str)
00141 {
00142         return (str.compare(utf8_str) <= 0);
00143 }
00144 
00145 
00146 bool    operator<=(const String& str1, const String& str2)
00147 {
00148         return (str1.compare(str2) <= 0);
00149 }
00150 
00151 bool    operator<=(const String& str, const std::string& std_str)
00152 {
00153         return (str.compare(std_str) <= 0);
00154 }
00155 
00156 bool    operator<=(const std::string& std_str, const String& str)
00157 {
00158         return (str.compare(std_str) >= 0);
00159 }
00160 
00161 bool    operator<=(const String& str, const utf8* utf8_str)
00162 {
00163         return (str.compare(utf8_str) <= 0);
00164 }
00165 
00166 bool    operator<=(const utf8* utf8_str, const String& str)
00167 {
00168         return (str.compare(utf8_str) >= 0);
00169 }
00170 
00171 
00172 bool    operator>=(const String& str1, const String& str2)
00173 {
00174         return (str1.compare(str2) >= 0);
00175 }
00176 
00177 bool    operator>=(const String& str, const std::string& std_str)
00178 {
00179         return (str.compare(std_str) >= 0);
00180 }
00181 
00182 bool    operator>=(const std::string& std_str, const String& str)
00183 {
00184         return (str.compare(std_str) <= 0);
00185 }
00186 
00187 bool    operator>=(const String& str, const utf8* utf8_str)
00188 {
00189         return (str.compare(utf8_str) >= 0);
00190 }
00191 
00192 bool    operator>=(const utf8* utf8_str, const String& str)
00193 {
00194         return (str.compare(utf8_str) <= 0);
00195 }
00196 
00198 // c-string operators
00200 bool operator==(const String& str, const char* c_str)
00201 {
00202         return (str.compare(c_str) == 0);
00203 }
00204 
00205 bool operator==(const char* c_str, const String& str)
00206 {
00207         return (str.compare(c_str) == 0);
00208 }
00209 
00210 bool operator!=(const String& str, const char* c_str)
00211 {
00212         return (str.compare(c_str) != 0);
00213 }
00214 
00215 bool operator!=(const char* c_str, const String& str)
00216 {
00217         return (str.compare(c_str) != 0);
00218 }
00219 
00220 bool operator<(const String& str, const char* c_str)
00221 {
00222         return (str.compare(c_str) < 0);
00223 }
00224 
00225 bool operator<(const char* c_str, const String& str)
00226 {
00227         return (str.compare(c_str) >= 0);
00228 }
00229 
00230 bool operator>(const String& str, const char* c_str)
00231 {
00232         return (str.compare(c_str) > 0);
00233 }
00234 
00235 bool operator>(const char* c_str, const String& str)
00236 {
00237         return (str.compare(c_str) <= 0);
00238 }
00239 
00240 bool operator<=(const String& str, const char* c_str)
00241 {
00242         return (str.compare(c_str) <= 0);
00243 }
00244 
00245 bool operator<=(const char* c_str, const String& str)
00246 {
00247         return (str.compare(c_str) >= 0);
00248 }
00249 
00250 bool operator>=(const String& str, const char* c_str)
00251 {
00252         return (str.compare(c_str) >= 0);
00253 }
00254 
00255 bool operator>=(const char* c_str, const String& str)
00256 {
00257         return (str.compare(c_str) <= 0);
00258 }
00259 
00261 // Concatenation operator functions
00263 String  operator+(const String str1, const String& str2)
00264 {
00265         String temp(str1);
00266         temp.append(str2);
00267         return temp;
00268 }
00269 
00270 String  operator+(const String str, const std::string& std_str)
00271 {
00272         String temp(str);
00273         temp.append(std_str);
00274         return temp;
00275 }
00276 
00277 String  operator+(const std::string& std_str, const String& str)
00278 {
00279         String temp(std_str);
00280         temp.append(str);
00281         return temp;
00282 }
00283 
00284 String  operator+(const String str, const utf8* utf8_str)
00285 {
00286         String temp(str);
00287         temp.append(utf8_str);
00288         return temp;
00289 }
00290 
00291 String  operator+(const utf8* utf8_str, const String& str)
00292 {
00293         String temp(utf8_str);
00294         temp.append(str);
00295         return temp;
00296 }
00297 
00298 String  operator+(const String str, utf32 code_point)
00299 {
00300         String temp(str);
00301         temp.append(1, code_point);
00302         return temp;
00303 }
00304 
00305 String  operator+(utf32 code_point, const String& str)
00306 {
00307         String temp(1, code_point);
00308         temp.append(str);
00309         return temp;
00310 }
00311 
00312 String operator+(const String str, const char* c_str)
00313 {
00314         String tmp(str);
00315         tmp.append(c_str);
00316         return tmp;
00317 }
00318 
00319 String operator+(const char* c_str, const String& str)
00320 {
00321         String tmp(c_str);
00322         tmp.append(str);
00323         return tmp;
00324 }
00325 
00327 // Output (stream) functions
00329 std::ostream& operator<<(std::ostream& s, const String& str)
00330 {
00331         return s << str.c_str();
00332 }
00333 
00335 // Modifying operations
00337 // swap the contents of str1 and str2
00338 void    swap(String& str1, String& str2)
00339 {
00340         str1.swap(str2);
00341 }
00342 
00343 
00344 } // End of  CEGUI namespace section

Generated on Wed Feb 16 12:41:07 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1