id3lib 3.8.3

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

field.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: field.h,v 1.47 2002/07/02 22:10:26 t1mpy Exp $
3
4 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags
5 // Copyright 1999, 2000 Scott Thomas Haug
6
7 // This library is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU Library General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or (at your
10 // option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public License
18 // along with this library; if not, write to the Free Software Foundation,
19 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 // The id3lib authors encourage improvements and optimisations to be sent to
22 // the id3lib coordinator. Please see the README file for details on where to
23 // send such submissions. See the AUTHORS file for a list of people who have
24 // contributed to id3lib. See the ChangeLog file for a list of changes to
25 // id3lib. These files are distributed with id3lib at
26 // http://download.sourceforge.net/id3lib/
27
28 #ifndef _ID3LIB_FIELD_H_
29 #define _ID3LIB_FIELD_H_
30
31 #include "id3/globals.h" //has <stdlib.h> "id3/sized_types.h"
32
33 class ID3_Reader;
34 class ID3_Writer;
35
36 class ID3_CPP_EXPORT ID3_Field
37 {
38 public:
39 virtual void Clear() = 0;
40
41 virtual size_t Size() const = 0;
42 virtual size_t BinSize() const = 0;
43 virtual size_t GetNumTextItems() const = 0;
44
45 // integer field functions
46 virtual ID3_Field& operator= (uint32 val) = 0;
47 virtual void Set(uint32) = 0;
48 virtual uint32 Get() const = 0;
49
50 // ASCII string field functions
51 virtual ID3_Field& operator= (const char* s) = 0;
52 virtual size_t Set(const char*) = 0;
53 virtual size_t Get(char*, size_t) const = 0;
54 virtual size_t Get(char*, size_t, size_t) const = 0;
55 virtual const char* GetRawText() const = 0;
56 virtual const char* GetRawTextItem(size_t) const = 0;
57 virtual size_t Add(const char*) = 0;
58
59 // Unicode string field functions
60 virtual ID3_Field& operator= (const unicode_t* s) = 0;
61 virtual size_t Set(const unicode_t*) = 0;
62 virtual size_t Get(unicode_t *buffer, size_t) const = 0;
63 virtual size_t Get(unicode_t *buffer, size_t, size_t) const = 0;
64 virtual const unicode_t* GetRawUnicodeText() const = 0;
65 virtual const unicode_t* GetRawUnicodeTextItem(size_t) const = 0;
66 virtual size_t Add(const unicode_t*) = 0;
67
68 // binary field functions
69 virtual size_t Set(const uchar*, size_t) = 0;
70 virtual size_t Get(uchar*, size_t) const = 0;
71 virtual const uchar* GetRawBinary() const = 0;
72 virtual void FromFile(const char*) = 0;
73 virtual void ToFile(const char *sInfo) const = 0;
74
75 // miscelaneous functions
76 virtual ID3_Field& operator=( const ID3_Field & ) = 0;
77 virtual bool InScope(ID3_V2Spec spec) const = 0;
78
79 virtual ID3_FieldID GetID() const = 0;
80 virtual ID3_FieldType GetType() const = 0;
81 virtual bool SetEncoding(ID3_TextEnc enc) = 0;
82 virtual ID3_TextEnc GetEncoding() const = 0;
83 virtual bool IsEncodable() const = 0;
84
85 virtual void Render(ID3_Writer&) const = 0;
86 virtual bool Parse(ID3_Reader&) = 0;
87 virtual bool HasChanged() const = 0;
88
89 protected:
90 virtual ~ID3_Field() { };
91
92 // To prevent public instantiation, the constructor is made protected
93 ID3_Field() { };
94 };
95
96 class ID3_CPP_EXPORT ID3_FrameInfo
97 {
98
99 public:
100 ID3_FrameInfo() {};
101 ~ID3_FrameInfo() {};
102 char *ShortName(ID3_FrameID frameid);
103 char *LongName(ID3_FrameID frameid);
104 const char *Description(ID3_FrameID frameid);
105 int MaxFrameID();
106 int NumFields(ID3_FrameID frameid);
107 ID3_FieldType FieldType(ID3_FrameID frameid, int fieldnum);
108 size_t FieldSize(ID3_FrameID frameid, int fieldnum);
109 flags_t FieldFlags(ID3_FrameID frameid, int fieldnum);
110 };
111
112 #endif /* _ID3LIB_FIELD_H_ */
113
ID3_Field::~ID3_Field
virtual ~ID3_Field()
Definition: field.h:90
ID3_FrameInfo
Provides information about the frame and field types supported by id3lib.
Definition: field.h:96
flags_t
uint16 flags_t
Definition: globals.h:118
ID3_CPP_EXPORT
#define ID3_CPP_EXPORT
Definition: globals.h:79
ID3_FrameID
ID3_FrameID
Enumeration of the different types of frames recognized by id3lib.
Definition: globals.h:229
globals.h
uchar
unsigned char uchar
Definition: globals.h:114
ID3_FieldType
ID3_FieldType
Enumeration of the types of field types.
Definition: globals.h:351
ID3_Reader
Definition: reader.h:33
ID3_V2Spec
ID3_V2Spec
Definition: globals.h:161
ID3_TextEnc
ID3_TextEnc
Enumeration of the types of text encodings: ascii or unicode.
Definition: globals.h:137
ID3_FrameInfo::ID3_FrameInfo
ID3_FrameInfo()
Definition: field.h:100
ID3_FrameInfo::~ID3_FrameInfo
~ID3_FrameInfo()
Definition: field.h:101
ID3_Field
The representative class of an ID3v2 field.
Definition: field.h:36
ID3_Writer
Definition: writer.h:33
unicode_t
uint16 unicode_t
Definition: globals.h:117
ID3_Field::ID3_Field
ID3_Field()
Definition: field.h:93
ID3_FieldID
ID3_FieldID
Enumeration of the different types of fields in a frame.
Definition: globals.h:197