Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCFile.h

00001 #if !defined(__MCFILE_H_)
00002 #define __MCFILE_H_
00003 
00004 #ident "@(#)$Id: MCFile.h,v 1.4 2004/12/02 07:05:20 mike Exp $"
00005 
00006 /*
00007  * Copyright Miba Consulting Ltd. (c) 2000-2003
00008  * 
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  * 
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * Lesser General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00022  *
00023  */
00024 
00025 #include "mcllib/MCIOBase.h"
00026 #include "mcllib/MCDirEntry.h"
00027 #include <stdarg.h>
00028 
00029 namespace mcllib
00030 {
00038     class MCFile : public MCIOBase, public MCDirEntry
00039     {
00040     public:
00044         static const mcintn MCRDONLY;
00048         static const mcintn MCWRONLY;
00053         static const mcintn MCRDWR;
00058         static const mcintn MCCREATE;
00064         static const mcintn MCAPPEND;
00069         static const mcintn MCTRUNC;
00074         static const mcintn MCSYNC;
00078         static const mcintn MCEXCL;
00083         static const mcintn MCMAKE;
00089         static const mcintn MCMAKEEMPTY;
00090 
00094         enum ESeekWhence {
00096             MCSEEKSTART = 0,
00098             MCSEEKCUR = 1,
00100             MCSEEKEND = 2
00101         };
00105         enum EStdHandle {
00107             MCSTDIN = 0,
00109             MCSTDOUT = 1,
00111             MCSTDERR = 2
00112         };
00117         MCFile();
00123         MCFile(EStdHandle hdl);
00129         MCFile(const MCString& name);
00134         ~MCFile();
00147         void open(mcintn flags, mcintn mode = 0666);
00156         mcint64 seek(mcint64 offset, ESeekWhence whence);
00164         mcintn printf(const char* fmt, ...);
00173         mcintn print(const char* fmt, ...);
00182         mcintn vprintf(const char* fmt, va_list ap);
00191         mcintn vprint(const char* fmt, va_list ap);
00197         void sync();
00202         bool isStdHandle();
00203     };
00204 
00205     // To fprintf to a file, create an MCFile object then call the printf member function
00206     // These functions are for convenience to printf to the standard handles only
00208     mcintn mcprintf(const char* fmt, ...);
00210     mcintn mcvprintf(const char* fmt, va_list ap);
00212     mcintn mcprintf(MCFile::EStdHandle hdl, const char* fmt, ...);
00214     mcintn mcprint(MCFile::EStdHandle hdl, const char* fmt, ...);
00216     mcintn mcvprintf(MCFile::EStdHandle hdl, const char* fmt, va_list ap);
00218     mcintn mcvprint(MCFile::EStdHandle hdl, const char* fmt, va_list ap);
00219 
00220 };
00221 
00222 
00223 #endif

Generated on Wed Jan 12 19:05:48 2005 for MCLLIB by  doxygen 1.3.9.1