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

include/id3/tag.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: tag.h,v 1.53 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_TAG_H_
00029 #define _ID3LIB_TAG_H_
00030 
00031 #include <id3/frame.h>
00032 #include <id3/field.h>
00033 
00034 class ID3_Reader;
00035 class ID3_Writer;
00036 class ID3_TagImpl;
00037 class ID3_Tag;
00038 
00039 class ID3_CPP_EXPORT ID3_Tag
00040 {
00041   ID3_TagImpl* _impl;
00042 public:
00043 
00044   class Iterator
00045   {
00046   public:
00047     virtual ID3_Frame*       GetNext()       = 0;
00048   };
00049 
00050   class ConstIterator
00051   {
00052   public:
00053     virtual const ID3_Frame* GetNext()       = 0;
00054   };
00055 
00056 public:
00057 
00058   ID3_Tag(const char *name = NULL);
00059   ID3_Tag(const ID3_Tag &tag);
00060   virtual ~ID3_Tag();
00061   
00062   void       Clear();
00063   bool       HasChanged() const;
00064   size_t     Size() const;
00065   
00066   bool       SetUnsync(bool);
00067   bool       SetExtendedHeader(bool);
00068   bool       SetExperimental(bool);
00069   
00070   bool       GetUnsync() const;
00071   bool       GetExtendedHeader() const;
00072   bool       GetExperimental() const;
00073 
00074   bool       SetPadding(bool);
00075 
00076   void       AddFrame(const ID3_Frame&);
00077   void       AddFrame(const ID3_Frame*);
00078   void       AttachFrame(ID3_Frame*);
00079   ID3_Frame* RemoveFrame(const ID3_Frame *);
00080   
00081   size_t     Parse(const uchar*, size_t);
00082   bool       Parse(ID3_Reader& reader);
00083   size_t     Render(uchar*, ID3_TagType = ID3TT_ID3V2) const;
00084   size_t     Render(ID3_Writer&, ID3_TagType = ID3TT_ID3V2) const;
00085   
00086   size_t     Link(const char *fileInfo, flags_t = (flags_t) ID3TT_ALL);
00087   flags_t    Update(flags_t = (flags_t) ID3TT_ALL);
00088   flags_t    Strip(flags_t = (flags_t) ID3TT_ALL);
00089   
00090   size_t     GetPrependedBytes() const;
00091   size_t     GetAppendedBytes() const;
00092   size_t     GetFileSize() const;
00093   const char* GetFileName() const;
00094   
00095   ID3_Frame* Find(ID3_FrameID) const;
00096   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, uint32) const;
00097   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const char*) const;
00098   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const unicode_t*) const;
00099   
00100   size_t     NumFrames() const;
00101 
00102   Iterator*  CreateIterator();
00103   ConstIterator* CreateIterator() const;
00104 
00105   ID3_Tag&   operator=( const ID3_Tag & );
00106   
00107   bool       HasTagType(uint16 tt) const;
00108   ID3_V2Spec GetSpec() const;
00109   bool       SetSpec(ID3_V2Spec);
00110   
00111   static size_t IsV2Tag(const uchar*);
00112   static size_t IsV2Tag(ID3_Reader&);
00113   
00114   /* Deprecated! */
00115   void       AddNewFrame(ID3_Frame* f);
00116   size_t     Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3);
00117   void       SetCompression(bool);
00118   void       AddFrames(const ID3_Frame *, size_t);
00119   bool       HasLyrics() const;
00120   bool       HasV2Tag()  const;
00121   bool       HasV1Tag()  const;
00122   size_t     Parse(const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer);
00123   //ID3_Frame* operator[](index_t) const;
00124   //ID3_Frame* GetFrameNum(index_t) const;
00125 
00126   ID3_Tag&   operator<<(const ID3_Frame &);
00127   ID3_Tag&   operator<<(const ID3_Frame *);
00128 };
00129 
00130 // deprecated!
00131 int32 ID3_C_EXPORT ID3_IsTagHeader(const uchar header[ID3_TAGHEADERSIZE]);
00132 
00133 
00134 #endif /* _ID3LIB_TAG_H_ */

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