SFML logo
  • Main Page
  • Namespaces
  • Classes
  • Files
  • File List

String.hpp

00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_STRING_HPP
00026 #define SFML_STRING_HPP
00027 
00029 // Headers
00031 #include <SFML/Config.hpp>
00032 #include <locale>
00033 #include <string>
00034 
00035 
00036 namespace sf
00037 {
00043 class SFML_API String
00044 {
00045 public :
00046 
00048     // Types
00050     typedef std::basic_string<Uint32>::iterator       Iterator;      
00051     typedef std::basic_string<Uint32>::const_iterator ConstIterator; 
00052 
00054     // Static member data
00056     static const std::size_t InvalidPos; 
00057 
00064     String();
00065 
00076     String(char ansiChar);
00077 
00089     String(char ansiChar, const std::locale& locale);
00090 
00097     String(wchar_t wideChar);
00098 
00105     String(Uint32 utf32Char);
00106 
00117     String(const char* ansiString);
00118 
00129     String(const std::string& ansiString);
00130 
00142     String(const char* ansiString, const std::locale& locale);
00143 
00155     String(const std::string& ansiString, const std::locale& locale);
00156 
00163     String(const wchar_t* wideString);
00164 
00171     String(const std::wstring& wideString);
00172 
00179     String(const Uint32* utf32String);
00180 
00187     String(const std::basic_string<Uint32>& utf32String);
00188 
00195     String(const String& copy);
00196 
00212     operator std::string() const;
00213 
00227     operator std::wstring() const;
00228 
00243     std::string ToAnsiString() const;
00244 
00262     std::string ToAnsiString(const std::locale& locale) const;
00263 
00275     std::wstring ToWideString() const;
00276 
00285     String& operator =(const String& right);
00286 
00295     String& operator +=(const String& right);
00296 
00308     Uint32 operator [](std::size_t index) const;
00309 
00321     Uint32& operator [](std::size_t index);
00322 
00331     void Clear();
00332 
00341     std::size_t GetSize() const;
00342 
00351     bool IsEmpty() const;
00352 
00363     void Erase(std::size_t position, std::size_t count = 1);
00364 
00375     void Insert(std::size_t position, const String& str);
00376 
00389     std::size_t Find(const String& str, std::size_t start = 0) const;
00390 
00402     const Uint32* GetData() const;
00403 
00412     Iterator Begin();
00413 
00422     ConstIterator Begin() const;
00423 
00436     Iterator End();
00437 
00450     ConstIterator End() const;
00451 
00452 private :
00453 
00454     friend SFML_API bool operator ==(const String& left, const String& right);
00455     friend SFML_API bool operator <(const String& left, const String& right);
00456 
00458     // Member data
00460     std::basic_string<Uint32> myString; 
00461 };
00462 
00472 SFML_API bool operator ==(const String& left, const String& right);
00473 
00483 SFML_API bool operator !=(const String& left, const String& right);
00484 
00494 SFML_API bool operator <(const String& left, const String& right);
00495 
00505 SFML_API bool operator >(const String& left, const String& right);
00506 
00516 SFML_API bool operator <=(const String& left, const String& right);
00517 
00527 SFML_API bool operator >=(const String& left, const String& right);
00528 
00538 SFML_API String operator +(const String& left, const String& right);
00539 
00540 } // namespace sf
00541 
00542 
00543 #endif // SFML_STRING_HPP
00544 
00545 

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::