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.62 2002/11/02 17:35:56 t1mpy Exp $
00003 
00004 // id3lib: a software library for creating and manipulating id3v1/v2 tags
00005 // Copyright 1999, 2000  Scott Thomas Haug
00006 // Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
00007 
00008 // This library is free software; you can redistribute it and/or modify it
00009 // under the terms of the GNU Library General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or (at your
00011 // option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful, but WITHOUT
00014 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00016 // License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public License
00019 // along with this library; if not, write to the Free Software Foundation,
00020 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00021 
00022 // The id3lib authors encourage improvements and optimisations to be sent to
00023 // the id3lib coordinator.  Please see the README file for details on where to
00024 // send such submissions.  See the AUTHORS file for a list of people who have
00025 // contributed to id3lib.  See the ChangeLog file for a list of changes to
00026 // id3lib.  These files are distributed with id3lib at
00027 // http://download.sourceforge.net/id3lib/
00028 
00029 #ifndef _ID3LIB_TAG_H_
00030 #define _ID3LIB_TAG_H_
00031 
00032 #include <id3/id3lib_frame.h>
00033 #include <id3/field.h>
00034 
00035 class ID3_Reader;
00036 class ID3_Writer;
00037 class ID3_TagImpl;
00038 class ID3_Tag;
00039 
00040 class ID3_CPP_EXPORT ID3_Tag
00041 {
00042   ID3_TagImpl* _impl;
00043   char _tmp_filename[260];
00044 public:
00045 
00046   class Iterator
00047   {
00048   public:
00049     virtual ID3_Frame*       GetNext()       = 0;
00050   };
00051 
00052   class ConstIterator
00053   {
00054   public:
00055     virtual const ID3_Frame* GetNext()       = 0;
00056   };
00057 
00058 public:
00059 
00060   ID3_Tag(const char *name = NULL);
00061   ID3_Tag(const ID3_Tag &tag);
00062   virtual ~ID3_Tag();
00063 
00064   void       Clear();
00065   bool       HasChanged() const;
00066   size_t     Size() const;
00067 
00068   bool       SetUnsync(bool);
00069   bool       SetExtendedHeader(bool);
00070   bool       SetExperimental(bool);
00071 
00072   bool       GetUnsync() const;
00073   bool       GetExtendedHeader() const;
00074   bool       GetExperimental() const;
00075 
00076   bool       SetPadding(bool);
00077 
00078   void       AddFrame(const ID3_Frame&);
00079   void       AddFrame(const ID3_Frame*);
00080   bool       AttachFrame(ID3_Frame*);
00081   ID3_Frame* RemoveFrame(const ID3_Frame *);
00082 
00083   size_t     Parse(const uchar*, size_t);
00084   bool       Parse(ID3_Reader& reader);
00085   size_t     Render(uchar*, ID3_TagType = ID3TT_ID3V2) const;
00086   size_t     Render(ID3_Writer&, ID3_TagType = ID3TT_ID3V2) const;
00087 
00088   size_t     Link(const char *fileInfo, flags_t = (flags_t) ID3TT_ALL);
00089   size_t     Link(ID3_Reader &reader, flags_t = (flags_t) ID3TT_ALL);
00090   flags_t    Update(flags_t = (flags_t) ID3TT_ALL);
00091   flags_t    Strip(flags_t = (flags_t) ID3TT_ALL);
00092 
00093   size_t     GetPrependedBytes() const;
00094   size_t     GetAppendedBytes() const;
00095   size_t     GetFileSize() const;
00096   const char* GetFileName() const;
00097 
00098   ID3_Frame* Find(ID3_FrameID) const;
00099   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, uint32) const;
00100   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const char*) const;
00101   ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const unicode_t*) const;
00102 
00103   size_t     NumFrames() const;
00104 
00105   const Mp3_Headerinfo* GetMp3HeaderInfo() const;
00106 
00107   Iterator*  CreateIterator();
00108   ConstIterator* CreateIterator() const;
00109 
00110   ID3_Tag&   operator=( const ID3_Tag & );
00111 
00112   bool       HasTagType(ID3_TagType tt) const;
00113   ID3_V2Spec GetSpec() const;
00114   bool       SetSpec(ID3_V2Spec);
00115 
00116   static size_t IsV2Tag(const uchar*);
00117   static size_t IsV2Tag(ID3_Reader&);
00118 
00119   /* Deprecated! */
00120   void       AddNewFrame(ID3_Frame* f);
00121   size_t     Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3);
00122   void       SetCompression(bool);
00123   void       AddFrames(const ID3_Frame *, size_t);
00124   bool       HasLyrics() const;
00125   bool       HasV2Tag()  const;
00126   bool       HasV1Tag()  const;
00127   size_t     Parse(const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer);
00128   //ID3_Frame* operator[](size_t) const;
00129   //ID3_Frame* GetFrameNum(size_t) const;
00130 
00131   ID3_Tag&   operator<<(const ID3_Frame &);
00132   ID3_Tag&   operator<<(const ID3_Frame *);
00133 };
00134 
00135 // deprecated!
00136 int32 ID3_C_EXPORT ID3_IsTagHeader(const uchar header[ID3_TAGHEADERSIZE]);
00137 
00138 
00139 #endif /* _ID3LIB_TAG_H_ */
00140 

Generated on Fri Nov 29 06:01:53 2002 for id3lib by doxygen1.2.18