00001 /* 00002 ot_lib - Object Type Library 00003 Copyright (C) 2002 Alessandro Bonfanti 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 Alessandro Bonfanti 00020 xjbon@tin.it 00021 */ 00022 00023 00024 #ifndef OT_RAW_DATA_H 00025 #define OT_RAW_DATA_H 00026 00027 // ----------------------------------------------------------------------------------- 00029 00030 // ----------------------------------------------------------------------------------- 00031 00032 class ot_rawData : public ot_obj 00033 { 00034 private: 00035 00037 char *m_data; 00038 int m_size; 00039 00040 public: 00041 00042 // ######################################### 00043 // CONSTRUCTORS & DESTRUCTOR 00044 // ######################################### 00045 00049 ot_rawData(const char *data=0,int size=0); 00050 00052 ot_rawData(const ot_rawData &c); 00053 00055 virtual ~ot_rawData(void); 00056 00057 00058 // ######################################### 00059 // IMPLEMENTATIONS OF THE VIRTUAL FUNCTIONS 00060 // ######################################### 00061 00063 ot_obj *dup(void) const; 00064 00068 void asXml(ostream &s=cout,int i=0) const; 00069 00072 bool asData(ostream &s) const; 00073 00074 00075 // ######################################### 00076 // PROPIETARY FUNCTIONS 00077 // ######################################### 00078 00081 const char * get(void) const; 00082 00085 bool get(int pos,char &data) const; 00086 00087 00088 // ######################################### 00089 // MATH OPERATOR 00090 // ######################################### 00091 00093 const ot_rawData & operator= (const ot_rawData &c); 00094 00096 bool operator == (const ot_rawData &v) const; 00097 00099 bool operator != (const ot_rawData &v) const; 00100 00102 bool operator == (const ot_obj *o) const 00103 { 00104 if(o && o->getType()==getType()) return(*this==*((ot_rawData *) o)); 00105 else return(false); 00106 } 00107 00108 00110 void operator += (const ot_rawData &c); 00111 00113 const ot_rawData operator + (const ot_rawData &c) const; 00114 00115 /* 00117 template <class X> void operator += (X x); 00118 00120 template <class X> void operator << (X x); 00121 */ 00122 }; 00123 00124 #endif