Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

FBwFieldList.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00006 //---------------------------------------------------------------------------
00007 
00008 #ifndef FBwFieldListH
00009 #define FBwFieldListH
00010 #include <vector>
00011 //---------------------------------------------------------------------------
00012 
00013 namespace fbwrap
00014 {
00015 
00016 // What are we using from standard libraries
00017 using std::string;
00018 using std::vector;
00019 
00020 // Avoid Circular dependencies
00021 class FBwDb;
00022 
00023 // ! A class for managing hiden order index in FieldLists
00024 class FieldListIndex
00025 {
00026     int nIdx;
00027 public:
00029 
00032     FieldListIndex(int idx=0)
00033     {
00034         nIdx=idx;
00035     }
00036     int Idx() const
00037     {
00038         return nIdx;
00039     }
00040 };
00041 
00042 //
00044 
00061 class FieldList
00062 {
00063     vector<FBwField *> fields;
00064     int nullSize;
00065     FBwDb *db;
00066     // The following members are used by << operator!!!!
00067     int aFldIdx;        
00068     int IncaFldIdx()    
00069     {
00070         int ant=aFldIdx;
00071         aFldIdx = ((aFldIdx == Count()-1)? 0 : aFldIdx+1);
00072         return ant;
00073     }
00075     friend FieldList &operator <<(FieldList &f,const string &s);
00077     friend FieldList &operator <<(FieldList &f,const char *s);
00079     friend FieldList &operator <<(FieldList &f,const FBwDate &d);
00081     friend FieldList &operator <<(FieldList &f,const FBwTime &t);
00083     friend FieldList &operator <<(FieldList &f,const FBwDateTime &dt);
00085     friend FieldList &operator <<(FieldList &f,int  i);
00087     friend FieldList &operator <<(FieldList &f,long long int  i);
00089     friend FieldList &operator <<(FieldList &f,double  d);
00091     //friend FieldList &operator <<(FieldList &f,long double  d);
00093     friend FieldList &operator <<(FieldList &f,const FieldListIndex &idx);
00094 public:
00096 
00099     FieldList(FBwDb *pdb) :
00100             fields(0)
00101     {
00102         nullSize=-1;
00103         db=pdb;
00104         aFldIdx=0;
00105     }
00106     void Add(FBwField *pfld);                   
00107     FBwField *FindField(int idx) const;         
00108     FBwField *FindField(string fname) const;    
00109     FBwField *operator[](int idx) const;        
00110     FBwField *operator[](string fldname) const; 
00111     void DestroyFields();               
00112     void CreateFrom(XSQLDA *xsql);      
00113 
00114     void CreateFrom(const FieldList &fl, int from=0, int to=-1);    
00116     void BindParams(XSQLDA *xsql);
00118     FBwField *CreateField(XSQLVAR &xv, int i);  
00120     void ConvertStoV();
00122     void ConvertVtoS();
00124     ~FieldList()
00125     {
00126         DestroyFields();
00127     }
00128     // state methods
00129     //
00130     bool IsEmpty()              
00131     {
00132         return fields.size()==0;
00133     }
00134     int Count() const           
00135     {
00136         return fields.size();
00137     }
00138     void SetDb(FBwDb *pdb)      
00139     {
00140         db=pdb;
00141     }
00142     FieldList &operator=(const FieldList &f);   
00143     void CopyByName(const FieldList &p);        
00144 
00145     void CopyByIdx(const FieldList &p,int tfrom, int sfrom, int to);
00146     void SetAllNull();                          
00147     void SetUnasigned();                        
00148     int ByteLen();                              
00149     void Write(char *p);                        
00150     void Read(char *p);                         
00151 };
00152 FieldList &operator ,(FieldList &List,FBwField *fld);
00153 FieldList &operator +(FieldList &List,FBwField *fld);
00154 
00155 //-------------------------------------------------------------------------
00156 }
00157 #endif

Generated on Fri Jan 31 08:30:01 2003 for fbwrap by doxygen1.2.17