Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

include/id3/writer.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: writer.h,v 1.6 2001/07/30 18:22:53 abscess Exp $
00003 
00004 // id3lib: a software library for creating and manipulating id3v1/v2 tags
00005 // Copyright 1999, 2000  Scott Thomas Haug
00006 
00007 // This library is free software; you can redistribute it and/or modify it
00008 // under the terms of the GNU Library General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or (at your
00010 // option) any later version.
00011 //
00012 // This library is distributed in the hope that it will be useful, but WITHOUT
00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015 // License for more details.
00016 //
00017 // You should have received a copy of the GNU Library General Public License
00018 // along with this library; if not, write to the Free Software Foundation,
00019 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 
00021 // The id3lib authors encourage improvements and optimisations to be sent to
00022 // the id3lib coordinator.  Please see the README file for details on where to
00023 // send such submissions.  See the AUTHORS file for a list of people who have
00024 // contributed to id3lib.  See the ChangeLog file for a list of changes to
00025 // id3lib.  These files are distributed with id3lib at
00026 // http://download.sourceforge.net/id3lib/
00027 
00028 #ifndef _ID3LIB_WRITER_H_
00029 #define _ID3LIB_WRITER_H_
00030 
00031 #include <id3/globals.h>
00032 
00033 class ID3_CPP_EXPORT ID3_Writer
00034 {
00035  public:
00036   typedef uint32 size_type;
00037   typedef uint8  char_type;
00038   typedef uint32 pos_type;
00039   typedef  int32 off_type;
00040   typedef  int16 int_type;
00041   static const int_type END_OF_WRITER;
00042   
00044   virtual void close() = 0;
00045 
00047   virtual void flush() = 0;
00048 
00050   virtual pos_type getBeg() { return static_cast<pos_type>(0); }
00051 
00055   virtual pos_type getEnd() { return static_cast<pos_type>(-1); }
00056 
00058   virtual pos_type getCur() = 0;
00059 
00061   virtual size_type getSize() { return this->getCur() - this->getBeg(); }
00062 
00064   virtual size_type getMaxSize() { return this->getEnd() - this->getBeg(); }
00065 
00071   virtual int_type writeChar(char_type ch) 
00072   {
00073     if (this->atEnd())
00074     { 
00075       return END_OF_WRITER; 
00076     }
00077     this->writeChars(&ch, 1);
00078     return ch;
00079   }
00080 
00086   virtual size_type writeChars(const char_type buf[], size_type len) = 0;
00087   virtual size_type writeChars(const char buf[], size_type len)
00088   {
00089     return this->writeChars(reinterpret_cast<const char_type *>(buf), len);
00090   }
00091 
00092   virtual bool atEnd()
00093   {
00094     return this->getCur() >= this->getEnd();
00095   }
00096 };
00097 
00098 #endif /* _ID3LIB_WRITER_H_ */

Generated at Sat Sep 8 15:51:08 2001 for id3lib by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001