diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 071f984f..29cb0e0f 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -59,6 +59,7 @@ # define constexpr const //no support of constexpr until Visual C++ 2015 ? const ?? # endif +# undef STD_FILESYSTEM_NOT_SUPPORTED #elif defined(__GNUC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ < 6) # define noexcept //no support of noexcept until GCC 4.6 diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index 33799b74..7fddc3bb 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -30,6 +30,9 @@ #ifndef NANA_FILESYSTEM_HPP #define NANA_FILESYSTEM_HPP +//#undef NANA_USING_NANA_FILESYSTEM +#if NANA_USING_NANA_FILESYSTEM + #include #include @@ -233,18 +236,18 @@ namespace nana { namespace experimental { namespace filesystem { public: directory_entry() = default; - explicit directory_entry(const path&); + explicit directory_entry(const ::nana::experimental::filesystem::path&); //modifiers - void assign(const path&); - void replace_filename(const path&); + void assign(const ::nana::experimental::filesystem::path&); + void replace_filename(const ::nana::experimental::filesystem::path&); //observers file_status status() const; - operator const path&() const { return path_; }; - const path& path() const; + operator const filesystem::path&() const { return path_; }; + const filesystem::path& path() const; private: - filesystem::path path_; + ::nana::experimental::filesystem::path path_; }; /// InputIterator that iterate over the sequence of directory_entry elements representing the files in a directory, not an recursive_directory_iterator @@ -414,3 +417,4 @@ namespace nana { namespace experimental { namespace filesystem #include #endif +#endif diff --git a/include/nana/filesystem/filesystem_ext.hpp b/include/nana/filesystem/filesystem_ext.hpp index 526f3370..3711eb59 100644 --- a/include/nana/filesystem/filesystem_ext.hpp +++ b/include/nana/filesystem/filesystem_ext.hpp @@ -15,7 +15,9 @@ #ifndef NANA_FILESYSTEM_EXT_HPP #define NANA_FILESYSTEM_EXT_HPP +#include #include + #include namespace nana diff --git a/include/nana/filesystem/filesystem_selector.hpp b/include/nana/filesystem/filesystem_selector.hpp index 5ccfabc5..0d9c78dd 100644 --- a/include/nana/filesystem/filesystem_selector.hpp +++ b/include/nana/filesystem/filesystem_selector.hpp @@ -35,6 +35,8 @@ #if (defined(NANA_FILESYSTEM_FORCE) || ( (defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(BOOST_FILESYSTEM_AVAILABLE)) && !(defined(BOOST_FILESYSTEM_FORCE) || defined(STD_FILESYSTEM_FORCE)) ) ) +#undef NANA_USING_NANA_FILESYSTEM +#define NANA_USING_NANA_FILESYSTEM true # include namespace std { @@ -46,14 +48,14 @@ namespace std { # else using namespace nana::experimental::filesystem::v1; # endif -#undef NANA_USING_NANA_FILESYSTEM -#define NANA_USING_NANA_FILESYSTEM true } // filesystem } // experimental } // std #elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) )) +#undef NANA_USING_BOOST_FILESYSTEM +#define NANA_USING_BOOST_FILESYSTEM true # include // add boost::filesystem into std::experimental::filesystem @@ -61,17 +63,15 @@ namespace std { namespace experimental { namespace filesystem { using namespace boost::filesystem; -#undef NANA_USING_BOOST_FILESYSTEM -#define NANA_USING_BOOST_FILESYSTEM true } // filesystem } // experimental } // std #else -# include #undef NANA_USING_STD_FILESYSTEM #define NANA_USING_STD_FILESYSTEM true +# include #endif #ifndef __cpp_lib_experimental_filesystem diff --git a/include/nana/gui/filebox.hpp b/include/nana/gui/filebox.hpp index 3a9b9f4c..561dc5b7 100644 --- a/include/nana/gui/filebox.hpp +++ b/include/nana/gui/filebox.hpp @@ -1,4 +1,4 @@ -/* +/** * Filebox * Nana C++ Library(http://www.nanapro.org) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) @@ -7,7 +7,9 @@ * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * @file: nana/gui/filebox.hpp + * @file nana/gui/filebox.hpp + * @author Jinhao + * @brief a dialog to chose file(s), implemented "native" in windows but using nana for X11 */ #ifndef NANA_GUI_FILEBOX_HPP @@ -37,18 +39,20 @@ namespace nana /// Change owner window void owner(window); - /// specify a title for the dialog + /// Set a new title for the dialog /// @param string a text for title - /// @return old title. - ::std::string title( ::std::string new_title); ///< . Set a new title for the dialog and \return the old title + /// @return the old title. + ::std::string title( ::std::string new_title); - /** @brief specify a suggestion directory - * @param string a path of initial directory + /** @brief Suggest initial path used to locate a directory when the filebox starts. + * @param string initial_directory a path of initial directory * @note the behavior of init_path is different between Win7 and Win2K/XP/Vista, but its behavior under Linux is conformed with Win7. */ - filebox& init_path(const ::std::string&); ///< Suggested init path used to locate a directory when the filebox starts. + filebox& init_path(const ::std::string& initial_directory); + filebox& init_file(const ::std::string&); ///< Init file, if it contains a path, the init path is replaced by the path of init file. - /// \brief Add a filetype filter. + + /// \brief Add a filetype filter. /// To specify multiple filter in a single description, use a semicolon to separate the patterns(for example,"*.TXT;*.DOC;*.BAK"). filebox& add_filter(const ::std::string& description, ///< for example. "Text File" const ::std::string& filetype ///< filter pattern(for example, "*.TXT") @@ -68,8 +72,7 @@ namespace nana /// Display the filebox dialog bool show() const; - /// Display the filebox dialog - /// A function object method alternative to show() + /// a function object method alternative to show() to display the filebox dialog, bool operator()() const { return show(); diff --git a/include/nana/paint/detail/image_impl_interface.hpp b/include/nana/paint/detail/image_impl_interface.hpp index 4a0a1722..3e75d18e 100644 --- a/include/nana/paint/detail/image_impl_interface.hpp +++ b/include/nana/paint/detail/image_impl_interface.hpp @@ -2,7 +2,7 @@ #define NANA_PAINT_DETAIL_IMAGE_IMPL_INTERFACE_HPP #include "../image.hpp" -#include +#include namespace nana{ namespace paint{ @@ -16,7 +16,7 @@ namespace nana{ namespace paint{ public: typedef nana::paint::graphics& graph_reference; virtual ~image_impl_interface() = 0; //The destructor is defined in ../image.cpp - virtual bool open(const nana::experimental::filesystem::path& file) = 0; + virtual bool open(const std::experimental::filesystem::path& file) = 0; virtual bool open(const void* data, std::size_t bytes) = 0; // reads image from memory virtual bool alpha_channel() const = 0; virtual bool empty() const = 0; diff --git a/include/nana/paint/graphics.hpp b/include/nana/paint/graphics.hpp index fec075ab..7102c500 100644 --- a/include/nana/paint/graphics.hpp +++ b/include/nana/paint/graphics.hpp @@ -13,10 +13,11 @@ #ifndef NANA_PAINT_GRAPHICS_HPP #define NANA_PAINT_GRAPHICS_HPP +#include + #include "../basic_types.hpp" #include "../gui/basis.hpp" #include "pixel_buffer.hpp" -#include namespace nana { diff --git a/source/filesystem/filesystem.cpp b/source/filesystem/filesystem.cpp index 7377fa70..fec154d2 100644 --- a/source/filesystem/filesystem.cpp +++ b/source/filesystem/filesystem.cpp @@ -11,7 +11,8 @@ * provide some interface for file managment */ -#include +#include +#if NANA_USING_NANA_FILESYSTEM #include #if defined(NANA_WINDOWS) #include @@ -369,7 +370,7 @@ namespace nana { namespace experimental { namespace filesystem // return path_; //} - const path& directory_entry::path() const + const nana_fs::path& directory_entry::path() const { return path_; } @@ -888,3 +889,5 @@ namespace nana { namespace experimental { namespace filesystem }//end namespace filesystem } //end namespace experimental }//end namespace nana +#endif + diff --git a/source/gui/filebox.cpp b/source/gui/filebox.cpp index bc697d24..2644d910 100644 --- a/source/gui/filebox.cpp +++ b/source/gui/filebox.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #if defined(NANA_WINDOWS) #include @@ -24,13 +24,12 @@ #include #include #include - #include #include #include #include #endif -namespace fs = nana::experimental::filesystem; +namespace fs = std::experimental::filesystem; namespace nana { @@ -528,8 +527,6 @@ namespace nana if((path.size() == 0) || (path[path.size() - 1] != '/')) path += '/'; - namespace fs = ::nana::experimental::filesystem; - auto beg_node = tree_.selected(); while(!beg_node.empty() && (beg_node != nodes_.home) && (beg_node != nodes_.filesystem)) beg_node = beg_node.owner(); diff --git a/source/paint/detail/image_bmp.hpp b/source/paint/detail/image_bmp.hpp index da86c0a3..23d7907e 100644 --- a/source/paint/detail/image_bmp.hpp +++ b/source/paint/detail/image_bmp.hpp @@ -13,8 +13,8 @@ #ifndef NANA_PAINT_DETAIL_IMAGE_BMP_HPP #define NANA_PAINT_DETAIL_IMAGE_BMP_HPP -#include "image_pixbuf.hpp" #include +#include "image_pixbuf.hpp" namespace nana{ namespace paint { @@ -309,7 +309,7 @@ namespace nana{ namespace paint return true; } - bool open(const nana::experimental::filesystem::path& filename) override + bool open(const std::experimental::filesystem::path& filename) override { std::ifstream ifs(filename.string(), std::ios::binary); if(ifs) diff --git a/source/paint/detail/image_ico.hpp b/source/paint/detail/image_ico.hpp index debabac5..44b49191 100644 --- a/source/paint/detail/image_ico.hpp +++ b/source/paint/detail/image_ico.hpp @@ -1,8 +1,8 @@ #ifndef NANA_PAINT_DETAIL_IMAGE_ICO_HPP #define NANA_PAINT_DETAIL_IMAGE_ICO_HPP +#include #include -#include namespace nana{ namespace paint { @@ -24,7 +24,7 @@ namespace nana{ namespace paint image_ico(bool is_ico); - bool open(const ::nana::experimental::filesystem::path& filename) override; + bool open(const std::experimental::filesystem::path& filename) override; bool open(const void* data, std::size_t bytes) override; bool alpha_channel() const override; bool empty() const override; diff --git a/source/paint/image.cpp b/source/paint/image.cpp index f9b6f6cf..b654ca6a 100644 --- a/source/paint/image.cpp +++ b/source/paint/image.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #if defined(NANA_ENABLE_JPEG) #include "detail/image_jpeg.hpp" @@ -36,7 +36,7 @@ #include "image_accessor.hpp" -namespace fs = nana::experimental::filesystem; +namespace fs = std::experimental::filesystem; namespace nana {