15
15
/** Set of standard tags */
16
16
class StandardTags {
18
/** Flags for formatString(), replacePercentCodes(). */
19
enum FormatStringFlags {
20
FSF_SupportUrlEncode = 1
23
/** Flags for truncation. */
28
TF_Comment = (1 << 3),
23
40
* Set values which are different inactive.
25
42
* @param st tags to compare
27
44
void filterDifferent(const StandardTags& st);
29
47
* Set tags inactive.
31
49
void setInactive();
33
52
* Copy all tags which are not inactive.
35
54
* @param dest standard tags to copy into
37
void copyActiveTags(StandardTags &dest) const;
56
void copyActiveTags(StandardTags& dest) const;
64
* Copy tags which are empty or inactive from other tags.
65
* This can be used to merge two tags.
67
* @param st other tags
69
void merge(const StandardTags& st);
72
* Check if the tags are empty or inactive.
74
* @return true if empty or inactive.
76
bool isEmptyOrInactive() const;
79
* Format a string from tag data.
80
* Supported format fields:
86
* %t track, two digits, i.e. leading zero if < 10
87
* %T track, without leading zeroes
90
* @param format format specification
91
* @param flags flags: FSF_SupportUrlEncode to support modifier u
92
* (with code c "%uc") to URL encode
94
* @return formatted string.
96
QString formatString(const QString& format, unsigned flags = 0) const;
99
* Replace escaped characters in a string.
101
* @param format string with escaped two-character-sequences
102
* ("\n", "\t", "\r", "\\", "\a", "\b", "\f", "\v")
104
* @return string with escaped sequences replaced by characters.
106
static QString replaceEscapedChars(const QString& format);
109
* Replace percent codes in a string.
111
* @param format string with percent codes
112
* (% followed by a single character)
113
* @param codes characters following percent
114
* @param replacements strings with replacements for codes
115
* @param numCodes number of elements in codes and replacements
116
* @param flags flags: FSF_SupportUrlEncode to support modifier u
117
* (with code c "%uc") to URL encode
119
* @return string with percent codes replaced
121
static QString replacePercentCodes(
122
const QString& format, const QChar* codes,
123
const QString* replacements, int numCodes,
42
126
/** Title, empty if "", inactive if QString::null */
44
128
/** Artist, empty if "", inactive if QString::null */
52
136
/** Track, empty if 0, inactive if -1 */
54
/** Genre, empty if 0xff, inactive if -1 */
56
/** Genre without number, inactive if QString::null or genre != 0xff,
138
/** Genre, inactive if QString::null, empty if "" */
81
162
bool areAllTrue() const;
164
bool m_enableTitle; /**< true if title enabled */
165
bool m_enableArtist; /**< true if artist enabled */
166
bool m_enableAlbum; /**< true if album enabled */
167
bool m_enableComment; /**< true if comment enabled */
168
bool m_enableYear; /**< true if year enabled */
169
bool m_enableTrack; /**< true if track enabled */
170
bool m_enableGenre; /**< true if genre enabled */
92
173
#endif // STANDARDTAGS_H