fbstring.h

Go to the documentation of this file.
00001 #ifndef __FBSTRING_H__
00002 #define __FBSTRING_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 
00045 #ifndef FBSDK_DLL
00046 
00049   #define FBSDK_DLL K_DLLIMPORT
00050 #endif
00051 
00052 #include <fbsdk/fbtypes.h>
00053 
00054 K_FORWARD( KStringList );
00055 
00056 #ifdef FBSDKUseNamespace
00057     namespace FBSDKNamespace {
00058 #endif
00059 
00061 // FBString
00063 
00066 class FBSDK_DLL FBString
00067 {
00068 private:
00069     char* mStr;
00070 
00071 public:
00073     FBString();
00074 
00078     FBString(const char* pStr);
00079 
00083     FBString(const FBString &pStr);
00084 
00089     FBString(const char* p1Str,const char* p2Str);
00090 
00092     ~FBString();
00093 
00095     operator char*() const;
00096     operator const char*() const;
00097 
00102     char  operator[](unsigned int pIndex) const;
00103 
00108     const FBString& operator=( const char* pStr );
00109 
00114     const FBString& operator=( const FBString &pStr );
00115 
00120     bool  operator == ( const FBString& pStr ) const;
00121     bool  operator == ( const char* pStr ) const;
00122     bool  operator == ( char* pStr ) const;
00123 
00128     bool  operator != ( const FBString& pStr ) const;
00129     bool  operator != ( const char* pStr ) const;
00130     bool  operator != ( char* pStr ) const;
00131 
00136     const FBString& operator+=( const char* pStr );
00137 
00142     FBString operator+( const char* pStr );
00143 
00148     FBString Mid( unsigned int pStart, unsigned int pLen ) const;
00149 
00154     FBString Left( unsigned int pLen ) const;
00155 
00160     FBString Right( unsigned int pLen ) const;
00161 
00165     unsigned int GetLen() const;
00166 
00170     bool IsEmpty() const;
00171 
00176     int Find( char pCar ) const;
00177 
00182     int ReverseFind( char pCar ) const;
00183 
00184 private:
00188     void Copy( const char* pStr );
00189 
00193     void Cat( const char* pStr );
00194 
00195     friend FBString operator+( const FBString& p1Str, const char* p2Str );
00196 };
00197 
00198 FBString operator+( const FBString& p1Str, const char* p2Str );
00199 
00201 class FBSDK_DLL FBStringList    // This class is a direct wrapper it cannot have virtual functions
00202 {
00203 protected:
00205     KStringList* mItems;    
00206 public:
00208     FBStringList(); 
00209 
00211     ~FBStringList();
00212 
00213 public:
00215     KStringList*    GetInternal();
00216 
00221     kReference  GetReferenceAt( int pIndex );
00222 
00227     void SetReferenceAt( int pIndex,kReference pRef );
00228 
00233     int Find( kReference pRef );
00234 
00239     int Find( char *S );
00240 
00245     char *GetAt( int pIndex );
00246 
00252     char *operator[](int pIndex);
00253 
00255     void Sort( );
00256 
00260     int GetCount();
00261 
00266     int Remove( char *S );
00267 
00271     char* AsString();
00272 
00276     bool SetString( char *pString );
00277 
00278 public:  // Needs to be overriden for special behaviors
00279 
00285     int  Add( char *S,kReference pRef = 0 );
00286 
00288     void Clear();
00289 
00293     void RemoveAt( int pIndex );
00294     
00299     int IndexOf( char *S );
00300     
00306     void InsertAt( int pIndex, char *S,kReference pRef = 0 );
00307 
00312     bool SetAt( int pIndex,char *pString );
00313 };
00314 
00316 // Global
00318 #ifdef FBSDKUseNamespace
00319     }
00320 #endif
00321 
00322 #endif
00323