Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fa92c8c9e4b8bc4abf625e836f8c7a3feff6f910 (plain) (blame)
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
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (c) 2013, 2015 QNX Software Systems and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.cdt.internal.qt.core.index;

public class QProperty extends AbstractQField implements IQProperty {

	private String type;
	private final String[] values = new String[Attribute.values().length];

	public QProperty(IQObject owner, String type, String name) {
		super(owner);
		this.type = type;
		this.name = name;
	}

	public void setAttribute(IQProperty.Attribute attr, String value) {
		values[attr.ordinal()] = ( value == null ? "" : value );
	}

	@Override
	public String getType() {
		return type;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String getValue(Attribute attr) {
		return values[attr.ordinal()];
	}

	@Override
	public String getReadMethodName() {
		return Attribute.READ.valueIn(this);
	}

	@Override
	public String getWriteMethodName() {
		return Attribute.WRITE.valueIn(this);
	}

	@Override
	public String getResetMethodName() {
		return Attribute.RESET.valueIn(this);
	}

	@Override
	public String getNotifyMethodName() {
		return Attribute.NOTIFY.valueIn(this);
	}

	@Override
	public Long getRevision() {
		String revision = Attribute.REVISION.valueIn(this);
		if (revision != null)
			try {
				return Long.valueOf(revision);
			} catch(NumberFormatException e) {
				// This is a problem with the user's C++ code, there is no need to log this exception,
				// just ignore the value.
			}

		return null;
	}

	@Override
	public String getDesignable() {
		return Attribute.DESIGNABLE.valueIn(this);
	}

	@Override
	public String getScriptable() {
		return Attribute.SCRIPTABLE.valueIn(this);
	}

	@Override
	public String getStored() {
		return Attribute.STORED.valueIn(this);
	}

	@Override
	public String getUser() {
		return Attribute.USER.valueIn(this);
	}

	@Override
	public boolean isConstant() {
		return Attribute.CONSTANT.valueIn(this) != null;
	}

	@Override
	public boolean isFinal() {
		return Attribute.FINAL.valueIn(this) != null;
	}
}

Back to the top