Nebula
Loading...
Searching...
No Matches
BaseGameFeature::LevelParser Class Reference

#include <levelparser.h>

Detailed Description

Base class for level parsing.

Entity format is defined as:

{
"level": {
"version": "100"
"entities": {
"[GUID]": {
"name": String,
"components": {
"ComponentName1": VALUE,
"ComponentName2": {
"FieldName1": VALUE,
"FieldName2": VALUE
}
},
},
"[GUID]": {
...
}
}
}
}

(C) 2015-2024 Individual contributors, see AUTHORS file

Inherits Core::RefCounted.

Public Member Functions

 LevelParser ()
 constructor
 
virtual ~LevelParser ()
 destructor
 
void SetWorld (Game::World *world)
 Set the world that we want to load the levels into.
 
bool LoadJsonLevel (const Ptr< IO::JsonReader > &reader)
 Loads a level from a json file in work:levels.
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Protected Member Functions

Game::Entity LoadEntity (const Ptr< IO::JsonReader > &reader)
 parse a single object
 
virtual void BeginLoad ()
 called at beginning of load
 
virtual void AddEntity (Game::Entity entity, Util::Guid const &guid)
 add entity
 
virtual void SetName (Game::Entity entity, const Util::String &name)
 set entity name
 
virtual void CommitEntity (Game::Entity entity)
 entity loaded completely
 
virtual void CommitLevel ()
 parsing done
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 

Private Member Functions

 __DeclareClass (LevelParser)
 

Private Attributes

Util::Array< Util::StringinvalidAttrs
 
Game::Worldworld
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 

Constructor & Destructor Documentation

◆ LevelParser()

BaseGameFeature::LevelParser::LevelParser ( )

constructor

◆ ~LevelParser()

BaseGameFeature::LevelParser::~LevelParser ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

BaseGameFeature::LevelParser::__DeclareClass ( LevelParser )
private

◆ AddEntity()

virtual void BaseGameFeature::LevelParser::AddEntity ( Game::Entity entity,
Util::Guid const & guid )
inlineprotectedvirtual

add entity

◆ BeginLoad()

virtual void BaseGameFeature::LevelParser::BeginLoad ( )
inlineprotectedvirtual

called at beginning of load

◆ CommitEntity()

virtual void BaseGameFeature::LevelParser::CommitEntity ( Game::Entity entity)
inlineprotectedvirtual

entity loaded completely

◆ CommitLevel()

virtual void BaseGameFeature::LevelParser::CommitLevel ( )
inlineprotectedvirtual

parsing done

◆ LoadEntity()

Game::Entity BaseGameFeature::LevelParser::LoadEntity ( const Ptr< IO::JsonReader > & reader)
protected

parse a single object

◆ LoadJsonLevel()

bool BaseGameFeature::LevelParser::LoadJsonLevel ( const Ptr< IO::JsonReader > & reader)

Loads a level from a json file in work:levels.

◆ SetName()

virtual void BaseGameFeature::LevelParser::SetName ( Game::Entity entity,
const Util::String & name )
inlineprotectedvirtual

set entity name

◆ SetWorld()

void BaseGameFeature::LevelParser::SetWorld ( Game::World * world)

Set the world that we want to load the levels into.

Member Data Documentation

◆ invalidAttrs

Util::Array<Util::String> BaseGameFeature::LevelParser::invalidAttrs
private

◆ world

Game::World* BaseGameFeature::LevelParser::world
private

The documentation for this class was generated from the following files: