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

# field_types.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004 /***********************************************************************
    00005  Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
    00006  MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
    00007  Others may also hold copyrights on code in this file.  See the CREDITS
    00008  file in the top directory of the distribution for details.
    00009
    00010  This file is part of MySQL++.
    00011
    00012  MySQL++ is free software; you can redistribute it and/or modify it
    00013  under the terms of the GNU Lesser General Public License as published
    00014  by the Free Software Foundation; either version 2.1 of the License, or
    00015  (at your option) any later version.
    00016
    00017  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
    00018  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00019  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
    00020  License for more details.
    00021
    00022  You should have received a copy of the GNU Lesser General Public
    00023  License along with MySQL++; if not, write to the Free Software
    00024  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00025  USA
    00026 ***********************************************************************/
    00027
    00028 #ifndef MYSQLPP_FIELD_TYPES_H
    00029 #define MYSQLPP_FIELD_TYPES_H
    00030
    00031 #include "type_info.h"
    00032
    00033 #include <vector>
    00034
    00035 namespace mysqlpp {
    00036
    00037 class ResUse;
    00038
    00040 class FieldTypes : public std::vector<mysql_type_info>
    00041 {
    00042 public:
    00044         FieldTypes() { }
    00045
    00047         FieldTypes(const ResUse* res)
    00048         {
    00049                 init(res);
    00050         }
    00051
    00053         FieldTypes(int i) :
    00054         std::vector<mysql_type_info>(i)
    00055         {
    00056         }
    00057
    00059         FieldTypes& operator =(const ResUse* res)
    00060         {
    00061                 init(res);
    00062                 return *this;
    00063         }
    00064
    00069         FieldTypes& operator =(int i)
    00070         {
    00071                 insert(begin(), i, mysql_type_info());
    00072                 return *this;
    00073         }
    00074
    00076         mysql_type_info& operator [](int i)
    00077         {
    00078                 return std::vector<mysql_type_info>::operator [](i);
    00079         }
    00080
    00083         const mysql_type_info& operator [](int i) const
    00084         {
    00085                 return std::vector<mysql_type_info>::operator [](i);
    00086         }
    00087
    00088 private:
    00089         MYSQLPP_EXPORT void init(const ResUse* res);
    00090 };
    00091
    00092 } // end namespace mysqlpp
    00093
    00094 #endif