#include <script_modify.h>
Inheritance diagram for hoa_script::ModifyScriptDescriptor:


Public Member Functions | |||||||
| void | CommitChanges (bool leave_closed=false) | ||||||
| Commits all modified changes to the Lua file for permanent retention. | |||||||
| ~ModifyScriptDescriptor () | |||||||
Data Addition Functions | |||||||
These functions allow the addition of new key/value pairs
| |||||||
| void | AddNewBool (int32 key, bool value) | ||||||
| void | AddNewBool (const std::string &key, bool value) | ||||||
| void | AddNewFloat (int32 key, float value) | ||||||
| void | AddNewFloat (const std::string &key, float value) | ||||||
| void | AddNewInt (int32 key, int32 value) | ||||||
| void | AddNewInt (const std::string &key, int32 value) | ||||||
| void | AddNewString (int32 key, const std::string &value) | ||||||
| void | AddNewString (const std::string &key, const std::string &value) | ||||||
| void | AddNewUInt (int32 key, uint32 value) | ||||||
| void | AddNewUInt (const std::string &key, uint32 value) | ||||||
File Access Functions | |||||||
| |||||||
| void | CloseFile () | ||||||
| Closes the script file and sets the _access_mode member to SCRIPT_CLOSED. | |||||||
| bool | OpenFile () | ||||||
| Opens the file named by the classes' _filename member. | |||||||
| bool | OpenFile (const std::string &file_name) | ||||||
Data Modifier Functions | |||||||
These functions allow the modification of primitive data types
| |||||||
| void | ModifyBool (int32 key, bool value) | ||||||
| void | ModifyBool (const std::string &key, bool value) | ||||||
| void | ModifyFloat (int32 key, float value) | ||||||
| void | ModifyFloat (const std::string &key, float value) | ||||||
| void | ModifyInt (int32 key, int32 value) | ||||||
| void | ModifyInt (const std::string &key, int32 value) | ||||||
| void | ModifyString (int32 key, const std::string &value) | ||||||
| void | ModifyString (const std::string &key, const std::string &value) | ||||||
| void | ModifyUInt (int32 key, uint32 value) | ||||||
| void | ModifyUInt (const std::string &key, uint32 value) | ||||||
Private Member Functions | |||||||
| void | _CommitTable (WriteScriptDescriptor &file, const luabind::object &table) | ||||||
| A helper function to CommitChanges() that writes out the contents of a table to the file. | |||||||
| template<class T> | |||||||
| void | _AddNewData (int32 key, T value) | ||||||
| template<class T> | |||||||
| void | _AddNewData (const std::string &key, T value) | ||||||
| Template functions which add a new key, value pair to the most recently opened scope. | |||||||
| template<class T> | |||||||
| void | _ModifyData (int32 key, T value) | ||||||
| template<class T> | |||||||
| void | _ModifyData (const std::string &key, T value) | ||||||
| Template functions that update the key, value pair for the most recently opened table, or in the global scope. | |||||||
Friends | |||||||
| class | GameScript | ||||||
****************************************************************************
This class features all the functionality found in the ReadScriptDescriptor class, plus the additional ability to modify existing Lua data and save it back to the file. An object of this class should only be created if the user intends to modify the Lua data in the file at some point (i.e. don't use this class over the ReadScriptDescriptor simply because it has more functionality available).
In order to permanently (and irreversibly) change Lua data in the file, the user must call the CommitChanges function after making one or several ModifyData calls.
Definition at line 46 of file script_modify.h.
| hoa_script::ModifyScriptDescriptor::~ModifyScriptDescriptor | ( | ) |
Definition at line 29 of file script_modify.cpp.
References hoa_script::ScriptDescriptor::_access_mode, hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_filename, hoa_script::ScriptDescriptor::_open_tables, CloseFile(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::SCRIPT_CLOSED, and hoa_script::SCRIPT_DEBUG.
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::_AddNewData | ( | int32 | key, | |
| T | value | |||
| ) | [private] |
Definition at line 285 of file script_modify.h.
References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ReadScriptDescriptor::_lstack, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.
| void hoa_script::ModifyScriptDescriptor::_AddNewData | ( | const std::string & | key, | |
| T | value | |||
| ) | [private] |
Template functions which add a new key, value pair to the most recently opened scope.
| key | The key name of the variable to add | |
| value | The value to set for the new variable |
Definition at line 264 of file script_modify.h.
References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ReadScriptDescriptor::_lstack, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.
Referenced by AddNewBool(), AddNewFloat(), AddNewInt(), AddNewString(), and AddNewUInt().
| void hoa_script::ModifyScriptDescriptor::_CommitTable | ( | WriteScriptDescriptor & | file, | |
| const luabind::object & | table | |||
| ) | [private] |
A helper function to CommitChanges() that writes out the contents of a table to the file.
| file | A reference to the open file to write the table to | |
| table | A reference to the valid luabind::object that contains the table's contents |
Definition at line 145 of file script_modify.cpp.
References hoa_script::ScriptDescriptor::_error_messages, hoa_script::WriteScriptDescriptor::BeginTable(), hoa_script::WriteScriptDescriptor::EndTable(), hoa_script::SCRIPT_DEBUG, hoa_script::WriteScriptDescriptor::WriteBool(), hoa_script::WriteScriptDescriptor::WriteFloat(), hoa_script::WriteScriptDescriptor::WriteInt(), and hoa_script::WriteScriptDescriptor::WriteString().
Referenced by CommitChanges().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::_ModifyData | ( | int32 | key, | |
| T | value | |||
| ) | [private] |
| void hoa_script::ModifyScriptDescriptor::_ModifyData | ( | const std::string & | key, | |
| T | value | |||
| ) | [private] |
Template functions that update the key, value pair for the most recently opened table, or in the global scope.
| key | The key name of the variable to be change | |
| value | The new value to set the key |
Definition at line 189 of file script_modify.h.
References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ReadScriptDescriptor::_lstack, hoa_script::ScriptDescriptor::_open_tables, hoa_script::private_script::STACK_TOP, and hoa_script::private_script::TABLE_END.
Referenced by ModifyBool(), ModifyFloat(), ModifyInt(), ModifyString(), and ModifyUInt().
| void hoa_script::ModifyScriptDescriptor::AddNewBool | ( | int32 | key, | |
| bool | value | |||
| ) | [inline] |
Definition at line 113 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewBool | ( | const std::string & | key, | |
| bool | value | |||
| ) | [inline] |
Definition at line 110 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewFloat | ( | int32 | key, | |
| float | value | |||
| ) | [inline] |
Definition at line 131 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewFloat | ( | const std::string & | key, | |
| float | value | |||
| ) | [inline] |
Definition at line 128 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

Definition at line 119 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewInt | ( | const std::string & | key, | |
| int32 | value | |||
| ) | [inline] |
Definition at line 116 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewString | ( | int32 | key, | |
| const std::string & | value | |||
| ) | [inline] |
Definition at line 137 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewString | ( | const std::string & | key, | |
| const std::string & | value | |||
| ) | [inline] |
Definition at line 134 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

Definition at line 125 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::AddNewUInt | ( | const std::string & | key, | |
| uint32 | value | |||
| ) | [inline] |
Definition at line 122 of file script_modify.h.
References _AddNewData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::CloseFile | ( | ) | [virtual] |
Closes the script file and sets the _access_mode member to SCRIPT_CLOSED.
Reimplemented from hoa_script::ReadScriptDescriptor.
Definition at line 88 of file script_modify.cpp.
References hoa_script::ScriptDescriptor::_access_mode, hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_filename, hoa_script::ReadScriptDescriptor::_lstack, hoa_script::ScriptDescriptor::_open_tables, hoa_script::GameScript::_RemoveOpenFile(), hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::SCRIPT_CLOSED, hoa_script::SCRIPT_DEBUG, and hoa_script::ScriptManager.
Referenced by CommitChanges(), and ~ModifyScriptDescriptor().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::CommitChanges | ( | bool | leave_closed = false |
) |
Commits all modified changes to the Lua file for permanent retention.
| leave_closed | If set to true this file will be left closed once the function finishes (re-opens fileby default) |
Definition at line 113 of file script_modify.cpp.
References _CommitTable(), hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_filename, hoa_script::ReadScriptDescriptor::_lstack, CloseFile(), hoa_script::WriteScriptDescriptor::CloseFile(), hoa_utils::MoveFile(), OpenFile(), hoa_script::WriteScriptDescriptor::OpenFile(), and hoa_script::SCRIPT_DEBUG.
Referenced by hoa_boot::BootMode::_SaveSettingsFile().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyBool | ( | int32 | key, | |
| bool | value | |||
| ) | [inline] |
Definition at line 72 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyBool | ( | const std::string & | key, | |
| bool | value | |||
| ) | [inline] |
Definition at line 69 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyFloat | ( | int32 | key, | |
| float | value | |||
| ) | [inline] |
Definition at line 90 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyFloat | ( | const std::string & | key, | |
| float | value | |||
| ) | [inline] |
Definition at line 87 of file script_modify.h.
References _ModifyData().
Referenced by hoa_boot::BootMode::_SaveSettingsFile().
Here is the call graph for this function:

Definition at line 78 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyInt | ( | const std::string & | key, | |
| int32 | value | |||
| ) | [inline] |
Definition at line 75 of file script_modify.h.
References _ModifyData().
Referenced by hoa_boot::BootMode::_SaveSettingsFile().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyString | ( | int32 | key, | |
| const std::string & | value | |||
| ) | [inline] |
Definition at line 96 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyString | ( | const std::string & | key, | |
| const std::string & | value | |||
| ) | [inline] |
Definition at line 93 of file script_modify.h.
References _ModifyData().
Referenced by hoa_boot::BootMode::_SaveSettingsFile().
Here is the call graph for this function:

Definition at line 84 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| void hoa_script::ModifyScriptDescriptor::ModifyUInt | ( | const std::string & | key, | |
| uint32 | value | |||
| ) | [inline] |
Definition at line 81 of file script_modify.h.
References _ModifyData().
Here is the call graph for this function:

| bool hoa_script::ModifyScriptDescriptor::OpenFile | ( | ) | [virtual] |
Opens the file named by the classes' _filename member.
Reimplemented from hoa_script::ReadScriptDescriptor.
Definition at line 75 of file script_modify.cpp.
References hoa_script::ScriptDescriptor::_filename, and hoa_script::SCRIPT_DEBUG.
Referenced by CommitChanges().
| bool hoa_script::ModifyScriptDescriptor::OpenFile | ( | const std::string & | file_name | ) | [virtual] |
| file_name | The name of the Lua file to be opened. |
Reimplemented from hoa_script::ReadScriptDescriptor.
Definition at line 47 of file script_modify.cpp.
References hoa_script::ScriptDescriptor::_access_mode, hoa_script::GameScript::_AddOpenFile(), hoa_script::ScriptDescriptor::_filename, hoa_script::ReadScriptDescriptor::_lstack, hoa_script::GameScript::GetGlobalState(), hoa_script::GameScript::IsFileOpen(), hoa_script::SCRIPT_CLOSED, hoa_script::SCRIPT_DEBUG, hoa_script::SCRIPT_READ, and hoa_script::ScriptManager.
Referenced by hoa_boot::BootMode::_SaveSettingsFile().
Here is the call graph for this function:

friend class GameScript [friend] |
1.5.1