- un-const-ify some functions.

This commit is contained in:
Christoph Oelckers 2017-04-12 14:40:29 +02:00
parent abc4481431
commit 63eb3e331e
3 changed files with 22 additions and 23 deletions

View file

@ -209,7 +209,7 @@ bool PType::ReadValue(FSerializer &ar, const char *key, void *addr) const
//
//==========================================================================
void PType::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *stroffs) const
void PType::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *stroffs)
{
}
@ -219,7 +219,7 @@ void PType::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset>
//
//==========================================================================
void PType::SetPointer(void *base, unsigned offset, TArray<size_t> *stroffs) const
void PType::SetPointer(void *base, unsigned offset, TArray<size_t> *stroffs)
{
}
@ -1068,7 +1068,7 @@ bool PString::ReadValue(FSerializer &ar, const char *key, void *addr) const
//
//==========================================================================
void PString::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const
void PString::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
{
if (base != nullptr) new((uint8_t *)base + offset) FString;
if (special != nullptr)
@ -1444,7 +1444,7 @@ PObjectPointer::PObjectPointer(PClass *cls, bool isconst)
//
//==========================================================================
void PObjectPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *special) const
void PObjectPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *special)
{
// Add to the list of pointers for this class.
special->Push(offset);
@ -1612,7 +1612,7 @@ bool PClassPointer::isCompatible(PType *type)
//
//==========================================================================
void PClassPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *special) const
void PClassPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *special)
{
// Class pointers do not get added to FlatPointers because they are released from the GC.
}
@ -1829,7 +1829,7 @@ bool PArray::ReadValue(FSerializer &ar, const char *key, void *addr) const
//
//==========================================================================
void PArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const
void PArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
{
for (unsigned i = 0; i < ElementCount; ++i)
{
@ -1843,7 +1843,7 @@ void PArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset>
//
//==========================================================================
void PArray::SetPointer(void *base, unsigned offset, TArray<size_t> *special) const
void PArray::SetPointer(void *base, unsigned offset, TArray<size_t> *special)
{
for (unsigned i = 0; i < ElementCount; ++i)
{
@ -2067,7 +2067,7 @@ void PDynArray::DestroyValue(void *addr) const
//
//==========================================================================
void PDynArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const
void PDynArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
{
if (base != nullptr) memset((char*)base + offset, 0, sizeof(FArray)); // same as constructing an empty array.
if (special != nullptr)
@ -2312,7 +2312,7 @@ PStruct::PStruct(FName name, PTypeBase *outer)
//
//==========================================================================
void PStruct::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const
void PStruct::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
{
for (const PField *field : Fields)
{
@ -2329,7 +2329,7 @@ void PStruct::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset
//
//==========================================================================
void PStruct::SetPointer(void *base, unsigned offset, TArray<size_t> *special) const
void PStruct::SetPointer(void *base, unsigned offset, TArray<size_t> *special)
{
for (const PField *field : Fields)
{

View file

@ -123,8 +123,8 @@ public:
// and destruction (e.g. strings) can add their offsets to it for special
// initialization when the object is created and destruction when the
// object is destroyed.
virtual void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special=NULL) const;
virtual void SetPointer(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const;
virtual void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special=NULL);
virtual void SetPointer(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL);
virtual void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const;
// Initialize the value, if needed (e.g. strings)
@ -312,7 +312,7 @@ public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special=NULL) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special=NULL) override;
void InitializeValue(void *addr, const void *def) const override;
void DestroyValue(void *addr) const override;
};
@ -427,7 +427,7 @@ public:
void WriteValue(FSerializer &ar, const char *key, const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) override;
PClass *PointedClass() const;
};
@ -444,7 +444,7 @@ public:
void WriteValue(FSerializer &ar, const char *key, const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) override;
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
};
@ -479,8 +479,8 @@ public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) override;
protected:
PArray();
@ -513,7 +513,7 @@ public:
void WriteValue(FSerializer &ar, const char *key, const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) override;
void InitializeValue(void *addr, const void *def) const override;
void DestroyValue(void *addr) const override;
void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const override;
@ -546,7 +546,7 @@ public:
TArray<PField *> Fields;
bool HasNativeFields;
// Some internal structs require explicit construction and destruction of fields the VM cannot handle directly so use thes two functions for it.
// Some internal structs require explicit construction and destruction of fields the VM cannot handle directly so use these two functions for it.
VMFunction *mConstructor = nullptr;
VMFunction *mDestructor = nullptr;
@ -555,8 +555,8 @@ public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *specials) const override;
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *specials) override;
static void WriteFields(FSerializer &ar, const void *addr, const TArray<PField *> &fields);
bool ReadFields(FSerializer &ar, void *addr) const;
@ -565,7 +565,6 @@ protected:
};
// a native struct will always be abstract and cannot be instantiated. All variables are references.
// In addition, native structs can have methods (but no virtual ones.)
class PNativeStruct : public PStruct
{
DECLARE_CLASS(PNativeStruct, PStruct);

View file

@ -82,7 +82,7 @@ public:
{
}
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) const override
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override
{
if (base != nullptr) new((uint8_t *)base + offset) FActorInfo;
if (special != nullptr)