Make a lot of one-liner functions inline
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -52,19 +52,19 @@ namespace Porygon::UserData {
|
||||
delete _concatenation;
|
||||
}
|
||||
|
||||
bool ContainsField(uint32_t fieldId) const{
|
||||
inline bool ContainsField(uint32_t fieldId) const{
|
||||
return _fields.find(fieldId) != _fields.end();
|
||||
}
|
||||
|
||||
UserDataField *GetField(uint32_t fieldId) const {
|
||||
inline UserDataField *GetField(uint32_t fieldId) const {
|
||||
return _fields.at(fieldId);
|
||||
}
|
||||
|
||||
void CreateField(uint32_t fieldId, UserDataField *field) {
|
||||
inline void CreateField(uint32_t fieldId, UserDataField *field) {
|
||||
_fields.insert({fieldId, field});
|
||||
}
|
||||
|
||||
int32_t GetFieldCount() const{
|
||||
inline int32_t GetFieldCount() const{
|
||||
return _fields.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,23 +16,23 @@ namespace Porygon::UserData{
|
||||
: _type(shared_ptr<ScriptType>(type)), _get(getter), _set(setter){
|
||||
}
|
||||
|
||||
shared_ptr<ScriptType> GetType(){
|
||||
inline shared_ptr<ScriptType> GetType(){
|
||||
return _type;
|
||||
}
|
||||
|
||||
bool HasGetter(){
|
||||
inline bool HasGetter(){
|
||||
return _get != nullptr;
|
||||
}
|
||||
|
||||
Evaluation::EvalValue* Get(void* obj){
|
||||
inline Evaluation::EvalValue* Get(void* obj){
|
||||
return this ->_get(obj);
|
||||
}
|
||||
|
||||
bool HasSetter(){
|
||||
inline bool HasSetter(){
|
||||
return _set != nullptr;
|
||||
}
|
||||
|
||||
void Set(void* obj, Evaluation::EvalValue* val){
|
||||
inline void Set(void* obj, Evaluation::EvalValue* val){
|
||||
this->_set(obj, val);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Porygon::UserData{
|
||||
|
||||
}
|
||||
|
||||
Evaluation::EvalValue* Call(Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
inline Evaluation::EvalValue* Call(Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
return _call(_obj, parameters, parameterCount);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Porygon::UserData{
|
||||
return new UserDataFunctionOption(rt, p);
|
||||
}
|
||||
|
||||
static UserDataFunctionOption* FromRawPointers(ScriptType* returnType){
|
||||
inline static UserDataFunctionOption* FromRawPointers(ScriptType* returnType){
|
||||
auto rt = shared_ptr<ScriptType>(returnType);
|
||||
return new UserDataFunctionOption(rt, {});
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Porygon::UserData{
|
||||
|
||||
|
||||
|
||||
const bool IsScriptFunction() const final{
|
||||
inline const bool IsScriptFunction() const final{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Porygon::UserData {
|
||||
return _func(_parent, b);
|
||||
}
|
||||
|
||||
const shared_ptr<ScriptType> GetSecondParameterType() const{
|
||||
inline const shared_ptr<ScriptType> GetSecondParameterType() const{
|
||||
return _secondParameter;
|
||||
}
|
||||
|
||||
const shared_ptr<ScriptType> GetReturnType() const{
|
||||
inline const shared_ptr<ScriptType> GetReturnType() const{
|
||||
return _returnType;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace Porygon::UserData {
|
||||
return _userData->ContainsField(str->GetHashValue());
|
||||
}
|
||||
|
||||
const bool CanBeIndexedWithIdentifier(uint32_t hash) const final {
|
||||
inline const bool CanBeIndexedWithIdentifier(uint32_t hash) const final {
|
||||
return _userData -> ContainsField(hash);
|
||||
}
|
||||
|
||||
UserDataField *GetField(uint32_t id) {
|
||||
inline UserDataField *GetField(uint32_t id) {
|
||||
return _userData->GetField(id);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Porygon::UserData {
|
||||
throw "TODO: indexing with dynamic keys";
|
||||
}
|
||||
|
||||
const shared_ptr<ScriptType> GetIndexedType(uint32_t hash) const final {
|
||||
inline const shared_ptr<ScriptType> GetIndexedType(uint32_t hash) const final {
|
||||
return _userData->GetField(hash)->GetType();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,11 +43,11 @@ namespace Porygon::UserData {
|
||||
_internal._userData.clear();
|
||||
}
|
||||
|
||||
static bool HasUserDataType(uint32_t i) {
|
||||
inline static bool HasUserDataType(uint32_t i) {
|
||||
return UserDataStorage::_internal._userData.find(i) != UserDataStorage::_internal._userData.end();
|
||||
}
|
||||
|
||||
static UserData* GetUserDataType(uint32_t i) {
|
||||
inline static UserData* GetUserDataType(uint32_t i) {
|
||||
return UserDataStorage::_internal._userData[i];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Porygon::UserData {
|
||||
_obj = obj;
|
||||
}
|
||||
|
||||
const TypeClass GetTypeClass() const final {
|
||||
inline const TypeClass GetTypeClass() const final {
|
||||
return TypeClass::UserData;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace Porygon::UserData {
|
||||
return _obj == ((UserDataValue *) b)->_obj;
|
||||
}
|
||||
|
||||
const shared_ptr<EvalValue> Clone() const final {
|
||||
inline const shared_ptr<EvalValue> Clone() const final {
|
||||
return make_shared<UserDataValue>(_userData, _obj);
|
||||
}
|
||||
|
||||
const std::size_t GetHashCode() const final {
|
||||
inline const std::size_t GetHashCode() const final {
|
||||
return reinterpret_cast<intptr_t>(_obj);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Porygon::UserData {
|
||||
return shared_ptr<EvalValue>(field->Get(_obj));
|
||||
}
|
||||
|
||||
const shared_ptr<EvalValue> IndexValue(uint32_t hash) const final {
|
||||
inline const shared_ptr<EvalValue> IndexValue(uint32_t hash) const final {
|
||||
auto field = _userData->GetField(hash);
|
||||
return shared_ptr<EvalValue>(field->Get(_obj));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace Porygon::UserData {
|
||||
field->Set(_obj, value.get());
|
||||
}
|
||||
|
||||
void* GetObjectPointer(){
|
||||
inline void* GetObjectPointer(){
|
||||
return _obj;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user