CUGL 2.1
Cornell University Game Library
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cugl::WidgetValue Class Reference

#include <CUWidgetValue.h>

Public Member Functions

 WidgetValue ()
 
 ~WidgetValue ()
 
bool init (const std::shared_ptr< JsonValue > json)
 
const std::shared_ptr< JsonValuegetJson () const
 

Static Public Member Functions

static std::shared_ptr< WidgetValuealloc (std::shared_ptr< JsonValue > json)
 

Protected Attributes

std::shared_ptr< JsonValuejson
 

Detailed Description

This class represents an externally defined widget that may be used within the scene graph JSON.

This class wraps a JsonValue for the purposes of safe dependency loading.

Constructor & Destructor Documentation

◆ WidgetValue()

cugl::WidgetValue::WidgetValue ( )
inline

Creates a null WidgetValue.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.

◆ ~WidgetValue()

cugl::WidgetValue::~WidgetValue ( )
inline

Deletes this WidgetValue and all of its resources.

If no other references own the descendants of this node, they will all be recursively deleted as well.

Member Function Documentation

◆ alloc()

static std::shared_ptr<WidgetValue> cugl::WidgetValue::alloc ( std::shared_ptr< JsonValue json)
inlinestatic

Returns a newly allocated WidgetValue to wrap the given JsonValue.

Parameters
jsonThe JSON definition of this widget.
Returns
a newly allocated WidgetValue wrapping the provided JsonValue.

◆ getJson()

const std::shared_ptr<JsonValue> cugl::WidgetValue::getJson ( ) const
inline

Returns the JsonValue representation of this widget.

Returns
a shared pointer to the JsonValue representation of this widget.

◆ init()

bool cugl::WidgetValue::init ( const std::shared_ptr< JsonValue json)
inline

Initializes a new WidgetValue to wrap the give JsonValue.

This initializer simply wraps the provided JSON

Parameters
jsonA shared pointer to JsonValue that defines this widget.
Returns
true if the JsonValue is not a nullptr, false otherwise.

Member Data Documentation

◆ json

std::shared_ptr<JsonValue> cugl::WidgetValue::json
protected

The JSON entry representing this widget


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