PixelLightAPI  .
StringBufferASCII.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: StringBufferASCII.h                            *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_STRINGBUFFER_ASCII_H__
00024 #define __PLCORE_STRINGBUFFER_ASCII_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/String/StringBuffer.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Class that contains the buffer for a ASCII string
00046 */
00047 class StringBufferASCII : public StringBuffer {
00048 
00049 
00050     //[-------------------------------------------------------]
00051     //[ Friends                                               ]
00052     //[-------------------------------------------------------]
00053     friend class String;
00054     friend class StringBufferManager;
00055     friend class StringBufferUnicode;
00056     friend class StringBufferUTF8;
00057 
00058 
00059     //[-------------------------------------------------------]
00060     //[ Private functions                                     ]
00061     //[-------------------------------------------------------]
00062     private:
00063         /**
00064         *  @brief
00065         *    Constructor
00066         *
00067         *  @param[in] szString
00068         *    The string (this string buffer takes over the control)
00069         *  @param[in] nLength
00070         *    Length of the string buffer (excluding the terminating zero)
00071         *  @param[in] nMaxLength
00072         *    Maximum available length of the string buffer (excluding the terminating zero)
00073         */
00074         StringBufferASCII(char szString[], uint32 nLength, uint32 nMaxLength);
00075 
00076         /**
00077         *  @brief
00078         *    Constructor
00079         *
00080         *  @param[in] szString
00081         *    The string (converted to ASCII)
00082         *  @param[in] nLength
00083         *    Length of the string buffer (excluding the terminating zero)
00084         *  @param[in] nMaxLength
00085         *    Maximum available length of the string buffer (excluding the terminating zero)
00086         */
00087         StringBufferASCII(const wchar_t szString[], uint32 nLength, uint32 nMaxLength);
00088 
00089         /**
00090         *  @brief
00091         *    Destructor
00092         */
00093         virtual ~StringBufferASCII();
00094 
00095         /**
00096         *  @brief
00097         *    Sets the string
00098         *
00099         *  @param[in] szString
00100         *    The string
00101         *  @param[in] nLength
00102         *    Length of the string buffer (excluding the terminating zero)
00103         *
00104         *  @note
00105         *    - Makes the buffered unicode/UTF8 versions invalid
00106         */
00107         void SetString(char szString[], uint32 nLength);
00108 
00109         /**
00110         *  @brief
00111         *    Sets the new string length
00112         *
00113         *  @param[in] nLength
00114         *    Length of the string buffer (excluding the terminating zero)
00115         *
00116         *  @note
00117         *    - Makes the buffered unicode/UTF8 versions invalid
00118         */
00119         void SetNewStringLength(uint32 nLength);
00120 
00121         /**
00122         *  @brief
00123         *    Sets a character
00124         *
00125         *  @param[in] nCharacter
00126         *    Character to set
00127         */
00128         void SetCharacter(char nCharacter);
00129 
00130 
00131     //[-------------------------------------------------------]
00132     //[ Private data                                          ]
00133     //[-------------------------------------------------------]
00134     private:
00135         char                *m_pszString;   /**< The string itself (NEVER a null pointer!) */
00136         StringBufferUnicode *m_pUnicode;    /**< Unicode string buffer version of the current string (can be a null pointer) */
00137         StringBufferUTF8    *m_pUTF8;       /**< UTF8 string buffer version of the current string (can be a null pointer) */
00138 
00139 
00140     //[-------------------------------------------------------]
00141     //[ Public virtual StringBuffer functions                 ]
00142     //[-------------------------------------------------------]
00143     public:
00144         virtual uint32 GetFormat() const override;
00145         virtual StringBufferASCII *GetASCII() override;
00146         virtual StringBufferUnicode *GetUnicode() override;
00147         virtual StringBufferUTF8 *GetUTF8() override;
00148         virtual uint32 GetNumOfBytes() const override;
00149         virtual StringBuffer *Clone() const override;
00150         virtual StringBuffer *Duplicate() override;
00151         virtual bool IsLessThan(const char szString[], uint32 nLength) const override;
00152         virtual bool IsLessThan(const wchar_t szString[], uint32 nLength) const override;
00153         virtual bool IsGreaterThan(const char szString[], uint32 nLength) const override;
00154         virtual bool IsGreaterThan(const wchar_t szString[], uint32 nLength) const override;
00155         virtual bool Compare(const char szString[], uint32 nLength, uint32 nPos, uint32 nCount) const override;
00156         virtual bool Compare(const wchar_t szString[], uint32 nLength, uint32 nPos, uint32 nCount) const override;
00157         virtual bool CompareNoCase(const char szString[], uint32 nLength, uint32 nPos, uint32 nCount) const override;
00158         virtual bool CompareNoCase(const wchar_t szString[], uint32 nLength, uint32 nPos, uint32 nCount) const override;
00159         virtual bool IsAlphabetic() const override;
00160         virtual bool IsAlphaNumeric() const override;
00161         virtual bool IsNumeric() const override;
00162         virtual bool IsSubstring(const char szString[], uint32 nLength) const override;
00163         virtual bool IsSubstring(const wchar_t szString[], uint32 nLength) const override;
00164         virtual int IndexOf(const char szString[], uint32 nPos, uint32 nLength) const override;
00165         virtual int IndexOf(const wchar_t szString[], uint32 nPos, uint32 nLength) const override;
00166         virtual int LastIndexOf(const char szString[], int nPos, uint32 nLength) const override;
00167         virtual int LastIndexOf(const wchar_t szString[], int nPos, uint32 nLength) const override;
00168         virtual StringBuffer *GetSubstring(uint32 nPos, uint32 nCount) const override;
00169         virtual StringBuffer *ToLower() override;
00170         virtual StringBuffer *ToUpper() override;
00171         virtual StringBuffer *Delete(uint32 nPos, uint32 nCount) override;
00172         virtual StringBuffer *Append(const char szString[], uint32 nCount) override;
00173         virtual StringBuffer *Append(const wchar_t szString[], uint32 nCount) override;
00174         virtual StringBuffer *Insert(const char szString[], uint32 nPos, uint32 nCount) override;
00175         virtual StringBuffer *Insert(const wchar_t szString[], uint32 nPos, uint32 nCount) override;
00176         virtual StringBuffer *Replace(char nOld, char nNew, uint32 &nReplaced) override;
00177         virtual StringBuffer *Replace(wchar_t nOld, wchar_t nNew, uint32 &nReplaced) override;
00178         virtual StringBuffer *Replace(const char szOld[], uint32 nOldLength, const char szNew[], uint32 nNewLength, uint32 &nReplaced) override;
00179         virtual StringBuffer *Replace(const wchar_t szOld[], uint32 nOldLength, const wchar_t szNew[], uint32 nNewLength, uint32 &nReplaced) override;
00180         virtual StringBuffer *SetCharacter(uint32 nIndex, char nCharacter) override;
00181         virtual StringBuffer *SetCharacter(uint32 nIndex, wchar_t nCharacter) override;
00182         virtual StringBuffer *TrimLeading() override;
00183         virtual StringBuffer *TrimTrailing() override;
00184         virtual StringBuffer *RemoveLineEndings() override;
00185 
00186 
00187 };
00188 
00189 
00190 //[-------------------------------------------------------]
00191 //[ Namespace                                             ]
00192 //[-------------------------------------------------------]
00193 } // PLCore
00194 
00195 
00196 #endif // __PLCORE_STRINGBUFFER_ASCII_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:01
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported