fbsdk/fbstring.h Source File
 
 
 
fbsdk/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 
00214         FBStringList( const char *pString, const char pSeparator = '~');
00215 
00217         FBStringList(const FBStringList& pOther);       
00218 
00223     FBStringList& operator=     (const FBStringList& pOther);
00224 
00226         ~FBStringList();
00227 
00228 public:
00230         KStringList*    GetInternal() const;
00231 
00236         kReference  GetReferenceAt( int pIndex ) const;
00237 
00242     void SetReferenceAt( int pIndex,kReference pRef );
00243 
00248         int     Find( kReference pRef ) const;
00249 
00256         int     Find( const char *pString, bool pCaseSensitive = true, bool pStartWith = false ) const;
00257 
00262         const char *GetAt( int pIndex ) const;
00263 
00269     const char *operator[](int pIndex) const;
00270 
00272         void Sort( );
00273 
00277         int GetCount() const;
00278 
00283         int     Remove( const char *S );
00284 
00289         const char* AsString(const char pSeparator = '~') const;
00290 
00295         bool SetString( const char *pString, const char pSeparator = '~');
00296 
00302         int      Add( const char *S,kReference pRef = 0 );
00303 
00305     void Clear();
00306 
00310     void RemoveAt( int pIndex );
00311         
00316     int IndexOf( const char *S ) const;
00317         
00323     void InsertAt( int pIndex, const char *S,kReference pRef = 0 );
00324 
00329         bool SetAt( int pIndex,const char *pString );
00330 };
00331 
00333 // Global
00335 #ifdef FBSDKUseNamespace
00336         }
00337 #endif
00338 
00339 #endif
00340