Loading...
Searching...
No Matches
BaseContainerTools Interface Reference

Static Public Member Functions

static proto bool WriteToWidget (BaseContainer cont, Widget w, string varName)
 Fills the specified UI widget with the value from the container (supports boolean, scalar, and integer properties)
 
static proto bool ReadFromWidget (BaseContainer cont, Widget w, string varName)
 Reads the value from the specified UI widget and stores it in the container (supports boolean, scalar, and integer properties)
 
static proto void WriteToInstance (notnull Class inst, BaseContainer src)
 Copies properties from the container to the instance (the instance's class must match the container's class)
 
static proto void ReadFromInstance (notnull Class inst, BaseContainer src)
 Copies properties from the instance to the container (the instance's class must match the container's class)
 
static proto bool ReadPropertyFromInstance (notnull Class inst, string propertyName, out void val)
 Reads a property value from an instance member (member must be exposed as container property)
 
static proto bool WritePropertyToInstance (notnull Class inst, string propertyName, void val)
 Writes a property value to an instance member (member must be exposed as container property)
 
static proto ref Resource LoadContainer (ResourceName resourceName)
 Load BaseContainer from file.
 
static proto ref Resource CreateContainer (string typeClass)
 Create BaseContainer from object.
 
static proto bool SaveContainer (BaseContainer cont, ResourceName resourceName, string fileName="")
 Save BaseContainer to file.
 
static proto ref Resource CreateContainerFromInstance (notnull Managed instance)
 Create BaseContainer from object.
 
static proto ref Managed CreateInstanceFromContainer (BaseContainer src)
 Create object from BaseContainer.
 

Member Function Documentation

◆ CreateContainer()

static proto ref Resource BaseContainerTools.CreateContainer ( string typeClass)
static

Create BaseContainer from object.

class TestingClass
{
float m_float1;
float m_float2;
};
Resource holder = BaseContainerTools.CreateContainer("TestingClass");
if (holder)
{
}
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
Definition Attribute.c:13
An Attribute for BaseContainer.
Definition BaseContainerProps.c:51
Definition BaseContainerTools.c:13
static proto ref Resource CreateContainer(string typeClass)
Create BaseContainer from object.
Definition BaseContainer.c:13
proto external string GetClassName()
proto external BaseContainer ToBaseContainer()
Object holding reference to resource.
Definition Resource.c:25
proto external BaseResourceObject GetResource()

◆ CreateContainerFromInstance()

static proto ref Resource BaseContainerTools.CreateContainerFromInstance ( notnull Managed instance)
static

Create BaseContainer from object.

class TestingClass
{
float m_float1;
float m_float2;
};
// save config
TestingClass obj = new TestingClass();
obj.m_float1 = 654.1;
obj.m_float2 = 996.9;
// save config
if (holder)
{
BaseContainerTools.SaveContainer(holder.GetResource().ToBaseContainer(), "{86C36D99914265F8}test.conf");
}
static proto ref Resource CreateContainerFromInstance(notnull Managed instance)
Create BaseContainer from object.
static proto bool SaveContainer(BaseContainer cont, ResourceName resourceName, string fileName="")
Save BaseContainer to file.

◆ CreateInstanceFromContainer()

static proto ref Managed BaseContainerTools.CreateInstanceFromContainer ( BaseContainer src)
static

Create object from BaseContainer.

class TestingClass
{
float m_float1;
float m_float2;
};
// load config
Resource holder = BaseContainerTools.LoadContainer("{86C36D99914265F8}test.conf");
if (holder)
{
TestingClass obj = TestingClass.Cast(BaseContainerTools.CreateInstanceFromContainer(holder.GetResource().ToBaseContainer()));
if (obj)
{
Print(obj.m_float1);
Print(obj.m_float2);
}
}
static proto ref Resource LoadContainer(ResourceName resourceName)
Load BaseContainer from file.
static proto ref Managed CreateInstanceFromContainer(BaseContainer src)
Create object from BaseContainer.

◆ LoadContainer()

static proto ref Resource BaseContainerTools.LoadContainer ( ResourceName resourceName)
static

Load BaseContainer from file.

// load config
Resource holder = BaseContainerTools.LoadContainer("{86C36D99914265F8}test.conf");
if (holder)
{
}

◆ ReadFromInstance()

static proto void BaseContainerTools.ReadFromInstance ( notnull Class inst,
BaseContainer src )
static

Copies properties from the instance to the container (the instance's class must match the container's class)

◆ ReadFromWidget()

static proto bool BaseContainerTools.ReadFromWidget ( BaseContainer cont,
Widget w,
string varName )
static

Reads the value from the specified UI widget and stores it in the container (supports boolean, scalar, and integer properties)

◆ ReadPropertyFromInstance()

static proto bool BaseContainerTools.ReadPropertyFromInstance ( notnull Class inst,
string propertyName,
out void val )
static

Reads a property value from an instance member (member must be exposed as container property)

◆ SaveContainer()

static proto bool BaseContainerTools.SaveContainer ( BaseContainer cont,
ResourceName resourceName,
string fileName = "" )
static

Save BaseContainer to file.

class TestingClass
{
float m_float1;
float m_float2;
};
// save config
TestingClass obj = new TestingClass();
obj.m_float1 = 654.1;
obj.m_float2 = 996.9;
// save config
if (holder)
{
BaseContainerTools.SaveContainer(holder.GetResource().ToBaseContainer(), "{86C36D99914265F8}test.conf");
}

◆ WritePropertyToInstance()

static proto bool BaseContainerTools.WritePropertyToInstance ( notnull Class inst,
string propertyName,
void val )
static

Writes a property value to an instance member (member must be exposed as container property)

◆ WriteToInstance()

static proto void BaseContainerTools.WriteToInstance ( notnull Class inst,
BaseContainer src )
static

Copies properties from the container to the instance (the instance's class must match the container's class)

◆ WriteToWidget()

static proto bool BaseContainerTools.WriteToWidget ( BaseContainer cont,
Widget w,
string varName )
static

Fills the specified UI widget with the value from the container (supports boolean, scalar, and integer properties)


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