lib/upnp/Util: remove unused function stringToTokens()
This commit is contained in:
@@ -66,37 +66,3 @@ path_getfather(const std::string &s) noexcept
|
|||||||
path_catslash(father);
|
path_catslash(father);
|
||||||
return father;
|
return father;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string>
|
|
||||||
stringToTokens(const std::string &str,
|
|
||||||
const char delim) noexcept
|
|
||||||
{
|
|
||||||
std::list<std::string> tokens;
|
|
||||||
|
|
||||||
std::string::size_type startPos = str.find_first_not_of(delim, 0);
|
|
||||||
|
|
||||||
// Skip initial delims, return empty if this eats all.
|
|
||||||
if (startPos == std::string::npos)
|
|
||||||
return tokens;
|
|
||||||
|
|
||||||
while (startPos < str.size()) {
|
|
||||||
// Find next delimiter or end of string (end of token)
|
|
||||||
auto pos = str.find_first_of(delim, startPos);
|
|
||||||
|
|
||||||
// Add token to the vector and adjust start
|
|
||||||
if (pos == std::string::npos) {
|
|
||||||
tokens.emplace_back(str, startPos);
|
|
||||||
break;
|
|
||||||
} else if (pos == startPos) {
|
|
||||||
// Dont' push empty tokens after first
|
|
||||||
if (tokens.empty())
|
|
||||||
tokens.emplace_back();
|
|
||||||
startPos = ++pos;
|
|
||||||
} else {
|
|
||||||
tokens.emplace_back(str, startPos, pos - startPos);
|
|
||||||
startPos = ++pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tokens;
|
|
||||||
}
|
|
||||||
|
@@ -20,10 +20,7 @@
|
|||||||
#ifndef MPD_UPNP_UTIL_HXX
|
#ifndef MPD_UPNP_UTIL_HXX
|
||||||
#define MPD_UPNP_UTIL_HXX
|
#define MPD_UPNP_UTIL_HXX
|
||||||
|
|
||||||
#include "util/Compiler.h"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
trimstring(std::string &s, const char *ws = " \t\n") noexcept;
|
trimstring(std::string &s, const char *ws = " \t\n") noexcept;
|
||||||
@@ -31,8 +28,4 @@ trimstring(std::string &s, const char *ws = " \t\n") noexcept;
|
|||||||
std::string
|
std::string
|
||||||
path_getfather(const std::string &s) noexcept;
|
path_getfather(const std::string &s) noexcept;
|
||||||
|
|
||||||
gcc_pure
|
|
||||||
std::list<std::string>
|
|
||||||
stringToTokens(const std::string &str, char delim) noexcept;
|
|
||||||
|
|
||||||
#endif /* _UPNPP_H_X_INCLUDED_ */
|
#endif /* _UPNPP_H_X_INCLUDED_ */
|
||||||
|
Reference in New Issue
Block a user