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

include/id3/field.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: field.h,v 1.44 2001/08/07 11:58:23 shadrack Exp $
00003 
00004 // id3lib: a C++ 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_FIELD_H_
00029 #define _ID3LIB_FIELD_H_
00030 
00031 #include <id3/globals.h>
00032 
00033 class ID3_Reader;
00034 class ID3_Writer;
00035 
00036 class ID3_CPP_EXPORT ID3_Field
00037 {
00038 public:
00039   virtual void Clear() = 0;
00040 
00041   virtual size_t Size() const = 0;
00042   virtual size_t BinSize() const = 0;
00043   virtual size_t GetNumTextItems() const = 0;
00044 
00045   // integer field functions
00046   virtual ID3_Field&    operator= (uint32 val) = 0;
00047   virtual void          Set(uint32) = 0;
00048   virtual uint32        Get() const = 0;
00049 
00050   // ASCII string field functions
00051   virtual ID3_Field&    operator= (const char* s) = 0;
00052   virtual size_t        Set(const char*) = 0;
00053   virtual size_t        Get(char*, size_t) const = 0;
00054   virtual size_t        Get(char*, size_t, index_t) const = 0;
00055   virtual const char*   GetRawText() const = 0;
00056   virtual const char*   GetRawTextItem(index_t) const = 0;
00057   virtual size_t        Add(const char*) = 0;
00058 
00059   // Unicode string field functions
00060   virtual ID3_Field&    operator= (const unicode_t* s) = 0;
00061   virtual size_t        Set(const unicode_t*) = 0;
00062   virtual size_t        Get(unicode_t *buffer, size_t) const = 0;
00063   virtual size_t        Get(unicode_t *buffer, size_t, index_t) const = 0;
00064   virtual const unicode_t* GetRawUnicodeText() const = 0;
00065   virtual const unicode_t* GetRawUnicodeTextItem(index_t) const = 0;
00066   virtual size_t        Add(const unicode_t*) = 0;
00067 
00068   // binary field functions
00069   virtual size_t        Set(const uchar*, size_t) = 0;
00070   virtual size_t        Get(uchar*, size_t) const = 0;
00071   virtual const uchar*  GetRawBinary() const = 0;
00072   virtual void          FromFile(const char*) = 0;
00073   virtual void          ToFile(const char *sInfo) const = 0;
00074   
00075   // miscelaneous functions
00076   virtual ID3_Field&    operator=( const ID3_Field & ) = 0;
00077   virtual bool          InScope(ID3_V2Spec spec) const = 0;
00078 
00079   virtual ID3_FieldID   GetID() const = 0;
00080   virtual ID3_FieldType GetType() const = 0;
00081   virtual bool          SetEncoding(ID3_TextEnc enc) = 0;
00082   virtual ID3_TextEnc   GetEncoding() const = 0;
00083   virtual bool          IsEncodable() const = 0;
00084 
00085   virtual void          Render(ID3_Writer&) const = 0;
00086   virtual bool          Parse(ID3_Reader&) = 0;
00087   virtual bool          HasChanged() const = 0;
00088 
00089 protected:
00090   virtual ~ID3_Field() { };
00091 
00092   // To prevent public instantiation, the constructor is made protected
00093   ID3_Field() { };
00094 };
00095 
00096 class ID3_CPP_EXPORT ID3_FrameInfo
00097 {
00098 
00099 public:
00100   ID3_FrameInfo() {};
00101   ~ID3_FrameInfo() {};
00102   char *ShortName(ID3_FrameID frameid);
00103   char *LongName(ID3_FrameID frameid);
00104   const char *Description(ID3_FrameID frameid);
00105   int MaxFrameID();
00106   int NumFields(ID3_FrameID frameid);
00107   ID3_FieldType FieldType(ID3_FrameID frameid, int fieldnum);
00108   size_t FieldSize(ID3_FrameID frameid, int fieldnum);
00109   flags_t FieldFlags(ID3_FrameID frameid, int fieldnum);
00110 };
00111 
00112 #endif /* _ID3LIB_FIELD_H_ */

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