#include <field_impl.h>
Inheritance diagram for ID3_FieldImpl:
Public Member Functions | |
~ID3_FieldImpl () | |
void | Clear () |
Clears any data and frees any memory associated with the field. | |
size_t | Size () const |
Returns the size of a field. | |
size_t | BinSize () const |
size_t | GetNumTextItems () const |
Returns the number of items in a text list. | |
ID3_Field & | operator= (uint32 val) |
A shortcut for the Set method. | |
void | Set (uint32) |
Sets the value of the field to the specified integer. | |
uint32 | Get () const |
Returns the value of the integer field. | |
void | SetInteger (uint32) |
uint32 | GetInteger () const |
ID3_Field & | operator= (const char *s) |
Shortcut for the Set operator. | |
size_t | Set (const char *data) |
Copies the supplied string to the field. | |
size_t | Get (char *, size_t) const |
Copies the contents of the field into the supplied buffer, up to the number of characters specified; for fields with multiple entries, the optional third parameter indicates which of the fields to retrieve. | |
size_t | Get (char *, size_t, size_t) const |
const char * | GetRawText () const |
const char * | GetRawTextItem (size_t) const |
size_t | Add (const char *data) |
dami::String | GetText () const |
dami::String | GetTextItem (size_t) const |
size_t | SetText (dami::String) |
size_t | AddText (dami::String) |
ID3_Field & | operator= (const unicode_t *s) |
Shortcut for the Set operator. | |
size_t | Set (const unicode_t *) |
Copies the supplied unicode string to the field. | |
size_t | Get (unicode_t *buffer, size_t) const |
Copies the contents of the field into the supplied buffer, up to the number of characters specified; for fields with multiple entries, the optional third parameter indicates which of the fields to retrieve. | |
size_t | Get (unicode_t *buffer, size_t, size_t) const |
size_t | Add (const unicode_t *) |
const unicode_t * | GetRawUnicodeText () const |
const unicode_t * | GetRawUnicodeTextItem (size_t) const |
size_t | Set (const uchar *buf, size_t size) |
size_t | Set (const char *buf, size_t size) |
size_t | Get (uchar *, size_t) const |
Copies the field's internal string to the buffer. | |
const uchar * | GetRawBinary () const |
void | FromFile (const char *) |
Copies binary data from the file specified to the field. | |
void | ToFile (const char *sInfo) const |
Copies binary data from the field to the specified file. | |
size_t | SetBinary (dami::BString) |
dami::BString | GetBinary () const |
ID3_Field & | operator= (const ID3_Field &) |
bool | InScope (ID3_V2Spec spec) const |
ID3_FieldID | GetID () const |
ID3_FieldType | GetType () const |
bool | SetEncoding (ID3_TextEnc enc) |
ID3_TextEnc | GetEncoding () const |
bool | IsEncodable () const |
void | Render (ID3_Writer &) const |
bool | Parse (ID3_Reader &) |
bool | HasChanged () const |
Protected Member Functions | |
void | RenderInteger (ID3_Writer &) const |
void | RenderText (ID3_Writer &) const |
void | RenderBinary (ID3_Writer &) const |
bool | ParseInteger (ID3_Reader &) |
bool | ParseText (ID3_Reader &) |
bool | ParseBinary (ID3_Reader &) |
Friends | |
class | ID3_FrameImpl |
Definition at line 40 of file field_impl.h.
void ID3_FieldImpl::Clear | ( | ) | [virtual] |
Clears any data and frees any memory associated with the field.
Implements ID3_Field.
Definition at line 923 of file field.cpp.
References ID3FTY_BINARY, ID3FTY_INTEGER, ID3FTY_TEXTSTRING, ID3TE_ASCII, and ID3TE_UNICODE.
Referenced by ParseText().
size_t ID3_FieldImpl::Size | ( | ) | const [virtual] |
Returns the size of a field.
The value returned is dependent on the type of the field. For ASCII strings, this returns the number of characters in the field, not including any NULL-terminator. The same holds true for Unicode---it returns the number of characters in the field, not bytes, and this does not include the Unicode BOM, which isn't put in a Unicode string obtained by the Get(unicode_t*, size_t, size_t) method anyway. For binary and integer fields, this returns the number of bytes in the field.
size_t howBig = myFrame.GetField(ID3FN_DATA)->Size();
Implements ID3_Field.
Definition at line 1018 of file field.cpp.
References ID3FTY_INTEGER, and ID3FTY_TEXTSTRING.
Referenced by BinSize(), ParseInteger(), ParseText(), RenderBinary(), and ToFile().
size_t ID3_FieldImpl::BinSize | ( | ) | const [virtual] |
Implements ID3_Field.
Definition at line 992 of file field.cpp.
References GetEncoding(), ID3FF_CSTR, ID3FTY_TEXTSTRING, ID3TE_UNICODE, and Size().
size_t ID3_FieldImpl::GetNumTextItems | ( | ) | const [virtual] |
Returns the number of items in a text list.
size_t numItems = myFrame.GetField(ID3FN_UNICODE)->GetNumItems();
Implements ID3_Field.
Definition at line 399 of file field_string_ascii.cpp.
Referenced by Get(), GetRawTextItem(), and GetRawUnicodeTextItem().
ID3_Field& ID3_FieldImpl::operator= | ( | uint32 | val | ) | [inline, virtual] |
A shortcut for the Set method.
myFrame.GetField(ID3FN_PICTURETYPE)->= 0x0B;
val | The data to assign to this field |
Implements ID3_Field.
Definition at line 53 of file field_impl.h.
References Set().
void ID3_FieldImpl::Set | ( | uint32 | val | ) | [virtual] |
Sets the value of the field to the specified integer.
data | The data to assign to this field |
Implements ID3_Field.
Definition at line 47 of file field_integer.cpp.
References SetInteger().
Referenced by FromFile(), operator=(), ParseInteger(), and Set().
uint32 ID3_FieldImpl::Get | ( | ) | const [virtual] |
Returns the value of the integer field.
uint32 picType = myFrame.GetField(ID3FN_PICTURETYPE)->Get();
Implements ID3_Field.
Definition at line 72 of file field_integer.cpp.
References GetInteger().
void ID3_FieldImpl::SetInteger | ( | uint32 | ) |
uint32 ID3_FieldImpl::GetInteger | ( | ) | const |
Definition at line 77 of file field_integer.cpp.
References ID3FTY_INTEGER.
Referenced by Get(), and operator=().
ID3_Field& ID3_FieldImpl::operator= | ( | const char * | data | ) | [inline, virtual] |
Shortcut for the Set operator.
data | The string to assign to this field |
Implements ID3_Field.
Definition at line 61 of file field_impl.h.
References Set().
size_t ID3_FieldImpl::Set | ( | const char * | data | ) | [virtual] |
Copies the supplied string to the field.
You may dispose of the source string after a call to this method.
myFrame.GetField(ID3FN_TEXT)->Set("ID3Lib is very cool!");
Implements ID3_Field.
Definition at line 45 of file field_string_ascii.cpp.
References ID3FTY_TEXTSTRING.
size_t ID3_FieldImpl::Get | ( | char * | buffer, | |
size_t | maxLength | |||
) | const [virtual] |
Copies the contents of the field into the supplied buffer, up to the number of characters specified; for fields with multiple entries, the optional third parameter indicates which of the fields to retrieve.
The third parameter is useful when using text lists (see Add(const char*) for more details). The default value for this third parameter is 1, which returns the entire string if the field contains only one item.
It returns the number of characters (not bytes necessarily, and not including any NULL terminator) of the supplied buffer that are now used.
char myBuffer[1024]; size_t charsUsed = myFrame.GetField(ID3FN_TEXT)->Get(buffer, 1024);
It fills the buffer with as much data from the field as is present in the field, or as large as the buffer, whichever is smaller.
char myBuffer[1024]; size_t charsUsed = myFrame.GetField(ID3FN_TEXT)->Get(buffer, 1024, 3);
This fills the buffer with up to the first 1024 characters from the third element of the text list.
Implements ID3_Field.
Definition at line 87 of file field_string_ascii.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_ASCII, and NULL.
size_t ID3_FieldImpl::Get | ( | char * | , | |
size_t | , | |||
size_t | ||||
) | const [virtual] |
Implements ID3_Field.
Definition at line 106 of file field_string_ascii.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_ASCII, and NULL.
const char * ID3_FieldImpl::GetRawText | ( | ) | const [virtual] |
Implements ID3_Field.
Definition at line 261 of file field_string_ascii.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_ASCII, and NULL.
const char * ID3_FieldImpl::GetRawTextItem | ( | size_t | ) | const [virtual] |
Implements ID3_Field.
Definition at line 272 of file field_string_ascii.cpp.
References GetEncoding(), GetNumTextItems(), ID3FTY_TEXTSTRING, ID3TE_ASCII, and NULL.
size_t ID3_FieldImpl::Add | ( | const char * | data | ) | [virtual] |
Implements ID3_Field.
Definition at line 250 of file field_string_ascii.cpp.
References ID3FTY_TEXTSTRING.
String ID3_FieldImpl::GetText | ( | ) | const |
Definition at line 124 of file field_string_ascii.cpp.
References ID3FTY_TEXTSTRING.
Referenced by operator=().
String ID3_FieldImpl::GetTextItem | ( | size_t | ) | const |
Definition at line 134 of file field_string_ascii.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_ASCII, and NULL.
size_t ID3_FieldImpl::SetText | ( | dami::String | ) |
Referenced by operator=(), and ParseText().
size_t ID3_FieldImpl::AddText | ( | dami::String | ) |
Referenced by ParseText().
Shortcut for the Set operator.
Performs similarly as operator=(const char*), taking a unicode_t string as a parameter rather than an ascii string.
string | The string to assign to the field |
Implements ID3_Field.
Definition at line 75 of file field_impl.h.
References Set().
size_t ID3_FieldImpl::Set | ( | const unicode_t * | data | ) | [virtual] |
Copies the supplied unicode string to the field.
Performs similarly as the ASCII Set() method, taking a unicode_t string as a parameter rather than an ascii string.
string | The unicode string to set this field to. |
Implements ID3_Field.
Definition at line 49 of file field_string_unicode.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, and dami::ucslen().
size_t ID3_FieldImpl::Get | ( | unicode_t * | buffer, | |
size_t | maxLength | |||
) | const [virtual] |
Copies the contents of the field into the supplied buffer, up to the number of characters specified; for fields with multiple entries, the optional third parameter indicates which of the fields to retrieve.
Performs similarly as the ASCII Get(char *, size_t, size_t) method, taking a unicode_t string as a parameter rather than an ascii string. The maxChars parameter still represents the maximum number of characters, not bytes.
unicode_t myBuffer[1024]; size_t charsUsed = myFrame.GetField(ID3FN_UNICODE)->Get(buffer, 1024);
buffer | Where the field's data is copied to | |
maxChars | The maximum number of characters to copy to the buffer. | |
itemNum | For fields with multiple items (such as the involved people frame, the item number to retrieve. |
Implements ID3_Field.
Definition at line 93 of file field_string_unicode.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, NULL, and NULL_UNICODE.
size_t ID3_FieldImpl::Get | ( | unicode_t * | buffer, | |
size_t | , | |||
size_t | ||||
) | const [virtual] |
Implements ID3_Field.
Definition at line 139 of file field_string_unicode.cpp.
References GetEncoding(), GetNumTextItems(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, NULL, NULL_UNICODE, and dami::ucslen().
size_t ID3_FieldImpl::Add | ( | const unicode_t * | ) | [virtual] |
Implements ID3_Field.
Definition at line 61 of file field_string_unicode.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, and dami::ucslen().
const unicode_t * ID3_FieldImpl::GetRawUnicodeText | ( | ) | const [virtual] |
Implements ID3_Field.
Definition at line 111 of file field_string_unicode.cpp.
References GetEncoding(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, and NULL.
const unicode_t * ID3_FieldImpl::GetRawUnicodeTextItem | ( | size_t | ) | const [virtual] |
Implements ID3_Field.
Definition at line 122 of file field_string_unicode.cpp.
References GetEncoding(), GetNumTextItems(), ID3FTY_TEXTSTRING, ID3TE_UNICODE, NULL, and dami::ucslen().
size_t ID3_FieldImpl::Set | ( | const uchar * | buf, | |
size_t | size | |||
) | [virtual] |
size_t ID3_FieldImpl::Set | ( | const char * | buf, | |
size_t | size | |||
) | [inline] |
size_t ID3_FieldImpl::Get | ( | uchar * | buffer, | |
size_t | max_bytes | |||
) | const [virtual] |
Copies the field's internal string to the buffer.
It copies the data in the field into the buffer, for as many bytes as the field contains, or the size of buffer, whichever is smaller.
uchar buffer[1024]; myFrame.GetField(ID3FN_DATA)->Get(buffer, sizeof(buffer));
Implements ID3_Field.
Definition at line 113 of file field_binary.cpp.
References ID3FTY_BINARY, and NULL.
const uchar * ID3_FieldImpl::GetRawBinary | ( | ) | const [virtual] |
Implements ID3_Field.
Definition at line 92 of file field_binary.cpp.
References ID3FTY_BINARY, and NULL.
void ID3_FieldImpl::FromFile | ( | const char * | info | ) | [virtual] |
Copies binary data from the file specified to the field.
myFrame.GetField(ID3FN_DATA)->FromFile("mypic.jpg");
Implements ID3_Field.
Definition at line 136 of file field_binary.cpp.
References ID3FTY_BINARY, NULL, and Set().
void ID3_FieldImpl::ToFile | ( | const char * | info | ) | const [virtual] |
Copies binary data from the field to the specified file.
myFrame.GetField(ID3FN_DATA)->ToFile("output.bin");
Implements ID3_Field.
Definition at line 172 of file field_binary.cpp.
References ID3FTY_BINARY, NULL, and Size().
size_t ID3_FieldImpl::SetBinary | ( | dami::BString | ) |
Referenced by operator=().
BString ID3_FieldImpl::GetBinary | ( | ) | const |
Definition at line 81 of file field_binary.cpp.
References ID3FTY_BINARY.
Referenced by operator=().
Implements ID3_Field.
Definition at line 1143 of file field.cpp.
References GetBinary(), GetEncoding(), GetInteger(), GetText(), GetType(), ID3_Field::GetType(), ID3FTY_BINARY, ID3FTY_INTEGER, ID3FTY_TEXTSTRING, SetBinary(), SetEncoding(), and SetText().
bool ID3_FieldImpl::InScope | ( | ID3_V2Spec | spec | ) | const [inline, virtual] |
ID3_FieldID ID3_FieldImpl::GetID | ( | ) | const [inline, virtual] |
ID3_FieldType ID3_FieldImpl::GetType | ( | ) | const [inline, virtual] |
bool ID3_FieldImpl::SetEncoding | ( | ID3_TextEnc | enc | ) | [virtual] |
Implements ID3_Field.
Definition at line 1175 of file field.cpp.
References dami::convert(), GetEncoding(), ID3TE_NONE, ID3TE_NUMENCODINGS, and IsEncodable().
Referenced by operator=().
ID3_TextEnc ID3_FieldImpl::GetEncoding | ( | ) | const [inline, virtual] |
Implements ID3_Field.
Definition at line 105 of file field_impl.h.
Referenced by Add(), BinSize(), Get(), GetRawText(), GetRawTextItem(), GetRawUnicodeText(), GetRawUnicodeTextItem(), GetTextItem(), operator=(), ParseText(), RenderText(), Set(), and SetEncoding().
bool ID3_FieldImpl::IsEncodable | ( | ) | const [inline, virtual] |
Implements ID3_Field.
Definition at line 106 of file field_impl.h.
References ID3FF_ENCODABLE.
Referenced by SetEncoding().
void ID3_FieldImpl::Render | ( | ID3_Writer & | ) | const [virtual] |
Implements ID3_Field.
Definition at line 1112 of file field.cpp.
References ID3FTY_BINARY, ID3FTY_INTEGER, ID3FTY_TEXTSTRING, RenderBinary(), RenderInteger(), and RenderText().
bool ID3_FieldImpl::Parse | ( | ID3_Reader & | ) | [virtual] |
Implements ID3_Field.
Definition at line 1043 of file field.cpp.
References ID3FTY_BINARY, ID3FTY_INTEGER, ID3FTY_TEXTSTRING, ParseBinary(), and ParseText().
bool ID3_FieldImpl::HasChanged | ( | ) | const [virtual] |
void ID3_FieldImpl::RenderInteger | ( | ID3_Writer & | ) | const [protected] |
void ID3_FieldImpl::RenderText | ( | ID3_Writer & | ) | const [protected] |
Definition at line 376 of file field_string_ascii.cpp.
References GetEncoding(), and ID3FF_CSTR.
Referenced by Render().
void ID3_FieldImpl::RenderBinary | ( | ID3_Writer & | ) | const [protected] |
Definition at line 203 of file field_binary.cpp.
References Size(), and ID3_Writer::writeChars().
Referenced by Render().
bool ID3_FieldImpl::ParseInteger | ( | ID3_Reader & | ) | [protected] |
Definition at line 87 of file field_integer.cpp.
References ID3_Reader::atEnd(), ID3_Reader::getBeg(), ID3_Reader::getCur(), ID3_Reader::getEnd(), Set(), and Size().
bool ID3_FieldImpl::ParseText | ( | ID3_Reader & | ) | [protected] |
Definition at line 327 of file field_string_ascii.cpp.
References AddText(), ID3_Reader::atEnd(), Clear(), ID3_Reader::getBeg(), ID3_Reader::getCur(), GetEncoding(), ID3_Reader::getEnd(), ID3FF_CSTR, ID3FF_LIST, ID3_Reader::remainingBytes(), SetText(), and Size().
Referenced by Parse().
bool ID3_FieldImpl::ParseBinary | ( | ID3_Reader & | ) | [protected] |
friend class ID3_FrameImpl [friend] |
Definition at line 42 of file field_impl.h.