Cupt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
file.hpp
Go to the documentation of this file.
00001 /**************************************************************************
00002 *   Copyright (C) 2010 by Eugene V. Lyubimkin                             *
00003 *                                                                         *
00004 *   This program is free software; you can redistribute it and/or modify  *
00005 *   it under the terms of the GNU General Public License                  *
00006 *   (version 3 or above) as published by the Free Software Foundation.    *
00007 *                                                                         *
00008 *   This program is distributed in the hope that it will be useful,       *
00009 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00010 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00011 *   GNU General Public License for more details.                          *
00012 *                                                                         *
00013 *   You should have received a copy of the GNU GPL                        *
00014 *   along with this program; if not, write to the                         *
00015 *   Free Software Foundation, Inc.,                                       *
00016 *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA               *
00017 **************************************************************************/
00018 #ifndef CUPT_FILE_SEEN
00019 #define CUPT_FILE_SEEN
00020 
00022 
00023 #include <functional>
00024 
00025 #include <cupt/common.hpp>
00026 
00027 namespace cupt {
00028 
00029 namespace internal {
00030 
00031 struct FileImpl;
00032 
00033 }
00034 
00036 class CUPT_API File
00037 {
00038     internal::FileImpl* __impl;
00039  public:
00041 
00052     File(const string& path, const char* mode, string& error);
00054     virtual ~File();
00056 
00067     File& rawGetLine(const char*& buffer, size_t& size);
00069 
00088     File& getLine(string& line);
00090 
00103     File& getRecord(string& record);
00105 
00111     File& getBlock(char* buffer, size_t& size);
00113 
00118     void getFile(string& block);
00120 
00123     void put(const string& data);
00125 
00129     void put(const char* data, size_t size);
00131     void unbufferedPut(const char* data, size_t size);
00133 
00134 
00136     bool eof() const;
00138 
00144     void seek(size_t newPosition);
00146     size_t tell() const;
00147 
00149 
00152     void lock(int flags);
00153 };
00154 
00155 } // namespace
00156 
00157 #endif
00158 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator