HPGCC3 Documentation 3.0 R003

gstring.h

Go to the documentation of this file.
00001 //& *** (c) 2006-2011 The HPGCC3 Team ***
00002 //& Claudio Lapilli
00003 //& Ingo Blank
00004 //&
00005 //& This file is licensed under the terms and conditions of the
00006 //& HPGCC3 license that is included with the source distribution.
00007 //& *** (c) 2006-2011 The HPGCC3 Team ***
00008 
00009 #ifndef GSTRING_H_
00010 #define GSTRING_H_
00011 
00012 #ifndef MEMBLOCK_H_
00013 #include <memblock.h>
00014 #endif
00015 
00016 class gFont;
00017 
00018 class gString : public MemBlock
00019 {
00020         
00021         virtual void vTable();
00022 public:
00023         
00024         
00025         inline int TextWidth(int Offset,gFont& f) { return TextWidth(Offset,-1,f); };
00026         int TextWidth(int Offset,int EndOffset,gFont& f);
00027         int PrevLine(int Offset);       // RETURN OFFSET OF START OF PREVIOUS LINE, OR -1 IF NO MORE LINES 
00028         int NextLine(int Offset);       // RETURN OFFSET OF START OF NEXT LINE, OR -1 IF NO MORE LINES
00029         int StartOfLine(int Offset);    // RETURN OFFSET OF START OF CURRENT LINE 
00030         int EndOfPrevLine(int Offset); // RETURN POINTER TO THE \n OR \r CHARACTER AT THE END OF PREVIOUS LINE
00031         int EndOfLine(int Offset); // RETURN OFFSET TO THE END OF CURRENT LINE
00032         int StartOfText() { return 0; };
00033         int EndOfText() { return TotalUsed-1; };
00034         int Strlen() { return TotalUsed-1; };
00035         int NumLines();
00036         int PrevWord(int Offset);
00037         int NextWord(int Offset);
00038         
00039         inline BOOL IsValidOffset(int Offset) { return ((Offset>=0) && (Offset<TotalUsed)); }
00040         inline char GetChar(int Offset) {
00041                 return ((Offset>=Current->Offset) && (Offset<Current->Offset+Current->Used))? Current->Data[Offset-Current->Offset] : (*GetPtr(Offset));
00042                 };
00043         
00044         void InsertChar(int offset,char a);
00045         void Delete(int offset);
00046                 
00047         gString();
00048         virtual ~gString();
00049 };
00050 
00051 #endif /*GSTRING_H_*/