MySQL++ Reference Manual

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# autoflag.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004
    00005 /***********************************************************************
    00006  Copyright (c) 2007 by Educational Technology Resources, Inc.
    00007  Others may also hold copyrights on code in this file.  See the
    00008  CREDITS.txt 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 #if !defined(MYSQLPP_AUTOFLAG_H)
    00029 #define MYSQLPP_AUTOFLAG_H
    00030
    00034
    00035 template <class T = bool>
    00036 class AutoFlag
    00037 {
    00038 public:
    00040         AutoFlag(T& ref) :
    00041         referent_(ref)
    00042         {
    00043                 referent_ = true;
    00044         }
    00045
    00047         ~AutoFlag()
    00048         {
    00049                 referent_ = false;
    00050         }
    00051
    00052 private:
    00053         T& referent_;
    00054 };
    00055
    00056 #endif // !defined(MYSQLPP_AUTOFLAG_H)
    00057