00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __CSIBCString_H__
00016 #define __CSIBCString_H__
00017
00018
00019
00020
00021 #include <SIBCUtil.h>
00022
00023
00024
00025
00026
00027
00029
00033 class XSICOREEXPORT CSIBCString
00034 {
00035 public:
00036
00040 CSIBCString();
00041
00046 CSIBCString( const CSIBCString &in_pString );
00047
00048
00054 CSIBCString(const SI_Char *in_pString );
00055
00056 ~CSIBCString();
00057
00061 SI_Int GetLength();
00062
00079 SI_Char *GetText();
00080
00083 void Clear();
00084
00093 SI_Error Concat(CSIBCString *in_pString);
00094
00104 SI_Error Concat(const SI_Char *in_pString);
00105
00126 SI_Error Concat(const SI_Int in_lInt);
00127
00146 SI_Error Concat(const SI_Float in_fFloat);
00147
00156 SI_Error SetText(CSIBCString *in_pString);
00157
00167 SI_Error SetText(const SI_Char *in_pString);
00168
00177 SI_Error SetText(const SI_Int in_lInt);
00178
00187 SI_Error SetText(const SI_Float in_fFloat);
00188
00203 SI_Int Compare(CSIBCString *in_pString);
00204
00219 SI_Int Compare(const SI_Char *in_pString);
00220
00228 SI_Int Compare(const SI_Int in_lInt);
00229
00237 SI_Int Compare(const SI_Float in_fFloat);
00238
00246 SI_Error LowerCase();
00247
00255 SI_Error UpperCase();
00256
00260 SI_Error RemoveIllegalXSICharacters();
00261
00265 SI_Bool IsXSILegalName();
00266
00267
00272 CSIBCString &operator = ( const CSIBCString & i_pString);
00273
00279 CSIBCString &operator = ( const SI_Char * i_pString);
00280
00285 bool operator == (CSIBCString & i_pString);
00286
00291 bool operator == (const SI_Char * i_pString);
00292
00297 bool operator != (CSIBCString & i_pString);
00298
00302 void Dump();
00303
00309 SI_UInt UsedMemory();
00310
00316 SI_UInt AllocatedMemory();
00317
00318 protected:
00319
00320
00321 private:
00322
00323 SI_Int m_lLength;
00324 SI_Char *m_pBuffer;
00325 };
00326
00327
00328
00329
00330
00332
00336 class XSICOREEXPORT CSIAccumString
00337 {
00338 enum {eAllocSize = 0x100};
00339 public:
00340
00345 CSIAccumString()
00346 {
00347 m_AllocSize = eAllocSize;
00348 m_Buffer = (SI_Char*) malloc(m_AllocSize);
00349 m_BufferEnd = m_Buffer;
00350 *m_BufferEnd = 0;
00351 }
00352
00353 ~CSIAccumString()
00354 {
00355 free( m_Buffer );
00356 }
00357
00361 void Clear()
00362 {
00363 free( m_Buffer );
00364 m_AllocSize = eAllocSize;
00365 m_Buffer = (SI_Char*) malloc(m_AllocSize);
00366 m_BufferEnd = m_Buffer;
00367 *m_BufferEnd = 0;
00368 }
00369
00373 void ConcatByte( SI_Byte in_Byte )
00374 {
00375 SI_Int l_iCurrDelta = (SI_Int)(m_BufferEnd - m_Buffer);
00376 if ( l_iCurrDelta > ( m_AllocSize - 2 ) )
00377 {
00378
00379 m_AllocSize <<= 1;
00380 m_Buffer = (SI_Char*) realloc(m_Buffer,m_AllocSize);
00381 m_BufferEnd = m_Buffer + l_iCurrDelta;
00382 }
00383 *m_BufferEnd = in_Byte;
00384 ++m_BufferEnd;
00385 *m_BufferEnd = 0;
00386 }
00387
00391 SI_Int GetLength() const { return (SI_Int)(m_BufferEnd - m_Buffer); }
00392
00398 SI_Char *GetText() const { return m_Buffer; }
00399
00400 private:
00401
00402
00403 CSIAccumString(const CSIAccumString&);
00404 const CSIAccumString& operator=( const CSIAccumString &);
00405
00406 SI_Char* m_Buffer;
00407 SI_Char* m_BufferEnd;
00408 SI_Int m_AllocSize;
00409 };
00410
00411 #endif
00412