mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-30 23:02:39 -06:00
reorganizing repo
git-svn-id: svn://ultimatepp.org/upp/trunk@9206 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7d17505cfe
commit
e3e8d627f5
3840 changed files with 0 additions and 1161578 deletions
|
|
@ -1,107 +0,0 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
int wstrlen(const wchar *s)
|
||||
{
|
||||
const wchar *q = s;
|
||||
while(*q) q++;
|
||||
return (int)(q - s);
|
||||
}
|
||||
|
||||
unsigned ctoi(int c)
|
||||
{
|
||||
if(c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if(c >= 'A' && c <= 'Z')
|
||||
return c - 'A' + 10;
|
||||
if(c >= 'a' && c <= 'z')
|
||||
return c - 'a' + 10;
|
||||
return (unsigned)-1;
|
||||
}
|
||||
|
||||
int CharFilterAscii(int c)
|
||||
{
|
||||
return c >= 32 && c < 256 ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterAscii128(int c)
|
||||
{
|
||||
return c >= 32 && c < 128 ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterUnicode(int c)
|
||||
{
|
||||
return c >= 32 && c < 65536 ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterDigit(int c)
|
||||
{
|
||||
return IsDigit(c) ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterInt(int c)
|
||||
{
|
||||
if(c == '+' || c == '-') return c;
|
||||
return CharFilterDigit(c);
|
||||
}
|
||||
|
||||
int CharFilterDouble(int c)
|
||||
{
|
||||
if(c == ',' || c == '.') return '.';
|
||||
if(c == 'e' || c == 'E') return 'E';
|
||||
return CharFilterInt(c);
|
||||
}
|
||||
|
||||
int CharFilterWhitespace(int c)
|
||||
{
|
||||
return IsSpace(c) ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterAlpha(int c)
|
||||
{
|
||||
return IsAlpha(c) ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterAlphaToUpper(int c)
|
||||
{
|
||||
return IsAlpha(c) ? IsUpper(c) ? c : ToUpper(c) : 0;
|
||||
}
|
||||
|
||||
int CharFilterAlphaToLower(int c)
|
||||
{
|
||||
return IsAlpha(c) ? IsLower(c) ? c : ToLower(c) : 0;
|
||||
}
|
||||
|
||||
int CharFilterDefaultToUpperAscii(int c)
|
||||
{
|
||||
return ToUpper(ToAscii(c, CHARSET_DEFAULT));
|
||||
}
|
||||
|
||||
int CharFilterCrLf(int c)
|
||||
{
|
||||
return c == '\r' || c == '\n' ? c : 0;
|
||||
}
|
||||
|
||||
String Filter(const char *s, int (*filter)(int))
|
||||
{
|
||||
String result;
|
||||
while(*s) {
|
||||
int c = (*filter)((byte)*s++);
|
||||
if(c) result.Cat(c);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
String FilterWhile(const char *s, int (*filter)(int))
|
||||
{
|
||||
String result;
|
||||
while(*s) {
|
||||
int c = (*filter)((byte)*s++);
|
||||
if(!c) break;
|
||||
result.Cat(c);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue