61 lines
2.1 KiB
C++
61 lines
2.1 KiB
C++
#ifndef TEXTINPUT_STRING_BASE_H
|
|
#define TEXTINPUT_STRING_BASE_H
|
|
|
|
#include <revolution/types.h>
|
|
#include <revolution/mem/allocator.h>
|
|
|
|
namespace textinput {
|
|
namespace tistring {
|
|
class StringBase {
|
|
public:
|
|
StringBase(u16 maxLength) :
|
|
muMaxLength(maxLength),
|
|
muLength(0),
|
|
mpszString(NULL),
|
|
mpszTmpString(NULL),
|
|
mwcCandidate(0),
|
|
mpAllocator(NULL) {}
|
|
|
|
virtual ~StringBase();
|
|
|
|
virtual void create(MEMAllocator* allocator);
|
|
virtual void pushBack(wchar_t ch);
|
|
virtual void popBack();
|
|
virtual void clear();
|
|
virtual u16 getLength() const { return muLength; }
|
|
virtual bool append(const wchar_t* string);
|
|
virtual bool insert(u16, const wchar_t* string);
|
|
virtual void remove(u16, u16);
|
|
virtual void replace(u16, u16, const wchar_t* string);
|
|
|
|
virtual void set(const wchar_t* string);
|
|
virtual void setAt(u16 index, wchar_t ch);
|
|
|
|
virtual void setLength(u16);
|
|
|
|
virtual wchar_t* getWCString() const { return mpszString; }
|
|
|
|
virtual void setCandidate(wchar_t candidate) { mwcCandidate = candidate; }
|
|
virtual wchar_t getCandidate() { return mwcCandidate; }
|
|
virtual bool hasCandidate() const;
|
|
|
|
virtual wchar_t getLastWChar();
|
|
|
|
private:
|
|
u16 muMaxLength; // 0x04
|
|
u16 muLength; // 0x06
|
|
|
|
wchar_t* mpszString; // 0x08
|
|
wchar_t* mpszTmpString; // 0x0C
|
|
|
|
wchar_t mwcCandidate; // 0x10
|
|
|
|
MEMAllocator* mpAllocator; // 0x14
|
|
};
|
|
|
|
class Delocated : public StringBase {};
|
|
}
|
|
}
|
|
|
|
#endif // TEXTINPUT_STRING_BASE_H
|