String::null is not necessarily be empty or remains the same instance.
Using it in a public header may lead to a linkage error.
if(d->type == Text && !isEmpty())
return d->text.front();
else
- return String::null;
+ return String();
}
bool APE::Item::isEmpty() const
String APE::Tag::title() const
{
if(d->itemListMap["TITLE"].isEmpty())
- return String::null;
+ return String();
return d->itemListMap["TITLE"].values().toString();
}
String APE::Tag::artist() const
{
if(d->itemListMap["ARTIST"].isEmpty())
- return String::null;
+ return String();
return d->itemListMap["ARTIST"].values().toString();
}
String APE::Tag::album() const
{
if(d->itemListMap["ALBUM"].isEmpty())
- return String::null;
+ return String();
return d->itemListMap["ALBUM"].values().toString();
}
String APE::Tag::comment() const
{
if(d->itemListMap["COMMENT"].isEmpty())
- return String::null;
+ return String();
return d->itemListMap["COMMENT"].values().toString();
}
String APE::Tag::genre() const
{
if(d->itemListMap["GENRE"].isEmpty())
- return String::null;
+ return String();
return d->itemListMap["GENRE"].values().toString();
}
{
if(d->attributeListMap.contains("WM/AlbumTitle"))
return d->attributeListMap["WM/AlbumTitle"][0].toString();
- return String::null;
+ return String();
}
String ASF::Tag::copyright() const
{
if(d->attributeListMap.contains("WM/Genre"))
return d->attributeListMap["WM/Genre"][0].toString();
- return String::null;
+ return String();
}
void ASF::Tag::setTitle(const String &value)
for(; it != origProps.end(); ++it) {
if(!props.contains(it->first) || props[it->first].isEmpty()) {
if(it->first == "TITLE") {
- d->title = String::null;
+ d->title.clear();
}
else if(it->first == "ARTIST") {
- d->artist = String::null;
+ d->artist.clear();
}
else if(it->first == "COMMENT") {
- d->comment = String::null;
+ d->comment.clear();
}
else if(it->first == "COPYRIGHT") {
- d->copyright = String::null;
+ d->copyright.clear();
}
else {
d->attributeListMap.erase(reverseKeyMap[it->first]);
if(i < lines.size())
writeString(lines[i], 25);
else
- writeString(String::null, 25);
+ writeString(String(), 25);
writeByte(0);
}
if((TagLib::uint)(i + instrumentCount) < lines.size())
writeString(lines[i + instrumentCount], 25);
else
- writeString(String::null, 25);
+ writeString(String(), 25);
writeByte(0);
}
}
for(uint i = n; i < d->properties.instrumentCount(); ++ i) {
- writeString(String::null, 22);
+ writeString(String(), 22);
seek(8, Current);
}
return true;
String Mod::Tag::artist() const
{
- return String::null;
+ return String();
}
String Mod::Tag::album() const
{
- return String::null;
+ return String();
}
String Mod::Tag::comment() const
String Mod::Tag::genre() const
{
- return String::null;
+ return String();
}
TagLib::uint Mod::Tag::year() const
d->title = properties["TITLE"].front();
oneValueSet.append("TITLE");
} else
- d->title = String::null;
+ d->title.clear();
if(properties.contains("COMMENT")) {
d->comment = properties["COMMENT"].front();
oneValueSet.append("COMMENT");
} else
- d->comment = String::null;
+ d->comment.clear();
if(properties.contains("TRACKERNAME")) {
d->trackerName = properties["TRACKERNAME"].front();
oneValueSet.append("TRACKERNAME");
} else
- d->trackerName = String::null;
+ d->trackerName.clear();
// for each tag that has been set above, remove the first entry in the corresponding
// value list. The others will be returned as unsupported by this format.
{
if(d->items.contains("\251nam"))
return d->items["\251nam"].toStringList().toString(", ");
- return String::null;
+ return String();
}
String
{
if(d->items.contains("\251ART"))
return d->items["\251ART"].toStringList().toString(", ");
- return String::null;
+ return String();
}
String
{
if(d->items.contains("\251alb"))
return d->items["\251alb"].toStringList().toString(", ");
- return String::null;
+ return String();
}
String
{
if(d->items.contains("\251cmt"))
return d->items["\251cmt"].toStringList().toString(", ");
- return String::null;
+ return String();
}
String
{
if(d->items.contains("\251gen"))
return d->items["\251gen"].toStringList().toString(", ");
- return String::null;
+ return String();
}
unsigned int
void ID3v1::Tag::setYear(TagLib::uint i)
{
- d->year = i > 0 ? String::number(i) : String::null;
+ d->year = i > 0 ? String::number(i) : String();
}
void ID3v1::Tag::setTrack(TagLib::uint i)
String TableOfContentsFrame::toString() const
{
- return String::null;
+ return String();
}
PropertyMap TableOfContentsFrame::asProperties() const
d(0)
{
StringList l;
- l.append(String::null);
- l.append(String::null);
+ l.append(String());
+ l.append(String());
setText(l);
}
{
return !TextIdentificationFrame::fieldList().isEmpty()
? TextIdentificationFrame::fieldList().front()
- : String::null;
+ : String();
}
StringList UserTextIdentificationFrame::fieldList() const
void UserTextIdentificationFrame::setText(const String &text)
{
if(description().isEmpty())
- setDescription(String::null);
+ setDescription(String());
TextIdentificationFrame::setText(StringList(description()).append(text));
}
void UserTextIdentificationFrame::setText(const StringList &fields)
{
if(description().isEmpty())
- setDescription(String::null);
+ setDescription(String());
TextIdentificationFrame::setText(StringList(description()).append(fields));
}
int fields = fieldList().size();
if(fields == 0)
- setDescription(String::null);
+ setDescription(String());
if(fields <= 1)
- setText(String::null);
+ setText(String());
}
String UniqueFileIdentifierFrame::toString() const
{
- return String::null;
+ return String();
}
PropertyMap UniqueFileIdentifierFrame::asProperties() const
String UnknownFrame::toString() const
{
- return String::null;
+ return String();
}
ByteVector UnknownFrame::data() const
int end = data.find(delimiter, *position, delimiter.size());
if(end < *position)
- return String::null;
+ return String();
String str;
if(encoding == String::Latin1)
}
if(newfields.isEmpty())
- fields.append(String::null);
+ fields.append(String());
frame->setText(newfields);
{
if(!d->frameListMap["TIT2"].isEmpty())
return d->frameListMap["TIT2"].front()->toString();
- return String::null;
+ return String();
}
String ID3v2::Tag::artist() const
{
if(!d->frameListMap["TPE1"].isEmpty())
return d->frameListMap["TPE1"].front()->toString();
- return String::null;
+ return String();
}
String ID3v2::Tag::album() const
{
if(!d->frameListMap["TALB"].isEmpty())
return d->frameListMap["TALB"].front()->toString();
- return String::null;
+ return String();
}
String ID3v2::Tag::comment() const
const FrameList &comments = d->frameListMap["COMM"];
if(comments.isEmpty())
- return String::null;
+ return String();
for(FrameList::ConstIterator it = comments.begin(); it != comments.end(); ++it)
{
if(d->frameListMap["TCON"].isEmpty() ||
!dynamic_cast<TextIdentificationFrame *>(d->frameListMap["TCON"].front()))
{
- return String::null;
+ return String();
}
// ID3v2.4 lists genres as the fields in its frames field list. If the field
String Ogg::XiphComment::title() const
{
if(d->fieldListMap["TITLE"].isEmpty())
- return String::null;
+ return String();
return d->fieldListMap["TITLE"].toString();
}
String Ogg::XiphComment::artist() const
{
if(d->fieldListMap["ARTIST"].isEmpty())
- return String::null;
+ return String();
return d->fieldListMap["ARTIST"].toString();
}
String Ogg::XiphComment::album() const
{
if(d->fieldListMap["ALBUM"].isEmpty())
- return String::null;
+ return String();
return d->fieldListMap["ALBUM"].toString();
}
return d->fieldListMap["COMMENT"].toString();
}
- return String::null;
+ return String();
}
String Ogg::XiphComment::genre() const
{
if(d->fieldListMap["GENRE"].isEmpty())
- return String::null;
+ return String();
return d->fieldListMap["GENRE"].toString();
}
if(i < lines.size())
writeString(lines[i], 27);
else
- writeString(String::null, 27);
+ writeString(String(), 27);
// string terminating NUL is not optional:
writeByte(0);
}
setTitle(properties["TITLE"].front());
oneValueSet.append("TITLE");
} else
- setTitle(String::null);
+ setTitle(String());
if(properties.contains("ARTIST")) {
setArtist(properties["ARTIST"].front());
oneValueSet.append("ARTIST");
} else
- setArtist(String::null);
+ setArtist(String());
if(properties.contains("ALBUM")) {
setAlbum(properties["ALBUM"].front());
oneValueSet.append("ALBUM");
} else
- setAlbum(String::null);
+ setAlbum(String());
if(properties.contains("COMMENT")) {
setComment(properties["COMMENT"].front());
oneValueSet.append("COMMENT");
} else
- setComment(String::null);
+ setComment(String());
if(properties.contains("GENRE")) {
setGenre(properties["GENRE"].front());
oneValueSet.append("GENRE");
} else
- setGenre(String::null);
+ setGenre(String());
if(properties.contains("DATE")) {
bool ok;
return tag(1)->method(); \
if(tag(2) && !tag(2)->method().isEmpty()) \
return tag(2)->method(); \
- return String::null \
+ return String(); \
#define numberUnion(method) \
if(tag(0) && tag(0)->method() > 0) \
# include "tdebug.h"
# include <windows.h>
-namespace
+namespace
{
// Check if the running system has CreateFileW() function.
- // Windows9x systems don't have CreateFileW() or can't accept Unicode file names.
+ // Windows9x systems don't have CreateFileW() or can't accept Unicode file names.
bool supportsUnicode()
{
}
// Indicates whether the system supports Unicode file names.
-
- const bool SystemSupportsUnicode = supportsUnicode();
+
+ const bool SystemSupportsUnicode = supportsUnicode();
// Converts a UTF-16 string into a local encoding.
- // This function should only be used in Windows9x systems which don't support
+ // This function should only be used in Windows9x systems which don't support
// Unicode file names.
std::string unicodeToAnsi(const wchar_t *wstr)
// If WinNT, stores a Unicode string into m_wname directly.
// If Win9x, converts and stores it into m_name to avoid calling Unicode version functions.
-FileName::FileName(const wchar_t *name)
+FileName::FileName(const wchar_t *name)
: m_name (SystemSupportsUnicode ? "" : unicodeToAnsi(name))
, m_wname(SystemSupportsUnicode ? name : L"")
{
}
-FileName::FileName(const char *name)
- : m_name(name)
+FileName::FileName(const char *name)
+ : m_name(name)
{
}
-FileName::FileName(const FileName &name)
- : m_name (name.m_name)
+FileName::FileName(const FileName &name)
+ : m_name (name.m_name)
, m_wname(name.m_wname)
{
}
-FileName::operator const wchar_t *() const
-{
- return m_wname.c_str();
+FileName::operator const wchar_t *() const
+{
+ return m_wname.c_str();
}
-FileName::operator const char *() const
-{
- return m_name.c_str();
+FileName::operator const char *() const
+{
+ return m_name.c_str();
}
-const std::wstring &FileName::wstr() const
-{
- return m_wname;
+const std::wstring &FileName::wstr() const
+{
+ return m_wname;
}
-const std::string &FileName::str() const
-{
- return m_name;
-}
+const std::string &FileName::str() const
+{
+ return m_name;
+}
String FileName::toString() const
{
if(!m_wname.empty()) {
return String(m_wname);
- }
+ }
else if(!m_name.empty()) {
const int len = MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, NULL, 0);
if(len == 0)
- return String::null;
+ return String();
std::vector<wchar_t> buf(len);
MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, &buf[0], len);
return String(&buf[0]);
}
else {
- return String::null;
+ return String();
}
}
String PropertyMap::toString() const
{
- String ret = "";
+ String ret;
+
for(ConstIterator it = begin(); it != end(); ++it)
ret += it->first+"="+it->second.toString(", ") + "\n";
if(!unsupported.isEmpty())
seek(pos + 4);
const uint len = std::min(22UL, instrumentHeaderSize - 4U);
if(i >= lines.size())
- writeString(String::null, len);
+ writeString(String(), len);
else
writeString(lines[i], len);
seek(pos + 18);
const uint len = std::min(sampleHeaderSize - 18U, 22UL);
if(sampleNameIndex >= lines.size())
- writeString(String::null, len);
+ writeString(String(), len);
else
writeString(lines[sampleNameIndex ++], len);
}
ByteVector data("Test Data");
item.setBinaryData(data);
CPPUNIT_ASSERT(item.values().isEmpty());
- CPPUNIT_ASSERT_EQUAL(String::null, item.toString());
+ CPPUNIT_ASSERT_EQUAL(String(), item.toString());
CPPUNIT_ASSERT_EQUAL(data, item.binaryData());
item.setValue("Test Text 2");
String readStringField(const ByteVector &data, String::Type encoding,
int *positon = 0)
{ return ID3v2::Frame::readStringField(data, encoding, positon); }
- virtual String toString() const { return String::null; }
+ virtual String toString() const { return String(); }
virtual void parseFields(const ByteVector &) {}
virtual ByteVector renderFields() const { return ByteVector(); }
};
CPPUNIT_ASSERT_EQUAL((TagLib::uchar)128, p->panningSeparation());
CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 0, p->pitchWheelDepth());
CPPUNIT_ASSERT_EQUAL(title, t->title());
- CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
- CPPUNIT_ASSERT_EQUAL(String::null, t->album());
+ CPPUNIT_ASSERT_EQUAL(String(), t->artist());
+ CPPUNIT_ASSERT_EQUAL(String(), t->album());
CPPUNIT_ASSERT_EQUAL(comment, t->comment());
- CPPUNIT_ASSERT_EQUAL(String::null, t->genre());
+ CPPUNIT_ASSERT_EQUAL(String(), t->genre());
CPPUNIT_ASSERT_EQUAL(0U, t->year());
CPPUNIT_ASSERT_EQUAL(0U, t->track());
CPPUNIT_ASSERT_EQUAL(String("Impulse Tracker"), t->trackerName());
CPPUNIT_ASSERT_EQUAL(31U, p->instrumentCount());
CPPUNIT_ASSERT_EQUAL((uchar)1, p->lengthInPatterns());
CPPUNIT_ASSERT_EQUAL(title, t->title());
- CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
- CPPUNIT_ASSERT_EQUAL(String::null, t->album());
+ CPPUNIT_ASSERT_EQUAL(String(), t->artist());
+ CPPUNIT_ASSERT_EQUAL(String(), t->album());
CPPUNIT_ASSERT_EQUAL(comment, t->comment());
- CPPUNIT_ASSERT_EQUAL(String::null, t->genre());
+ CPPUNIT_ASSERT_EQUAL(String(), t->genre());
CPPUNIT_ASSERT_EQUAL(0U, t->year());
CPPUNIT_ASSERT_EQUAL(0U, t->track());
CPPUNIT_ASSERT_EQUAL(String("StarTrekker"), t->trackerName());
CPPUNIT_ASSERT_EQUAL((TagLib::uchar)125, p->tempo());
CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 6, p->bpmSpeed());
CPPUNIT_ASSERT_EQUAL(title, t->title());
- CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
- CPPUNIT_ASSERT_EQUAL(String::null, t->album());
+ CPPUNIT_ASSERT_EQUAL(String(), t->artist());
+ CPPUNIT_ASSERT_EQUAL(String(), t->album());
CPPUNIT_ASSERT_EQUAL(comment, t->comment());
- CPPUNIT_ASSERT_EQUAL(String::null, t->genre());
+ CPPUNIT_ASSERT_EQUAL(String(), t->genre());
CPPUNIT_ASSERT_EQUAL(0U, t->year());
CPPUNIT_ASSERT_EQUAL(0U, t->track());
CPPUNIT_ASSERT_EQUAL(String("ScreamTracker III"), t->trackerName());
s.clear();
CPPUNIT_ASSERT(s.isEmpty());
- CPPUNIT_ASSERT(!s.isNull());
+ CPPUNIT_ASSERT(!s.isNull()); // deprecated, but still worth it to check.
String unicode("José Carlos", String::UTF8);
CPPUNIT_ASSERT(strcmp(unicode.toCString(), "Jos\xe9 Carlos") == 0);
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 6, p->tempo());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort)125, p->bpmSpeed());
CPPUNIT_ASSERT_EQUAL(titleBefore, t->title());
- CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
- CPPUNIT_ASSERT_EQUAL(String::null, t->album());
- CPPUNIT_ASSERT_EQUAL(String::null, t->comment());
- CPPUNIT_ASSERT_EQUAL(String::null, t->genre());
+ CPPUNIT_ASSERT_EQUAL(String(), t->artist());
+ CPPUNIT_ASSERT_EQUAL(String(), t->album());
+ CPPUNIT_ASSERT_EQUAL(String(), t->comment());
+ CPPUNIT_ASSERT_EQUAL(String(), t->genre());
CPPUNIT_ASSERT_EQUAL(0U, t->year());
CPPUNIT_ASSERT_EQUAL(0U, t->track());
- CPPUNIT_ASSERT_EQUAL(String::null, t->trackerName());
+ CPPUNIT_ASSERT_EQUAL(String(), t->trackerName());
}
void testWriteTagsShort()
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 6, p->tempo());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort)125, p->bpmSpeed());
CPPUNIT_ASSERT_EQUAL(title, t->title());
- CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
- CPPUNIT_ASSERT_EQUAL(String::null, t->album());
+ CPPUNIT_ASSERT_EQUAL(String(), t->artist());
+ CPPUNIT_ASSERT_EQUAL(String(), t->album());
CPPUNIT_ASSERT_EQUAL(comment, t->comment());
- CPPUNIT_ASSERT_EQUAL(String::null, t->genre());
+ CPPUNIT_ASSERT_EQUAL(String(), t->genre());
CPPUNIT_ASSERT_EQUAL(0U, t->year());
CPPUNIT_ASSERT_EQUAL(0U, t->track());
CPPUNIT_ASSERT_EQUAL(trackerName, t->trackerName());