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
00026
00027
00028 #ifndef MYSQLPP_FIELD_NAMES_H
00029 #define MYSQLPP_FIELD_NAMES_H
00030
00031 #include "coldata.h"
00032 #include "string_util.h"
00033
00034 #include <algorithm>
00035 #include <vector>
00036
00037 namespace mysqlpp {
00038
00039 class ResUse;
00040
00042 class FieldNames : public std::vector<std::string>
00043 {
00044 public:
00046 FieldNames() { }
00047
00049 FieldNames(const ResUse* res)
00050 {
00051 init(res);
00052 }
00053
00056 FieldNames(int i) :
00057 std::vector<std::string>(i)
00058 {
00059 }
00060
00062 FieldNames& operator =(const ResUse* res)
00063 {
00064 init(res);
00065 return *this;
00066 }
00067
00069 FieldNames& operator =(int i)
00070 {
00071 insert(begin(), i, "");
00072 return *this;
00073 }
00074
00076 std::string& operator [](int i)
00077 {
00078 return at(i);
00079 }
00080
00083 const std::string& operator [](int i) const
00084 {
00085 return at(i);
00086 }
00087
00089 uint operator [](std::string i) const
00090 {
00091 std::string temp(i);
00092 str_to_lwr(temp);
00093 return uint(std::find(begin(), end(), temp) - begin());
00094 }
00095
00096 private:
00097 MYSQLPP_EXPORT void init(const ResUse* res);
00098 };
00099
00100 }
00101
00102 #endif