util/DivideString: remove unused library
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#include "DivideString.hxx"
|
||||
#include "StringStrip.hxx"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
DivideString::DivideString(const char *s, char separator, bool strip) noexcept
|
||||
:first(nullptr)
|
||||
{
|
||||
const char *x = std::strchr(s, separator);
|
||||
if (x == nullptr)
|
||||
return;
|
||||
|
||||
size_t length = x - s;
|
||||
second = x + 1;
|
||||
|
||||
if (strip)
|
||||
second = StripLeft(second);
|
||||
|
||||
if (strip) {
|
||||
const char *end = s + length;
|
||||
s = StripLeft(s);
|
||||
end = StripRight(s, end);
|
||||
length = end - s;
|
||||
}
|
||||
|
||||
first = new char[length + 1];
|
||||
memcpy(first, s, length);
|
||||
first[length] = 0;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef MPD_DIVIDE_STRING_HXX
|
||||
#define MPD_DIVIDE_STRING_HXX
|
||||
|
||||
#include <cassert>
|
||||
|
||||
/**
|
||||
* Split a given constant string at a separator character. Duplicates
|
||||
* the first part to be able to null-terminate it.
|
||||
*/
|
||||
class DivideString {
|
||||
char *first;
|
||||
const char *second;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param strip strip the first part and left-strip the second
|
||||
* part?
|
||||
*/
|
||||
DivideString(const char *s, char separator, bool strip=false) noexcept;
|
||||
|
||||
~DivideString() {
|
||||
delete[] first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Was the separator found?
|
||||
*/
|
||||
bool IsDefined() const {
|
||||
return first != nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the first part empty?
|
||||
*/
|
||||
bool empty() const {
|
||||
assert(IsDefined());
|
||||
|
||||
return *first == 0;
|
||||
}
|
||||
|
||||
const char *GetFirst() const {
|
||||
assert(IsDefined());
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
const char *GetSecond() const {
|
||||
assert(IsDefined());
|
||||
|
||||
return second;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,6 @@ util = static_library(
|
||||
'StringUtil.cxx',
|
||||
'StringCompare.cxx',
|
||||
'WStringCompare.cxx',
|
||||
'DivideString.cxx',
|
||||
'SplitString.cxx',
|
||||
'Tokenizer.cxx',
|
||||
'UriExtract.cxx',
|
||||
|
||||
Reference in New Issue
Block a user