Go to the documentation of this file.
28 #ifndef _ID3LIB_IO_STRINGS_H_
29 #define _ID3LIB_IO_STRINGS_H_
31 #include "id3/id3lib_strings.h"
36 #define min(a,b) (((a) < (b)) ? (a) : (b))
45 const String& _string;
48 StringReader(
const String&
string) : _string(string), _cur(0) { ; }
66 return this->readChars((
char_type*) buf, len);
70 size_type size =
min((
unsigned int)len, (
unsigned int)(_string.size() - _cur));
71 _string.copy(
reinterpret_cast<String::value_type *
>(buf), size, _cur);
88 return _string.size();
96 _cur = (pos < end) ? pos : end;
102 return _cur >= _string.size();
107 size_type size =
min((
unsigned int)len, (
unsigned int)(_string.size() - _cur));
115 const BString& _string;
126 return _string[_cur];
128 return END_OF_READER;
136 return this->readChars((
char_type*) buf, len);
140 size_type size =
min((
unsigned int)len, (
unsigned int)(_string.size() - _cur));
141 _string.copy(
reinterpret_cast<BString::value_type *
>(buf), size, _cur);
158 return _string.size();
166 _cur = (pos < end) ? pos : end;
172 return _cur >= _string.size();
177 size_type size =
min((
unsigned int)len,(
unsigned int)( _string.size() - _cur));
194 _string.append(
reinterpret_cast<const String::value_type *
>(buf), len);
199 _string.append(
reinterpret_cast<const String::value_type *
>(buf), len);
205 return _string.size();
220 _string.append(
reinterpret_cast<const BString::value_type *
>(buf), len);
225 _string.append(
reinterpret_cast<const BString::value_type *
>(buf), len);
231 return _string.size();
virtual pos_type setCur(pos_type pos)
Set the value of the internal position for reading.
virtual int_type peekChar()
Return the next character to be read without advancing the internal position.
BStringWriter(BString &string)
void close()
Close the writer.
virtual void close()
Close the reader.
virtual size_type readChars(char_type buf[], size_type len)
Read up to len characters into buf and advance the internal position accordingly.
virtual size_type readChars(char_type buf[], size_type len)
Read up to len characters into buf and advance the internal position accordingly.
virtual pos_type getEnd()
Return the ending position in the reader.
size_type readChars(char buf[], size_type len)
Read up to len chars into buf and advance the internal position accordingly.
virtual size_type writeChars(const char buf[], size_type len)
virtual pos_type getEnd()
Return the ending position in the reader.
void flush()
Flush the writer.
virtual pos_type getBeg()
Return the beginning position in the reader.
void close()
Close the writer.
size_type writeChars(const char_type buf[], size_type len)
Write up to len characters into buf and advance the internal position accordingly.
virtual int_type peekChar()
Return the next character to be read without advancing the internal position.
virtual pos_type getCur()
Return the current position in the reader.
virtual size_type skipChars(size_type len)
Skip up to len chars in the stream and advance the internal position accordingly.
pos_type getCur()
Return the next position that will be written to.
virtual pos_type getCur()
Return the current position in the reader.
virtual void close()
Close the reader.
virtual pos_type getBeg()
Return the beginning position in the reader.
StringWriter(String &string)
size_type writeChars(const char_type buf[], size_type len)
Write up to len characters into buf and advance the internal position accordingly.
pos_type getCur()
Return the next position that will be written to.
virtual pos_type setCur(pos_type pos)
Set the value of the internal position for reading.
virtual size_type writeChars(const char buf[], size_type len)
BStringReader(const BString &string)
size_type readChars(char buf[], size_type len)
Read up to len chars into buf and advance the internal position accordingly.
StringReader(const String &string)
virtual size_type skipChars(size_type len)
Skip up to len chars in the stream and advance the internal position accordingly.
void flush()
Flush the writer.