mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Remove unused code, some string_view
This commit is contained in:
parent
dae44c1120
commit
e5178d2bc4
@ -133,30 +133,7 @@ public:
|
||||
// Returns true if key exists in section
|
||||
bool Exists(const char* sectionName, const char* key) const;
|
||||
|
||||
// TODO: Get rid of these, in favor of the Section ones.
|
||||
void Set(const char* sectionName, const char* key, const char* newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue);
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, const std::string& newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue.c_str());
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, int newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue);
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, uint32_t newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue);
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, uint64_t newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue);
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, bool newValue) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValue);
|
||||
}
|
||||
void Set(const char* sectionName, const char* key, const std::vector<std::string>& newValues) {
|
||||
GetOrCreateSection(sectionName)->Set(key, newValues);
|
||||
}
|
||||
|
||||
// TODO: Get rid of these, in favor of the Section ones.
|
||||
// These will not create the section if it doesn't exist.
|
||||
bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
|
||||
bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);
|
||||
bool Get(const char* sectionName, const char* key, uint32_t* value, uint32_t defaultValue = 0);
|
||||
@ -164,13 +141,6 @@ public:
|
||||
bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false);
|
||||
bool Get(const char* sectionName, const char* key, std::vector<std::string>& values);
|
||||
|
||||
template<typename T> bool GetIfExists(const char* sectionName, const char* key, T value)
|
||||
{
|
||||
if (Exists(sectionName, key))
|
||||
return Get(sectionName, key, value);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
|
||||
|
||||
bool DeleteKey(const char* sectionName, const char* key);
|
||||
|
@ -334,7 +334,7 @@ void SplitString(std::string_view str, const char delim, std::vector<std::string
|
||||
}
|
||||
}
|
||||
|
||||
static std::string ApplyHtmlEscapes(std::string str) {
|
||||
static std::string ApplyHtmlEscapes(std::string_view str_view) {
|
||||
struct Repl {
|
||||
const char *a;
|
||||
const char *b;
|
||||
@ -345,15 +345,15 @@ static std::string ApplyHtmlEscapes(std::string str) {
|
||||
// Easy to add more cases.
|
||||
};
|
||||
|
||||
std::string str(str_view);
|
||||
for (const Repl &r : replacements) {
|
||||
str = ReplaceAll(str, r.a, r.b);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Meant for HTML listings and similar, so supports some HTML escapes.
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string> &output) {
|
||||
void GetQuotedStrings(std::string_view str, std::vector<std::string> &output) {
|
||||
size_t next = 0;
|
||||
bool even = 0;
|
||||
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
|
||||
@ -372,11 +372,11 @@ void GetQuotedStrings(const std::string& str, std::vector<std::string> &output)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this is quite inefficient.
|
||||
std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest) {
|
||||
size_t pos = 0;
|
||||
|
||||
std::string result(input);
|
||||
|
||||
if (src == dest)
|
||||
return result;
|
||||
|
||||
|
@ -86,7 +86,7 @@ void SplitString(std::string_view str, const char delim, std::vector<std::string
|
||||
// Try to avoid this when possible, in favor of the string_view version.
|
||||
void SplitString(std::string_view str, const char delim, std::vector<std::string> &output);
|
||||
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output);
|
||||
void GetQuotedStrings(std::string_view str, std::vector<std::string> &output);
|
||||
|
||||
std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user