Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

/home/tommi/tntdb/include/tntdb/bits/result.h

00001 /*
00002  * Copyright (C) 2005 Tommi Maekitalo
00003  * 
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  * 
00009  * As a special exception, you may use this file as part of a free
00010  * software library without restriction. Specifically, if other files
00011  * instantiate templates or use macros or inline functions from this
00012  * file, or you compile this file and link it with other files to
00013  * produce an executable, this file does not by itself cause the
00014  * resulting executable to be covered by the GNU General Public
00015  * License. This exception does not however invalidate any other
00016  * reasons why the executable file might be covered by the GNU Library
00017  * General Public License.
00018  * 
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Lesser General Public License for more details.
00023  * 
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this library; if not, write to the Free Software
00026  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00027  */
00028 
00029 #ifndef TNTDB_BITS_RESULT_H
00030 #define TNTDB_BITS_RESULT_H
00031 
00032 #include <cxxtools/smartptr.h>
00033 #include <tntdb/iface/iresult.h>
00034 
00035 namespace tntdb
00036 {
00037   class Row;
00038   class Value;
00039 
00045   class Result
00046   {
00047     public:
00048       typedef unsigned size_type;
00049       typedef Row value_type;
00050 
00051     private:
00052       cxxtools::SmartPtr<IResult> result;
00053 
00054     public:
00055       class const_iterator;
00056 
00057       Result()  { }
00058       Result(IResult* res)
00059         : result(res)
00060         { }
00061 
00065       Row getRow(size_type row_num) const;
00069       Value getValue(size_type row_num, size_type field_num) const;
00070 
00074       size_type size() const           { return result->size(); }
00078       bool empty() const               { return size() == 0; }
00082       size_type getFieldCount() const  { return result->getFieldCount(); }
00083 
00087       Row operator[] (size_type row_num) const;
00088 
00092       const_iterator begin() const;
00096       const_iterator end() const;
00097 
00101       bool operator!() const          { return !result; }
00105       const IResult* getImpl() const  { return &*result; }
00106   };
00107 }
00108 
00109 #endif // TNTDB_BITS_RESULT_H
00110 
Copyright © 2008 The Tntnet Development Team
Tntnet 1.6