Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: ad40adca99e80d0bb5c5d9e9dcea4da991db64b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
   properties.cc
   This file is part of the Project::OSiRiON world editor 
   and is distributed under the terms and conditions of 
   the GNU General Public License version 2
*/

#include "properties.h"

namespace editor
{

Properties::Properties()
{
}

Properties::Properties(const Properties & other)
{
	assign(other);
}

Properties::~Properties()
{
}

void Properties::assign(const Properties & other)
{
	properties_comment = other.properties_comment;
	
	properties_comments.clear();
	for (Comments::const_iterator i = properties_comments.constBegin(); i != properties_comments.constEnd(); ++i) {
		set_comment(i.key(), i.value());
	}
	
	properties_label = other.properties_label;
	properties_name = other.properties_name;
		
	properties_location = other.properties_location;
	properties_color = other.properties_color;
	
	properties_info = other.properties_info;
	properties_values = other.properties_values;
}

void Properties::add_value(const QString &key, const QString &value, const QString &comment)
{
	if (comment.size())
		properties_values += comment;
	
	properties_values += key;
	properties_values += '=';
	properties_values += value;
	properties_values += '\n';
}

void Properties::add_info(const QString &text)
{
	properties_info += text;
	properties_info += '\n';
}

void Properties::save_comment(QTextStream &textstream, const QString &attribute)
{
	QString text = comment(attribute);
	if (text.size()) {
		textstream << text;
	}
}

} // namespace editor