RIP tp::Strings
This commit is contained in:
parent
fa2d0aaa92
commit
1756ca026d
90 changed files with 419 additions and 1475 deletions
|
|
@ -16,8 +16,8 @@ namespace obj {
|
|||
|
||||
static void from_int(BoolObject* self, tp::alni in);
|
||||
static void from_float(BoolObject* self, tp::alnf in);
|
||||
static void from_string(BoolObject* self, tp::String in);
|
||||
static tp::String to_string(BoolObject* self);
|
||||
static void from_string(BoolObject* self, const std::string& in);
|
||||
static std::string to_string(BoolObject* self);
|
||||
static tp::alni to_int(BoolObject* self);
|
||||
static tp::alnf to_float(BoolObject* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ namespace obj {
|
|||
|
||||
DictObject* members;
|
||||
|
||||
void addMember(Object* obj, tp::String id);
|
||||
void createMember(tp::String type, tp::String id);
|
||||
void addMember(Object* obj, const std::string& id);
|
||||
void createMember(const std::string& type, const std::string& id);
|
||||
|
||||
template<typename Type>
|
||||
Type* createMember(tp::String id) {
|
||||
Type* createMember(const std::string& id) {
|
||||
auto out = NDO->create(Type::TypeData.name);
|
||||
addMember(out, id);
|
||||
NDO->destroy(out);
|
||||
|
|
@ -28,7 +28,7 @@ namespace obj {
|
|||
}
|
||||
|
||||
template<typename Type>
|
||||
Type* getMember(const tp::String& id) {
|
||||
Type* getMember(const std::string& id) {
|
||||
auto idx = members->presents(id);
|
||||
if (bool(idx)) {
|
||||
return ((Type*)obj::ndo_cast(members->getSlotVal(idx), &Type::TypeData));
|
||||
|
|
@ -37,7 +37,7 @@ namespace obj {
|
|||
}
|
||||
|
||||
template<typename Type>
|
||||
Type* getMemberAssert(const tp::String& id) {
|
||||
Type* getMemberAssert(const std::string& id) {
|
||||
auto out = getMember<Type>(id);
|
||||
assert(out && "invalid member access");
|
||||
return out;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace obj {
|
|||
|
||||
static void from_int(ColorObject* self, tp::alni in);
|
||||
static void from_float(ColorObject* self, tp::alnf in);
|
||||
static tp::String to_string(ColorObject* self);
|
||||
static std::string to_string(ColorObject* self);
|
||||
|
||||
static ColorObject* create(tp::RGBA in);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ namespace obj {
|
|||
static tp::alni allocated_size(DictObject* self);
|
||||
static tp::alni allocated_size_recursive(DictObject* self);
|
||||
|
||||
void put(tp::String, Object*);
|
||||
void remove(tp::String);
|
||||
Object* get(tp::String);
|
||||
tp::Map<tp::String, Object*>::Idx presents(tp::String);
|
||||
Object* getSlotVal(tp::Map<tp::String, Object*>::Idx);
|
||||
void put(const std::string&, Object*);
|
||||
void remove(const std::string&);
|
||||
Object* get(const std::string&);
|
||||
tp::Map<std::string, Object*>::Idx presents(const std::string&);
|
||||
Object* getSlotVal(tp::Map<std::string, Object*>::Idx);
|
||||
|
||||
const tp::Map<tp::String, Object*>& getItems() const;
|
||||
[[nodiscard]] const tp::Map<std::string, Object*>& getItems() const;
|
||||
|
||||
private:
|
||||
tp::Map<tp::String, Object*> items;
|
||||
tp::Map<std::string, Object*> items;
|
||||
};
|
||||
};
|
||||
|
|
@ -23,8 +23,8 @@ namespace obj {
|
|||
|
||||
static void from_int(EnumObject* self, tp::alni in);
|
||||
static void from_float(EnumObject* self, tp::alnf in);
|
||||
static void from_string(EnumObject* self, tp::String in);
|
||||
static tp::String to_string(EnumObject* self);
|
||||
static void from_string(EnumObject* self, const std::string& in);
|
||||
static std::string to_string(EnumObject* self);
|
||||
static tp::alni to_int(EnumObject* self);
|
||||
static tp::alnf to_float(EnumObject* self);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace obj {
|
|||
|
||||
static void from_int(FloatObject* self, tp::alni in);
|
||||
static void from_float(FloatObject* self, tp::alnf in);
|
||||
static void from_string(FloatObject* self, tp::String in);
|
||||
static tp::String to_string(FloatObject* self);
|
||||
static void from_string(FloatObject* self, const std::string& in);
|
||||
static std::string to_string(FloatObject* self);
|
||||
static tp::alni to_int(FloatObject* self);
|
||||
static tp::alnf to_float(FloatObject* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace obj {
|
|||
static void constructor(InterpreterObject* self);
|
||||
static void load(ArchiverIn& file_self, InterpreterObject* self);
|
||||
|
||||
void exec(obj::ClassObject* self = NULL, tp::InitialierList<Interpreter::GlobalDef> globals = {});
|
||||
void exec(obj::ClassObject* self = nullptr, tp::InitialierList<Interpreter::GlobalDef> globals = {});
|
||||
void debug();
|
||||
bool running();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ namespace obj {
|
|||
|
||||
static void from_int(Object* self, tp::alni in);
|
||||
static void from_float(Object* self, tp::alnf in);
|
||||
static void from_string(Object* self, tp::String in);
|
||||
static tp::String to_string(Object* self);
|
||||
static void from_string(Object* self, const std::string& in);
|
||||
static std::string to_string(Object* self);
|
||||
static tp::alni to_int(Object* self);
|
||||
static tp::alnf to_float(Object* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace obj {
|
|||
static void save(ListObject* self, ArchiverOut& file_self);
|
||||
static tp::alni save_size(ListObject* self);
|
||||
|
||||
const tp::List<Object*>& getItems() const;
|
||||
[[nodiscard]] const tp::List<Object*>& getItems() const;
|
||||
|
||||
void pushBack(Object* obj);
|
||||
void pushFront(Object* obj);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,6 @@ namespace obj {
|
|||
|
||||
void compile();
|
||||
|
||||
static MethodObject* create(tp::String script);
|
||||
static MethodObject* create(const std::string& script);
|
||||
};
|
||||
};
|
||||
|
|
@ -6,18 +6,18 @@
|
|||
namespace obj {
|
||||
|
||||
struct StringObject : Object {
|
||||
tp::String val;
|
||||
std::string val;
|
||||
|
||||
static ObjectType TypeData;
|
||||
static void constructor(Object* self);
|
||||
static void destructor(StringObject* self);
|
||||
static void copy(Object* self, const Object* in);
|
||||
static StringObject* create(tp::String in);
|
||||
static StringObject* create(const std::string& in);
|
||||
|
||||
static void from_int(StringObject* self, tp::alni in);
|
||||
static void from_float(StringObject* self, tp::alnf in);
|
||||
static void from_string(StringObject* self, tp::String in);
|
||||
static tp::String to_string(StringObject* self);
|
||||
static void from_string(StringObject* self, const std::string& in);
|
||||
static std::string to_string(StringObject* self);
|
||||
static tp::alni to_int(StringObject* self);
|
||||
static tp::alnf to_float(StringObject* self);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue