1/***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_STRINGLIST_H
27#define TAGLIB_STRINGLIST_H
28
29#include "tstring.h"
30#include "tlist.h"
31#include "tbytevectorlist.h"
32#include "taglib_export.h"
33
34#include <iostream>
35
36namespace TagLib {
37
38 //! A list of strings
39
40 /*!
41 * This is a specialization of the List class with some members convention for
42 * string operations.
43 */
44
45 class TAGLIB_EXPORT StringList : public List<String>
46 {
47 public:
48
49 /*!
50 * Constructs an empty StringList.
51 */
52 StringList();
53
54 /*!
55 * Make a shallow, implicitly shared, copy of \a l. Because this is
56 * implicitly shared, this method is lightweight and suitable for
57 * pass-by-value usage.
58 */
59 StringList(const StringList &l);
60
61 /*!
62 * Constructs a StringList with \a s as a member.
63 */
64 StringList(const String &s);
65
66 /*!
67 * Makes a deep copy of the data in \a vl.
68 *
69 * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when
70 * used with other codecs it will simply print a warning and exit.
71 */
72 StringList(const ByteVectorList &vl, String::Type t = String::Latin1);
73
74 /*!
75 * Destroys this StringList instance.
76 */
77 virtual ~StringList();
78
79 /*!
80 * Concatenate the list of strings into one string separated by \a separator.
81 */
82 String toString(const String &separator = " ") const;
83
84 /*!
85 * Appends \a s to the end of the list and returns a reference to the
86 * list.
87 */
88 StringList &append(const String &s);
89
90 /*!
91 * Appends all of the values in \a l to the end of the list and returns a
92 * reference to the list.
93 */
94 StringList &append(const StringList &l);
95
96 /*!
97 * Splits the String \a s into several strings at \a pattern. This will not include
98 * the pattern in the returned strings.
99 */
100 static StringList split(const String &s, const String &pattern);
101
102 private:
103 class StringListPrivate;
104 StringListPrivate *d;
105 };
106
107}
108
109/*!
110 * \related TagLib::StringList
111 * Send the StringList to an output stream.
112 */
113std::ostream &operator<<(std::ostream &s, const TagLib::StringList &l);
114
115#endif
116