mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Remove obsolete String::null and related functions.
This commit is contained in:
parent
15775d4135
commit
973fb49cde
@ -443,7 +443,7 @@ String EBML::Matroska::File::Tag::title() const
|
||||
if(e->title != e->document->d->tags.end())
|
||||
return e->title->first.find(Constants::TITLE)->second.front();
|
||||
else
|
||||
return String::null;
|
||||
return String();
|
||||
}
|
||||
|
||||
String EBML::Matroska::File::Tag::artist() const
|
||||
@ -451,7 +451,7 @@ String EBML::Matroska::File::Tag::artist() const
|
||||
if(e->artist != e->document->d->tags.end())
|
||||
return e->artist->first.find(Constants::ARTIST)->second.front();
|
||||
else
|
||||
return String::null;
|
||||
return String();
|
||||
}
|
||||
|
||||
String EBML::Matroska::File::Tag::album() const
|
||||
@ -459,7 +459,7 @@ String EBML::Matroska::File::Tag::album() const
|
||||
if(e->album != e->document->d->tags.end())
|
||||
return e->album->first.find(Constants::TITLE)->second.front();
|
||||
else
|
||||
return String::null;
|
||||
return String();
|
||||
}
|
||||
|
||||
PictureMap EBML::Matroska::File::Tag::pictures() const
|
||||
@ -472,7 +472,7 @@ String EBML::Matroska::File::Tag::comment() const
|
||||
if(e->comment != e->document->d->tags.end())
|
||||
return e->comment->first.find(Constants::COMMENT)->second.front();
|
||||
else
|
||||
return String::null;
|
||||
return String();
|
||||
}
|
||||
|
||||
String EBML::Matroska::File::Tag::genre() const
|
||||
@ -480,7 +480,7 @@ String EBML::Matroska::File::Tag::genre() const
|
||||
if(e->genre != e->document->d->tags.end())
|
||||
return e->genre->first.find(Constants::GENRE)->second.front();
|
||||
else
|
||||
return String::null;
|
||||
return String();
|
||||
}
|
||||
|
||||
uint EBML::Matroska::File::Tag::year() const
|
||||
|
@ -160,18 +160,18 @@ void Ogg::XiphComment::setGenre(const String &s)
|
||||
|
||||
void Ogg::XiphComment::setYear(uint i)
|
||||
{
|
||||
removeField("YEAR");
|
||||
removeFields("YEAR");
|
||||
if(i == 0)
|
||||
removeField("DATE");
|
||||
removeFields("DATE");
|
||||
else
|
||||
addField("DATE", String::number(i));
|
||||
}
|
||||
|
||||
void Ogg::XiphComment::setTrack(uint i)
|
||||
{
|
||||
removeField("TRACKNUM");
|
||||
removeFields("TRACKNUM");
|
||||
if(i == 0)
|
||||
removeField("TRACKNUMBER");
|
||||
removeFields("TRACKNUMBER");
|
||||
else
|
||||
addField("TRACKNUMBER", String::number(i));
|
||||
}
|
||||
@ -220,7 +220,7 @@ PropertyMap Ogg::XiphComment::setProperties(const PropertyMap &properties)
|
||||
toRemove.append(it->first);
|
||||
|
||||
for(StringList::ConstIterator it = toRemove.begin(); it != toRemove.end(); ++it)
|
||||
removeField(*it);
|
||||
removeFields(*it);
|
||||
|
||||
// now go through keys in \a properties and check that the values match those in the xiph comment
|
||||
PropertyMap invalid;
|
||||
@ -233,7 +233,7 @@ PropertyMap Ogg::XiphComment::setProperties(const PropertyMap &properties)
|
||||
const StringList &sl = it->second;
|
||||
if(sl.isEmpty())
|
||||
// zero size string list -> remove the tag with all values
|
||||
removeField(it->first);
|
||||
removeFields(it->first);
|
||||
else {
|
||||
// replace all strings in the list for the tag
|
||||
StringList::ConstIterator valueIterator = sl.begin();
|
||||
@ -266,20 +266,12 @@ String Ogg::XiphComment::vendorID() const
|
||||
void Ogg::XiphComment::addField(const String &key, const String &value, bool replace)
|
||||
{
|
||||
if(replace)
|
||||
removeField(key.upper());
|
||||
removeFields(key.upper());
|
||||
|
||||
if(!key.isEmpty() && !value.isEmpty())
|
||||
d->fieldListMap[key.upper()].append(value);
|
||||
}
|
||||
|
||||
void Ogg::XiphComment::removeField(const String &key, const String &value)
|
||||
{
|
||||
if(!value.isNull())
|
||||
removeFields(key, value);
|
||||
else
|
||||
removeFields(key);
|
||||
}
|
||||
|
||||
void Ogg::XiphComment::removeFields(const String &key)
|
||||
{
|
||||
d->fieldListMap.erase(key.upper());
|
||||
|
@ -181,15 +181,6 @@ namespace TagLib {
|
||||
*/
|
||||
void addField(const String &key, const String &value, bool replace = true);
|
||||
|
||||
/*!
|
||||
* Remove the field specified by \a key with the data \a value. If
|
||||
* \a value is null, all of the fields with the given key will be removed.
|
||||
*
|
||||
* \deprecated Using this method may lead to a linkage error.
|
||||
*/
|
||||
// BIC: remove and merge with below
|
||||
void removeField(const String &key, const String &value = String::null);
|
||||
|
||||
/*!
|
||||
* Remove all the fields specified by \a key.
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#define stringUnion(method) \
|
||||
for(size_t j = 0; j < COUNT; ++j) { \
|
||||
String val = d->tags[j] ? d->tags[j]->method() : String::null; \
|
||||
String val = d->tags[j] ? d->tags[j]->method() : String(); \
|
||||
if(!val.isEmpty()) \
|
||||
return val; \
|
||||
} \
|
||||
|
@ -137,8 +137,6 @@ public:
|
||||
SHARED_PTR<std::string> cstring;
|
||||
};
|
||||
|
||||
const String String::null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// static members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -377,11 +375,6 @@ bool String::isEmpty() const
|
||||
return d->data->empty();
|
||||
}
|
||||
|
||||
bool String::isNull() const
|
||||
{
|
||||
return (d == null.d);
|
||||
}
|
||||
|
||||
ByteVector String::data(Type t) const
|
||||
{
|
||||
switch(t)
|
||||
@ -483,7 +476,7 @@ String String::stripWhiteSpace() const
|
||||
|
||||
const size_t pos1 = d->data->find_first_not_of(WhiteSpaceChars);
|
||||
if(pos1 == std::wstring::npos)
|
||||
return String::null;
|
||||
return String();
|
||||
|
||||
const size_t pos2 = d->data->find_last_not_of(WhiteSpaceChars);
|
||||
return substr(pos1, pos2 - pos1 + 1);
|
||||
|
@ -330,20 +330,6 @@ namespace TagLib {
|
||||
*/
|
||||
bool isEmpty() const;
|
||||
|
||||
/*!
|
||||
* Returns true if this string is null -- i.e. it is a copy of the
|
||||
* String::null string.
|
||||
*
|
||||
* \note A string can be empty and not null. So do not use this method to
|
||||
* check if the string is empty.
|
||||
*
|
||||
* \see isEmpty()
|
||||
*
|
||||
* \deprecated
|
||||
*/
|
||||
// BIC: remove
|
||||
bool isNull() const;
|
||||
|
||||
/*!
|
||||
* Returns a ByteVector containing the string's data. If \a t is Latin1 or
|
||||
* UTF8, this will return a vector of 8 bit characters, otherwise it will use
|
||||
@ -504,16 +490,6 @@ namespace TagLib {
|
||||
*/
|
||||
bool operator<(const String &s) const;
|
||||
|
||||
/*!
|
||||
* A null string provided for convenience.
|
||||
*
|
||||
* \warning Do not modify this variable. It will mess up the internal state
|
||||
* of TagLib.
|
||||
*
|
||||
* \deprecated
|
||||
*/
|
||||
static const String null;
|
||||
|
||||
/*!
|
||||
* Returns a special value used for \a length parameter in String's member
|
||||
* functions, means "until the end of the string".
|
||||
|
@ -75,7 +75,6 @@ public:
|
||||
|
||||
s.clear();
|
||||
CPPUNIT_ASSERT(s.isEmpty());
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user