Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

oscl_string.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00003 
00004 //                               O S C L_ S T R I N G   C L A S S
00005 
00006 //        This file contains a standardized set of string containers that
00007 //        can be used in place of character arrays.
00008 
00009 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00010 
00025 #ifndef OSCL_STRING_H_INCLUDED
00026 #define OSCL_STRING_H_INCLUDED
00027 
00028 
00029 #ifndef OSCL_BASE_H_INCLUDED
00030 #include "oscl_base.h"
00031 #endif
00032 
00033 #ifndef OSCL_MEM_H_INCLUDED
00034 #include "oscl_mem.h"
00035 #endif
00036 
00041 class OSCL_String : public HeapBase
00042 
00043 {
00044     public:
00045         typedef char chartype;
00046 
00051         virtual uint32 get_size() const = 0;
00052 
00058         virtual uint32 get_maxsize() const = 0;
00059 
00063         virtual const chartype* get_cstr() const = 0;
00064 
00068         OSCL_IMPORT_REF virtual bool is_writable() const;
00069 
00074         virtual chartype* get_str() const = 0;
00075 
00078         OSCL_IMPORT_REF OSCL_String& operator=(const OSCL_String& src);
00079 
00083         OSCL_IMPORT_REF OSCL_String& operator=(const chartype* cstr);
00084 
00089         OSCL_IMPORT_REF OSCL_String& operator+=(const OSCL_String& src);
00090 
00096         OSCL_IMPORT_REF OSCL_String& operator+=(const chartype* cstr);
00097 
00102         OSCL_IMPORT_REF OSCL_String& operator+=(const chartype c);
00103 
00106         OSCL_IMPORT_REF bool operator== (const OSCL_String& src) const;
00107         OSCL_IMPORT_REF bool operator!= (const OSCL_String& src) const;
00108         OSCL_IMPORT_REF bool operator< (const OSCL_String& src) const;
00109         OSCL_IMPORT_REF bool operator<= (const OSCL_String& src) const;
00110         OSCL_IMPORT_REF bool operator> (const OSCL_String& src) const;
00111         OSCL_IMPORT_REF bool operator>= (const OSCL_String& src) const;
00112 
00116         OSCL_IMPORT_REF bool operator== (const chartype* cstr) const;
00117 
00124         OSCL_IMPORT_REF chartype operator[](uint32 index) const;
00125 
00131         OSCL_IMPORT_REF virtual chartype read(uint32 index)const;
00132 
00137         OSCL_IMPORT_REF virtual int8 hash() const;
00138 
00145         OSCL_IMPORT_REF virtual void write(uint32 index,chartype c);
00146 
00156         OSCL_IMPORT_REF virtual void write(uint32 offset, uint32 length, const chartype* buf);
00157 
00158 #ifdef T_ARM
00159 //ADS 1.2 compiler doesn't interpret "protected" correctly for templates.
00160 //so the constructor/destructor need to be public.
00161     public:
00162 #else
00163     protected:
00164 #endif
00165         OSCL_IMPORT_REF OSCL_String();
00166         OSCL_IMPORT_REF virtual ~OSCL_String();
00167 
00168     protected:
00175         virtual void set_rep(const chartype* cstr) = 0;
00176 
00181         virtual void append_rep(const chartype* cstr) = 0;
00182 
00185         virtual void set_rep(const OSCL_String& src) = 0;
00186 
00190         virtual void append_rep(const OSCL_String& src) = 0;
00191 
00195         virtual void set_len(uint32 len) = 0;
00196 };
00197 
00205 class OSCL_wString
00206 {
00207     public:
00208         typedef oscl_wchar chartype;
00209 
00210         virtual uint32 get_size() const = 0;
00211 
00212         virtual uint32 get_maxsize() const = 0;
00213 
00214         virtual const chartype* get_cstr() const = 0;
00215 
00216         OSCL_IMPORT_REF virtual bool is_writable() const;
00217 
00218         virtual chartype* get_str() const = 0;
00219 
00220         OSCL_IMPORT_REF OSCL_wString& operator=(const OSCL_wString& src);
00221         OSCL_IMPORT_REF OSCL_wString& operator=(const chartype* cstr);
00222 
00223         OSCL_IMPORT_REF OSCL_wString& operator+=(const OSCL_wString& src);
00224         OSCL_IMPORT_REF OSCL_wString& operator+=(const chartype* cstr);
00225         OSCL_IMPORT_REF OSCL_wString& operator+=(const chartype c);
00226 
00227         OSCL_IMPORT_REF bool operator== (const OSCL_wString& src) const;
00228         OSCL_IMPORT_REF bool operator!= (const OSCL_wString& src) const;
00229         OSCL_IMPORT_REF bool operator< (const OSCL_wString& src) const;
00230         OSCL_IMPORT_REF bool operator<= (const OSCL_wString& src) const;
00231         OSCL_IMPORT_REF bool operator> (const OSCL_wString& src) const;
00232         OSCL_IMPORT_REF bool operator>= (const OSCL_wString& src) const;
00233         OSCL_IMPORT_REF bool operator== (const chartype* cstr) const;
00234 
00235         OSCL_IMPORT_REF chartype operator[](uint32 index) const;
00236 
00237         OSCL_IMPORT_REF virtual chartype read(uint32 index)const;
00238 
00239         OSCL_IMPORT_REF virtual int8 hash() const;
00240 
00241         OSCL_IMPORT_REF virtual void write(uint32 index,chartype c);
00242         OSCL_IMPORT_REF virtual void write(uint32 offset, uint32 length, const chartype* buf);
00243 
00244 #ifdef T_ARM
00245 //ADS 1.2 compiler doesn't interpret "protected" correctly for templates.
00246 //so the constructor/destructor need to be public.
00247     public:
00248 #else
00249     protected:
00250 #endif
00251         OSCL_IMPORT_REF OSCL_wString();
00252         OSCL_IMPORT_REF virtual ~OSCL_wString();
00253 
00254     protected:
00255         virtual void set_rep(const chartype* cstr) = 0;
00256         virtual void append_rep(const chartype* cstr) = 0;
00257 
00258         virtual void set_rep(const OSCL_wString& src) = 0;
00259         virtual void append_rep(const OSCL_wString& src) = 0;
00260 
00261         virtual void set_len(uint32 len) = 0;
00262 };
00263 
00264 #endif   // OSCL_STRING_H_INCLUDED
00265 

OSCL API
Posting Version: OPENCORE_20090310