mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 06:15:32 +00:00
Improve constness of the Nif RecordPtr structs
This commit is contained in:
parent
8e24cab935
commit
fb0ee7f2fc
1 changed files with 15 additions and 3 deletions
|
@ -71,16 +71,26 @@ public:
|
|||
}
|
||||
|
||||
/// Look up the actual object from the index
|
||||
X* getPtr() const
|
||||
const X* getPtr() const
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
return ptr;
|
||||
}
|
||||
X& get() const
|
||||
X* getPtr()
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
const X& get() const
|
||||
{ return *getPtr(); }
|
||||
X& get()
|
||||
{ return *getPtr(); }
|
||||
|
||||
/// Syntactic sugar
|
||||
X* operator->() const
|
||||
const X* operator->() const
|
||||
{ return getPtr(); }
|
||||
X* operator->()
|
||||
{ return getPtr(); }
|
||||
|
||||
/// Pointers are allowed to be empty
|
||||
|
@ -116,6 +126,8 @@ public:
|
|||
|
||||
const Ptr& operator[](size_t index) const
|
||||
{ return list.at(index); }
|
||||
Ptr& operator[](size_t index)
|
||||
{ return list.at(index); }
|
||||
|
||||
size_t length() const
|
||||
{ return list.size(); }
|
||||
|
|
Loading…
Reference in a new issue