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 <string>
00032 #include <vector>
00033
00034 namespace mysqlpp {
00035
00036 #if !defined(DOXYGEN_IGNORE)
00037
00038 class MYSQLPP_EXPORT ResultBase;
00039 #endif
00040
00042 class FieldNames : public std::vector<std::string>
00043 {
00044 public:
00046 FieldNames() { }
00047
00049 FieldNames(const FieldNames& other) :
00050 std::vector<std::string>()
00051 {
00052 assign(other.begin(), other.end());
00053 }
00054
00056 FieldNames(const ResultBase* res) :
00057 std::vector<std::string>()
00058 {
00059 init(res);
00060 }
00061
00064 FieldNames(int i) :
00065 std::vector<std::string>(i)
00066 {
00067 }
00068
00070 FieldNames& operator =(const ResultBase* res)
00071 {
00072 init(res);
00073 return *this;
00074 }
00075
00077 FieldNames& operator =(int i)
00078 {
00079 insert(begin(), i, "");
00080 return *this;
00081 }
00082
00084 std::string& operator [](int i)
00085 {
00086 return at(i);
00087 }
00088
00091 const std::string& operator [](int i) const
00092 {
00093 return at(i);
00094 }
00095
00097 std::string& operator [](size_type i)
00098 {
00099 return at(i);
00100 }
00101
00104 const std::string& operator [](size_type i) const
00105 {
00106 return at(i);
00107 }
00108
00110 unsigned int operator [](const std::string& s) const;
00111
00112 private:
00113 void init(const ResultBase* res);
00114 };
00115
00116 }
00117
00118 #endif