tbx
0.7.3
|
Class to allow creation, loading, editing and saving of a toolbox resource file. More...
#include <reseditor.h>
Public Types | |
typedef std::vector< ResObject > ::const_iterator | const_iterator |
Constant iterator to iterate through the objects being edited. | |
typedef std::vector< ResObject > ::iterator | iterator |
Iterator to iterate through the objects being edited. | |
Public Member Functions | |
ResEditor () | |
Construct an empty resource file. | |
const ResFileHeader * | header () const |
Return header details of the file. | |
const_iterator | begin () const |
Get constant iterator to first object. More... | |
const_iterator | end () const |
Get constant iterator to the end of the objects. More... | |
const_iterator | find (std::string name) const |
Find object with given name. More... | |
iterator | begin () |
Get iterator to first object. More... | |
iterator | end () |
Get iterator to the end of the objects. More... | |
iterator | find (std::string name) |
Find object with given name. More... | |
unsigned int | count () const |
Return number of objects. | |
bool | contains (std::string name) const |
Check if editor contains the named object. More... | |
const ResObject & | object (std::string name) const |
Get object. More... | |
void | clear () |
Remove all objects from the editor. | |
void | add (ResObject obj) |
Add a new object. More... | |
void | replace (ResObject obj) |
Replace object with same name as object given. More... | |
void | erase (std::string name) |
Erase object with given name. More... | |
iterator | insert (iterator before, ResObject obj) |
Insert object before given object. More... | |
iterator | erase (iterator where) |
Erase object at iterator. | |
void | replace (iterator where, ResObject obj) |
Replace object at location. More... | |
bool | load (std::string file_name) |
Load resources from a file. More... | |
bool | save (std::string file_name) |
Save resources to the name file. More... | |
Class to allow creation, loading, editing and saving of a toolbox resource file.
void tbx::res::ResEditor::add | ( | ResObject | obj | ) |
Add a new object.
obj | object to add |
ResObjectExists | if name is already used for an object |
|
inline |
Get constant iterator to first object.
|
inline |
Get iterator to first object.
bool tbx::res::ResEditor::contains | ( | std::string | name | ) | const |
Check if editor contains the named object.
name | to check for |
|
inline |
Get constant iterator to the end of the objects.
|
inline |
Get iterator to the end of the objects.
void tbx::res::ResEditor::erase | ( | std::string | name | ) |
Erase object with given name.
ResObjectNotFound | if object with name doesn't exists |
ResEditor::const_iterator tbx::res::ResEditor::find | ( | std::string | name | ) | const |
Find object with given name.
name | to find |
ResEditor::iterator tbx::res::ResEditor::find | ( | std::string | name | ) |
Find object with given name.
name | to find |
ResEditor::iterator tbx::res::ResEditor::insert | ( | iterator | before, |
ResObject | obj | ||
) |
Insert object before given object.
ResObjectExists | if name is already used for an object |
bool tbx::res::ResEditor::load | ( | std::string | file_name | ) |
Load resources from a file.
file_name | - name of file for load |
const ResObject & tbx::res::ResEditor::object | ( | std::string | name | ) | const |
Get object.
name | name of the object |
ResObjectNotFound | if object with name doesn't exists |
void tbx::res::ResEditor::replace | ( | ResObject | obj | ) |
Replace object with same name as object given.
obj | to replace. |
ResObjectNotFound | if object with name doesn't exists |
Replace object at location.
It is recommend this is used instead of just *where = obj as this routine checks that the name is unique in the editor
ResObjectExists | if name is already used for an object other than the one that is being replaced |
bool tbx::res::ResEditor::save | ( | std::string | file_name | ) |
Save resources to the name file.
file_name | name of file to save to |