00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // Created on Mon Mar 30 09:54:57 PST 1998 by heydon 00020 // Last modified on Tue Aug 3 14:17:40 EDT 2004 by ken@xorian.net 00021 // modified on Mon Mar 30 15:01:50 PST 1998 by heydon 00022 00023 #ifndef _TEXT_IO_H 00024 #define _TEXT_IO_H 00025 00026 /* Defines functions for reading and writing texts from/to files 00027 and logs. */ 00028 00029 #include <Basics.H> 00030 #include <FS.H> 00031 #include <SRPC.H> 00032 #include <VestaLog.H> 00033 #include <Recovery.H> 00034 00035 class TextIO { 00036 public: 00037 // log/recover 00038 static void Log(VestaLog &log, const Text &t) throw (VestaLog::Error); 00039 static void Recover(RecoveryReader &rd, /*OUT*/ Text &t) 00040 throw (VestaLog::Error, VestaLog::Eof); 00041 00042 // write/read 00043 static void Write(std::ostream &ofs, const Text &t) throw (FS::Failure); 00044 static void Read(std::istream &ifs, /*OUT*/ Text &t) 00045 throw (FS::Failure, FS::EndOfFile); 00046 00047 // send/receive 00048 // Use SRCP::send_Text and SRPC::recv_text 00049 00050 static int Skip(std::istream &ifs) throw (FS::Failure, FS::EndOfFile); 00051 /* Assuming "ifs" is positioned at a text written by "Write", skip 00052 the text and return the number of bytes skipped. */ 00053 }; 00054 00055 #endif // _TEXT_IO_H