TCWString.h

Go to the documentation of this file.
00001 //*******************************************************************************
00002 //
00003 // *******   ***   ***               *
00004 //    *     *     *                  *
00005 //    *    *      *                *****
00006 //    *    *       ***  *   *   **   *    **    ***
00007 //    *    *          *  * *   *     *   ****  * * *
00008 //    *     *         *   *      *   * * *     * * *
00009 //    *      ***   ***    *     **   **   **   *   *
00010 //                        *
00011 //*******************************************************************************
00012 // see http://sourceforge.net/projects/tcsystem/ for details.
00013 // Copyright (C) 2003 - 2008 Thomas Goessler. All Rights Reserved. 
00014 //*******************************************************************************
00015 //
00016 // TCSystem is the legal property of its developers.
00017 // Please refer to the COPYRIGHT file distributed with this source distribution.
00018 // 
00019 // This library is free software; you can redistribute it and/or             
00020 // modify it under the terms of the GNU Lesser General Public                
00021 // License as published by the Free Software Foundation; either              
00022 // version 2.1 of the License, or (at your option) any later version.        
00023 //                                                                           
00024 // This library is distributed in the hope that it will be useful,           
00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of            
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00027 // Lesser General Public License for more details.                           
00028 //                                                                           
00029 // You should have received a copy of the GNU Lesser General Public          
00030 // License along with this library; if not, write to the Free Software       
00031 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00032 //*******************************************************************************
00033 //  $Id: TCWString.h 847 2008-05-29 16:26:54Z the_____tiger $
00034 //*******************************************************************************
00035 #ifndef _TC_WSTRING_H_
00036 #define _TC_WSTRING_H_
00037 
00038 #ifdef UNICODE
00039 
00040 #include "TCTypes.h"
00041 
00042 #include <string>
00043 #include <vector>
00044 #include <cstdarg>
00045 
00046 namespace TC
00047 {
00063    namespace WString
00064    {
00065       TCBASE_API std::wstring ToString(const char* val);
00066       TCBASE_API std::string  ToString(const wchar_t* val);
00067       TCBASE_API std::wstring ToString(wchar_t val);
00068       TCBASE_API std::wstring ToString(bool val);
00069       TCBASE_API std::wstring ToString(uint64 val);
00070       TCBASE_API std::wstring ToString(uint32 val);
00071       TCBASE_API std::wstring ToString(uint16 val);
00072       TCBASE_API std::wstring ToString(uint8 val);
00073       TCBASE_API std::wstring ToString(sint64 val);
00074       TCBASE_API std::wstring ToString(sint32 val);
00075       TCBASE_API std::wstring ToString(sint16 val);
00076       TCBASE_API std::wstring ToString(sint8 val);
00077       TCBASE_API std::wstring ToString(float val);
00078       TCBASE_API std::wstring ToString(double val);
00079 
00080       TCBASE_API bool IsIntValue(const std::wstring& text);
00081       TCBASE_API bool IsFltValue(const std::wstring& text);
00082       TCBASE_API bool IsValue(const std::wstring& text);
00083 
00084       TCBASE_API bool  ToBool(const std::wstring& text);
00085 
00086       TCBASE_API uint64 ToUint64(const std::wstring& text);
00087       TCBASE_API uint32 ToUint32(const std::wstring& text);
00088       TCBASE_API uint16 ToUint16(const std::wstring& text);
00089       TCBASE_API uint8  ToUint8(const std::wstring& text);
00090 
00091       TCBASE_API sint64 ToSint64(const std::wstring& text);
00092       TCBASE_API sint32 ToSint32(const std::wstring& text);
00093       TCBASE_API sint16 ToSint16(const std::wstring& text);
00094       TCBASE_API sint8  ToSint8(const std::wstring& text);
00095 
00096       TCBASE_API double ToFlt64(const std::wstring& text);
00097       TCBASE_API float ToFlt32(const std::wstring& text);
00098 
00099       TCBASE_API bool Split(const std::wstring& text, const std::wstring& split,
00100                  std::wstring& text1, std::wstring& text2);
00101       TCBASE_API bool Split(const std::wstring& text, const std::wstring& split,
00102                  std::vector<std::wstring>& texts);
00103       TCBASE_API void Join(const std::vector<std::wstring>& texts, const std::wstring& split,
00104                 std::wstring& text);
00105 
00106       TCBASE_API std::wstring Replace(const std::wstring& text, wchar_t c1, wchar_t c2);
00107       TCBASE_API std::wstring Replace(const std::wstring& text, const std::wstring& text1, const std::wstring& text2);
00108       TCBASE_API std::wstring ToLower(const std::wstring& text);
00109       TCBASE_API std::wstring ToUpper(const std::wstring& text);
00110 
00111       TCBASE_API std::wstring DeleteBlanksAndTabs(const std::wstring& text);
00112       TCBASE_API std::wstring TrimmSpaces(const std::wstring& text);
00114       TCBASE_API std::wstring TrimmLeadingSpaces(const std::wstring& text);
00116       TCBASE_API std::wstring TrimmTrailingSpaces(const std::wstring& text);
00117 
00124       TCBASE_API sint32 StringICompare(const wchar_t* s1, const wchar_t* s2);
00132       TCBASE_API sint32 StringICompare(const wchar_t* s1, const wchar_t* s2, uint32 len_to_compare);
00133 
00134       TCBASE_API sint32 Snprintf(wchar_t* buffer, uint32 size_of_buf, const wchar_t*, ...);
00135       TCBASE_API sint32 VSnprintf(wchar_t* buffer, uint32 size_of_buf, const wchar_t*, va_list arguments);
00136       TCBASE_API std::wstring Print(const wchar_t* format, ...);
00137       TCBASE_API std::wstring VPrint(const wchar_t* format, va_list arguments);
00138 
00139    } // namespace WString
00140 
00145 } // namspace TC
00146 
00147 #endif // UNICODE
00148 
00149 #endif  // _TC_WSTRING_H_

Copyright (c) Thomas Goessler 2003 - 2008