Add iterators and operator[] to the string class.

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@319064 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler
2004-06-09 13:33:05 +00:00
parent 0c6be64f8a
commit b69dd382c6
2 changed files with 68 additions and 0 deletions

View File

@ -63,6 +63,12 @@ namespace TagLib {
class String
{
public:
#ifndef DO_NOT_DOCUMENT
typedef std::basic_string<wchar>::iterator Iterator;
typedef std::basic_string<wchar>::const_iterator ConstIterator;
#endif
/**
* The four types of string encodings supported by the ID3v2 specification.
* ID3v1 is assumed to be Latin1 and Ogg Vorbis comments use UTF8.
@ -176,6 +182,28 @@ namespace TagLib {
*/
const char *toCString(bool unicode = false) const;
/*!
* Returns an iterator pointing to the beginning of the string.
*/
Iterator begin();
/*!
* Returns a const iterator pointing to the beginning of the string.
*/
ConstIterator begin() const;
/*!
* Returns an iterator pointing to the end of the string (the position
* after the last character).
*/
Iterator end();
/*!
* Returns a const iterator pointing to the end of the string (the position
* after the last character).
*/
ConstIterator end() const;
/*!
* Finds the first occurance of pattern \a s in this string starting from
* \a offset. If the pattern is not found, -1 is returned.
@ -244,6 +272,16 @@ namespace TagLib {
*/
static String number(int n);
/*!
* Returns a reference to the character at position \a i.
*/
wchar &operator[](int i);
/*!
* Returns a const reference to the character at position \a i.
*/
const wchar &operator[](int i) const;
/*!
* Compares each character of the String with each character of \a s and
* returns true if the strings match.