From 72c46bdd7f5d430ab1ad1d420ed77c7f22df857a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 30 Sep 2017 15:01:35 +0200 Subject: rename --- Tobii-EyeX/include/eyex-cpp/Property.inl | 90 ++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 Tobii-EyeX/include/eyex-cpp/Property.inl (limited to 'Tobii-EyeX/include/eyex-cpp/Property.inl') diff --git a/Tobii-EyeX/include/eyex-cpp/Property.inl b/Tobii-EyeX/include/eyex-cpp/Property.inl new file mode 100755 index 0000000..9469af4 --- /dev/null +++ b/Tobii-EyeX/include/eyex-cpp/Property.inl @@ -0,0 +1,90 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Property.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +bool Property::TryGetValue(TValue* pValue) const +{ + if(PropertyValueResolver().GetValue(this, pValue) == TX_RESULT_OK) + return true; + + return false; +} + +/*********************************************************************************************************************/ + +template +typename PropertyValueResolver::ValueType Property::GetValue() const +{ + TValue value; + if(TryGetValue(&value)) + return value; + + throw APIException(TX_RESULT_INVALIDPROPERTYTYPE, "Invalid property type"); +} + +/*********************************************************************************************************************/ + +template +void Property::SetValue(const TValue& value) +{ + TX_VALIDATE(PropertyValueResolver().SetValue(this, value)); +} + +/*********************************************************************************************************************/ + +inline Property::Property(const std::shared_ptr& spContext, TX_PROPERTYHANDLE hProperty) +: HandleWrapper(spContext, hProperty) +{} + +/*********************************************************************************************************************/ + +inline TX_PROPERTYVALUETYPE Property::GetValueType() const +{ + TX_PROPERTYVALUETYPE valueType; + TX_VALIDATE(txGetPropertyValueType(_hObject, &valueType)); + return valueType; +} + +/*********************************************************************************************************************/ + +inline std::string Property::GetName() const +{ + return GetString(txGetPropertyName, _hObject); +} + +/*********************************************************************************************************************/ + +inline TX_PROPERTYFLAGS Property::GetFlags() const +{ + TX_PROPERTYFLAGS flags; + TX_VALIDATE(txGetPropertyFlags(_hObject, &flags)); + return flags; +} + +/*********************************************************************************************************************/ + +inline void Property::Clear() +{ + TX_VALIDATE(txClearPropertyValue(_hObject)); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__) + +/*********************************************************************************************************************/ -- cgit v1.2.3