Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-02-21 20:06:17 +0000
committerStijn Buys <ingar@osirion.org>2012-02-21 20:06:17 +0000
commit4460f43972bd52c498161c64d4ddcc4da4c45d20 (patch)
treebf9f56c6d0e04bc249986e4bfc2fd1fa30e1c60f /src/entityproperties.cc
parent43c292e1dda7c789a31cdb679065c75d8f8cebba (diff)
Add support for zone properties, added framework to save files.
Diffstat (limited to 'src/entityproperties.cc')
-rw-r--r--src/entityproperties.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/entityproperties.cc b/src/entityproperties.cc
index 371746f..84a6bc4 100644
--- a/src/entityproperties.cc
+++ b/src/entityproperties.cc
@@ -39,4 +39,49 @@ void EntityProperties::add_subsection_value(const QString &key, const QString &v
properties_subsections += '\n';
}
+void EntityProperties::save(QTextStream &textstream)
+{
+ textstream << "[" << type() << "]" << '\n';
+ if (label().size())
+ textstream << "label=" << label() << '\n';
+ if (name().size())
+ textstream << "name=" << name() << '\n';
+
+ // other values
+ if (values().size()) {
+ textstream << values();
+ }
+
+ // info string
+ if (info().size()) {
+ textstream << '\n';
+
+ // QTextStream operates on QString, not on QString const
+ QString infobuffer = info();
+ QTextStream infostream(&infobuffer);
+ QString line;
+ while (!infostream.atEnd()) {
+ line = infostream.readLine(1024);
+ textstream << "info=" << line << '\n';
+ }
+ }
+
+ if (subsections().size()) {
+ textstream << '\n';
+
+ QString subsectionbuffer = subsections();
+ QTextStream subsectionstream(&subsectionbuffer);
+ QString line;
+ while (!subsectionstream.atEnd()) {
+ line = subsectionstream.readLine(1024);
+ if (line.size())
+ textstream << '\t' << line << '\n';
+ else
+ textstream << '\n';
+ }
+
+ }
+
+ textstream << '\n';
+}
} // namespace editor