mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-12 02:55:05 +00:00
19
include/rstl/StringExtras.hpp
Normal file
19
include/rstl/StringExtras.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _RSTL_STRINGEXTRAS
|
||||
#define _RSTL_STRINGEXTRAS
|
||||
|
||||
#include "rstl/string.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CStringExtras {
|
||||
public:
|
||||
static int IndexOfSubstring(const rstl::string&, const rstl::string&);
|
||||
static int CompareCaseInsensitive(const rstl::string&, const rstl::string&);
|
||||
static char ConvertToUpperCase(char c);
|
||||
static rstl::string CreateFromInteger(int v);
|
||||
static rstl::string ConvertToANSI(const rstl::wstring& str);
|
||||
static rstl::wstring ConvertToUNICODE(const rstl::string& str);
|
||||
static rstl::string ReadString(CInputStream& in);
|
||||
static rstl::vector<rstl::string> TokenizeString(const rstl::string&, const char*, int);
|
||||
};
|
||||
|
||||
#endif // _RSTL_STRINGEXTRAS
|
||||
@@ -8,6 +8,7 @@ class CRefData {
|
||||
public:
|
||||
CRefData(const void* ptr) : x0_ptr(ptr), x4_refCount(1) {}
|
||||
CRefData(const void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {}
|
||||
~CRefData() {}
|
||||
|
||||
void* GetPtr() const { return const_cast< void* >(x0_ptr); }
|
||||
int GetRefCount() const { return x4_refCount; }
|
||||
|
||||
@@ -26,6 +26,7 @@ class basic_string {
|
||||
uint x8_size;
|
||||
uint _pad; // Alloc?
|
||||
|
||||
void internal_prepare_to_write(int len, bool);
|
||||
void internal_allocate(int size);
|
||||
// {
|
||||
// x4_cow = reinterpret_cast<COWData*>(new uchar[size * sizeof(_CharTp) +
|
||||
@@ -99,6 +100,8 @@ public:
|
||||
~basic_string() { internal_dereference(); }
|
||||
|
||||
size_t size() const { return x8_size; }
|
||||
void reserve(int len) { internal_prepare_to_write(len, true); }
|
||||
|
||||
void assign(const basic_string&);
|
||||
basic_string& operator=(const basic_string& other) {
|
||||
assign(other);
|
||||
@@ -107,13 +110,15 @@ public:
|
||||
basic_string operator+(const _CharTp*);
|
||||
void append(const basic_string& other);
|
||||
void append(int, _CharTp);
|
||||
void append(const _CharTp*, int);
|
||||
|
||||
int _eq_helper(const basic_string& other) const;
|
||||
bool operator==(const basic_string& other) const;
|
||||
bool operator<(const basic_string& other) const;
|
||||
|
||||
const char* data() const { return x0_ptr; }
|
||||
const _CharTp* data() const { return x0_ptr; }
|
||||
void PutTo(COutputStream& out) const;
|
||||
const _CharTp at(int idx) const { return data()[idx]; }
|
||||
};
|
||||
|
||||
template < typename _CharTp, typename Traits, typename Alloc >
|
||||
|
||||
Reference in New Issue
Block a user