File: property.sip

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 239,928 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (95 lines) | stat: -rw-r--r-- 2,771 bytes parent folder | download | duplicates (4)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class NamedProperty
	: PersistentObject
{
%TypeHeaderCode
	#include <BALL/CONCEPT/property.h>
%End
	public:
	NamedProperty(String&);
	NamedProperty(String&, bool);
	NamedProperty(String&, String&);
	NamedProperty(String&, PersistentObject&);
	NamedProperty(NamedProperty&);
	~NamedProperty();
	int getType() const;
	String getName() const;
	bool getBool() const;
	int getInt() const;
	float getFloat() const;
	int getUnsignedInt() const;
	PersistentObject* getObject() const;
	String getString() const;
	NamedProperty();

	SIP_PYOBJECT __str__();
%MethodCode
	if(sipCpp == 0)
	{
		sipRes = PyString_FromString("");
	}
	else
	{
		BALL::String output = sipCpp->getName() + ", Type: ";
		switch(sipCpp->getType())
		{
			case NamedProperty::BOOL:
				output += BALL::String("Bool, Value: ") + (sipCpp->getBool() ? "True" : "False");
				break;
			case NamedProperty::INT:
				output += BALL::String("Integer, Value: ") + BALL::String(sipCpp->getInt());
				break;
			case NamedProperty::UNSIGNED_INT:
				output += BALL::String("Unsigned Integer, Value: ") + BALL::String(sipCpp->getUnsignedInt());
				break;
			case NamedProperty::FLOAT:
				output += BALL::String("Float, Value: ") + BALL::String(sipCpp->getFloat());
				break;
			case NamedProperty::DOUBLE:
				output += BALL::String("Double, Value: ") + BALL::String(sipCpp->getDouble());
				break;
			case NamedProperty::STRING:
				output += BALL::String("String, Value: ") + BALL::String(sipCpp->getString());
				break;
			case NamedProperty::OBJECT:
				output += BALL::String("Object, Value: ") + BALL::String((unsigned long) sipCpp->getObject());
				break;
			case NamedProperty::NONE:
				output += BALL::String("None");
				break;
			case NamedProperty::SMART_OBJECT:
				output += BALL::String("Smart Object, Value: ") + BALL::String((unsigned long) &*sipCpp->getSmartObject());
				break;
		}
		sipRes = PyString_FromString(output.c_str());
	}
%End
};

class PropertyManager
{
	public:
	PropertyManager();
	PropertyManager(const PropertyManager&);
	~PropertyManager();
  void clear();
	void destroy();
	void set(const PropertyManager&);
	void get(PropertyManager&) const;
	void swap(PropertyManager&);
	void setProperty(int);
	void clearProperty(int);
	void toggleProperty(int);
	int countProperties() const;
	void setProperty(NamedProperty&);
	void setProperty(const String&);
	void setProperty(const String&, float);
	void setProperty(const String&, String&);
	void setProperty(const String&, PersistentObject&);
	const NamedProperty& getProperty(const String&) const;
	void clearProperty(const String&);
	Size countNamedProperties() const;
	NamedProperty& getNamedProperty(Position) throw(IndexOverflow);
	bool hasProperty(int) const;
	bool hasProperty(const String&) const;
	bool isValid() const;
};