mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* all except pol * pol and includes under defines * something weird has happened * remove own folder from include searchpath * fixed remaining, adapted include style for external headers * missing include
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "clib/fixalloc.h"
|
|
#include "clib/refptr.h"
|
|
#include "bscript/bobjectimp.h"
|
|
|
|
#include <string>
|
|
|
|
namespace Pol::Bscript
|
|
{
|
|
class UninitObject final : public BObjectImp
|
|
{
|
|
public:
|
|
UninitObject();
|
|
UninitObject( const UninitObject& i );
|
|
|
|
static UninitObject* SharedInstance;
|
|
static ref_ptr<BObjectImp> SharedInstanceOwner;
|
|
static BObjectRef SharedInstanceRef;
|
|
|
|
BObjectImp* copy() const override;
|
|
size_t sizeEstimate() const override;
|
|
std::string getStringRep() const override { return "<uninitialized object>"; }
|
|
|
|
bool isTrue() const override;
|
|
bool operator==( const BObjectImp& objimp ) const override;
|
|
bool operator<( const BObjectImp& objimp ) const override;
|
|
|
|
void* operator new( std::size_t len );
|
|
void operator delete( void* );
|
|
|
|
static UninitObject* create() { return SharedInstance; }
|
|
static void ReleaseSharedInstance()
|
|
{
|
|
SharedInstanceOwner.clear();
|
|
SharedInstance = nullptr;
|
|
}
|
|
};
|
|
extern Clib::fixed_allocator<UninitObject, 256> uninit_alloc;
|
|
|
|
inline void* UninitObject::operator new( std::size_t /*len*/ )
|
|
{
|
|
return uninit_alloc.allocate();
|
|
}
|
|
|
|
inline void UninitObject::operator delete( void* p )
|
|
{
|
|
uninit_alloc.deallocate( p );
|
|
}
|
|
} // namespace Pol::Bscript
|