UFO: Alien Invasion
ui_parse.h File Reference
Include dependency graph for ui_parse.h:

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_s * UI_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

◆ V_CVAR_OR_FLOAT

#define V_CVAR_OR_FLOAT   (V_UI_CVAR + V_FLOAT)

Definition at line 68 of file ui_parse.h.

◆ V_CVAR_OR_LONGSTRING

#define V_CVAR_OR_LONGSTRING   (V_UI_CVAR + V_LONGSTRING)

Definition at line 70 of file ui_parse.h.

◆ V_CVAR_OR_STRING

#define V_CVAR_OR_STRING   (V_UI_CVAR + V_STRING)

Definition at line 69 of file ui_parse.h.

◆ V_NOT_UI

#define V_NOT_UI   0

Definition at line 53 of file ui_parse.h.

◆ V_REF_OF_STRING

#define V_REF_OF_STRING   (V_UI_REF + V_STRING)

Definition at line 71 of file ui_parse.h.

◆ V_UI

#define V_UI   0x8000

bit identity an UI type

Definition at line 52 of file ui_parse.h.

◆ V_UI_ACTION

#define V_UI_ACTION   (V_UI + 0)

Identify an action type into the value_t structure

Definition at line 54 of file ui_parse.h.

◆ V_UI_ALIGN

#define V_UI_ALIGN   V_INT

Definition at line 65 of file ui_parse.h.

◆ V_UI_CVAR

#define V_UI_CVAR   (V_UI + 0x0100)

Property is a CVAR string (mix this flag with base type, see bellow)

Definition at line 59 of file ui_parse.h.

◆ V_UI_DATAID

#define V_UI_DATAID   (V_UI + 5)

Definition at line 58 of file ui_parse.h.

◆ V_UI_EXCLUDERECT

#define V_UI_EXCLUDERECT   (V_UI + 1)

Identify a special attribute, use special parse function

Definition at line 55 of file ui_parse.h.

◆ V_UI_IF

#define V_UI_IF   (V_UI + 4)

Identify a special attribute, use special parse function

Definition at line 57 of file ui_parse.h.

◆ V_UI_MASK

#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.

◆ V_UI_NODEMETHOD

#define V_UI_NODEMETHOD   (V_UI + 0x0400)

Property is a function

Definition at line 61 of file ui_parse.h.

◆ V_UI_NODEMETHOD_LUA

#define V_UI_NODEMETHOD_LUA   (V_UI + 0x0800)

Properti is a lua based function

Definition at line 62 of file ui_parse.h.

◆ V_UI_REF

#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.

◆ V_UI_SPRITEREF

#define V_UI_SPRITEREF   (V_UI + 3)

Identify a special attribute, use special parse function

Definition at line 56 of file ui_parse.h.

Function Documentation

◆ UI_AllocStaticAction()

struct uiAction_s * UI_AllocStaticAction ( void  )

◆ UI_AllocStaticColor()

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().

◆ UI_AllocStaticFloat()

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().

◆ UI_AllocStaticString()

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().

◆ UI_FindPropertyByName()

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 name, Q_strcasecmp, and value_t::string.

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

◆ UI_GetReferenceFloat()

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().

◆ UI_GetReferenceString()

◆ UI_InitRawActionValue()

bool UI_InitRawActionValue ( struct uiAction_s *  action,
uiNode_t node,
const struct value_s *  property,
const char *  string 
)

◆ UI_ParseComponent()

bool UI_ParseComponent ( const char *  type,
const char *  name,
const char **  text 
)

◆ UI_ParseSprite()

bool UI_ParseSprite ( const char *  name,
const char **  text 
)

◆ UI_ParseUIModel()

bool UI_ParseUIModel ( const char *  name,
const char **  text 
)

◆ UI_ParseWindow()

◆ UI_TokenIsName()

bool UI_TokenIsName ( const char *  name,
bool  isQuoted 
)

◆ UI_TokenIsReserved()

bool UI_TokenIsReserved ( const char *  name)