Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

MyString.h

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_MYSTRING_H
00024 #define INCLUDE_MYSTRING_H
00025 
00026 #include <windef.h>
00027 
00028 // pour gestion de manipulateur
00029 class MyString;
00030 typedef void (*FncManipulateur) (MyString&);
00031 
00046 class MyString
00047 {
00048         private:
00049                 void Delete();
00050                 BOOL Resize();
00051                 BOOL Resize(int newSize,BOOL recopy=FALSE);
00052 
00053         public:
00054                 MyString();
00055                 virtual ~MyString() { Delete(); }
00056 
00057                 BOOL IsEmpty() { return (size == 0)||(size==1&&value[0]=='\0'); } // \0 par default
00058 
00059                 MyString(char letter);
00060                 MyString(int integer);
00061                 MyString(long linteger);
00062                 MyString(float floating);
00063                 MyString(double lfloating);
00064                 MyString(char *string);
00065                 MyString(MyString &string);
00066 
00067                 void Zero() { *this='\0'; };
00068                 void operator+=(char letter);
00069                 void operator+=(int integer);
00070                 void operator+=(long linteger);
00071                 void operator+=(float floating);
00072                 void operator+=(double lfloating);
00073                 void operator+=(char *string);
00074                 void operator+=(MyString &string) { *this+=string.value; }
00075 
00076                 MyString & operator=(char letter);
00077                 MyString & operator=(int integer);
00078                 MyString & operator=(long linteger);
00079                 MyString & operator=(float floating);
00080                 MyString & operator=(double lfloating);
00081                 MyString & operator=(char *string);
00082                 MyString & operator=(MyString &string);
00083 
00084                 BOOL operator==(char letter);
00085                 BOOL operator==(int integer);
00086                 BOOL operator==(long linteger);
00087                 BOOL operator==(float floating);
00088                 BOOL operator==(double lfloating);
00089                 BOOL operator==(char *string);
00090                 BOOL operator==(MyString &string);
00091 
00092                 BOOL operator!=(char letter) { return !operator==(letter); };
00093                 BOOL operator!=(int integer) { return !operator==(integer); };
00094                 BOOL operator!=(long linteger) { return !operator==(linteger); };
00095                 BOOL operator!=(float floating) { return !operator==(floating); };
00096                 BOOL operator!=(double lfloating) { return !operator==(lfloating); };
00097                 BOOL operator!=(char *string) { return !operator==(string); };
00098                 BOOL operator!=(MyString &string) { return !operator==(string); };
00099 
00100                 BOOL AddFormat(char *format,...);
00101                 BOOL Format(char *format,...);
00102 
00103                 long    ToInteger();
00104                 float   ToFloat();
00105                 double  ToDouble();
00106 
00107                 friend MyString operator+(MyString &string,char letter);
00108                 friend MyString operator+(char letter,MyString &string);
00109 
00110                 friend MyString operator+(MyString &string,int integer);
00111                 friend MyString operator+(int integer,MyString &string);
00112 
00113                 friend MyString operator+(MyString &string,long linteger);
00114                 friend MyString operator+(long linteger,MyString &string);
00115 
00116                 friend MyString operator+(MyString &string,float floating);
00117                 friend MyString operator+(float floating,MyString &string);
00118 
00119                 friend MyString operator+(MyString &string,double lfloating);
00120                 friend MyString operator+(double lfloating,MyString &string);
00121 
00122                 friend MyString operator+(MyString &string1,char *string2);
00123                 friend MyString operator+(char *string1,MyString &string2);
00124 
00125                 friend MyString operator+(MyString &string1,MyString &string2);
00126 
00127                 char & operator [] (int num);
00128                 operator char *() const { return value; }
00129 
00130                 friend MyString & operator << (MyString& string , char letter);
00131                 friend MyString & operator << (MyString& string , int integer);
00132                 friend MyString & operator << (MyString& string , long linteger);
00133                 friend MyString & operator << (MyString& string , float floating);
00134                 friend MyString & operator << (MyString& string , double lfloating);
00135                 friend MyString & operator << (MyString& string1 , char *string2);
00136                 friend MyString & operator << (MyString& string1 , MyString &string2);
00137                 friend MyString & operator << (MyString& in ,FncManipulateur fnc);
00138 
00139                 void SplitPath(MyString *drive,MyString *dir,MyString *file,MyString *ext,MyString *driveDir,MyString *fileExt);
00140                 BOOL SubStringBeforToken(int numSubString,MyString &result,char *lstToken);
00141 
00142                 char * GetValue(int index);
00143                 BOOL CopyTo(MyString &result,int index,int size);
00144 
00145                 BOOL FormatToNoCtrl();
00146                 BOOL FormatToLower();
00147                 BOOL FormatToUpper();
00148 
00149                 void AddRepetitiveFormat(char *matrise,int nbCopy);
00150                 
00151                 BOOL IsVisibleText();
00152 
00153                 int GetPositionFromLeft(int pos);
00154                 int GetPositionFromRight(int pos);
00155 
00156                 BOOL Delete(int pos,BOOL after,char letterToFind);
00157                 BOOL Delete(int pos,BOOL after,int nbLetter);
00158 
00159                 BOOL Add(int pos,BOOL after,char letter);
00160                 BOOL Add(int pos,BOOL after,int integer);
00161                 BOOL Add(int pos,BOOL after,long linteger);
00162                 BOOL Add(int pos,BOOL after,float floating);
00163                 BOOL Add(int pos,BOOL after,double lfloating);
00164                 BOOL Add(int pos,BOOL after,char *string);
00165                 BOOL Add(int pos,BOOL after,MyString &string);
00166                 
00167                 int FindLetter(int pos,BOOL after,char letter);
00168                 int FindLetter(char letter);
00169                 MyString Mids(int beginPos,int sizeToCopy);
00170                 BOOL IsBeginWith(char *model);
00171                 char * TestSubString(char *text,BOOL caseSensitive=TRUE);
00172 
00173                 void EnterHexaNumber(int value);
00174                 void EnterBinNumber(int value);
00175                 void Reverse();
00176 
00177                 long GetSize();
00178                 char *GetValue();
00179 
00180         private:
00181                 char *value;
00182                 long size;
00183                 long allocSize;
00184 };
00185 
00186 // liste des manipulateurs
00187 void clear (MyString &in); // permet l'ecriture: myString<<clear<<"coucou";
00188 
00189 #endif

Generated on Fri Aug 20 19:19:48 2004 for 3d Controls by doxygen 1.3.6