|
@@ -134,11 +134,21 @@ namespace bx
|
|
|
return strCmp<toNoop>(_lhs, _rhs, _max);
|
|
return strCmp<toNoop>(_lhs, _rhs, _max);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int32_t strCmp(const char* _lhs, const StringView& _rhs)
|
|
|
|
|
+ {
|
|
|
|
|
+ return strCmp(_lhs, _rhs.getPtr(), _rhs.getLength() );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int32_t strCmpI(const char* _lhs, const char* _rhs, int32_t _max)
|
|
int32_t strCmpI(const char* _lhs, const char* _rhs, int32_t _max)
|
|
|
{
|
|
{
|
|
|
return strCmp<toLower>(_lhs, _rhs, _max);
|
|
return strCmp<toLower>(_lhs, _rhs, _max);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int32_t strCmpI(const char* _lhs, const StringView& _rhs)
|
|
|
|
|
+ {
|
|
|
|
|
+ return strCmpI(_lhs, _rhs.getPtr(), _rhs.getLength() );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int32_t strLen(const char* _str, int32_t _max)
|
|
int32_t strLen(const char* _str, int32_t _max)
|
|
|
{
|
|
{
|
|
|
if (NULL == _str)
|
|
if (NULL == _str)
|
|
@@ -166,6 +176,11 @@ namespace bx
|
|
|
return num;
|
|
return num;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int32_t strCopy(char* _dst, int32_t _dstSize, const StringView& _str)
|
|
|
|
|
+ {
|
|
|
|
|
+ return strCopy(_dst, _dstSize, _str.getPtr(), _str.getLength() );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int32_t strCat(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
|
|
int32_t strCat(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
|
|
|
{
|
|
{
|
|
|
BX_CHECK(NULL != _dst, "_dst can't be NULL!");
|
|
BX_CHECK(NULL != _dst, "_dst can't be NULL!");
|
|
@@ -177,6 +192,11 @@ namespace bx
|
|
|
return strCopy(&_dst[len], max-len, _src, _num);
|
|
return strCopy(&_dst[len], max-len, _src, _num);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int32_t strCat(char* _dst, int32_t _dstSize, const StringView& _str)
|
|
|
|
|
+ {
|
|
|
|
|
+ return strCat(_dst, _dstSize, _str.getPtr(), _str.getLength() );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const char* strFind(const char* _str, char _ch, int32_t _max)
|
|
const char* strFind(const char* _str, char _ch, int32_t _max)
|
|
|
{
|
|
{
|
|
|
for (int32_t ii = 0, len = strLen(_str, _max); ii < len; ++ii)
|
|
for (int32_t ii = 0, len = strLen(_str, _max); ii < len; ++ii)
|
|
@@ -192,7 +212,7 @@ namespace bx
|
|
|
|
|
|
|
|
const char* strRFind(const char* _str, char _ch, int32_t _max)
|
|
const char* strRFind(const char* _str, char _ch, int32_t _max)
|
|
|
{
|
|
{
|
|
|
- for (int32_t ii = strLen(_str, _max); 0 < ii; --ii)
|
|
|
|
|
|
|
+ for (int32_t ii = strLen(_str, _max); 0 <= ii; --ii)
|
|
|
{
|
|
{
|
|
|
if (_str[ii] == _ch)
|
|
if (_str[ii] == _ch)
|
|
|
{
|
|
{
|
|
@@ -900,21 +920,6 @@ namespace bx
|
|
|
return len;
|
|
return len;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const char* baseName(const char* _filePath)
|
|
|
|
|
- {
|
|
|
|
|
- const char* bs = strRFind(_filePath, '\\');
|
|
|
|
|
- const char* fs = strRFind(_filePath, '/');
|
|
|
|
|
- const char* slash = (bs > fs ? bs : fs);
|
|
|
|
|
- const char* colon = strRFind(_filePath, ':');
|
|
|
|
|
- const char* basename = slash > colon ? slash : colon;
|
|
|
|
|
- if (NULL != basename)
|
|
|
|
|
- {
|
|
|
|
|
- return basename+1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return _filePath;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
static const char s_units[] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' };
|
|
static const char s_units[] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' };
|
|
|
|
|
|
|
|
template<uint32_t Kilo, char KiloCh0, char KiloCh1>
|
|
template<uint32_t Kilo, char KiloCh0, char KiloCh1>
|