Remove more unused libnall code

This commit is contained in:
libretroadmin 2022-06-09 12:49:20 +02:00
parent c0351c2c50
commit 18bc24be14
6 changed files with 0 additions and 143 deletions

View File

@ -6,7 +6,6 @@
#include <nall/array.hpp> #include <nall/array.hpp>
#include <nall/string/base.hpp> #include <nall/string/base.hpp>
#include <nall/string/bsv.hpp>
#include <nall/string/core.hpp> #include <nall/string/core.hpp>
#include <nall/string/cast.hpp> #include <nall/string/cast.hpp>
#include <nall/string/compare.hpp> #include <nall/string/compare.hpp>

View File

@ -139,7 +139,6 @@ namespace nall {
template<typename T> inline lstring& operator<<(const T& value); template<typename T> inline lstring& operator<<(const T& value);
inline void split (const char*, const char*, unsigned = 0); inline void split (const char*, const char*, unsigned = 0);
inline void qsplit(const char*, const char*, unsigned = 0);
lstring(); lstring();
@ -183,10 +182,6 @@ namespace nall {
//match.hpp //match.hpp
inline bool match(const char *pattern, const char *str); inline bool match(const char *pattern, const char *str);
//math.hpp
inline bool strint (const char *str, int &result);
inline bool strmath(const char *str, int &result);
//strl.hpp //strl.hpp
inline unsigned strlcpy(char *dest, const char *src, unsigned length); inline unsigned strlcpy(char *dest, const char *src, unsigned length);
inline unsigned strlcat(char *dest, const char *src, unsigned length); inline unsigned strlcat(char *dest, const char *src, unsigned length);

View File

@ -1,75 +0,0 @@
#ifndef NALL_STRING_BSV_HPP
#define NALL_STRING_BSV_HPP
//BSV parser
//version 0.01
namespace nall {
inline string bsv_decode(const char *input) {
string output;
unsigned offset = 0;
while(*input) {
//illegal characters
if(*input == '}' ) return "";
if(*input == '\r') return "";
if(*input == '\n') return "";
//normal characters
if(*input != '{') { output[offset++] = *input++; continue; }
//entities
if(strbegin(input, "{lf}")) { output[offset++] = '\n'; input += 4; continue; }
if(strbegin(input, "{lb}")) { output[offset++] = '{'; input += 4; continue; }
if(strbegin(input, "{rb}")) { output[offset++] = '}'; input += 4; continue; }
//illegal entities
return "";
}
output[offset] = 0;
return output;
}
inline string bsv_encode(const char *input) {
string output;
unsigned offset = 0;
while(*input) {
//illegal characters
if(*input == '\r') return "";
if(*input == '\n') {
output[offset++] = '{';
output[offset++] = 'l';
output[offset++] = 'f';
output[offset++] = '}';
input++;
continue;
}
if(*input == '{') {
output[offset++] = '{';
output[offset++] = 'l';
output[offset++] = 'b';
output[offset++] = '}';
input++;
continue;
}
if(*input == '}') {
output[offset++] = '{';
output[offset++] = 'r';
output[offset++] = 'b';
output[offset++] = '}';
input++;
continue;
}
output[offset++] = *input++;
}
output[offset] = 0;
return output;
}
}
#endif

View File

@ -44,18 +44,6 @@ inline string basename(char const *name) {
return result; return result;
} }
// "foo/bar.c" -> "c"
inline string extension(char const *name) {
for(signed i = strlen(name); i >= 0; i--) {
if(name[i] == '.') {
name += i + 1;
break;
}
}
string result = name;
return result;
}
} }
#endif #endif

View File

@ -139,26 +139,6 @@ inline int eval(const char *&s, int depth = 0) {
return value; return value;
} }
inline bool strint(const char *s, int &result) {
try {
result = eval_integer(s);
return true;
} catch(const char*) {
result = 0;
return false;
}
}
inline bool strmath(const char *s, int &result) {
try {
result = eval(s);
return true;
} catch(const char*) {
result = 0;
return false;
}
}
} }
#endif #endif

View File

@ -21,36 +21,6 @@ void lstring::split(const char *key, const char *src, unsigned limit) {
operator[](split_count++) = src + lp; operator[](split_count++) = src + lp;
} }
void lstring::qsplit(const char *key, const char *src, unsigned limit) {
reset();
int ssl = strlen(src), ksl = strlen(key);
int lp = 0, split_count = 0;
for(int i = 0; i <= ssl - ksl;) {
uint8_t x = src[i];
if(x == '\"' || x == '\'') {
int z = i++; //skip opening quote
while(i < ssl && src[i] != x) i++;
if(i >= ssl) i = z; //failed match, rewind i
else {
i++; //skip closing quote
continue; //restart in case next char is also a quote
}
}
if(!memcmp(src + i, key, ksl)) {
strlcpy(operator[](split_count++), src + lp, i - lp + 1);
i += ksl;
lp = i;
if(!--limit) break;
} else i++;
}
operator[](split_count++) = src + lp;
}
}; };
#endif #endif