Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/descriptions.cc')
-rw-r--r--src/core/descriptions.cc47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/core/descriptions.cc b/src/core/descriptions.cc
index 8c0f4ee..307cc87 100644
--- a/src/core/descriptions.cc
+++ b/src/core/descriptions.cc
@@ -8,7 +8,8 @@
#include "auxiliary/functions.h"
#include "sys/sys.h"
-namespace core {
+namespace core
+{
/* ---- class ButtonDescription ------------------------------------ */
@@ -55,7 +56,7 @@ MenuDescription::MenuDescription()
MenuDescription::~MenuDescription()
{
for (Buttons::iterator it = buttons().begin(); it != buttons().end(); it++) {
- delete (*it);
+ delete(*it);
}
buttons().clear();
@@ -82,16 +83,16 @@ void MenuDescription::add_button(ButtonDescription *button)
void Descriptions::serialize(MenuDescription *menu, std::ostream & os)
{
os << menu->label() << " "
- << "\"" << menu->text() << "\" "
- << menu->buttons().size() << " ";
-
+ << "\"" << menu->text() << "\" "
+ << menu->buttons().size() << " ";
+
for (MenuDescription::Buttons::iterator it = menu-> buttons().begin(); it != menu->buttons().end(); it++) {
ButtonDescription *button = (*it);
os << "\"" << button->text() << "\" "
- << button->alignment() << " "
- << button->command_type() << " "
- << "\"" << button->command() << "\" "
- << "\"" << button->modelname() << "\" ";
+ << button->alignment() << " "
+ << button->command_type() << " "
+ << "\"" << button->command() << "\" "
+ << "\"" << button->modelname() << "\" ";
}
}
@@ -111,8 +112,8 @@ MenuDescription * Descriptions::receive(std::istream &is)
// menu text
n.clear();
- while ( (is.get(c)) && (c != '"'));
- while ( (is.get(c)) && (c != '"'))
+ while ((is.get(c)) && (c != '"'));
+ while ((is.get(c)) && (c != '"'))
n += c;
if (n.size())
@@ -120,12 +121,12 @@ MenuDescription * Descriptions::receive(std::istream &is)
// menu buttons
is >> nb;
- for (size_t i=0; i < nb; i++) {
+ for (size_t i = 0; i < nb; i++) {
ButtonDescription *button = new ButtonDescription();
// button text
n.clear();
- while ( (is.get(c)) && (c != '"'));
- while ( (is.get(c)) && (c != '"'))
+ while ((is.get(c)) && (c != '"'));
+ while ((is.get(c)) && (c != '"'))
n += c;
if (n.size()) button->set_text(n);
@@ -144,8 +145,8 @@ MenuDescription * Descriptions::receive(std::istream &is)
// button command
n.clear();
- while ( (is.get(c)) && (c != '"'));
- while ( (is.get(c)) && (c != '"'))
+ while ((is.get(c)) && (c != '"'));
+ while ((is.get(c)) && (c != '"'))
n += c;
if (n.size()) {
@@ -158,8 +159,8 @@ MenuDescription * Descriptions::receive(std::istream &is)
// button modelname
n.clear();
- while ( (is.get(c)) && (c != '"'));
- while ( (is.get(c)) && (c != '"'))
+ while ((is.get(c)) && (c != '"'));
+ while ((is.get(c)) && (c != '"'))
n += c;
if (n.size()) button->set_modelname(n);
@@ -167,7 +168,7 @@ MenuDescription * Descriptions::receive(std::istream &is)
}
return menu;
-
+
}
bool Descriptions::load_entity_menus(core::Entity *entity, const std::string &menufilename)
@@ -180,11 +181,11 @@ bool Descriptions::load_entity_menus(core::Entity *entity, const std::string &me
}
con_debug << " " << inifile.name() << std::endl;
-
+
std::string strval;
MenuDescription *menu = 0;
ButtonDescription *button = 0;
-
+
while (inifile.getline()) {
if (inifile.got_section()) {
@@ -216,14 +217,14 @@ bool Descriptions::load_entity_menus(core::Entity *entity, const std::string &me
}
} else if (inifile.in_section("button")) {
-
+
if (!button) {
continue;
} else if (inifile.got_key_string("text", strval)) {
aux::strip_quotes(strval);
button->set_text(strval);
} else if (inifile.got_key_string("command", strval)) {
- for (size_t i =0; i <= strval.size(); i++) {
+ for (size_t i = 0; i <= strval.size(); i++) {
if (strval[i] == ',') strval[i] = ';';
}
aux::strip_quotes(strval);