xsi_string.h
Go to the documentation of this file.

    00001 //*****************************************************************************
    00011 //*****************************************************************************
    00012
    00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
    00014 #pragma once
    00015 #endif
    00016
    00017 #ifndef __XSISTRING_H__
    00018 #define __XSISTRING_H__
    00019
    00020 #include "sicppsdk.h"
    00021 #include <stdlib.h>
    00022
    00023 namespace XSI {
    00024
    00025 class CStatus;
    00026 class CValue;
    00027 class CStringArray;
    00028
    00029 //*****************************************************************************
    00074 //*****************************************************************************
    00075
    00076 class SICPPSDKDECL CString
    00077 {
    00078 public:
    00080     CString();
    00081
    00083     virtual ~CString();
    00084
    00088     CString(const CString& in_str);
    00089
    00094     CString(const wchar_t * in_str );
    00095
    00101     CString(const wchar_t* in_str, ULONG in_nCount );
    00102
    00108     CString( const char* in_str );
    00109
    00115     CString(const char* in_str, ULONG in_nCount );
    00116
    00134     explicit CString( const CValue& in_val );
    00135
    00156     const wchar_t * GetWideString() const ;
    00157
    00182     const char* GetAsciiString() const ;
    00183
    00216     CStatus PutAsciiString(const char* in_pszStr);
    00217
    00222     ULONG Length() const ;
    00223
    00227     bool IsEmpty() const ;
    00228
    00231     void Clear() ;
    00232
    00237     CString& operator=(const CString& in_rhs) ;
    00238
    00243     CString& operator=(const wchar_t * in_rhs) ;
    00244
    00250     CString& operator=(const char* in_rhs) ;
    00251
    00257     bool operator==(const CString& in_refStr) const;
    00258
    00263     bool operator==(const wchar_t* in_pwstr) const;
    00264
    00270     bool operator==(const char* in_pstr) const;
    00271
    00288     bool IsEqualNoCase( const CString& in_rhs ) const ;
    00289
    00294     bool IsEqualNoCase( const wchar_t* in_pwstr ) const ;
    00295
    00302     bool IsEqualNoCase( const char* in_pstr ) const ;
    00303
    00310     CStringArray Split( const CString& in_strDel ) const;
    00311
    00317     bool operator!=(const CString& in_refStr) const;
    00318
    00324     bool operator!=(const wchar_t* in_pwstr) const;
    00325
    00332     bool operator!=(const char* in_pstr) const;
    00333
    00347     CString& operator+=(const CString& in_refStr);
    00348
    00353     CString& operator+=(const wchar_t* in_pwstr);
    00354
    00360     CString& operator+=(const char* in_pstr);
    00361
    00366     CString& operator+=(const wchar_t in_wchar);
    00367
    00373     CString& operator+=(const char in_char);
    00374
    00379     CString operator+(const CString& in_refStr) const;
    00380
    00385     CString operator+(const wchar_t* in_pwstr) const;
    00386
    00392     CString operator+(const char* in_pstr) const;
    00393
    00398     CString operator+(const wchar_t in_wchar) const;
    00399
    00405     CString operator+(const char in_char) const;
    00406
    00415     wchar_t operator [] (ULONG in_index) const;
    00416
    00426     char GetAt(ULONG in_index) const;
    00427
    00434     bool operator < ( const CString& in_str) const;
    00435
    00442     bool operator > ( const CString& in_str) const;
    00443
    00478     ULONG FindString( const CString& in_str, ULONG in_nOffset = 0 ) const;
    00479
    00512     ULONG ReverseFindString( const CString& in_str, ULONG in_nOffset = UINT_MAX ) const;
    00513
    00543     CString GetSubString( ULONG in_nOffset = 0, ULONG in_nCount = UINT_MAX ) const;
    00544
    00549     void Lower();
    00550
    00555     void Upper();
    00556
    00586     void TrimLeft( const CString& in_target = CString() );
    00587
    00617     void TrimRight( const CString& in_target = CString() );
    00618
    00619 private:
    00620
    00621     //*************************************************************************
    00626     //*************************************************************************
    00627     struct StringData
    00628     {
    00629         void * m_pImpl ;
    00630
    00632
    00636         wchar_t* m_pWDebugStr;
    00637         char* m_pDebugStr;
    00638     };
    00640     StringData* m_pData;
    00641 };
    00642
    00646 SICPPSDKDECL CString operator+( const wchar_t* in_pwstr, const CString& in_refStr ) ;
    00647
    00651 SICPPSDKDECL CString operator+( const wchar_t in_wchar, const CString& in_refStr ) ;
    00652
    00657 SICPPSDKDECL CString operator+( const char* in_pstr, const CString& in_refStr ) ;
    00658
    00663 SICPPSDKDECL CString operator+( const char in_char, const CString& in_refStr ) ;
    00664
    00665 //*************************************************************************
    00674 //*************************************************************************
    00675 class SICPPSDKDECL CStringArray
    00676 {
    00677 public:
    00683     CStringArray( LONG in_size=0);
    00684
    00688     CStringArray(const CStringArray& in_array );
    00689
    00691     ~CStringArray();
    00692
    00697     CStringArray& operator=( const CStringArray& in_array );
    00698
    00702     LONG GetCount() const;
    00703
    00708     CStatus Add( const CString& in_item );
    00709
    00713     CStatus Clear();
    00714
    00721     CStatus Resize( LONG in_size);
    00722
    00728     const CString& operator[]( LONG in_index ) const;
    00729
    00735     CString& operator[]( LONG in_index );
    00736
    00742     bool operator==(const CStringArray& in_array) const;
    00743
    00749     bool operator!=(const CStringArray& in_array) const;
    00750
    00751 private:
    00752     void* m_ptr;
    00753 };
    00754
    00755 };
    00756
    00757 #endif // __XSISTRING_H__