From bd7b6e691c8d6f3a2c14381228b5925ca4242234 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 24 Feb 2016 23:21:16 +0100 Subject: [PATCH 01/34] travi test nana branch hotfix-1.3 with demo-nana branch dev_nana_in_examples --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6e840779..d411b4b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ matrix: - llvm-toolchain-precise before_install: - - git clone --depth=50 --branch=dev_dir_it https://github.com/qPCR4vir/nana-demo.git nana-demo + - git clone --depth=50 --branch=dev_nana_in_examples https://github.com/qPCR4vir/nana-demo.git nana-demo - export PATH="$HOME/bin:$PATH" - mkdir ~/bin - wget --no-check-certificate --no-clobber -O /tmp/tools/cmake https://cmake.org/files/v3.4/cmake-3.4.0-rc3-Linux-x86_64.sh || true From e649a06b6fafde9ede4a606f4638f9b4ee112fe7 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 25 Feb 2016 00:07:39 +0100 Subject: [PATCH 02/34] include protoversion of the file_explore demo --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24b23784..4d099d6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,8 +203,8 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) if (BUILD_NANA_DEMOS) - set (demos calculator notepad widget_show widget_show2 ) - # Pending: file_explorer FreeMe + set (demos calculator file_explorer notepad widget_show widget_show2 ) + # Pending: FreeMe foreach ( demo ${demos}) add_executable(${demo} "../nana-demo/${demo}.cpp") From 0978ed7e1815d93b06660150eea9bcd4184e7a93 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 25 Feb 2016 08:40:57 +0100 Subject: [PATCH 03/34] NANA_BOOST_FILESYSTEM_PREFERRED On by default. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d099d6b..cdbbe357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF # By default Nana will use the ISO TS if available, or nana if not. # Boost will be use only if you change one of the following: option(CMAKE_BOOST_FILESYSTEM_AVAILABLE "Is Boost filesystem available?" OFF) -option(NANA_BOOST_FILESYSTEM_PREFERRED "Is Boost filesystem preferred over nana?" OFF) +option(NANA_BOOST_FILESYSTEM_PREFERRED "Is Boost filesystem preferred over nana?" ON) option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over ISO)?" OFF) option(CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") From 1dd42c8841e68e9a7039528a94a5b4891db3edca Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 25 Feb 2016 09:26:06 +0100 Subject: [PATCH 04/34] log Boost related configuration --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdbbe357..261fe97d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,4 +264,12 @@ message ( "CMAKE_COMPILER_IS_GNUCXX= " ${CMAKE_COMPILER_IS_GNUCXX}) message ( "CMAKE_EXE_LINKER_FLAGS = " ${CMAKE_EXE_LINKER_FLAGS}) message ( "NANA_LINKS = " ${NANA_LINKS}) message ( "ENABLE_AUDIO = " ${ENABLE_AUDIO}) +message ( "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX}) +message ( "DESTDIR = " ${DESTDIR}) +message ( "CMAKE_BOOST_FILESYSTEM_AVAILABLE = " ${CMAKE_BOOST_FILESYSTEM_AVAILABLE}) +message ( "NANA_BOOST_FILESYSTEM_PREFERRED = " ${NANA_BOOST_FILESYSTEM_PREFERRED}) +message ( "CMAKE_BOOST_FILESYSTEM_FORCE = " ${CMAKE_BOOST_FILESYSTEM_FORCE}) +message ( "CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT = " ${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}) +message ( "CMAKE_BOOST_FILESYSTEM_LIB = " ${CMAKE_BOOST_FILESYSTEM_LIB}) + From aad9e7780462803bde037845ed56b83c169950cc Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 25 Feb 2016 19:18:40 +0100 Subject: [PATCH 05/34] a few more std features in filesystem --- include/nana/filesystem/filesystem.hpp | 53 ++++++++++++++++++-------- source/filesystem/filesystem.cpp | 9 ++++- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index c44345c6..1bbe3aa9 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -127,23 +127,41 @@ namespace nana { namespace experimental { namespace filesystem _m_assign(source); } + // modifiers + //void clear() noexcept; + path& make_preferred(); + path& remove_filename(); + //path& replace_filename(const path& replacement); + //path& replace_extension(const path& replacement = path()); + //void swap(path& rhs) noexcept; + + // decomposition + //path root_name() const; + //path root_directory() const; + //path root_path() const; + //path relative_path() const; + path parent_path() const; + path filename() const; + //path stem() const; + path extension() const; + + // query + bool empty() const noexcept; + //bool has_root_name() const; + //bool has_root_directory() const; + //bool has_root_path() const; + //bool has_relative_path() const; + bool has_parent_path() const { return !parent_path().empty(); }; // temp;; + bool has_filename() const { return !filename().empty(); }; // temp; + //bool has_stem() const; + bool has_extension() const { return !extension().empty(); }; // temp + //bool is_absolute() const; + //bool is_relative() const; int compare(const path& other) const; - bool empty() const; - path extension() const; - - path parent_path() const; file_type what() const; - //decomposition - path filename() const; - - //modifiers - path& remove_filename(); - - - const value_type*c_str() const; const string_type& native() const; operator string_type() const; @@ -335,16 +353,21 @@ namespace nana { namespace experimental { namespace filesystem bool create_directory(const path& p, const path& attributes); //bool create_directory(const path& p, const path& attributes, error_code& ec) noexcept; - bool modified_file_time(const path& p, struct tm&); + bool modified_file_time(const path& p, struct tm&); ///< extention ? + + /// The time of last data modification of p, determined as if by the value of the POSIX + /// stat structure member st_mtime obtained as if by POSIX stat(). + file_time_type last_write_time(const path& p); + /// returns file_time_type::min() if an error occurs + //file_time_type last_write_time(const path& p, error_code& ec) noexcept; path path_user(); ///< extention ? - + path current_path(); //path current_path(error_code& ec); void current_path(const path& p); ///< chdir //void current_path(const path& p, error_code& ec) noexcept; - bool remove(const path& p); bool remove(const path& p, std::error_code& ec); // noexcept; diff --git a/source/filesystem/filesystem.cpp b/source/filesystem/filesystem.cpp index 63795147..1f523f3a 100644 --- a/source/filesystem/filesystem.cpp +++ b/source/filesystem/filesystem.cpp @@ -110,7 +110,7 @@ namespace nana { namespace experimental { namespace filesystem return pathstr_.compare(p.pathstr_); } - bool path::empty() const + bool path::empty() const noexcept { #if defined(NANA_WINDOWS) return (::GetFileAttributes(pathstr_.c_str()) == INVALID_FILE_ATTRIBUTES); @@ -781,6 +781,13 @@ namespace nana { namespace experimental { namespace filesystem return false; } + file_time_type last_write_time(const path& p) + { + struct tm t; + modified_file_time(p, t); + std::chrono::system_clock::time_point dateTime =std::chrono::system_clock::from_time_t( mktime(&t) ); + return dateTime; + } bool create_directory(const path& p) { From c499c351dce565c87b0fdeb23373699fdea22f01 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 25 Feb 2016 19:21:29 +0100 Subject: [PATCH 06/34] cleanup selection of std, boost or nana filesystem and install it in travis, with detection in cmake todo: check namespaces and compatibility of boost filesystem --- .travis.yml | 4 +- CMakeLists.txt | 71 +++++++++++++------ include/nana/config.hpp | 38 ++++++---- .../nana/filesystem/filesystem_selector.hpp | 60 ++++++++-------- 4 files changed, 107 insertions(+), 66 deletions(-) diff --git a/.travis.yml b/.travis.yml index d411b4b0..a688d416 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,10 +65,12 @@ install: - /tmp/tools/cmake --prefix="$HOME" --exclude-subdir before_script : + - sudo apt-get update -qq + - sudo apt-get install libboost-filesystem-dev - mkdir bld - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF + - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON - make diff --git a/CMakeLists.txt b/CMakeLists.txt index 261fe97d..1a4b6852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ # use CACHEĀ FORCE or set(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ ON) or delete CMakecache.txt or the entirely build dir # if your changes don't execute +set(NANA_LINKS) + option(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ "replaced boost.thread with meganz's mingw-std-threads." OFF) option(ENABLE_PNG "Enable the use of PNG" OFF) option(LIBPNG_FROM_OS "Use libpng from operating system." ON) @@ -20,8 +22,9 @@ option(ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF) +option(INCLUDE_EXPERIMENTAL_DEMOS "" OFF) -# The ISO C++ File System Technical Specification is optional. +# The ISO C++ File System Technical Specification (ISO-TS, or STD) is optional. # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf # This is not a workaround, but an user option. # The library maybe available in the std library in use or from Boost (almost compatible) @@ -29,28 +32,51 @@ option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF # or you can choose to use the (partial, but functional) implementation provided by nana. # If you include the file # The selected option will be set by nana into std::experimental::filesystem -# By default Nana will use the ISO TS if available, or nana if not. -# Boost will be use only if you change one of the following: -option(CMAKE_BOOST_FILESYSTEM_AVAILABLE "Is Boost filesystem available?" OFF) -option(NANA_BOOST_FILESYSTEM_PREFERRED "Is Boost filesystem preferred over nana?" ON) -option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over ISO)?" OFF) -option(CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") -option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") +# By default Nana will try to use the STD. If not available will try +# to use boost if available. Nana own implementation will be use only none of them are available. +# You can change that default if you change one of the following +# (please don't define more than one of the _XX_FORCE options): +option(CMAKE_FIND_BOOST_FILESYSTEM "Search: Is Boost filesystem available?" ON) +option(CMAKE_NANA_FILESYSTEM_FORCE "Force nana filesystem over ISO and boost?" OFF) +option(CMAKE_STD_FILESYSTEM_FORCE "Use of STD filesystem?(a compilation error will ocurre if not available)" OFF) +option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over STD)?" OFF) +# cmake will find the package self, if don't works set the following (please find the correct values): +#option(CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") +#option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") +#include_directories("${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}") +#list(APPEND NANA_LINKS "${CMAKE_BOOST_FILESYSTEM_LIB}") -set(NANA_LINKS) -if (CMAKE_BOOST_FILESYSTEM_AVAILABLE) - if (CMAKE_BOOST_FILESYSTEM_PREFERED OR CMAKE_BOOST_FILESYSTEM_FORCE) + +if (CMAKE_NANA_FILESYSTEM_FORCE) + add_definitions(-DNANA_FILESYSTEM_FORCE) + +elseif (CMAKE_STD_FILESYSTEM_FORCE) + add_definitions(-DSTD_FILESYSTEM_FORCE) + +elseif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) + + if (CMAKE_BOOST_FILESYSTEM_FORCE) + add_definitions(-DNANA_BOOST_FILESYSTEM_FORCE) + endif(CMAKE_BOOST_FILESYSTEM_FORCE) + + # https://cmake.org/cmake/help/git-master/module/FindBoost.html + # Implicit dependencies such as Boost::filesystem requiring Boost::system will be automatically detected and satisfied, + # even if system is not specified when using find_package and if Boost::system is not added to target_link_libraries. + # If using Boost::thread, then Thread::Thread will also be added automatically. + find_package(Boost COMPONENTS filesystem) + if (Boost_FOUND) add_definitions(-DNANA_BOOST_FILESYSTEM_AVAILABLE) - if (CMAKE_BOOST_FILESYSTEM_FORCE) - add_definitions(-DNANA_BOOST_FILESYSTEM_FORCE) - else() - add_definitions(-DNANA_BOOST_FILESYSTEM_PREFERED) - endif() - include_directories("${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}") - list(APPEND NANA_LINKS "${CMAKE_BOOST_FILESYSTEM_LIB}") - endif (CMAKE_BOOST_FILESYSTEM_PREFERED OR CMAKE_BOOST_FILESYSTEM_FORCE) -endif (CMAKE_BOOST_FILESYSTEM_AVAILABLE) + include_directories(SYSTEM "${Boost_INCLUDE_DIR}") + list(APPEND NANA_LINKS "${Boost_LIBRARIES}") + endif (Boost_FOUND) + + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_STATIC_RUNTIME ON) # ?? + #set(Boost_USE_MULTITHREADED ON) + +endif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) + project(nana) cmake_minimum_required(VERSION 2.8) @@ -203,7 +229,10 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) if (BUILD_NANA_DEMOS) - set (demos calculator file_explorer notepad widget_show widget_show2 ) + set (demos calculator notepad widget_show widget_show2 ) + if (INCLUDE_EXPERIMENTAL_DEMOS) + list(APPEND demos file_explorer) + endif (INCLUDE_EXPERIMENTAL_DEMOS) # Pending: FreeMe foreach ( demo ${demos}) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 6335f2e2..2c1d3c83 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -39,20 +39,30 @@ // https://github.com/meganz/mingw-std-threads //#define NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ -//////////////////////////// -// The ISO C++ File System Technical Specification is optional. -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf -// This is not a workaround, but an user option. -// The library maybe available in the std library in use or from Boost (almost compatible) -// http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm -// or you can choose to use the (partial, but functional) implementation provided by nana. -// If you include the file -// The selected option will be set by nana into std::experimental::filesystem -// By default Nana will use the ISO TS if available, or nana if not. -// Boost will be use only if you change one of the following (set the includes and link correspondly): -//#define NANA_BOOST_FILESYSTEM_AVAILABLE // "Is Boost filesystem available?" -//#define NANA_BOOST_FILESYSTEM_PREFERRED // "Is Boost filesystem preferred over nana?" -//#define NANA_BOOST_FILESYSTEM_FORCE // "Force use of Boost filesystem if available (over ISO)? +//# The ISO C++ File System Technical Specification(ISO - TS, or STD) is optional. +//# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf +//# This is not a workaround, but an user option. +//# The library maybe available in the std library in use or from Boost(almost compatible) +//# http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm +//# or you can choose to use the(partial, but functional) implementation provided by nana. +//# If you include the file +//# the selected option will be set by nana into std::experimental::filesystem +//# By default Nana will try to use the STD.If not available will try +//# to use boost if available.Nana own implementation will be use only none of them are available. +//# You can change that default if you change one of the following +//# (please don't define more than one of the _XX_FORCE options): +// +//#define BOOST_FILESYSTEM_AVAILABLE // "Is Boost filesystem available?" +//#define BOOST_FILESYSTEM_FORCE // "Force use of Boost filesystem if available (over ISO and nana) +//#define STD_FILESYSTEM_FORCE // "Use of STD filesystem?(a compilation error will ocurre if not available)" OFF) +//#define NANA_FILESYSTEM_FORCE // "Force nana filesystem over ISO and boost?" OFF) +// +// Make sure you (cmake?) provide the following where correspond (please find the correct values): +// set CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") +// set CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") +// include_directories CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT +// APPEND flag LINKS CMAKE_BOOST_FILESYSTEM_LIB + /////////////////// // Support of PCM playback diff --git a/include/nana/filesystem/filesystem_selector.hpp b/include/nana/filesystem/filesystem_selector.hpp index af4cf298..5b00e0c7 100644 --- a/include/nana/filesystem/filesystem_selector.hpp +++ b/include/nana/filesystem/filesystem_selector.hpp @@ -9,16 +9,17 @@ * @file nana\filesystem\filesystem_selector.hpp * @autor by Ariel Vina-Rodriguez: * @brief A "ISO C++" filesystem Implementation selector -* The ISO C++ File System Technical Specification is optional. -* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf -* This is not a workaround, but an user option. -* The library maybe available in the std library in use or from Boost (almost compatible) -* http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm -* or you can choose to use the (partial, but functional) implementation provided by nana. -* If you include the file -* The selected option will be set by nana into std::experimental::filesystem -* By default Nana will use the ISO TS if available, or nana if not. -* Boost will be use only if explicitily changed +* +* The ISO C++ File System Technical Specification(ISO - TS, or STD) is optional. +* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf +* This is not a workaround, but an user option. +* The library maybe available in the std library in use or from Boost(almost compatible) +* http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm +* or you can choose to use the(partial, but functional) implementation provided by nana. +* If you include the file +* the selected option will be set by nana into std::experimental::filesystem +* By default Nana will try to use the STD. If not available will try +* to use boost if available. Nana own implementation will be use only if none of them are available. * nana Now mimic std::experimental::filesystem::v1 (boost v3) * */ @@ -28,7 +29,25 @@ #include -#if (!defined(NANA_FILESYSTEM_FORCE) && defined(NANA_BOOST_FILESYSTEM_AVAILABLE) && ( defined(NANA_BOOST_FILESYSTEM_FORCE) || (defined(STD_FILESYSTEM_NOT_SUPPORTED) && defined(NANA_BOOST_FILESYSTEM_PREFERRED) ) )) +#if (defined(NANA_FILESYSTEM_FORCE) || ( (defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(BOOST_FILESYSTEM_AVAILABLE)) && !(defined(BOOST_FILESYSTEM_FORCE) || defined(STD_FILESYSTEM_FORCE)) ) ) + +# include + +namespace std { + namespace experimental { + namespace filesystem { + +# ifdef CXX_NO_INLINE_NAMESPACE + using namespace nana::experimental::filesystem; +# else + using namespace nana::experimental::filesystem::v1; +# endif + + } // filesystem + } // experimental +} // std + +#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) )) # include @@ -47,25 +66,6 @@ namespace std { } // experimental } // std - -#elif (defined(NANA_FILESYSTEM_FORCE) || defined(STD_FILESYSTEM_NOT_SUPPORTED)) - -# include - -namespace std { - namespace experimental { - namespace filesystem { - -# ifdef CXX_NO_INLINE_NAMESPACE - using namespace nana::experimental::filesystem; -# else - using namespace nana::experimental::filesystem::v1; -# endif - - } // filesystem - } // experimental -} // std - #else # include #endif From ad926c3d0317f2c14b7974bbe3b7700e0b445ef4 Mon Sep 17 00:00:00 2001 From: Ariel Vina-Rodriguez Date: Thu, 25 Feb 2016 19:27:33 +0100 Subject: [PATCH 07/34] eliminate problematic line in travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a688d416..a8f6c634 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,6 @@ install: - /tmp/tools/cmake --prefix="$HOME" --exclude-subdir before_script : - - sudo apt-get update -qq - sudo apt-get install libboost-filesystem-dev - mkdir bld - cd bld From 890b60d9c73cb3ec3f305ba5fc522b6ddc820ba0 Mon Sep 17 00:00:00 2001 From: Ariel Vina-Rodriguez Date: Thu, 25 Feb 2016 19:30:50 +0100 Subject: [PATCH 08/34] elimine - sudo apt-get install libboost-filesystem-dev --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a8f6c634..96209c96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ matrix: - alsa-oss - libx11-dev - libxft-dev + - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test - env: CXX=g++-4.9 CC=gcc-4.9 @@ -65,7 +66,6 @@ install: - /tmp/tools/cmake --prefix="$HOME" --exclude-subdir before_script : - - sudo apt-get install libboost-filesystem-dev - mkdir bld - cd bld From 1c42e93d917cb8bdf0ad65aefef881baf9f71919 Mon Sep 17 00:00:00 2001 From: Ariel Vina-Rodriguez Date: Thu, 25 Feb 2016 19:41:41 +0100 Subject: [PATCH 09/34] try nana, no boost filesystem --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96209c96..15e6c5d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,6 +70,6 @@ before_script : - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON + - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=OFF -DINCLUDE_EXPERIMENTAL_DEMOS=ON - make From 2504a915b30a3c90d0ed91163ca31907045c0b60 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 14:03:01 +0100 Subject: [PATCH 10/34] FIX: project() defines essential system variables like CMAKE_FIND_LIBRARY_PREFIXES --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a4b6852..2a6706ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,11 @@ # use CACHEĀ FORCE or set(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ ON) or delete CMakecache.txt or the entirely build dir # if your changes don't execute +# It seems that project() defines essential system variables like CMAKE_FIND_LIBRARY_PREFIXES. +# https://bbs.archlinux.org/viewtopic.php?id=84967 +project(nana) +cmake_minimum_required(VERSION 2.8) + set(NANA_LINKS) option(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ "replaced boost.thread with meganz's mingw-std-threads." OFF) @@ -22,7 +27,7 @@ option(ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF) -option(INCLUDE_EXPERIMENTAL_DEMOS "" OFF) +option(INCLUDE_EXPERIMENTAL_DEMOS "" ON) # The ISO C++ File System Technical Specification (ISO-TS, or STD) is optional. # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf @@ -47,7 +52,6 @@ option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available #list(APPEND NANA_LINKS "${CMAKE_BOOST_FILESYSTEM_LIB}") - if (CMAKE_NANA_FILESYSTEM_FORCE) add_definitions(-DNANA_FILESYSTEM_FORCE) @@ -78,8 +82,6 @@ elseif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) endif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) -project(nana) -cmake_minimum_required(VERSION 2.8) # Compatibility with CMake 3.1 if(POLICY CMP0054) @@ -230,9 +232,9 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) if (BUILD_NANA_DEMOS) set (demos calculator notepad widget_show widget_show2 ) - if (INCLUDE_EXPERIMENTAL_DEMOS) + #if (INCLUDE_EXPERIMENTAL_DEMOS) list(APPEND demos file_explorer) - endif (INCLUDE_EXPERIMENTAL_DEMOS) + #endif (INCLUDE_EXPERIMENTAL_DEMOS) # Pending: FreeMe foreach ( demo ${demos}) From ff279652bce90fe47f2cf5853561e7ccb2150fdc Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 15:24:51 +0100 Subject: [PATCH 11/34] two pretty print functions in filesystem_ext --- include/nana/filesystem/filesystem_ext.hpp | 50 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/include/nana/filesystem/filesystem_ext.hpp b/include/nana/filesystem/filesystem_ext.hpp index 3c911b2b..abcdc5d3 100644 --- a/include/nana/filesystem/filesystem_ext.hpp +++ b/include/nana/filesystem/filesystem_ext.hpp @@ -108,6 +108,54 @@ inline regular_file_only_iterator end(const regular_file_only_iterator&) noexcep { return{}; } - + +inline std::string pretty_file_size(const std::experimental::filesystem::path& path) // todo: move to .cpp +{ + try { + std::size_t bytes = std::experimental::filesystem::file_size ( path ); + const char * ustr[] = { " KB", " MB", " GB", " TB" }; + std::stringstream ss; + if (bytes < 1024) + ss << bytes << " Bytes"; + else + { + double cap = bytes / 1024.0; + std::size_t uid = 0; + while ((cap >= 1024.0) && (uid < sizeof(ustr) / sizeof(char *))) + { + cap /= 1024.0; + ++uid; + } + ss << cap; + auto s = ss.str(); + auto pos = s.find('.'); + if (pos != s.npos) + { + if (pos + 2 < s.size()) + s.erase(pos + 2); + } + return s + ustr[uid]; + } + + return ss.str(); + } + catch (...) {} + return {}; +} + +inline std::string pretty_file_date(const std::experimental::filesystem::path& path) // todo: move to .cpp +{ + try { + auto ftime = std::experimental::filesystem::last_write_time(path); + std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime); + std::stringstream tm; + tm << std::put_time(std::localtime(&cftime), "%Y-%m-%d, %H:%M:%S"); + return tm.str(); + } + catch (...) { + return {}; + } +} + }}}} #endif //NANA_FILESYSTEM_EXT_HPP From d335f34a6c1709faebce8992ca236fe0538dd176 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 16:47:53 +0100 Subject: [PATCH 12/34] truly empty? in filesystem_ext --- include/nana/filesystem/filesystem.hpp | 8 ++++---- source/filesystem/filesystem.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index 1bbe3aa9..b7cb9cdc 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -112,7 +112,7 @@ namespace nana { namespace experimental { namespace filesystem public: #if defined(NANA_WINDOWS) using value_type = wchar_t; - const static value_type preferred_separator = '\\'; //? L'\\' ? + const static value_type preferred_separator = L'\\'; //? L'\\' ? #else using value_type = char; const static value_type preferred_separator = '/'; @@ -151,10 +151,10 @@ namespace nana { namespace experimental { namespace filesystem //bool has_root_directory() const; //bool has_root_path() const; //bool has_relative_path() const; - bool has_parent_path() const { return !parent_path().empty(); }; // temp;; - bool has_filename() const { return !filename().empty(); }; // temp; + bool has_parent_path() const { return !parent_path().string().empty(); }; // temp;; + bool has_filename() const { return !filename().string().empty(); }; // temp; //bool has_stem() const; - bool has_extension() const { return !extension().empty(); }; // temp + bool has_extension() const { return !extension().string().empty(); }; // temp //bool is_absolute() const; //bool is_relative() const; diff --git a/source/filesystem/filesystem.cpp b/source/filesystem/filesystem.cpp index 1f523f3a..ead15a1a 100644 --- a/source/filesystem/filesystem.cpp +++ b/source/filesystem/filesystem.cpp @@ -110,6 +110,7 @@ namespace nana { namespace experimental { namespace filesystem return pathstr_.compare(p.pathstr_); } + /// true if the path is empty, false otherwise. ?? bool path::empty() const noexcept { #if defined(NANA_WINDOWS) @@ -122,17 +123,20 @@ namespace nana { namespace experimental { namespace filesystem path path::extension() const { + // todo: make more globlal #if defined(NANA_WINDOWS) - auto pos = pathstr_.find_last_of(L"\\/."); + auto SLorP=L"\\/."; + auto P=L'.'; #else - auto pos = pathstr_.find_last_of("\\/."); + auto SLorP="\\/."; + auto P='.'; #endif - if ((pos == pathstr_.npos) || (pathstr_[pos] != '.')) - return path(); + auto pos = pathstr_.find_last_of(SLorP); - - if (pos + 1 == pathstr_.size()) - return path(); + if ( ( pos == pathstr_.npos) + || ( pathstr_[pos] != P ) + || ( pos + 1 == pathstr_.size() )) + return path(); return path(pathstr_.substr(pos)); } From d7a3f12136b9e26c1be19f84d716fb53e17dd1d2 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 16:52:26 +0100 Subject: [PATCH 13/34] include demo --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a6706ed..594c5f4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,9 +232,9 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) if (BUILD_NANA_DEMOS) set (demos calculator notepad widget_show widget_show2 ) - #if (INCLUDE_EXPERIMENTAL_DEMOS) + if (INCLUDE_EXPERIMENTAL_DEMOS) list(APPEND demos file_explorer) - #endif (INCLUDE_EXPERIMENTAL_DEMOS) + endif (INCLUDE_EXPERIMENTAL_DEMOS) # Pending: FreeMe foreach ( demo ${demos}) From 81aacd4f3c4fbc96560e6c18f90a9df5a26c9c43 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 20:04:36 +0100 Subject: [PATCH 14/34] fix #include --- include/nana/filesystem/filesystem_ext.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/nana/filesystem/filesystem_ext.hpp b/include/nana/filesystem/filesystem_ext.hpp index abcdc5d3..ef561665 100644 --- a/include/nana/filesystem/filesystem_ext.hpp +++ b/include/nana/filesystem/filesystem_ext.hpp @@ -15,6 +15,7 @@ #ifndef NANA_FILESYSTEM_EXT_HPP #define NANA_FILESYSTEM_EXT_HPP +#include #include namespace nana {namespace experimental {namespace filesystem {namespace ext { From e06f124ea19559129e8077f3a3d67951e7a6b2f1 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 20:59:50 +0100 Subject: [PATCH 15/34] allow failures g++-4.9 http://stackoverflow.com/questions/14136833/stdput-time-implementation-status-in-gcc --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 15e6c5d6..23642786 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,8 @@ matrix: - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test + + allow_failures: - env: CXX=g++-4.9 CC=gcc-4.9 addons: apt: From 859631732db9d222a61c4c2e3205ebe5b373b521 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 21:00:58 +0100 Subject: [PATCH 16/34] first test boost --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 23642786..01bccf3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,6 @@ before_script : - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=OFF -DINCLUDE_EXPERIMENTAL_DEMOS=ON + - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON - make From 7a4d18789b742fd4b2af3268bc0c92fc9311762d Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 21:04:58 +0100 Subject: [PATCH 17/34] fix? no 4.9 --- .travis.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01bccf3b..5d41b28e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,22 +24,6 @@ matrix: sources: - ubuntu-toolchain-r-test - allow_failures: - - env: CXX=g++-4.9 CC=gcc-4.9 - addons: - apt: - packages: - - g++-4.9 - - libjpeg8-dev - - libpng-dev - - libasound2-dev - - alsa-utils - - alsa-oss - - libx11-dev - - libxft-dev - sources: - - ubuntu-toolchain-r-test - allow_failures: - env: CXX=clang++-3.8 CC=clang-3.8 addons: @@ -73,5 +57,4 @@ before_script : script: - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON - - make From 61145300f1e6449a60986fcfef8dd93e91ff50ac Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 21:21:14 +0100 Subject: [PATCH 18/34] -DCMAKE_FIND_BOOST_FILESYSTEM=OFF --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d41b28e..44391d09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,5 +56,5 @@ before_script : - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON + - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=OFF -DINCLUDE_EXPERIMENTAL_DEMOS=ON - make From f8fb4a464d5624a014edeed0d51de6dda117b2da Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 26 Feb 2016 21:24:04 +0100 Subject: [PATCH 19/34] restore travis --- .travis.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44391d09..c3b00bb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,21 @@ matrix: - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test - + - env: CXX=g++-4.9 CC=gcc-4.9 + addons: + apt: + packages: + - g++-4.9 + - libjpeg8-dev + - libpng-dev + - libasound2-dev + - alsa-utils + - alsa-oss + - libx11-dev + - libxft-dev + sources: + - ubuntu-toolchain-r-test + allow_failures: - env: CXX=clang++-3.8 CC=clang-3.8 addons: @@ -57,4 +71,5 @@ before_script : script: - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=OFF -DINCLUDE_EXPERIMENTAL_DEMOS=ON - - make + + - make \ No newline at end of file From 7f10f8d28de464735bec52f51824d6931f429379 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sat, 27 Feb 2016 00:13:37 +0100 Subject: [PATCH 20/34] add STD_put_time_NOT_SUPPORTED --- include/nana/c++defines.hpp | 8 ++++++- include/nana/deploy.hpp | 18 ++++++++++++++++ source/deploy.cpp | 43 +++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index d23e0a48..f7ac48e5 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -31,6 +31,7 @@ * - _SCL_SECURE_NO_WARNNGS, _CRT_SECURE_NO_DEPRECATE (VC) * - STD_CODECVT_NOT_SUPPORTED (VC RC, is a known issue on libstdc++, it works on libc++) * - STD_THREAD_NOT_SUPPORTED (GCC < 4.8.1) + * - STD_put_time_NOT_SUPPORTED (GCC < 5) * - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1) * - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1) * - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8) @@ -133,8 +134,13 @@ #endif #endif + + #if ((__GNUC__ > 5) ) + # defie STD_put_time_NOT_SUPPORTED + #endif + #if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) ) - #undef STD_FILESYSTEM_NOT_SUPPORTED + # undef STD_FILESYSTEM_NOT_SUPPORTED #endif #if (__GNUC__ == 4) diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index 35659972..afb955da 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -92,6 +92,24 @@ namespace std } #endif +#ifdef STD_put_time_NOT_SUPPORTED +namespace std +{ + //Workaround for no implemenation of std::put_time in gcc < 5. + /* std unspecified return type */ + //template< class CharT, class RTSTR >// let fail for CharT != char / wchar_t + //RTSTR put_time(const std::tm* tmb, const CharT* fmt); + + //template< > + std::string put_time/**/(const std::tm* tmb, const char* fmt); + + //Defined in header + // std::size_t strftime(char* str, std::size_t count, const char* format, const std::tm* time); + //template<> + //std::wstring put_time(const std::tm* tmb, const wchar_t* fmt); +} +#endif // STD_put_time_NOT_SUPPORTED + namespace nana { /// Checks whether a specified text is utf8 encoding diff --git a/source/deploy.cpp b/source/deploy.cpp index 3592a3bf..91c4300d 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -436,6 +436,49 @@ namespace std } #endif +//#ifdef STD_put_time_NOT_SUPPORTED +#include +#include +namespace std +{ + //Workaround for no implemenation of std::put_time in gcc < 5. + /* std unspecified return type */ + //template< class CharT, class RTSTR >// let fail for CharT != char / wchar_t + //RTSTR put_time(const std::tm* tmb, const CharT* fmt); + + //template< > + std::string put_time/**/(const std::tm* tmb, const char* fmt) + { + unsigned sz = 200; + std::string str(sz, '\0'); + sz = std::strftime(&str[0], str.size() - 1, fmt, tmb); + str.resize(sz); + return str; + } + //Defined in header + // std::size_t strftime(char* str, std::size_t count, const char* format, const std::tm* time); + //template<> + //std::wstring put_time(const std::tm* tmb, const wchar_t* fmt) + //{ + // unsigned sz = 200; + // std::wstring str(sz, L'\0'); + // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); + // str.resize(sz); + // return str; + //} + // http://en.cppreference.com/w/cpp/chrono/c/wcsftime + // Defined in header + // std::size_t wcsftime(wchar_t* str, std::size_t count, const wchar_t* format, const std::tm* time); + // Converts the date and time information from a given calendar time time to a null - terminated + // wide character string str according to format string format.Up to count bytes are written. + // Parameters + // str - pointer to the first element of the wchar_t array for output + // count - maximum number of wide characters to write + // format - pointer to a null - terminated wide character string specifying the format of conversion. + + } +//#endif // STD_put_time_NOT_SUPPORTED + namespace nana { bool is_utf8(const char* str, unsigned len) From 1f2a48e63e3a42584956b5ff191905548c0b54b8 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sat, 27 Feb 2016 00:14:10 +0100 Subject: [PATCH 21/34] test boost fs --- .travis.yml | 2 +- include/nana/filesystem/filesystem_selector.hpp | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3b00bb2..216196c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,6 +70,6 @@ before_script : - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=OFF -DINCLUDE_EXPERIMENTAL_DEMOS=ON + - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON - make \ No newline at end of file diff --git a/include/nana/filesystem/filesystem_selector.hpp b/include/nana/filesystem/filesystem_selector.hpp index 5b00e0c7..b2a02293 100644 --- a/include/nana/filesystem/filesystem_selector.hpp +++ b/include/nana/filesystem/filesystem_selector.hpp @@ -55,13 +55,7 @@ namespace std { namespace std { namespace experimental { namespace filesystem { - -# ifdef CXX_NO_INLINE_NAMESPACE - using namespace boost::experimental::filesystem; -# else - using namespace boost::experimental::filesystem::v3; -# endif - + using namespace boost::filesystem; } // filesystem } // experimental } // std From 13123710337b5e0e8b2486dd027903907cb4d6a8 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sat, 27 Feb 2016 00:40:16 +0100 Subject: [PATCH 22/34] fix STD_put_time_NOT_SUPPORTED --- include/nana/c++defines.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index f7ac48e5..02970f53 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -135,7 +135,7 @@ #endif - #if ((__GNUC__ > 5) ) + #if ((__GNUC__ < 5) ) # defie STD_put_time_NOT_SUPPORTED #endif From fd1904ccc7f10f70663de6073cee8f2d1d49d64d Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sat, 27 Feb 2016 00:44:40 +0100 Subject: [PATCH 23/34] fix define --- include/nana/c++defines.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 02970f53..6d5df62b 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -136,7 +136,7 @@ #if ((__GNUC__ < 5) ) - # defie STD_put_time_NOT_SUPPORTED + # define STD_put_time_NOT_SUPPORTED #endif #if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) ) From 0660530cd211339ec29c68ce44d250c8569918e2 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sat, 27 Feb 2016 00:51:00 +0100 Subject: [PATCH 24/34] =?UTF-8?q?fix=20=E2=80=98tm=E2=80=99=20in=20namespa?= =?UTF-8?q?ce=20=E2=80=98std=E2=80=99=20does=20not=20name=20a=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/nana/deploy.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index afb955da..069545cb 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -93,6 +93,7 @@ namespace std #endif #ifdef STD_put_time_NOT_SUPPORTED +#include namespace std { //Workaround for no implemenation of std::put_time in gcc < 5. From f236ca91cf6c2e2f515668d2ea3e164df9dc5f05 Mon Sep 17 00:00:00 2001 From: git Date: Sat, 27 Feb 2016 16:47:27 -0800 Subject: [PATCH 25/34] Copy include files to installation directory. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 594c5f4c..ad065543 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,6 +225,10 @@ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) +# Install include directories too. +install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/nana + DESTINATION include) + set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) # TODO: move this nana-demo section to the nana demo repository, and here only include that cmake file From 4eef6c679a4bfb47704cc1b2edb72472c1f36056 Mon Sep 17 00:00:00 2001 From: git Date: Sat, 27 Feb 2016 17:55:39 -0800 Subject: [PATCH 26/34] Fixed path to experimental filesystem header for GNU environments. --- include/nana/filesystem/filesystem_selector.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/nana/filesystem/filesystem_selector.hpp b/include/nana/filesystem/filesystem_selector.hpp index b2a02293..7d18115f 100644 --- a/include/nana/filesystem/filesystem_selector.hpp +++ b/include/nana/filesystem/filesystem_selector.hpp @@ -60,6 +60,8 @@ namespace std { } // experimental } // std +#elif (__GNUC__) +# include #else # include #endif From be2b67d9707524a7d1b6ef9266a2165056310e4a Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 29 Feb 2016 00:23:04 +0100 Subject: [PATCH 27/34] by default but optionally install includes, make easy to find variables in large lists --- CMakeLists.txt | 108 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad065543..636b6176 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,16 +18,17 @@ cmake_minimum_required(VERSION 2.8) set(NANA_LINKS) -option(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ "replaced boost.thread with meganz's mingw-std-threads." OFF) -option(ENABLE_PNG "Enable the use of PNG" OFF) -option(LIBPNG_FROM_OS "Use libpng from operating system." ON) -option(ENABLE_JPEG "Enable the use of JPEG" OFF) -option(LIBJPEG_FROM_OS "Use libjpeg from operating system." ON) -option(ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) -option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) -option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) -option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF) -option(INCLUDE_EXPERIMENTAL_DEMOS "" ON) +option(NANA_CMAKE_INSTALL_INCLUDES "Install nana includes when compile the library" ON) +option(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ "replaced boost.thread with meganz's mingw-std-threads." OFF) +option(NANA_CMAKE_ENABLE_PNG "Enable the use of PNG" OFF) +option(NANA_CMAKE_LIBPNG_FROM_OS "Use libpng from operating system." ON) +option(NANA_CMAKE_ENABLE_JPEG "Enable the use of JPEG" OFF) +option(NANA_CMAKE_LIBJPEG_FROM_OS "Use libjpeg from operating system." ON) +option(NANA_CMAKE_ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) +option(NANA_CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) +option(NANA_CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) +option(NANA_CMAKE_BUILD_DEMOS "Build all the demos form the nana_demo repository." OFF) +option(NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS "" ON) # The ISO C++ File System Technical Specification (ISO-TS, or STD) is optional. # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf @@ -41,28 +42,28 @@ option(INCLUDE_EXPERIMENTAL_DEMOS "" ON) # to use boost if available. Nana own implementation will be use only none of them are available. # You can change that default if you change one of the following # (please don't define more than one of the _XX_FORCE options): -option(CMAKE_FIND_BOOST_FILESYSTEM "Search: Is Boost filesystem available?" ON) -option(CMAKE_NANA_FILESYSTEM_FORCE "Force nana filesystem over ISO and boost?" OFF) -option(CMAKE_STD_FILESYSTEM_FORCE "Use of STD filesystem?(a compilation error will ocurre if not available)" OFF) -option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over STD)?" OFF) +option(NANA_CMAKE_FIND_BOOST_FILESYSTEM "Search: Is Boost filesystem available?" ON) +option(NANA_CMAKE_NANA_FILESYSTEM_FORCE "Force nana filesystem over ISO and boost?" OFF) +option(NANA_CMAKE_STD_FILESYSTEM_FORCE "Use of STD filesystem?(a compilation error will ocurre if not available)" OFF) +option(NANA_CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over STD)?" OFF) # cmake will find the package self, if don't works set the following (please find the correct values): -#option(CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") -#option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") -#include_directories("${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}") -#list(APPEND NANA_LINKS "${CMAKE_BOOST_FILESYSTEM_LIB}") +#option(NANA_CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") +#option(NANA_CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") +#include_directories("${NANA_CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}") +#list(APPEND NANA_LINKS "${NANA_CMAKE_BOOST_FILESYSTEM_LIB}") -if (CMAKE_NANA_FILESYSTEM_FORCE) +if (NANA_CMAKE_NANA_FILESYSTEM_FORCE) add_definitions(-DNANA_FILESYSTEM_FORCE) -elseif (CMAKE_STD_FILESYSTEM_FORCE) +elseif (NANA_CMAKE_STD_FILESYSTEM_FORCE) add_definitions(-DSTD_FILESYSTEM_FORCE) -elseif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) +elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) - if (CMAKE_BOOST_FILESYSTEM_FORCE) + if (NANA_CMAKE_BOOST_FILESYSTEM_FORCE) add_definitions(-DNANA_BOOST_FILESYSTEM_FORCE) - endif(CMAKE_BOOST_FILESYSTEM_FORCE) + endif(NANA_CMAKE_BOOST_FILESYSTEM_FORCE) # https://cmake.org/cmake/help/git-master/module/FindBoost.html # Implicit dependencies such as Boost::filesystem requiring Boost::system will be automatically detected and satisfied, @@ -79,7 +80,7 @@ elseif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) set(Boost_USE_STATIC_RUNTIME ON) # ?? #set(Boost_USE_MULTITHREADED ON) -endif (CMAKE_FIND_BOOST_FILESYSTEM OR CMAKE_BOOST_FILESYSTEM_FORCE) +endif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) @@ -104,9 +105,9 @@ if(WIN32) endif(MSVC) if(MINGW) - if(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) + if(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) - endif(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) + endif(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) endif(MINGW) elseif(WIN32) set(BUILD_FreeMe OFF) @@ -134,34 +135,34 @@ if(UNIX) endif(UNIX) #Find PNG -if(ENABLE_PNG) +if(NANA_CMAKE_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) #set(NANA_PNG_LIB "png") list(APPEND NANA_LINKS -lpng ) - if(LIBPNG_FROM_OS) + if(NANA_CMAKE_LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) include_directories( ${PNG_INCLUDE_DIRS}) add_definitions(-DUSE_LIBPNG_FROM_OS) endif(PNG_FOUND) - endif(LIBPNG_FROM_OS) -endif(ENABLE_PNG) + endif(NANA_CMAKE_LIBPNG_FROM_OS) +endif(NANA_CMAKE_ENABLE_PNG) #Find JPEG -if(ENABLE_JPEG) +if(NANA_CMAKE_ENABLE_JPEG) add_definitions(-DNANA_ENABLE_JPEG) #set(NANA_JPEG_LIB "jpeg") list(APPEND NANA_LINKS -ljpeg ) - if(LIBJPEG_FROM_OS) + if(NANA_CMAKE_LIBJPEG_FROM_OS) find_package(JPEG) if (JPEG_FOUND) include_directories( ${JPEG_INCLUDE_DIRS}) add_definitions(-DUSE_LIBJPEG_FROM_OS) endif(JPEG_FOUND) - endif(LIBJPEG_FROM_OS) -endif(ENABLE_JPEG) + endif(NANA_CMAKE_LIBJPEG_FROM_OS) +endif(NANA_CMAKE_ENABLE_JPEG) -if(ENABLE_AUDIO) +if(NANA_CMAKE_ENABLE_AUDIO) add_definitions(-DNANA_ENABLE_AUDIO) if(UNIX) find_package(ASOUND) @@ -172,11 +173,11 @@ if(ENABLE_AUDIO) message(FATAL_ERROR "libasound is not found") endif(ASOUND_FOUND) endif(UNIX) -endif(ENABLE_AUDIO) +endif(NANA_CMAKE_ENABLE_AUDIO) -if(CMAKE_VERBOSE_PREPROCESSOR) +if(NANA_CMAKE_VERBOSE_PREPROCESSOR) add_definitions(-DVERBOSE_PREPROCESSOR) -endif(CMAKE_VERBOSE_PREPROCESSOR) +endif(NANA_CMAKE_VERBOSE_PREPROCESSOR) set(NANA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source) @@ -194,7 +195,7 @@ aux_source_directory(${NANA_SOURCE_DIR}/paint NANA_PAINT_SOURCE) aux_source_directory(${NANA_SOURCE_DIR}/paint/detail NANA_PAINT_DETAIL_SOURCE) aux_source_directory(${NANA_SOURCE_DIR}/system NANA_SYSTEM_SOURCE) aux_source_directory(${NANA_SOURCE_DIR}/threads NANA_THREADS_SOURCE) -if(ENABLE_AUDIO) +if(NANA_CMAKE_ENABLE_AUDIO) aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE) aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE) endif() @@ -226,19 +227,21 @@ install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib) # Install include directories too. -install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/nana - DESTINATION include) +if(NANA_CMAKE_INSTALL_INCLUDES) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/nana + DESTINATION include) +endif(NANA_CMAKE_INSTALL_INCLUDES) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) # TODO: move this nana-demo section to the nana demo repository, and here only include that cmake file -if (BUILD_NANA_DEMOS) +if (NANA_CMAKE_BUILD_DEMOS) set (demos calculator notepad widget_show widget_show2 ) - if (INCLUDE_EXPERIMENTAL_DEMOS) + if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) list(APPEND demos file_explorer) - endif (INCLUDE_EXPERIMENTAL_DEMOS) + endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) # Pending: FreeMe foreach ( demo ${demos}) @@ -268,7 +271,7 @@ if (BUILD_NANA_DEMOS) message("... to build: ../nana-demo/Examples/${demo}.cpp" ) endforeach( demo ${demos}) -endif (BUILD_NANA_DEMOS) +endif (NANA_CMAKE_BUILD_DEMOS) # set compile flags @@ -297,14 +300,13 @@ message ( "COMPILER_IS_CLANG = " ${COMPILER_IS_CLANG}) message ( "CMAKE_CXX_FLAGS = " ${CMAKE_CXX_FLAGS}) message ( "CMAKE_COMPILER_IS_GNUCXX= " ${CMAKE_COMPILER_IS_GNUCXX}) message ( "CMAKE_EXE_LINKER_FLAGS = " ${CMAKE_EXE_LINKER_FLAGS}) -message ( "NANA_LINKS = " ${NANA_LINKS}) -message ( "ENABLE_AUDIO = " ${ENABLE_AUDIO}) -message ( "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX}) message ( "DESTDIR = " ${DESTDIR}) -message ( "CMAKE_BOOST_FILESYSTEM_AVAILABLE = " ${CMAKE_BOOST_FILESYSTEM_AVAILABLE}) -message ( "NANA_BOOST_FILESYSTEM_PREFERRED = " ${NANA_BOOST_FILESYSTEM_PREFERRED}) -message ( "CMAKE_BOOST_FILESYSTEM_FORCE = " ${CMAKE_BOOST_FILESYSTEM_FORCE}) -message ( "CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT = " ${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}) -message ( "CMAKE_BOOST_FILESYSTEM_LIB = " ${CMAKE_BOOST_FILESYSTEM_LIB}) +message ( "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX}) +message ( "NANA_LINKS = " ${NANA_LINKS}) +message ( "NANA_CMAKE_ENABLE_AUDIO = " ${NANA_CMAKE_ENABLE_AUDIO}) +message ( "NANA_CMAKE_FIND_BOOST_FILESYSTEM = " ${NANA_CMAKE_FIND_BOOST_FILESYSTEM}) +message ( "NANA_CMAKE_BOOST_FILESYSTEM_FORCE = " ${NANA_CMAKE_BOOST_FILESYSTEM_FORCE}) +message ( "NANA_CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT = " ${NANA_CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}) +message ( "NANA_CMAKE_BOOST_FILESYSTEM_LIB = " ${NANA_CMAKE_BOOST_FILESYSTEM_LIB}) From bd0e27deb88f8060a5afa90f6a2931be76dbdf37 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 29 Feb 2016 00:23:55 +0100 Subject: [PATCH 28/34] Microsoft also support --- include/nana/filesystem/filesystem_selector.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/nana/filesystem/filesystem_selector.hpp b/include/nana/filesystem/filesystem_selector.hpp index 7d18115f..b0d3ae3a 100644 --- a/include/nana/filesystem/filesystem_selector.hpp +++ b/include/nana/filesystem/filesystem_selector.hpp @@ -60,10 +60,8 @@ namespace std { } // experimental } // std -#elif (__GNUC__) -# include #else -# include +# include #endif #ifndef __cpp_lib_experimental_filesystem From 282508d54faa285d72b61a2b677b5a63c04a19d8 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 29 Feb 2016 00:32:32 +0100 Subject: [PATCH 29/34] update travis too --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 216196c3..5ab94854 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,6 +70,6 @@ before_script : - cd bld script: - - cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF -DCMAKE_FIND_BOOST_FILESYSTEM=ON -DINCLUDE_EXPERIMENTAL_DEMOS=ON + - cmake -G"Unix Makefiles" .. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS=ON - make \ No newline at end of file From 54ecf4d7140faee6acaae6b40d6c94774d608c92 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 29 Feb 2016 14:30:49 +0100 Subject: [PATCH 30/34] a simple but not trivial HelloWorld --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 636b6176..e223c53c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) set(Boost_USE_STATIC_RUNTIME ON) # ?? #set(Boost_USE_MULTITHREADED ON) -endif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) +endif (NANA_CMAKE_NANA_FILESYSTEM_FORCE) @@ -238,7 +238,7 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) if (NANA_CMAKE_BUILD_DEMOS) - set (demos calculator notepad widget_show widget_show2 ) + set (demos calculator helloworld_demo notepad widget_show widget_show2 ) if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) list(APPEND demos file_explorer) endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) From 8be4603ef5331942347d585c419acdddc7659055 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 1 Mar 2016 14:12:48 +0100 Subject: [PATCH 31/34] doxygen comments --- build/makefile/readme.md | 6 ++--- include/nana/gui/basis.hpp | 48 +++++++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/build/makefile/readme.md b/build/makefile/readme.md index 1b8d9b1b..38ce2141 100644 --- a/build/makefile/readme.md +++ b/build/makefile/readme.md @@ -1,8 +1,8 @@ -Building Nana C++ Library -requires: +# Building Nana C++ Library directly with make +If you are using make directly, it require: X11, pthread, Xpm, rt, dl, freetype2, Xft, fontconfig, ALSA -Writing a makefile for creating applications with Nana C++ Library +Example of writing a makefile for creating applications with Nana C++ Library ------------------- ``` GCC = g++ diff --git a/include/nana/gui/basis.hpp b/include/nana/gui/basis.hpp index 26ca8885..55518554 100644 --- a/include/nana/gui/basis.hpp +++ b/include/nana/gui/basis.hpp @@ -1,15 +1,15 @@ -/* +/** + * \file basis.hpp + * \brief This file provides basis class and data structures required by the GUI + * * Basis Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * @file: nana/gui/basis.hpp - * - * This file provides basis class and data structrue that required by gui */ #ifndef NANA_GUI_BASIS_HPP @@ -151,7 +151,25 @@ namespace nana appearance(); appearance(bool has_decoration, bool taskbar, bool floating, bool no_activate, bool min, bool max, bool sizable); }; - /// Provided to generate an appearance object with better readability and understandability + + +/** @brief Provided to generate an appearance object with better readability and understandability + +A window has an appearance. This appearance can be specified when a window is being created. +To determine the appearance of a window there is a structure named nana::appearance with +a bool member for each feature with can be included or excluded in the "apereance" of the windows form. +But in practical development is hard to describe the style of the appearance using the struct nana::appearance. +If a form would to be defined without min/max button and sizable border, then + +\code{.CPP} + nana::form form(x, y, width, height, nana::appearance(false, false, false, true, false)); +\endcode + +This piece of code may be confusing because of the 5 parameters of the constructor of `nana::form`. So the library provides a helper class for making it easy. +For better readability and understandability Nana provides three templates classes to generate an appearance object: +nana::appear::decorate, nana::appear::bald and nana::appear::optional. Each provide an operator +that return a corresponding nana::appearance with predefined values. +*/ struct appear { struct minimize{}; @@ -160,7 +178,20 @@ namespace nana struct taskbar{}; struct floating{}; struct no_activate{}; - /// Create an appearance of a window with "decoration" + + /** @brief Create an appearance of a window with "decoration" in non-client area, such as title bar + * + * We can create a form without min/max button and sizable border like this: + * \code{.CPP} + * using nana::appear; + * nana::form form(x, y, width, height, appear::decorate()); + * \endcode + * The appearance created by appear::decorate<>() has a titlebar and borders that are draw by the + * platform- window manager. If a window needs a minimize button, it should be: + * \code{.CPP} + * appear::decorate() + * \endcode + */ template< typename Minimize = null_type, typename Maximize = null_type, typename Sizable = null_type, @@ -181,7 +212,8 @@ namespace nana ); } }; - /// Create an appearance of a window without "decoration" + + /// Create an appearance of a window without "decoration" with no titlebar and no 3D-look borders. template < typename Taskbar = null_type, typename Floating = null_type, typename NoActive = null_type, From ddbbdf21ff1580009ee29a92a72b77cbf98b4989 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 1 Mar 2016 17:00:43 +0100 Subject: [PATCH 32/34] doxy comments --- include/nana/gui/detail/general_events.hpp | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp index 8d75dc9e..87a7b2b2 100644 --- a/include/nana/gui/detail/general_events.hpp +++ b/include/nana/gui/detail/general_events.hpp @@ -42,7 +42,7 @@ namespace nana void events_operation_cancel(event_handle); }//end namespace detail - /// base clase for all event argument types + /// base class for all event argument types class event_arg { public: @@ -57,7 +57,12 @@ namespace nana struct general_events; - /// the type of the members of general_events + /// \brief the type of the members of general_events. + /// It connect the functions to be called as response to the event and manages that chain of responses + /// It is a functor, that get called to connect a "normal" response function, with normal "priority". + /// If a response function need another priority (unignorable or called first) it will need to be connected with + /// the specific connect function not with the operator() + /// It also permit to "emit" that event, calling all the active responders. template class basic_event : public detail::event_interface { @@ -68,6 +73,8 @@ namespace nana : public detail::docker_interface { basic_event * const event_ptr; + + /// the callback/response function taking the typed argument std::function invoke; bool flag_deleted{ false }; @@ -92,9 +99,9 @@ namespace nana } }; - //class emit_counter is a RAII helper for emitting count - //It is used for avoiding a try{}catch block which is required for some finial works when - //event handlers throw exceptions. + /// \breif RAII helper for emitting count. + /// It is used to avoid a try{}catch block which is required for some finial works when + /// event handlers throw exceptions. class emit_counter { public: @@ -133,11 +140,12 @@ namespace nana using prototype = typename std::remove_reference::type; std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn)), false)); auto evt = reinterpret_cast(dck.get()); - dockers_->emplace(dockers_->begin(), std::move(dck)); + dockers_->emplace(dockers_->begin(), std::move(dck)); // <---- the difference detail::events_operation_register(evt); return evt; } + /// It will not get called if stop_propagation() was called. event_handle connect(void (*fn)(arg_reference)) { return connect([fn](arg_reference arg){ @@ -145,7 +153,7 @@ namespace nana }); } - /// It will not get called if stop_propagation() was called. + /// It will not get called if stop_propagation() was called, because it is set at the end of the chain.. template event_handle connect(Function && fn) { @@ -156,7 +164,7 @@ namespace nana using prototype = typename std::remove_reference::type; std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn)), false)); auto evt = reinterpret_cast(dck.get()); - dockers_->emplace_back(std::move(dck)); + dockers_->emplace_back(std::move(dck)); // <---- the difference detail::events_operation_register(evt); return evt; } @@ -187,12 +195,14 @@ namespace nana return evt; } + /// how many responses are registered? std::size_t length() const { internal_scope_guard lock; return (nullptr == dockers_ ? 0 : dockers_->size()); } + /// by emitting the event it call each active response with the given arg. void emit(arg_reference& arg) { internal_scope_guard lock; @@ -205,7 +215,7 @@ namespace nana const auto dockers_len = dockers.size(); //The dockers may resize when a new event handler is created by a calling handler. - //Traverses with position can avaid crash error which caused by a iterator which becomes invalid. + //Traverses with position can avoid crash error caused by an iterator which becomes invalid. for (std::size_t pos = 0; pos < dockers_len; ++pos) { auto docker_ptr = static_cast(dockers[pos].get()); @@ -221,7 +231,7 @@ namespace nana if (!docker_ptr->unignorable || docker_ptr->flag_deleted) continue; - docker_ptr->invoke(arg); + docker_ptr->invoke(arg); // <--- finally call the response } break; } @@ -418,11 +428,11 @@ namespace nana bool deleted_flags_{ false }; std::unique_ptr>> dockers_; }; - + struct arg_mouse : public event_arg { - event_code evt_code; ///< + event_code evt_code; ///< what kind of mouse event? ::nana::window window_handle; ///< A handle to the event window ::nana::point pos; ///< cursor position in the event window ::nana::mouse button; ///< indicates a button which triggers the event @@ -473,7 +483,7 @@ namespace nana { ::nana::window window_handle; ///< A handle to the event window ::nana::native_window_type receiver; ///< it is a native window handle, and specified which window receives focus - bool getting; ///< the window received focus? + bool getting; ///< the window received focus? (as oppose to losing focus) }; struct arg_keyboard : public event_arg @@ -518,7 +528,7 @@ namespace nana { ::nana::window window_handle; ///< A handle to the event window }; - + /// a higher level event argument than just mouse down struct arg_click : public event_arg { ::nana::window window_handle; ///< A handle to the event window From d09c1bd733d3fd06f4f546a6d390c00be924f900 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 1 Mar 2016 18:54:31 +0100 Subject: [PATCH 33/34] brief --- include/nana/gui/detail/general_events.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp index 87a7b2b2..8c17ff28 100644 --- a/include/nana/gui/detail/general_events.hpp +++ b/include/nana/gui/detail/general_events.hpp @@ -58,6 +58,7 @@ namespace nana struct general_events; /// \brief the type of the members of general_events. + /// It connect the functions to be called as response to the event and manages that chain of responses /// It is a functor, that get called to connect a "normal" response function, with normal "priority". /// If a response function need another priority (unignorable or called first) it will need to be connected with @@ -99,7 +100,8 @@ namespace nana } }; - /// \breif RAII helper for emitting count. + /// \brief RAII helper for emitting count. + /// It is used to avoid a try{}catch block which is required for some finial works when /// event handlers throw exceptions. class emit_counter @@ -451,7 +453,8 @@ namespace nana } }; - /// in arg_wheel event_code is event_code::mouse_wheel + /// \brief in arg_wheel event_code is event_code::mouse_wheel + /// The type arg_wheel is derived from arg_mouse, a handler /// with prototype void(const arg_mouse&) can be set for mouse_wheel. struct arg_wheel : public arg_mouse From cbe639900805e2281121b59dbd4dff8f491fe59b Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 1 Mar 2016 18:57:03 +0100 Subject: [PATCH 34/34] doxy --- include/nana/gui/detail/general_events.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp index 8c17ff28..29dae364 100644 --- a/include/nana/gui/detail/general_events.hpp +++ b/include/nana/gui/detail/general_events.hpp @@ -57,13 +57,14 @@ namespace nana struct general_events; - /// \brief the type of the members of general_events. - - /// It connect the functions to be called as response to the event and manages that chain of responses - /// It is a functor, that get called to connect a "normal" response function, with normal "priority". - /// If a response function need another priority (unignorable or called first) it will need to be connected with - /// the specific connect function not with the operator() - /// It also permit to "emit" that event, calling all the active responders. + /** @brief the type of the members of general_events. + * + * It connect the functions to be called as response to the event and manages that chain of responses + * It is a functor, that get called to connect a "normal" response function, with normal "priority". + * If a response function need another priority (unignorable or called first) it will need to be connected with + * the specific connect function not with the operator() + * It also permit to "emit" that event, calling all the active responders. + */ template class basic_event : public detail::event_interface {