34 #include "io_helpers.h"
44 BString str(data, len);
45 size =
dami::min(len, this->SetBinary(str));
61 size_t fixed = _fixed_size;
69 _binary.assign(data, 0,
dami::min(size, fixed));
72 _binary.append(fixed - size,
'\0');
75 size = _binary.size();
97 data = _binary.data();
120 bytes =
dami::min(max_bytes, this->Size());
121 if (
NULL != buffer && bytes > 0)
123 ::memcpy(buffer, _binary.data(), bytes);
144 FILE* temp_file = ::fopen(info,
"rb");
145 if (temp_file !=
NULL)
147 ::fseek(temp_file, 0, SEEK_END);
148 size_t fileSize = ::ftell(temp_file);
149 ::fseek(temp_file, 0, SEEK_SET);
154 ::fread(buffer, 1, fileSize, temp_file);
156 this->Set(buffer, fileSize);
180 size_t size = this->Size();
183 FILE* temp_file = ::fopen(info,
"wb");
184 if (temp_file !=
NULL)
186 ::fwrite(_binary.data(), 1, size, temp_file);
199 _binary = io::readAllBinary(reader);
205 writer.
writeChars(this->GetRawBinary(), this->Size());
void ToFile(const char *sInfo) const
Copies binary data from the field to the specified file.
bool ParseBinary(ID3_Reader &)
void Set(uint32)
Sets the value of the field to the specified integer.
uint32 Get() const
Returns the value of the integer field.
const uchar * GetRawBinary() const
void RenderBinary(ID3_Writer &) const
size_t SetBinary(dami::BString)
Copies the supplied unicode string to the field.
dami::BString GetBinary() const
void FromFile(const char *)
Copies binary data from the file specified to the field.
virtual size_type writeChars(const char_type buf[], size_type len)=0
Write up to len characters into buf and advance the internal position accordingly.
const T & min(const T &a, const T &b)