# HG changeset patch # User David Demelier # Date 1430212414 -7200 # Node ID eb7723d8627aaa95560690875d6d0e382873bc7b # Parent 3174c463af95c937cfc19c963b8ac95fac1aab9e Xdg: - Add documentation - Remove EXPORT thingy, will be set with the pre-processor feature diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/Home.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/Home.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,14 @@ +# Xdg + +Read the directories from the [XDG base directory specifications][xdg]. + +**Note**: this class should compile on Windows (to make your code more portable) +but the functions should not be used. + +## API Reference + +### Classes + +- [Xdg](class/Xdg.md) + +[xdg]: http://www.freedesktop.org/wiki/Specifications/basedir-spec diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,19 @@ +# Xdg + +The Xdg class. The constructor loads the directories and you can access to the directories. + +## Class + +````cpp +class Xdg; +```` + +### Public member functions + +- [(Constructor)](Xdg/Constructor.md) +- [configHome](Xdg/configHome.md) +- [dataHome](Xdg/dataHome.md) +- [cacheHome](Xdg/cacheHome.md) +- [runtimeDir](Xdg/runtimeDir.md) +- [configDirs](Xdg/configDirs.md) +- [dataDirs](Xdg/dataDirs.md) \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/Constructor.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/Constructor.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# Constructor + +Construct the Xdg object, loads the directories. + +## Function + +### SYNOPSIS + +````cpp +Xdg(); +```` + +### THROWS + +- [std::runtime_error](http://en.cppreference.com/w/cpp/error/runtime_error) on errors \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/cacheHome.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/cacheHome.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# cacheHome + +Get the cache directory which is `XDG_CACHE_HOME` or `${HOME}/.cache` + +## Function + +### SYNOPSIS + +````cpp +const std::string &cacheHome() const noexcept; +```` + +### RETURNS + +The directory. \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/configDirs.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/configDirs.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# configDirs + +Get the list of preferred configuration directories which is `XDG_CONFIG_DIRS`. If unset, returns the list `"/etc/xdg"`. + +## Function + +### SYNOPSIS + +````cpp +const List &configDirs() const noexcept; +``` + +### RETURNS + +The list of directories. \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/configHome.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/configHome.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# configHome + +Get the configuration directory which is `XDG_CONFIG_HOME` or `${HOME}/.config` + +## Function + +### SYNOPSIS + +````cpp +const std::string &configHome() const noexcept; +```` + +### RETURNS + +The directory. \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/dataDirs.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/dataDirs.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# dataDirs + +Get the list of preferred data directories which is `XDG_DATA_DIRS`. If unset, returns the list `"/usr/local/share", "/usr/share"`. + +## Function + +### SYNOPSIS + +````cpp +const List &dataDirs() const noexcept; +```` + +### RETURNS + +The list of directories. \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/dataHome.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/dataHome.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,15 @@ +# dataHome + +Get the data directory which is `XDG_DATA_HOME` or `${HOME}/.local/share` + +## Function + +### SYNOPSIS + +````cpp +const std::string &dataHome() const noexcept; +```` + +### RETURNS + +The directory. \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/doc/Xdg/class/Xdg/runtimeDir.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/doc/Xdg/class/Xdg/runtimeDir.md Tue Apr 28 11:13:34 2015 +0200 @@ -0,0 +1,21 @@ +# runtimeDir + +Get the runtime directory which is `XDG_RUNTIME_DIR`. If no one is set, throws an exception. The standard says that the application should set a directory if it is not set by the user. + +**Note**: the standard says that the runtime directory should be mode 0700 and owner by the user but Xdg does not test that. + +## Function + +### SYNOPSIS + +````cpp +const std::string &runtimeDir() const; +```` + +### RETURNS + +The directory. + +### THROWS + +- [std::runtime_error](http://en.cppreference.com/w/cpp/error/runtime_error) on failures \ No newline at end of file diff -r 3174c463af95 -r eb7723d8627a C++/modules/Xdg/Xdg.h --- a/C++/modules/Xdg/Xdg.h Tue Apr 28 11:04:54 2015 +0200 +++ b/C++/modules/Xdg/Xdg.h Tue Apr 28 11:13:34 2015 +0200 @@ -22,16 +22,6 @@ #include #include -#if defined(_WIN32) -# if defined(BUILDING_DLL) -# define EXPORT __declspec(dllexport) -# else -# define EXPORT __declspec(dllimport) -# endif -#else -# define EXPORT -#endif - /** * @class Xdg * @brief XDG specifications @@ -39,7 +29,7 @@ * Read and get XDG directories. This file contains exports thingies so it can * compiles successfully on Windows but its usage is discouraged. */ -class EXPORT Xdg { +class Xdg { public: using List = std::vector; diff -r 3174c463af95 -r eb7723d8627a CMakeLists.txt --- a/CMakeLists.txt Tue Apr 28 11:04:54 2015 +0200 +++ b/CMakeLists.txt Tue Apr 28 11:13:34 2015 +0200 @@ -366,7 +366,7 @@ ) # --------------------------------------------------------- -# Utf8 +# Unicode # --------------------------------------------------------- define_module( @@ -382,17 +382,26 @@ # Xdg # --------------------------------------------------------- -if (UNIX) +#if (UNIX) define_module( TARGET xdg NAME Xdg DIRECTORY Xdg - SOURCES ${code_SOURCE_DIR}/C++/modules/Xdg/Xdg.cpp ${code_SOURCE_DIR}/C++/modules/Xdg/Xdg.h + DOCS + ${code_SOURCE_DIR}/C++/doc/Xdg/Home.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/cacheHome.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/configDirs.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/configHome.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/Constructor.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/dataDirs.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/dataHome.md + ${code_SOURCE_DIR}/C++/doc/Xdg/class/Xdg/runtimeDir.md ) -endif () +#endif () # --------------------------------------------------------- # Zip