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

field_names.h

Go to the documentation of this file.
00001 #ifndef MYSQLPP_FIELD_NAMES_H
00002 #define MYSQLPP_FIELD_NAMES_H
00003 
00006 
00007 #include "coldata.h"
00008 #include "string_util.h"
00009 
00010 #include <algorithm>
00011 #include <vector>
00012 
00013 namespace mysqlpp {
00014 
00015 class ResUse;
00016 
00018 class FieldNames : public std::vector<std::string> {
00019 private:
00020   void init (const ResUse *res);
00021 public:
00022   FieldNames () {}
00023   FieldNames (const ResUse *res) {init(res);}
00024   FieldNames (int i) : std::vector<std::string>(i) {}
00025 
00027   FieldNames& operator = (const ResUse *res) {init(res); return *this;}  
00028 
00030   FieldNames& operator = (int i) {insert(begin(), i, ""); return *this;} 
00031   
00033   std::string& operator [] (int i)
00034   {
00035         return std::vector<std::string>::operator [] (i);
00036   }
00037   const std::string& operator [] (int i) const
00038   {
00039         return std::vector<std::string>::operator [] (i);
00040   }
00041 
00043   uint operator [] (std::string i) const
00044   {
00045           std::string temp(i); str_to_lwr(temp);
00046           return uint(std::find(begin(),end(), temp) - begin());
00047   }
00048 };
00049 
00050 } // end namespace mysqlpp
00051 
00052 #endif
00053 

Generated on Thu May 5 05:30:43 2005 for MySQL++ by doxygen1.2.18