From 382284f3ac263566c6ef368a155bcdfddd2eb022 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Stawicki?= Date: Tue, 19 Sep 2017 17:50:29 +0200 Subject: [PATCH] Generate rpm package with doxygen documentation running gbs build with docs: gbs build --define "_with_docs 1" Change-Id: Ica3d3834488539b78479c70b9a072f792256c1f4 --- CMakeLists.txt | 26 ++++++++++++++++ docs/Doxyfile.in | 3 ++ packaging/org.tizen.universal-switch.spec | 23 +++++++++++++- src/VConf.hpp | 51 +++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 docs/Doxyfile.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 5548274..d187db3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,10 @@ ENABLE_TESTING() PROJECT(universal-switch CXX) FIND_PACKAGE(PkgConfig REQUIRED) +FIND_PACKAGE(Doxygen) option(TESTS "enable/disable universal switch tests" ON) +option(DOCS "Build documentation" OFF) pkg_check_modules(pkgs REQUIRED atspi-2 @@ -61,3 +63,27 @@ INSTALL(DIRECTORY res/icons/ DESTINATION ${ICONS_DIR} FILES_MATCHING PATTERN "*. INSTALL(FILES org.tizen.universal-switch.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) INSTALL(FILES ${PROJECT_NAME}.edj DESTINATION ${RES_DIR}) INSTALL(PROGRAMS utils/setVconfKeys.sh DESTINATION scripts/) + + +#documentation + +if (DOCS) + # check if Doxygen is installed + if (DOXYGEN_FOUND) + # set input and output files + set(DOXYGEN_IN docs/Doxyfile.in) + set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + set(DOXYGEN_DIR ${CMAKE_BINARY_DIR}/doc_doxygen/) + + configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) + message("Doxygen build started") + add_custom_target(doc_doxygen ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM ) + INSTALL(DIRECTORY ${DOXYGEN_DIR} DESTINATION docs) + else (DOXYGEN_FOUND) + message("Doxygen need to be installed to generate the doxygen documentation") + endif (DOXYGEN_FOUND) +endif (DOCS) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 0000000..77f5098 --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,3 @@ +OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc_doxygen/ +INPUT = @CMAKE_SOURCE_DIR@/src/ @CMAKE_SOURCE_DIR@/docs +JAVADOC_AUTOBRIEF = YES diff --git a/packaging/org.tizen.universal-switch.spec b/packaging/org.tizen.universal-switch.spec index eb3e18e..befad76 100644 --- a/packaging/org.tizen.universal-switch.spec +++ b/packaging/org.tizen.universal-switch.spec @@ -1,4 +1,5 @@ %bcond_without tests +%bcond_with docs Name: org.tizen.universal-switch Summary: Universal Switch Assistive Technology @@ -28,6 +29,9 @@ BuildRequires: pkgconfig(gobject-2.0) BuildRequires: pkgconfig(eldbus) #Required for tests BuildRequires: net-config +%if %{with docs} +BuildRequires: doxygen +%endif %description Assistive technology client for users with dexterity disability. @@ -47,9 +51,13 @@ cmake . -DCMAKE_INSTALL_PREFIX="%{AppDir}" \ -DCMAKE_TESTS_INSTALL_PREFIX="%{TestsAppDir}" \ -DTZ_SYS_RO_PACKAGES=%{TZ_SYS_RO_PACKAGES} \ %if !%{with tests} - -DTESTS=OFF + -DTESTS=OFF \ +%endif +%if %{with docs} + -DDOCS=ON \ %endif + make %{?jobs:-j%jobs} export CTEST_OUTPUT_ON_FAILURE=1 @@ -98,3 +106,16 @@ tpk-backend -y %{TestsName} --preload %{TestsAppDir}/scripts/VConf_init.sh %{TestsAppDir}/lib/libuniversal-switch-shared.so %endif + +%if %{with docs} +%package docs +Summary: Universal Switch Assistive Technology - documentation +Requires: %{name} = %{version} + +%description docs +Universal Switch documentation + +%files docs +%license LICENSE +%{AppDir}/docs/* +%endif diff --git a/src/VConf.hpp b/src/VConf.hpp index 47d74b0..39c9f27 100644 --- a/src/VConf.hpp +++ b/src/VConf.hpp @@ -14,16 +14,67 @@ public: struct HandleBase { virtual ~HandleBase() = default; }; + using CallbackHandle = std::unique_ptr; + /** + * get int value for given key. + * @param key vconf key + * @param defaultValue value returned if key is not set + * @return vconf value for given key or defaultValue if key is not set + */ virtual int get(const std::string &key, int defaultValue) const = 0; + + /** + * get boolean value for given key. + * @param key vconf key + * @param defaultValue value returned if key is not set + * @return vconf value for given key or defaultValue if key is not set + */ virtual bool get(const std::string &key, bool defaultValue) const = 0; + + /** + * get double value for given key. + * @param key vconf key + * @param defaultValue value returned if key is not set + * @return vconf value for given key or defaultValue if key is not set + */ virtual double get(const std::string &key, double defaultValue) const = 0; + + /** + * get string value for given key. + * @param key vconf key + * @param defaultValue value returned if key is not set + * @return vconf value for given key or defaultValue if key is not set + */ virtual std::string get(const std::string &key, const std::string &defaultValue) const = 0; + /** + * set int value for given key. + * @param key vconf key + * @param value value to be set + */ virtual void set(const std::string &key, int value) = 0; + + /** + * set boolean value for given key. + * @param key vconf key + * @param value value to be set + */ virtual void set(const std::string &key, bool value) = 0; + + /** + * set double value for given key. + * @param key vconf key + * @param value value to be set + */ virtual void set(const std::string &key, double value) = 0; + + /** + * set string value for given key. + * @param key vconf key + * @param value value to be set + */ virtual void set(const std::string &key, const std::string &value) = 0; virtual CallbackHandle registerKeyChangedCb(const std::string &key, std::function) = 0; -- 2.7.4