UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_parse.h File Reference

Go to the source code of this file.

Macros

#define V_UI_MASK   0x8F00
 
#define V_UI   0x8000
 
#define V_NOT_UI   0
 
#define V_UI_ACTION   (V_UI + 0)
 
#define V_UI_EXCLUDERECT   (V_UI + 1)
 
#define V_UI_SPRITEREF   (V_UI + 3)
 
#define V_UI_IF   (V_UI + 4)
 
#define V_UI_DATAID   (V_UI + 5)
 
#define V_UI_CVAR   (V_UI + 0x0100)
 
#define V_UI_REF   (V_UI + 0x0200)
 
#define V_UI_NODEMETHOD   (V_UI + 0x0400)
 
#define V_UI_NODEMETHOD_LUA   (V_UI + 0x0800)
 
#define V_UI_ALIGN   V_INT
 
#define V_CVAR_OR_FLOAT   (V_UI_CVAR + V_FLOAT)
 
#define V_CVAR_OR_STRING   (V_UI_CVAR + V_STRING)
 
#define V_CVAR_OR_LONGSTRING   (V_UI_CVAR + V_LONGSTRING)
 
#define V_REF_OF_STRING   (V_UI_REF + V_STRING)
 

Functions

bool UI_ParseWindow (const char *type, const char *name, const char **text)
 Parse a window. More...
 
bool UI_ParseComponent (const char *type, const char *name, const char **text)
 Parse a component. More...
 
bool UI_ParseSprite (const char *name, const char **text)
 
bool UI_ParseUIModel (const char *name, const char **text)
 parses the models.ufo and all files where UI models (menu_model) are defined More...
 
float UI_GetReferenceFloat (uiNode_t const *node, const void *ref)
 Returns the value of the reference variable. More...
 
const char * UI_GetReferenceString (uiNode_t const *node, const char *ref) __attribute__((warn_unused_result))
 
const value_tUI_FindPropertyByName (const value_t *propertyList, const char *name) __attribute__((warn_unused_result))
 Find a value_t by name into a array of value_t. More...
 
char * UI_AllocStaticString (const char *string, int size) __attribute__((warn_unused_result))
 Allocate a string into the UI static memory. More...
 
float * UI_AllocStaticFloat (int count) __attribute__((warn_unused_result))
 Allocate a float into the UI static memory. More...
 
vec4_tUI_AllocStaticColor (int count) __attribute__((warn_unused_result))
 Allocate a color into the UI static memory. More...
 
struct uiAction_sUI_AllocStaticAction (void) __attribute__((warn_unused_result))
 Allocate an action. More...
 
bool UI_InitRawActionValue (struct uiAction_s *action, uiNode_t *node, const struct value_s *property, const char *string)
 
bool UI_TokenIsReserved (const char *name)
 
bool UI_TokenIsName (const char *name, bool isQuoted)
 

Macro Definition Documentation

#define V_CVAR_OR_FLOAT   (V_UI_CVAR + V_FLOAT)
#define V_CVAR_OR_LONGSTRING   (V_UI_CVAR + V_LONGSTRING)
#define V_NOT_UI   0
#define V_REF_OF_STRING   (V_UI_REF + V_STRING)

Definition at line 71 of file ui_parse.h.

#define V_UI   0x8000

bit identity an UI type

Definition at line 52 of file ui_parse.h.

Referenced by UI_NodeSetProperty(), and UI_ParseProperty().

#define V_UI_ALIGN   V_INT

Definition at line 65 of file ui_parse.h.

Referenced by UI_RegisterAbstractNode().

#define V_UI_DATAID   (V_UI + 5)

Definition at line 58 of file ui_parse.h.

Referenced by UI_ParseProperty(), UI_RegisterAbstractOptionNode(), and UI_RegisterTextNode().

#define V_UI_EXCLUDERECT   (V_UI + 1)

Identify a special attribute, use special parse function

Definition at line 55 of file ui_parse.h.

Referenced by UI_ParseProperty(), and UI_RegisterAbstractNode().

#define V_UI_IF   (V_UI + 4)

Identify a special attribute, use special parse function

Definition at line 57 of file ui_parse.h.

Referenced by UI_ParseProperty(), and UI_RegisterAbstractNode().

#define V_UI_MASK   0x8F00
Todo:
we should split/flag parse type (type need only 1 lex; and other)

Mask for all UI bits

Definition at line 51 of file ui_parse.h.

Referenced by UI_DeleteNode(), UI_GetFloatFromNodeProperty(), UI_GetStringFromNodeProperty(), UI_InitRawActionValue(), UI_NodeSetProperty(), UI_NodeSetPropertyFromActionValue(), UI_NodeSetPropertyFromRAW(), and UI_ParseProperty().

#define V_UI_NODEMETHOD   (V_UI + 0x0400)
#define V_UI_NODEMETHOD_LUA   (V_UI + 0x0800)

Properti is a lua based function

Definition at line 62 of file ui_parse.h.

Referenced by UI_ExecuteCallAction(), and UI_GetPropertyOrLuaMethod().

#define V_UI_REF   (V_UI + 0x0200)

Property is a ref into a value (mix this flag with base type, see bellow)

Definition at line 60 of file ui_parse.h.

Referenced by UI_ParseProperty().

Function Documentation

struct uiAction_s* UI_AllocStaticAction ( void  )
vec4_t* UI_AllocStaticColor ( int  count)

Allocate a color into the UI static memory.

Note
Its not a dynamic memory allocation. Please only use it at the loading time
Parameters
[in]countnumber of element need to allocate
Todo:
Assert out when we are not in parsing/loading stage

Definition at line 187 of file ui_parse.cpp.

References Com_Error(), count, ERR_FATAL, and UI_AllocHunkMemory().

float* UI_AllocStaticFloat ( int  count)

Allocate a float into the UI static memory.

Note
Its not a dynamic memory allocation. Please only use it at the loading time
Parameters
[in]countnumber of element need to allocate
Todo:
Assert out when we are not in parsing/loading stage

Definition at line 171 of file ui_parse.cpp.

References Com_Error(), count, ERR_FATAL, and UI_AllocHunkMemory().

Referenced by UI_CloneCvarOrFloat(), and UI_InitCvarOrFloat().

char* UI_AllocStaticString ( const char *  string,
int  size 
)

Allocate a string into the UI static memory.

Note
Its not a dynamic memory allocation. Please only use it at the loading time
Parameters
[in]stringUse to initialize the string
[in]sizerequest a fixed memory size, if 0 the string size is used
Todo:
Assert out when we are not in parsing/loading stage

Definition at line 204 of file ui_parse.cpp.

References Com_Error(), ERR_FATAL, Q_strncpyz(), and UI_AllocHunkMemory().

Referenced by uiModelNode::clone(), uiModelNode::doLayout(), UI_AutoGenerateSprite(), UI_InitRawActionValue(), UI_ParseActionList(), UI_ParseSetAction(), and UI_ParseValueExpression().

const value_t* UI_FindPropertyByName ( const value_t propertyList,
const char *  name 
)

Find a value_t by name into a array of value_t.

Parameters
[in]propertyListArray of value_t, with null termination
[in]nameProperty name we search
Returns
A value_t with the requested name, else nullptr

Definition at line 154 of file ui_parse.cpp.

References Q_strcasecmp, and value_s::string.

Referenced by UI_MaterialEditorChangeValue_f(), UI_ParseSprite(), and UI_ParseUIModel().

float UI_GetReferenceFloat ( const uiNode_t *const  node,
const void ref 
)

Returns the value of the reference variable.

Note
A reference variable is either a pointer to a float or a pointer to a string. In case of a pointer to a string, a Cvar name is expected, starting with "*cvar".
See also
uiAbstractValueNode

Definition at line 1434 of file ui_parse.cpp.

References Cvar_GetValue(), and Q_strstart().

Referenced by uiAbstractValueNode::decValue(), uiAbstractValueNode::getDelta(), uiAbstractValueNode::getMax(), uiAbstractValueNode::getMin(), uiAbstractValueNode::getValue(), uiAbstractValueNode::incValue(), uiRadioButtonNode::onActivate(), uiAbstractValueNode::setDelta(), uiAbstractValueNode::setMax(), uiAbstractValueNode::setMin(), uiAbstractValueNode::setValue(), UI_GetStringFromNodeProperty(), and UI_RadioButtonNodeIsSelected().

bool UI_InitRawActionValue ( struct uiAction_s action,
uiNode_t node,
const struct value_s property,
const char *  string 
)
bool UI_ParseComponent ( const char *  type,
const char *  name,
const char **  text 
)
bool UI_ParseSprite ( const char *  name,
const char **  text 
)
bool UI_ParseWindow ( const char *  type,
const char *  name,
const char **  text 
)
bool UI_TokenIsName ( const char *  name,
bool  isQuoted 
)
bool UI_TokenIsReserved ( const char *  name)