15 Commits
0.1.0 ... 0.4.0

28 changed files with 1006 additions and 189 deletions

85
.travis.yml Normal file
View File

@@ -0,0 +1,85 @@
language: cpp
sudo: required
dist: trusty
branches:
only:
- master
- dev
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
- expect
- binutils-mingw-w64-x86-64 # 64bit MinGW
- gcc-mingw-w64-x86-64
- g++-mingw-w64-x86-64
matrix:
include:
- os: linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9" GCOV=--gcov
compiler: gcc
- os: linux
env: CONF=debug BUILDER=clang TARGET=Linux
compiler: clang
- os: linux
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
compiler: x86_64-w64-mingw32-gcc
- os: linux
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
compiler: gcc
- os: osx
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
compiler: clang
- os: osx
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
compiler: clang
install:
- cd ..
- pip install --user lutin
- if [ "$TAG" == "Android" ]; then
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
./android-download-tool/dl-android.sh;
fi
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
- cd -
before_script:
- cd ..
- git clone https://github.com/atria-soft/elog.git -b $TRAVIS_BRANCH
- git clone https://github.com/atria-soft/etk.git -b $TRAVIS_BRANCH
- git clone https://github.com/atria-soft/ememory.git -b $TRAVIS_BRANCH
- git clone https://github.com/generic-library/gtest-lutin.git --recursive
- git clone https://github.com/generic-library/z-lutin.git --recursive
- pwd
- ls -l
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export PATH=$PATH:/Users/travis/Library/Python/2.7/bin/;
fi
- ./ci/build_send.py --tag=$TAG --status=START;
script:
- lutin -w -j4 -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE eproperty-*; STATUS=$?
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
after_script:
- if [ "$GCOV" != "" ]; then
./ci/warning_send.py --find-path ./out/Linux_x86_64/$CONF/build/$BUILDER/eproperty/;
fi
- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE eproperty-test?run:--elog-level=3 | tee out_test.txt
- if [ "$GCOV" != "" ]; then
./ci/test_send.py --file=out_test.txt;
lutin -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF -p eproperty?gcov;
./ci/coverage_send.py --json=out/Linux_x86_64/$CONF/build/$BUILDER/eproperty/eproperty.json;
fi
notifications:
email:
- yui.heero@gmail.com

View File

@@ -1,2 +1,80 @@
# eproperty
(APACHE v2.0) class property depending on etk only
e-property
==========
`eproperty` is c++ simple class property handling that permit to change parameter through XML file.
Release (master)
----------------
[![Build Status](https://travis-ci.org/atria-soft/eproperty.svg?branch=master)](https://travis-ci.org/atria-soft/eproperty)
[![Coverage Status](http://atria-soft.com/ci/coverage/atria-soft/eproperty.svg?branch=master)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Test Status](http://atria-soft.com/ci/test/atria-soft/eproperty.svg?branch=master)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Warning Status](http://atria-soft.com/ci/warning/atria-soft/eproperty.svg?branch=master)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=master&tag=Linux)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=master&tag=MacOs)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=master&tag=Mingw)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=master&tag=Android)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=master&tag=IOs)](http://atria-soft.com/ci/atria-soft/eproperty)
Developement (dev)
------------------
[![Build Status](https://travis-ci.org/atria-soft/eproperty.svg?branch=dev)](https://travis-ci.org/atria-soft/eproperty)
[![Coverage Status](http://atria-soft.com/ci/coverage/atria-soft/eproperty.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Test Status](http://atria-soft.com/ci/test/atria-soft/eproperty.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Warning Status](http://atria-soft.com/ci/warning/atria-soft/eproperty.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=dev&tag=Linux)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=dev&tag=MacOs)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=dev&tag=Mingw)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=dev&tag=Android)](http://atria-soft.com/ci/atria-soft/eproperty)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/eproperty.svg?branch=dev&tag=IOs)](http://atria-soft.com/ci/atria-soft/eproperty)
Instructions
============
download Build system:
----------------------
sudo pip install lutin
sudo pip install pillow
download the software:
----------------------
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
git clone https://github.com/atria-soft/etk.git
git clone https://github.com/atria-soft/elog.git
git clone https://github.com/atria-soft/ememory.git
git clone https://github.com/atria-soft/eproperty.git
git clone https://github.com/generic-library/gtest-lutin.git --recursive
git clone https://github.com/generic-library/z-lutin.git --recursive
Compile software:
-----------------
cd WORKING_DIRECTORY
lutin -C -P eproperty-test eproperty-sample
License (APACHE v2.0)
=====================
Copyright eproperty Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

1
authors.txt Normal file
View File

@@ -0,0 +1 @@
MR Edouard DUPIN <yui.heero@gmail.com>

65
doc/build.md Normal file
View File

@@ -0,0 +1,65 @@
Build lib & build sample {#eproperty_build}
========================
@tableofcontents
Download: {#eproperty_build_download}
=========
eproperty use some tools to manage source and build it:
lutin (build-system): {#eproperty_build_download_lutin}
---------------------
```{.sh}
pip install lutin --user
# optionnal dependency of lutin (manage image changing size for application release
pip install pillow --user
```
dependency: {#eproperty_build_download_dependency}
-----------
```{.sh}
mkdir framework
cd framework
git clone https://github.com/atria-soft/elog.git
git clone https://github.com/atria-soft/etk.git
cd ..
```
sources: {#eproperty_build_download_sources}
--------
```{.sh}
cd framework
git clone https://github.com/atria-soft/eproperty.git
cd ..
```
Build: {#eproperty_build_build}
======
library: {#eproperty_build_build_library}
--------
```{.sh}
lutin -mdebug eproperty
```
Sample: {#eproperty_build_build_sample}
-------
```{.sh}
lutin -mdebug eproperty-sample
```
Run sample: {#eproperty_build_run_sample}
===========
```{.sh}
lutin -mdebug eproperty-sample?run
```

54
doc/mainpage.md Normal file
View File

@@ -0,0 +1,54 @@
EPROPERTY library {#mainpage}
=================
@tableofcontents
What is EPROPERTY: {#eproperty_mainpage_what}
==================
EPROPERTY, or Ewol property interface is a simple property API to set and get generic APIS
EPROPERTY is designed for
- Expose property on generic class
- Call class when the parameter change
- permit to set value throw string (good for XML configurations)
What languages are supported? {#eproperty_mainpage_language}
=============================
EPROPERTY is written in C++.
Are there any licensing restrictions? {#eproperty_mainpage_license_restriction}
=====================================
EPROPERTY is **FREE software** and _all sub-library are FREE and staticly linkable !!!_
License (APACHE-2.0) {#eproperty_mainpage_license}
====================
Copyright EPROPERTY Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Other pages {#eproperty_mainpage_sub_page}
===========
- @ref eproperty_build
- @ref eproperty_tutorial
- [**ewol coding style**](http://atria-soft.github.io/ewol/ewol_coding_style.html)

138
doc/tutorial.md Normal file
View File

@@ -0,0 +1,138 @@
Tutorial {#eproperty_tutorial}
========
@tableofcontents
What is a property: {#eproperty_tutorial_what}
===================
A property is a generic interface to manage parameter of a class whithout redeclare all the time the setter and getter (that is a little boring)
Calling a property car mermit to be notify when the value change and to control the values range of list ...
A property can use agreator interface eproperty::interface that declare a **"properties"** variablke that permit to acces at all the property declared.
Declare a class that have this interface:
@snippet sampleAll.cpp eproperty_sample_declare_class_with_interface
Declare property: {#eproperty_tutorial_declare}
=================
We have some basic properties:
- eproperty::Value Simple store of a unique Value
- eproperty::Range Store a value inside an authorized range
- eproperty::List Store a value inside a list of values (set in constructor)
Declare a Value property: {#eproperty_tutorial_declare_value}
-------------------------
Do the correct include:
@snippet sampleAll.cpp eproperty_sample_declare_value
Declare your property:
@snippet sampleAll.cpp eproperty_sample_declare_class_property_value
Construct the property with eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_value
Construct the property with **NO** eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_value2
Configure your property:
@snippet sampleAll.cpp eproperty_sample_use_set_value_1
Use your property:
@snippet sampleAll.cpp eproperty_sample_get_value_value
Declare a Range property: {#eproperty_tutorial_declare_range}
-------------------------
Do the correct include:
@snippet sampleAll.cpp eproperty_sample_declare_range
Declare your property:
@snippet sampleAll.cpp eproperty_sample_declare_class_property_range
Construct the property with eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_range
Construct the property with **NO** eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_range2
Configure your property:
@snippet sampleAll.cpp eproperty_sample_use_set_range_1
Use your property:
@snippet sampleAll.cpp eproperty_sample_get_value_range
Declare a List property: {#eproperty_tutorial_declare_list}
------------------------
Do the correct include:
@snippet sampleAll.cpp eproperty_sample_declare_list
Declare your property:
@snippet sampleAll.cpp eproperty_sample_declare_class_property_list
Construct the property with eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_list
Construct the property with **NO** eproperty::Interface:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_list2
Special case for the List is adding the value with their string assiciated:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_list_add
Configure your property:
@snippet sampleAll.cpp eproperty_sample_use_set_list_1
Use your property:
@snippet sampleAll.cpp eproperty_sample_get_value_list
Particularity: {#eproperty_tutorial_particularity}
==============
Define a callback: {#eproperty_tutorial_particularity_callback}
------------------
All property can define a callback, it is used to update class property with special settings.
The callback is set in the construction instruction like:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_value
The fucntion define is like:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_value_callback
It is called every time the Value change, if the value is identical the callback is not called.
Set value without calling the callback: {#eproperty_tutorial_particularity_direct_set}
---------------------------------------
To set a value in a property without calling the nitifiction function, you might use:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_set_direct
Please do not use it ouside the internal class that define the peoperty (call me if you have an api to control it at the compilation time)
Heritage and callback: {#eproperty_tutorial_particularity_heritage}
----------------------
When you herit from an other class with theire property you can prefer changing the default value or set an other list of parameter.
To set value without calling the callback (that can be virtual then ==0 in the initialisation state), you need to call:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_set_direct
For the eproperty::List, you chan rename enumeration or remove values:
@snippet sampleAll.cpp eproperty_sample_initialize_class_property_list_rename
All sample Code: {#eproperty_tutorial_all_code}
================
This Will generate this simple sample code:
@snippet sampleAll.cpp eproperty_sample_all

34
doxy_eproperty.py Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/python
import os
import doxy.module as module
import doxy.debug as debug
import doxy.tools as tools
def create(target, module_name):
my_module = module.Module(__file__, module_name)
my_module.set_version([0,1,"dev"])
my_module.set_title("eproperty: Ewol property interface")
my_module.set_website("http://atria-soft.github.io/" + module_name)
my_module.set_website_sources("http://github.com/atria-soft/" + module_name)
my_module.add_path([
module_name,
"doc"
])
my_module.add_depend([
'etk'
])
my_module.add_sample_path([
'sample'
])
my_module.add_exclude_symbols([
'*operator<<*',
])
my_module.add_exclude_file([
'debug.hpp',
])
my_module.add_file_patterns([
'*.hpp',
'*.md',
])
return my_module

24
eproperty/Interface.hpp Normal file
View File

@@ -0,0 +1,24 @@
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#pragma once
#include <vector>
#include <map>
#include <eproperty/InterfaceData.hpp>
namespace eproperty {
/**
* @brief Interface to collect the property list (for abstarction "set" and "get")
* It create a simple "properties" member that permit to access at the properties.
*/
class Interface {
public:
eproperty::InterfaceData properties; //!< Interface to access at all properties...
};
}

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -6,23 +6,21 @@
* @license APACHE v2.0 (see license file)
*/
#include <eproperty/debug.h>
#include <eproperty/List.h>
#include <eproperty/Property.h>
#include <eproperty/debug.hpp>
#include <eproperty/List.hpp>
#include <eproperty/Property.hpp>
#include <eproperty/InterfaceData.hpp>
#undef __class__
#define __class__ "Interface"
eproperty::Interface::Interface() {
eproperty::InterfaceData::InterfaceData() {
}
eproperty::Interface::~Interface() {
propertyClean();
eproperty::InterfaceData::~InterfaceData() {
clean();
}
// note this pointer is not allocated and not free at the end of the class
void eproperty::Interface::propertyAdd(eproperty::Property* _pointerOnProperty) {
void eproperty::InterfaceData::add(eproperty::Property* _pointerOnProperty) {
if (_pointerOnProperty == nullptr) {
EPROPERTY_ERROR("Try to link a nullptr properties");
return;
@@ -36,14 +34,14 @@ void eproperty::Interface::propertyAdd(eproperty::Property* _pointerOnProperty)
m_list.push_back(_pointerOnProperty);
}
void eproperty::Interface::propertyClean() {
void eproperty::InterfaceData::clean() {
// remove all pointer on these propertys
m_list.clear();
}
// Note no lock is needed at this level, because the lock is done is the upper elements ...
// the property set might be done with a pool of property, allone, the overhed is bigger ...
bool eproperty::Interface::propertySet(const std::string& _property, const std::string& _value) {
bool eproperty::InterfaceData::set(const std::string& _property, const std::string& _value) {
for (auto &it : m_list) {
if( it != nullptr
&& it->getName() == _property) {
@@ -55,7 +53,7 @@ bool eproperty::Interface::propertySet(const std::string& _property, const std::
return false;
}
std::string eproperty::Interface::propertyGet(const std::string& _property) const {
std::string eproperty::InterfaceData::get(const std::string& _property) const {
for (auto &it : m_list) {
if( it != nullptr
&& it->getName() == _property) {
@@ -65,7 +63,7 @@ std::string eproperty::Interface::propertyGet(const std::string& _property) cons
return "???";
}
void eproperty::Interface::propertyDisplay(bool _changeOnly) const {
void eproperty::InterfaceData::display(bool _changeOnly) const {
EPROPERTY_INFO(" Object propertys:");
for (auto &it : m_list) {
if(it != nullptr) {
@@ -82,7 +80,7 @@ void eproperty::Interface::propertyDisplay(bool _changeOnly) const {
}
}
std::map<std::string, std::string> eproperty::Interface::propertyGetAll(bool _notIfDefault) const {
std::map<std::string, std::string> eproperty::InterfaceData::getAll(bool _notIfDefault) const {
std::map<std::string, std::string> out;
for (auto &it : m_list) {
if(it != nullptr) {
@@ -98,11 +96,11 @@ std::map<std::string, std::string> eproperty::Interface::propertyGetAll(bool _no
}
size_t eproperty::Interface::getPropertyCount() const {
size_t eproperty::InterfaceData::size() const {
return m_list.size();
}
eproperty::Property* eproperty::Interface::getPropertyRaw(const size_t& _id) const {
eproperty::Property* eproperty::InterfaceData::getRaw(const size_t& _id) const {
if (_id >= m_list.size()) {
EPROPERTY_ERROR("Wrong ID for property list. " << _id << " >= " << m_list.size());
return nullptr;
@@ -110,7 +108,7 @@ eproperty::Property* eproperty::Interface::getPropertyRaw(const size_t& _id) con
return m_list[_id];
}
eproperty::Property* eproperty::Interface::getPropertyRaw(const std::string _name) const {
eproperty::Property* eproperty::InterfaceData::getRaw(const std::string _name) const {
for (auto &it : m_list) {
if(it->getName() == _name) {
return it;
@@ -118,3 +116,4 @@ eproperty::Property* eproperty::Interface::getPropertyRaw(const std::string _nam
}
return nullptr;
}

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -13,69 +13,75 @@
namespace eproperty {
class Property;
class Ref;
class Interface {
friend class eproperty::Property; // to register property in the list.
/**
* @brief Interface data to collect the property list (for abstarction connection)
*/
class InterfaceData {
private:
std::vector<eproperty::Property*> m_list; //!< list of availlable Propertys (no need to free)
public:
/**
* @brief Constructor.
*/
Interface();
InterfaceData();
/**
* @brief Destructor.
*/
virtual ~Interface();
virtual ~InterfaceData();
/**
* @brief Register a property class pointer in the List of propertys
* @note This class does not destroy the property pointer!!!
* @param[in] pointerOnProperty Pointer on the property that might be added.
* @param[in] _pointerOnProperty Pointer on the property that might be added.
*/
void propertyAdd(Property* _pointerOnProperty);
void add(Property* _pointerOnProperty);
/**
* @brief Remove all the property reference in this class.
* @note no delete, just clean and inform that a property has not been removed.
*/
void propertyClean();
void clean();
/**
* @brief Set a specific value to the property reference name.
* @param[in] property The property string name.
* @param[in] value The new value of the property (string).
* @param[in] _property The property string name.
* @param[in] _value The new value of the property (string).
* @return true Property update.
* @return false Property not update.
*/
bool propertySet(const std::string& _property, const std::string& _value);
bool set(const std::string& _property, const std::string& _value);
/**
* @brief Get a specific value of the property reference name.
* @param[in] property The property string name.
* @param[in] _property The property string name.
* @return The value of the property (string).
*/
std::string propertyGet(const std::string& _property) const;
std::string get(const std::string& _property) const;
/**
* @brief Display all the property value with there name.
* @param[in] changeOnly check at true if the user want to display only property that are not at default value.
* @param[in] _changeOnly check at true if the user want to display only property that are not at default value.
*/
void propertyDisplay(bool _changeOnly = false) const;
void display(bool _changeOnly = false) const;
/**
* @brief Get All the property configuration:
* @param[in] _notIfDefault if true the parameter value with default value are not extracted.
* @return map on the propertys
*/
std::map<std::string, std::string> propertyGetAll(bool _notIfDefault=true) const;
std::map<std::string, std::string> getAll(bool _notIfDefault=true) const;
public:
/**
* @brief Get count of propertys.
* @return The number of the property.
*/
size_t getPropertyCount() const;
size_t size() const;
/**
* @brief Get name of a propertys.
* @param[in] _id Id of the property.
* @return pointer on the property.
*/
eproperty::Property* getRaw(const size_t& _id) const;
/**
* @brief Get name of a propertys.
* @param[in] _name name of the property.
* @return pointer on the property.
*/
eproperty::Property* getPropertyRaw(const size_t& _id) const;
//! @previous
eproperty::Property* getPropertyRaw(const std::string _name) const;
eproperty::Property* getRaw(const std::string _name) const;
};
}

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,20 +7,20 @@
*/
#pragma once
#include <eproperty/PropertyType.h>
#include <eproperty/PropertyType.hpp>
#include <map>
#include <typeinfo>
#undef __class__
#define __class__ "List<T>"
namespace eproperty {
/**
* @brief Set a list of value availlable (for enumeration)
*/
template<class TYPE> class List : public PropertyType<TYPE> {
private:
std::map<std::string, TYPE> m_list; //!< pointer on the list of all elements.
public:
/**
* @brief Create a parameter with List of element parameter.
* @brief Create a parameter with List of element parameter (nullptr if none).
* @param[in] _owner reference on the parameter lister.
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
@@ -37,9 +37,23 @@ namespace eproperty {
};
/**
* @brief Destructor.
* @brief Create a parameter with List of element parameter (nullptr if none).
* @param[in] _defaultValue Default value of the parameter.
*/
List(const TYPE& _defaultValue) :
eproperty::PropertyType<TYPE>(_defaultValue) {
};
/**
* @brief virtualisation of Destructor.
*/
virtual ~List() = default;
/**
* @brief Add a value in the list of parameter
* @param[in] _value Value of the string
* @param[in] _name String of the value
* @param[in] _description Description of the parameter value
*/
void add(const TYPE& _value, const std::string& _name, const std::string& _description = "") {
auto it = m_list.find(_name);
if (it != m_list.end()) {
@@ -48,6 +62,10 @@ namespace eproperty {
}
m_list.insert(std::make_pair(_name, _value));
}
/**
* @brief Remove a value of the element availlable
* @param[in] _name Name of the value to remove
*/
void remove(const std::string& _name) {
auto it = m_list.find(_name);
bool firstValue = false;
@@ -75,6 +93,11 @@ namespace eproperty {
eproperty::PropertyType<TYPE>::m_value = m_list.begin()->second;
}
}
/**
* @brief Rename a value of the property
* @param[in] _nameOld Old property name to replace
* @param[in] _nameNew New name of the property
*/
void rename(const std::string& _nameOld, const std::string& _nameNew) {
//get old value
TYPE value;
@@ -101,9 +124,11 @@ namespace eproperty {
return;
}
EPROPERTY_WARNING("paramList value='" << _newVal << "' is not un the list ... ==> no change");
#ifdef DEBUG
for (auto &it : m_list) {
EPROPERTY_VERBOSE(" element : " << it.first);
}
#endif
}
std::string getInfo() const override {
std::string list = "List default=" + getValueSpecific(eproperty::PropertyType<TYPE>::m_default) + " in : [";
@@ -163,12 +188,10 @@ namespace eproperty {
return "???";
}
};
//! @not_in_doc
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::List<TYPE>& _obj) {
_os << _obj.get();
return _os;
}
}
#undef __class__
#define __class__ nullptr

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -6,9 +6,9 @@
* @license APACHE v2.0 (see license file)
*/
#include <eproperty/debug.h>
#include <eproperty/Interface.h>
#include <eproperty/Property.h>
#include <eproperty/debug.hpp>
#include <eproperty/Interface.hpp>
#include <eproperty/Property.hpp>
eproperty::Property::Property(eproperty::Interface* _paramInterfaceLink, const std::string& _name) :
@@ -17,10 +17,17 @@ eproperty::Property::Property(eproperty::Interface* _paramInterfaceLink, const s
m_name(_name) {
// add a reference on the current Property ...
if (m_interfaceLink != nullptr) {
m_interfaceLink->propertyAdd(this);
m_interfaceLink->properties.add(this);
}
}
eproperty::Property::Property() :
m_interfaceLink(nullptr),
m_setObserver(),
m_name("") {
}
void eproperty::Property::setObserver(eproperty::Property::Observer _setObs) {
m_setObserver = _setObs;
}

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,24 +7,47 @@
*/
#pragma once
#include <eproperty/Interface.h>
#include <eproperty/Interface.hpp>
#include <string>
#include <typeinfo>
#include <functional>
/**
* @brief eproperty global interface for all property implementation
*/
namespace eproperty {
class Ref;
/**
* @brief Base of the property With all generic element needed
*/
class Property {
public:
using Observer = std::function<void()>;
using Observer = std::function<void()>; //!< Local main object observer of changing value of the property
private:
eproperty::Interface* m_interfaceLink;
Observer m_setObserver;
std::string m_name;
eproperty::Interface* m_interfaceLink; //!< Base interface class to group all the property
Observer m_setObserver; //!< Observer of the changing value
std::string m_name; //!< Name of the property
public:
/**
* @brief Basic property elements
* @param[in] _paramInterfaceLink Link on the esignal::Interface class to register parameter (can be nullptr)
* @param[in] _name Name of the parameter (must be unique if _paramInterfaceLink is define)
*/
Property(eproperty::Interface* _paramInterfaceLink, const std::string& _name);
/**
* @brief Basic property elements
*/
Property();
/**
* @brief Virtualize the destructor
* @internal
*/
virtual ~Property() = default;
protected:
/**
* @brief Set the change observer of the property
* @param[in] _setObs New observer of the property
*/
void setObserver(eproperty::Property::Observer _setObs);
public:
/**
@@ -83,16 +106,52 @@ namespace eproperty {
return std::vector<std::string>();
}
public:
/**
* @brief Eguality comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object is identic
* @return false The current object is NOT identic
*/
template<class TYPE>
bool operator== (const TYPE& _obj) const = delete;
/**
* @brief IN-Eguality comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object is NOT identic
* @return false The current object is identic
*/
template<class TYPE>
bool operator!= (const TYPE& _obj) const = delete;
/**
* @brief Lesser eguality comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object lesser or equal than input object
* @return false The current object greater than input object
*/
template<class TYPE>
bool operator<= (const TYPE& _obj) const = delete;
/**
* @brief Greater eguality comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object greater or equal than input object
* @return false The current object lesser than input object
*/
template<class TYPE>
bool operator>= (const TYPE& _obj) const = delete;
/**
* @brief Lesser comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object lesser than input object
* @return false The current object greater or equal than input object
*/
template<class TYPE>
bool operator< (const TYPE& _obj) const = delete;
/**
* @brief Greater comparaison operator (REMOVED)
* @param[in] _obj Object to compare
* @return true The current object greater than input object
* @return false The current object lesser or equal than input object
*/
template<class TYPE>
bool operator> (const TYPE& _obj) const = delete;
};

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,14 +7,14 @@
*/
#pragma once
#include <eproperty/Interface.h>
#include <eproperty/Property.h>
#include <eproperty/debug.h>
#undef __class__
#define __class__ "PropertyType<T>"
#include <eproperty/Interface.hpp>
#include <eproperty/Property.hpp>
#include <eproperty/debug.hpp>
namespace eproperty {
/**
* @brief Template base of the property (have a generic set and get for string)
*/
template<class TYPE> class PropertyType : public Property {
protected:
TYPE m_value; //!< Current value.
@@ -22,7 +22,7 @@ namespace eproperty {
public:
/**
* @brief Create a parameter with a specific type.
* @param[in] _owner Owner of the parameter.
* @param[in] _owner Owner of the parameter (nullptr if none).
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _description description of the parameter.
@@ -41,6 +41,15 @@ namespace eproperty {
setObserver([=](){(*_owner.*_setObs)();});
}
}
/**
* @brief Create a parameter with a specific type.
* @param[in] _defaultValue Default value of the parameter.
*/
PropertyType(const TYPE& _defaultValue) :
m_value(_defaultValue),
m_default(_defaultValue) {
}
/**
* @brief Destructor.
*/
@@ -66,6 +75,10 @@ namespace eproperty {
void setDefault() override {
set(m_default);
}
/**
* @brief Set new default value on the property
* @param[in] _newDefault New value to set
*/
virtual void changeDefault(const TYPE& _newDefault) {
m_default = _newDefault;
}
@@ -80,7 +93,7 @@ namespace eproperty {
};
/**
* @brief Set a new value for this parameter
* @param[in] newVal New value to set (set the nearest value if range is set)
* @param[in] _newVal New value to set (set the nearest value if range is set)
*/
virtual void set(const TYPE& _newVal) {
if (_newVal != m_value) {
@@ -93,11 +106,16 @@ namespace eproperty {
* @note For performence, this function must be inline
* @note Only use by the owner of the property (can not be check on compile time for now ...)
* TODO: Do it better ... compile check
* @param[in] newVal New value to set
* @param[in] _newVal New value to set
*/
inline void setDirect(const TYPE& _newVal) {
m_value = _newVal;
}
/**
* @brief Set the value of the current parameter (check range and ... if needed).
* @note Only use by the owner of the property/
* @param[in] _newVal New value to set
*/
virtual void setDirectCheck(const TYPE& _newVal) {
m_value = _newVal;
}
@@ -111,25 +129,44 @@ namespace eproperty {
TYPE& getDirect() {
return m_value;
}
/**
* @brief Get the string of the specify value.
* @param[in] _valueRequested Value to convert in string
* @return convertion of the value in string.
*/
virtual std::string getValueSpecific(const TYPE& _valueRequested) const = 0;
public:
/**
* @brief Const cast the property in the Type of the data
* @return Const reference on the value.
*/
operator const TYPE&() const {
return m_value;
}
/**
* @brief Get the property Value
* @return Const reference on the value.
*/
const TYPE& operator *() const noexcept {
return m_value;
}
/**
* @brief Get the property Value
* @return Const reference on the value.
*/
const TYPE* operator->() const noexcept {
return &m_value;
}
const PropertyType<TYPE>& operator= (const TYPE& _newVal) = delete;
/**
* @brief Assignation opérator (REMOVED)
* @param _newVal Value to asign
* @return Reference on current object
*/
PropertyType<TYPE>& operator= (const TYPE& _newVal) = delete;
};
//! @not_in_doc
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::PropertyType<TYPE>& _obj) {
_os << _obj.get();
return _os;
}
}
#undef __class__
#define __class__ nullptr

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,14 +7,15 @@
*/
#pragma once
#include <eproperty/Interface.h>
#include <eproperty/Value.h>
#include <eproperty/Interface.hpp>
#include <eproperty/Value.hpp>
#include <typeinfo>
#undef __class__
#define __class__ "Range<T>"
namespace eproperty {
/**
* @brief Range template of the property (limit with a min and a max value)
* @tparam TYPE Tpe of the range value
*/
template<class TYPE> class Range : public Value<TYPE> {
private:
TYPE m_min; //!< Minimum value.
@@ -22,7 +23,7 @@ namespace eproperty {
public:
/**
* @brief Create a parameter with a specific type.
* @param[in] _owner reference on the parameter lister.
* @param[in] _owner reference on the parameter lister (nullptr if none).
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _min Minumum value.
@@ -45,6 +46,15 @@ namespace eproperty {
//EPROPERTY_CRITICAL("min > max...");
}
};
/**
* @brief Create a parameter with a specific type.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _min Minumum value.
* @param[in] _max Maximum value.
*/
Range(const TYPE& _defaultValue,
const TYPE& _min,
const TYPE& _max);
/**
* @brief Destructor.
*/
@@ -56,13 +66,9 @@ namespace eproperty {
void set(const TYPE& _newVal) override;
void setDirectCheck(const TYPE& _newVal) override;
};
//! @not_in_doc
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::Range<TYPE>& _obj) {
_os << _obj.get();
return _os;
}
}
#undef __class__
#define __class__ nullptr

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,21 +7,21 @@
*/
#pragma once
#include <eproperty/PropertyType.h>
#include <etk/types.h>
#include <etk/math/Vector2D.h>
#include <etk/math/Vector3D.h>
#include <etk/Color.h>
#undef __class__
#define __class__ "Value<T>"
#include <eproperty/PropertyType.hpp>
#include <etk/types.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/math/Vector3D.hpp>
#include <etk/Color.hpp>
namespace eproperty {
/**
* @brief Simple Value of the property (need to implement fuction etk::from_string<TYPE> to use it)
*/
template<class TYPE> class Value : public PropertyType<TYPE> {
public:
/**
* @brief Create a parameter with a specific type.
* @param[in] _owner Owner of the parameter.
* @param[in] _owner Owner of the parameter (nullptr if none).
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _description description of the parameter.
@@ -36,22 +36,19 @@ namespace eproperty {
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
}
protected:
/**
* @brief Get the string of the specify value.
* @return convetion of the velue in string.
* @brief Create a parameter with a specific type.
* @param[in] _defaultValue Default value of the parameter.
*/
Value(const TYPE& _defaultValue);
public:
std::string getValueSpecific(const TYPE& _valueRequested) const override;
void setString(const std::string& _newVal) override;
};
//! @not_in_doc
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::Value<TYPE>& _obj) {
_os << _obj.get();
return _os;
}
}
#undef __class__
#define __class__ nullptr

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -6,7 +6,7 @@
* @license APACHE v2.0 (see license file)
*/
#include <eproperty/debug.h>
#include <eproperty/debug.hpp>
int32_t eproperty::getLogId() {
static int32_t g_val = elog::registerInstance("eproperty");

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,7 +7,7 @@
*/
#pragma once
#include <elog/log.h>
#include <elog/log.hpp>
namespace eproperty {
int32_t getLogId();

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -6,13 +6,11 @@
* @license APACHE v2.0 (see license file)
*/
#include <eproperty/details/Range.hxx>
#include <etk/types.h>
#include <etk/math/Vector2D.h>
#include <etk/math/Vector3D.h>
#include <etk/Color.h>
#include <etk/types.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/math/Vector3D.hpp>
#include <etk/Color.hpp>
#undef __class__
#define __class__ "Range<T>"
// void generic properties
template class eproperty::Range<int64_t>;
template class eproperty::Range<int32_t>;

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,10 +7,20 @@
*/
#pragma once
#include <eproperty/Range.h>
#include <eproperty/Range.hpp>
#undef __class__
#define __class__ "Range<T>"
template<class TYPE>
eproperty::Range<TYPE>::Range(const TYPE& _defaultValue,
const TYPE& _min,
const TYPE& _max) :
eproperty::Value<TYPE>(_defaultValue),
m_min(_min),
m_max(_max) {
if (m_min > m_max) {
//EPROPERTY_CRITICAL("min > max...");
}
}
template<class TYPE>
std::string eproperty::Range<TYPE>::getPropertyType() const {

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,13 +7,11 @@
*/
#include <eproperty/details/Value.hxx>
#include <etk/types.h>
#include <etk/math/Vector2D.h>
#include <etk/math/Vector3D.h>
#include <etk/Color.h>
#include <etk/types.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/math/Vector3D.hpp>
#include <etk/Color.hpp>
#undef __class__
#define __class__ "Value<T>"
// void generic properties
template class eproperty::Value<bool>;
template class eproperty::Value<std::string>;

View File

@@ -1,4 +1,4 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
@@ -7,10 +7,14 @@
*/
#pragma once
#include <eproperty/Value.h>
#include <eproperty/Value.hpp>
#undef __class__
#define __class__ "Value<T>"
template<class TYPE>
eproperty::Value<TYPE>::Value(const TYPE& _defaultValue) :
eproperty::PropertyType<TYPE>(_defaultValue) {
}
template<class TYPE>
std::string eproperty::Value<TYPE>::getValueSpecific(const TYPE& _valueRequested) const {
@@ -24,8 +28,3 @@ void eproperty::Value<TYPE>::setString(const std::string& _newVal) {
// TODO : Do it better ...
eproperty::PropertyType<TYPE>::notifyChange();
}
#undef __class__
#define __class__ nullptr

35
lutin_eproperty-sample.py Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "SAMPLE"
def get_desc():
return "e-property sample 1"
def get_licence():
return "APACHE-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def configure(target, my_module):
my_module.add_src_file([
'sample/sampleAll.cpp'
])
my_module.add_depend([
'eproperty',
'test-debug'
])
return True

View File

@@ -1,7 +1,6 @@
#!/usr/bin/python
import lutin.module as module
import lutin.debug as debug
import lutin.tools as tools
import datetime
def get_type():
@@ -23,10 +22,9 @@ def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
return "authors.txt"
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
def configure(target, my_module):
my_module.add_src_file([
'test/main.cpp',
'test/declareProperties.cpp',
@@ -34,6 +32,10 @@ def create(target, module_name):
'test/test_range.cpp',
'test/test_value.cpp'
])
my_module.add_module_depend(['eproperty', 'gtest', 'test-debug'])
return my_module
my_module.add_depend([
'eproperty',
'gtest',
'test-debug'
])
return True

View File

@@ -1,5 +1,4 @@
#!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
import lutin.debug as debug
import os
@@ -21,36 +20,38 @@ def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
return "authors.txt"
def get_version():
return [0,1,"dev"]
return "version.txt"
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_extra_compile_flags()
def configure(target, my_module):
my_module.add_extra_flags()
my_module.add_src_file([
'eproperty/debug.cpp',
'eproperty/Property.cpp',
'eproperty/Interface.cpp',
'eproperty/InterfaceData.cpp',
'eproperty/details/Range.cpp',
'eproperty/details/Value.cpp',
])
my_module.add_header_file([
'eproperty/debug.h',
'eproperty/Value.h',
'eproperty/Interface.h',
'eproperty/Property.h',
'eproperty/PropertyType.h',
'eproperty/Range.h',
'eproperty/List.h',
'eproperty/debug.hpp',
'eproperty/Value.hpp',
'eproperty/Interface.hpp',
'eproperty/InterfaceData.hpp',
'eproperty/Property.hpp',
'eproperty/PropertyType.hpp',
'eproperty/Range.hpp',
'eproperty/List.hpp',
'eproperty/details/Range.hxx',
'eproperty/details/Value.hxx',
])
my_module.add_module_depend(['etk'])
my_module.add_path(tools.get_current_path(__file__))
my_module.compile_flags('c++', [
my_module.add_depend([
'etk'
])
my_module.add_path(".")
my_module.add_flag('c++', [
"-DEPROPERTY_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
])
return my_module
return True

163
sample/sampleAll.cpp Normal file
View File

@@ -0,0 +1,163 @@
/** @file
* @author Edouard DUPIN
*
* @copyright 2016, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <etk/etk.hpp>
#include <test-debug/debug.hpp>
//! [eproperty_sample_all]
//! [eproperty_sample_declare_interface]
#include <eproperty/Interface.hpp>
//! [eproperty_sample_declare_interface]
//! [eproperty_sample_declare_value]
#include <eproperty/Value.hpp>
//! [eproperty_sample_declare_value]
//! [eproperty_sample_declare_list]
#include <eproperty/List.hpp>
//! [eproperty_sample_declare_list]
//! [eproperty_sample_declare_range]
#include <eproperty/Range.hpp>
//! [eproperty_sample_declare_range]
//! [eproperty_sample_declare_an_enum]
enum simpleEnum {
simpleEnum_enum1,
simpleEnum_enum2,
simpleEnum_enum3,
simpleEnum_enum4,
};
//! [eproperty_sample_declare_an_enum]
//! [eproperty_sample_class_with_interface]
//! [eproperty_sample_declare_class_with_interface]
class sampleClassGroup : public eproperty::Interface {
//! [eproperty_sample_declare_class_with_interface]
public:
//! [eproperty_sample_declare_class_property_value]
eproperty::Value<std::string> propertyValue; //!< Simple property Value with type string
//! [eproperty_sample_declare_class_property_value]
//! [eproperty_sample_declare_class_property_list]
eproperty::List<enum simpleEnum> propertyList; //!< Simple property List with type enumeration
//! [eproperty_sample_declare_class_property_list]
//! [eproperty_sample_declare_class_property_range]
eproperty::Range<int32_t> propertyRange; //!< Simple property Range with type integer
//! [eproperty_sample_declare_class_property_range]
sampleClassGroup():
//! [eproperty_sample_initialize_class_property_value]
propertyValue(this, "value", "default value", "optionnal Description", &sampleClassGroup::onPropertyChangeValue),
//! [eproperty_sample_initialize_class_property_value]
//! [eproperty_sample_initialize_class_property_list]
propertyList(this, "list", simpleEnum_enum4),
//! [eproperty_sample_initialize_class_property_list]
//! [eproperty_sample_initialize_class_property_range]
propertyRange(this, "range", 5646546, -5, 555555555) {
//! [eproperty_sample_initialize_class_property_range]
// add all enumeration values
//! [eproperty_sample_initialize_class_property_list_add]
propertyList.add(simpleEnum_enum1, "enum1");
propertyList.add(simpleEnum_enum2, "enum2");
propertyList.add(simpleEnum_enum3, "enum3");
propertyList.add(simpleEnum_enum4, "enum4");
//! [eproperty_sample_initialize_class_property_list_add]
//! [eproperty_sample_initialize_class_property_list_rename]
// Rename an element
propertyList.rename("enum1", "new enum name");
// Remove an element
propertyList.remove("enum2");
//! [eproperty_sample_initialize_class_property_list_rename]
//! [eproperty_sample_initialize_class_property_set_direct]
// no check on the value set (the faster in CPU cycle)
propertyValue.setDirect("New Value to Set");
// Check the internal value (better for range)
propertyRange.setDirectCheck(-5555);
//! [eproperty_sample_initialize_class_property_set_direct]
}
//! [eproperty_sample_initialize_class_property_value_callback]
void onPropertyChangeValue() {
TEST_PRINT("Property value has change ... " << *propertyValue);
TEST_INFO("Use properties:");
//! [eproperty_sample_get_value_value]
TEST_INFO(" value:" << *propertyValue);
//! [eproperty_sample_get_value_value]
//! [eproperty_sample_get_value_range]
TEST_INFO(" range:" << *propertyRange);
//! [eproperty_sample_get_value_range]
//! [eproperty_sample_get_value_list]
TEST_INFO(" list:" << *propertyList);
//! [eproperty_sample_get_value_list]
}
//! [eproperty_sample_initialize_class_property_value_callback]
};
//! [eproperty_sample_class_with_interface]
//! [eproperty_sample_class_without_interface]
class sampleClassSolo {
public:
eproperty::Value<std::string> propertyValue;
eproperty::List<enum simpleEnum> propertyList;
eproperty::Range<int32_t> propertyRange;
sampleClassSolo():
//! [eproperty_sample_initialize_class_property_value2]
propertyValue("default value"),
//! [eproperty_sample_initialize_class_property_value2]
//! [eproperty_sample_initialize_class_property_list2]
propertyList(simpleEnum_enum4),
//! [eproperty_sample_initialize_class_property_list2]
//! [eproperty_sample_initialize_class_property_range2]
propertyRange(5646546, -5, 555555555) {
//! [eproperty_sample_initialize_class_property_range2]
propertyList.add(simpleEnum_enum1, "enum1");
propertyList.add(simpleEnum_enum2, "enum2");
propertyList.add(simpleEnum_enum3, "enum3");
propertyList.add(simpleEnum_enum4, "enum4");
}
};
//! [eproperty_sample_class_without_interface]
void simpleSet() {
//! [eproperty_sample_use_declare_class]
sampleClassGroup myClass;
//! [eproperty_sample_use_declare_class]
//! [eproperty_sample_use_set_value_1]
myClass.propertyValue.set("New Value");
myClass.propertyValue.setString("New Value 2");
//! [eproperty_sample_use_set_value_1]
//! [eproperty_sample_use_set_list_1]
myClass.propertyList.set(simpleEnum_enum3);
myClass.propertyList.setString("enum3");
//! [eproperty_sample_use_set_list_1]
//! [eproperty_sample_use_set_range_1]
myClass.propertyRange.set(15621);
myClass.propertyRange.setString("15621");
//! [eproperty_sample_use_set_range_1]
//! [eproperty_sample_use_set_value_2]
myClass.properties.set("value", "New Value in string");
//! [eproperty_sample_use_set_value_2]
//! [eproperty_sample_use_set_list_2]
myClass.properties.set("list", "enum4");
//! [eproperty_sample_use_set_list_2]
//! [eproperty_sample_use_set_range_2]
myClass.properties.set("range", "-2");
//! [eproperty_sample_use_set_range_2]
}
//! [eproperty_sample_all]
int main(int _argc, const char *_argv[]) {
etk::init(_argc, _argv);
TEST_INFO("simpleSet [START] ***************************");
simpleSet();
TEST_INFO("simpleSet [STOP] ***************************");
return 0;
}

View File

@@ -7,14 +7,11 @@
*/
#define NAME "Empty"
#include <etk/types.h>
#include <etk/etk.h>
#include <test-debug/debug.h>
#include <etk/types.hpp>
#include <etk/etk.hpp>
#include <test-debug/debug.hpp>
#include <gtest/gtest.h>
#undef __class__
#define __class__ "eproperty-test"
int main(int _argc, const char *_argv[]) {
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
etk::init(_argc, _argv);

1
version.txt Normal file
View File

@@ -0,0 +1 @@
0.4.0