PpsAttribute
#include <bb/PpsAttribute>
To link against this class, add the following line to your .pro file: LIBS += -lbb
The PpsAttribute class encapsulates a PPS attribute.
bb::PpsObject ppsObject("/pps/somepath");
ppsObject.open(bb::PpsOpenMode::Subscribe);
QByteArray rawData = ppsObject.read();
QMap<QString, bb::PpsAttribute> ppsData = bb::PpsObject::decodeWithFlags(rawData);
bb::PpsAttribute rootObject = ppsData.value("@somepath");
...
BlackBerry 10.0.0
Public Functions Index
| PpsAttribute () | |
| ~PpsAttribute () | |
| PpsAttribute (const PpsAttribute &other) | |
| PpsAttribute & | operator= (const PpsAttribute &other) |
| bool | operator== (const PpsAttribute &other) const |
| bool | operator!= (const PpsAttribute &other) const |
| bool | isValid () const |
| Type | type () const |
| PpsAttributeFlag::Types | flags () const |
| bool | isNumber () const |
| bool | isBool () const |
| bool | isString () const |
| bool | isArray () const |
| bool | isObject () const |
| double | toDouble () const |
| qlonglong | toLongLong () const |
| int | toInt () const |
| bool | toBool () const |
| QString | toString () const |
| QList< PpsAttribute > | toList () const |
| QMap< QString, PpsAttribute > | toMap () const |
| QVariant | toVariant () const |
Public Types
Attribute encoding types.
BlackBerry 10.0.0
- None = 0
The attribute has no type because the PpsAttribute is invalid.
Since:BlackBerry 10.0.0
- Number = 1
The attribute was encoded as a number (e.g., "attr:n:10").
Since:BlackBerry 10.0.0
- Bool = 2
The attribute was encoded as a Boolean (e.g., "attr:b:false").
Since:BlackBerry 10.0.0
- String = 3
The attribute was encoded as a string (e.g., "attr::value").
Since:BlackBerry 10.0.0
- Array = 4
The attribute was encoded as a JSON array (e.g., "attr:json:[10, 20]").
Since:BlackBerry 10.0.0
- Object = 5
The attribute was encoded as a PPS or JSON object (e.g., "attr:json: { "key":10 }").
This type is also used if the flags for this attribute include bb::PpsAttributeFlag::Deleted, since the actual type of a deleted attribute cannot be determined. The map associated with the attribute will be empty.
Since:BlackBerry 10.0.0
Public Functions
Destructor.
BlackBerry 10.0.0
Copy constructor.
Creates a copy of a PpsAttribute.
| Parameters | |
|---|---|
| other |
The PpsAttribute to copy. |
BlackBerry 10.0.0
PpsAttribute &
Assignment operator.
Assigns a copy of a PpsAttribute.
| Parameters | |
|---|---|
| other |
The source PpsAttribute. |
The PpsAttribute instance.
BlackBerry 10.0.0
bool
Equality operator.
Attributes of different types are not equal. For example, Number/10.0 and String/10.0 are not equal.
| Parameters | |
|---|---|
| other |
The PpsAttribute to compare to. |
BlackBerry 10.0.0
bool
Inequality operator.
Attributes of different types are not equal. For example, Number/10.0 and String/10.0 are not equal.
| Parameters | |
|---|---|
| other |
The PpsAttribute to compare to. |
BlackBerry 10.0.0
bool
Whether this PpsAttribute object contains valid information about a PPS attribute.
true if this PpsAttribute object contains valid information about a PPS attribute; false otherwise.
BlackBerry 10.0.0
Type
Gets the type of the PPS attribute.
The type of the PPS attribute.
BlackBerry 10.0.0
PpsAttributeFlag::Types
Gets the PPS attribute's flags.
The PPS attribute's flags.
BlackBerry 10.0.0
bool
Checks whether this PPS attribute is type Number.
true if type() is Number, false otherwise.
BlackBerry 10.0.0
bool
Checks whether this PPS attribute is type bb::PpsAttribute::Bool.
true if type() is bb::PpsAttribute::Bool, false otherwise.
BlackBerry 10.0.0
bool
Checks whether this PPS attribute is type bb::PpsAttribute::String.
true if type() is bb::PpsAttribute::String, false otherwise.
BlackBerry 10.0.0
bool
Checks whether this PPS attribute is type bb::PpsAttribute::Array.
true if type() is bb::PpsAttribute::Array, false otherwise.
BlackBerry 10.0.0
bool
Checks whether this PPS attribute is type bb::PpsAttribute::Object.
true if type() is bb::PpsAttribute::Object, false otherwise.
BlackBerry 10.0.0
double
Gets the value of this attribute as a double.
If type() is bb::PpsAttribute::Number, then this will return the number value as a double.
If type() is bb::PpsAttribute::Bool or bb::PpsAttribute::String, this will convert the raw value to a double using QVariant.toDouble().
The value of the PPS attribute as a double if the value can be represented as a double, 0 otherwise.
BlackBerry 10.0.0
qlonglong
Gets the value of this attribute as a qlonglong.
If type() is bb::PpsAttribute::Number, then this will return the number value as a qlonglong.
If type() is bb::PpsAttribute::Bool or bb::PpsAttribute::String, this will convert the raw value to a qlonglong using QVariant.toLongLong().
The value of the PPS attribute as a qlongong if the value can be represented as a qlongong, 0 otherwise.
BlackBerry 10.0.0
int
Gets the value of this attribute as an int.
If type() is bb::PpsAttribute::Number, then this will return the number value as an int.
If type() is bb::PpsAttribute::Bool or bb::PpsAttribute::String, this will convert the raw value to an int using QVariant.toInt().
The value of the PPS attribute as an int if the value can be represented as an int, 0 otherwise.
BlackBerry 10.0.0
bool
Gets the value of this attribute as a bool.
If type() is bb::PpsAttribute::Bool, then this will return the Boolean value as a bool.
If type() is bb::PpsAttribute::Number or bb::PpsAttribute::String, this will convert the raw value to a bool using QVariant.toBool().
The value of the PPS attribute as a bool if the value can be represented as a bool, false otherwise.
BlackBerry 10.0.0
QString
Gets the value of this attribute as a QString.
If type() is bb::PpsAttribute::String, then this will return the string value as a QString.
If type() is bb::PpsAttribute::Bool or bb::PpsAttribute::Number, this will convert the raw value to a QString using QVariant.toString().
QList< PpsAttribute >
Gets the value of this attribute as a QList.
The value of the PPS attribute as a QList if type() is bb::PpsAttribute::Array, a default-constructed QList<PpsAttribute> otherwise.
BlackBerry 10.0.0
QMap< QString, PpsAttribute >
Gets the value of this attribute as a QMap.
The value of the PPS attribute as a QMap if type() is bb::PpsAttribute::Object, a default-constructed QMap<QString, PpsAttribute> otherwise.
BlackBerry 10.0.0