Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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