00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00028 #ifndef _DBBASIC_H_
00029 #define _DBBASIC_H_
00030
00031 #include <list>
00032 #include <database>
00033
00034 namespace coco {
00035
00037
00042 class dbt_row : public std::list<vdbl::col_spec>
00043 {
00044 private:
00047 typedef std::list<vdbl::col_spec> _Base;
00048
00049 public:
00051 dbt_row() : _Base() {}
00054 template <class _TC>
00055 dbt_row(const std::string& nm, const _TC& cont) : _Base() { add(nm,cont); }
00058 template <class _TC>
00059 dbt_row(const char* nm, const _TC& cont) : _Base() { add(nm,cont); }
00060
00062 dbt_row(const dbt_row& dr) : _Base(dr) {}
00063
00065 ~dbt_row() {}
00066
00068 const _Base& row() const { return *(_Base*)this; }
00069
00071 _Base& row() { return *(_Base*)this; }
00072
00074 template < class _TC >
00075 void add(const std::string& nm, const _TC& cont);
00076
00078 template < class _TC >
00079 void add(const char* nm, const _TC& cont);
00080 };
00081
00082 template < class _TC >
00083 inline void dbt_row::add(const std::string& nm, const _TC& cont)
00084 {
00085 this->push_back(vdbl::col_spec(nm, vdbl::col(vdbl::typed_col<_TC>(cont))));
00086 }
00087
00088 template < class _TC >
00089 inline void dbt_row::add(const char* nm, const _TC& cont)
00090 {
00091 add(std::string(nm), cont);
00092 }
00093
00094 }
00095
00096 #endif // _DBBASIC_H