FIX crash in VS consistently using filesysten_ext

This commit is contained in:
qPCR4vir 2016-06-24 23:48:53 +02:00
parent 70b1b0b9ee
commit 4450ff9678
12 changed files with 49 additions and 38 deletions

View File

@ -59,6 +59,7 @@
# define constexpr const //no support of constexpr until Visual C++ 2015 ? const ?? # define constexpr const //no support of constexpr until Visual C++ 2015 ? const ??
# endif # endif
# undef STD_FILESYSTEM_NOT_SUPPORTED
#elif defined(__GNUC__) #elif defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ < 6) # if (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
# define noexcept //no support of noexcept until GCC 4.6 # define noexcept //no support of noexcept until GCC 4.6

View File

@ -30,6 +30,9 @@
#ifndef NANA_FILESYSTEM_HPP #ifndef NANA_FILESYSTEM_HPP
#define NANA_FILESYSTEM_HPP #define NANA_FILESYSTEM_HPP
//#undef NANA_USING_NANA_FILESYSTEM
#if NANA_USING_NANA_FILESYSTEM
#include <nana/push_ignore_diagnostic> #include <nana/push_ignore_diagnostic>
#include <string> #include <string>
@ -233,18 +236,18 @@ namespace nana { namespace experimental { namespace filesystem
{ {
public: public:
directory_entry() = default; directory_entry() = default;
explicit directory_entry(const path&); explicit directory_entry(const ::nana::experimental::filesystem::path&);
//modifiers //modifiers
void assign(const path&); void assign(const ::nana::experimental::filesystem::path&);
void replace_filename(const path&); void replace_filename(const ::nana::experimental::filesystem::path&);
//observers //observers
file_status status() const; file_status status() const;
operator const path&() const { return path_; }; operator const filesystem::path&() const { return path_; };
const path& path() const; const filesystem::path& path() const;
private: 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 /// 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 <nana/pop_ignore_diagnostic> #include <nana/pop_ignore_diagnostic>
#endif #endif
#endif

View File

@ -15,7 +15,9 @@
#ifndef NANA_FILESYSTEM_EXT_HPP #ifndef NANA_FILESYSTEM_EXT_HPP
#define NANA_FILESYSTEM_EXT_HPP #define NANA_FILESYSTEM_EXT_HPP
#include <sstream>
#include <iomanip> #include <iomanip>
#include <nana/filesystem/filesystem_selector.hpp> #include <nana/filesystem/filesystem_selector.hpp>
namespace nana namespace nana

View File

@ -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)) ) ) #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 <nana/filesystem/filesystem.hpp> # include <nana/filesystem/filesystem.hpp>
namespace std { namespace std {
@ -46,14 +48,14 @@ namespace std {
# else # else
using namespace nana::experimental::filesystem::v1; using namespace nana::experimental::filesystem::v1;
# endif # endif
#undef NANA_USING_NANA_FILESYSTEM
#define NANA_USING_NANA_FILESYSTEM true
} // filesystem } // filesystem
} // experimental } // experimental
} // std } // std
#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) )) #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 <boost/filesystem.hpp> # include <boost/filesystem.hpp>
// add boost::filesystem into std::experimental::filesystem // add boost::filesystem into std::experimental::filesystem
@ -61,17 +63,15 @@ namespace std {
namespace experimental { namespace experimental {
namespace filesystem { namespace filesystem {
using namespace boost::filesystem; using namespace boost::filesystem;
#undef NANA_USING_BOOST_FILESYSTEM
#define NANA_USING_BOOST_FILESYSTEM true
} // filesystem } // filesystem
} // experimental } // experimental
} // std } // std
#else #else
# include <experimental/filesystem>
#undef NANA_USING_STD_FILESYSTEM #undef NANA_USING_STD_FILESYSTEM
#define NANA_USING_STD_FILESYSTEM true #define NANA_USING_STD_FILESYSTEM true
# include <experimental/filesystem>
#endif #endif
#ifndef __cpp_lib_experimental_filesystem #ifndef __cpp_lib_experimental_filesystem

View File

@ -1,4 +1,4 @@
/* /**
* Filebox * Filebox
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
@ -7,7 +7,9 @@
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * 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 #ifndef NANA_GUI_FILEBOX_HPP
@ -37,18 +39,20 @@ namespace nana
/// Change owner window /// Change owner window
void owner(window); void owner(window);
/// specify a title for the dialog /// Set a new title for the dialog
/// @param string a text for title /// @param string a text for title
/// @return old title. /// @return the old title.
::std::string title( ::std::string new_title); ///< . Set a new title for the dialog and \return the old title ::std::string title( ::std::string new_title);
/** @brief specify a suggestion directory /** @brief Suggest initial path used to locate a directory when the filebox starts.
* @param string a path of initial directory * @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. * @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. 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"). /// 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" filebox& add_filter(const ::std::string& description, ///< for example. "Text File"
const ::std::string& filetype ///< filter pattern(for example, "*.TXT") const ::std::string& filetype ///< filter pattern(for example, "*.TXT")
@ -68,8 +72,7 @@ namespace nana
/// Display the filebox dialog /// Display the filebox dialog
bool show() const; bool show() const;
/// Display the filebox dialog /// a function object method alternative to show() to display the filebox dialog,
/// A function object method alternative to show()
bool operator()() const bool operator()() const
{ {
return show(); return show();

View File

@ -2,7 +2,7 @@
#define NANA_PAINT_DETAIL_IMAGE_IMPL_INTERFACE_HPP #define NANA_PAINT_DETAIL_IMAGE_IMPL_INTERFACE_HPP
#include "../image.hpp" #include "../image.hpp"
#include <nana/filesystem/filesystem.hpp> #include <nana/filesystem/filesystem_ext.hpp>
namespace nana{ namespace paint{ namespace nana{ namespace paint{
@ -16,7 +16,7 @@ namespace nana{ namespace paint{
public: public:
typedef nana::paint::graphics& graph_reference; typedef nana::paint::graphics& graph_reference;
virtual ~image_impl_interface() = 0; //The destructor is defined in ../image.cpp 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 open(const void* data, std::size_t bytes) = 0; // reads image from memory
virtual bool alpha_channel() const = 0; virtual bool alpha_channel() const = 0;
virtual bool empty() const = 0; virtual bool empty() const = 0;

View File

@ -13,10 +13,11 @@
#ifndef NANA_PAINT_GRAPHICS_HPP #ifndef NANA_PAINT_GRAPHICS_HPP
#define NANA_PAINT_GRAPHICS_HPP #define NANA_PAINT_GRAPHICS_HPP
#include <memory>
#include "../basic_types.hpp" #include "../basic_types.hpp"
#include "../gui/basis.hpp" #include "../gui/basis.hpp"
#include "pixel_buffer.hpp" #include "pixel_buffer.hpp"
#include <memory>
namespace nana namespace nana
{ {

View File

@ -11,7 +11,8 @@
* provide some interface for file managment * provide some interface for file managment
*/ */
#include <nana/filesystem/filesystem.hpp> #include <nana/filesystem/filesystem_ext.hpp>
#if NANA_USING_NANA_FILESYSTEM
#include <vector> #include <vector>
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
#include <windows.h> #include <windows.h>
@ -369,7 +370,7 @@ namespace nana { namespace experimental { namespace filesystem
// return path_; // return path_;
//} //}
const path& directory_entry::path() const const nana_fs::path& directory_entry::path() const
{ {
return path_; return path_;
} }
@ -888,3 +889,5 @@ namespace nana { namespace experimental { namespace filesystem
}//end namespace filesystem }//end namespace filesystem
} //end namespace experimental } //end namespace experimental
}//end namespace nana }//end namespace nana
#endif

View File

@ -12,7 +12,7 @@
#include <nana/gui.hpp> #include <nana/gui.hpp>
#include <nana/gui/filebox.hpp> #include <nana/gui/filebox.hpp>
#include <nana/filesystem/filesystem.hpp> #include <nana/filesystem/filesystem_ext.hpp>
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
#include <windows.h> #include <windows.h>
@ -24,13 +24,12 @@
#include <nana/gui/widgets/textbox.hpp> #include <nana/gui/widgets/textbox.hpp>
#include <nana/gui/widgets/treebox.hpp> #include <nana/gui/widgets/treebox.hpp>
#include <nana/gui/widgets/combox.hpp> #include <nana/gui/widgets/combox.hpp>
#include <nana/filesystem/filesystem.hpp>
#include <nana/gui/place.hpp> #include <nana/gui/place.hpp>
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#endif #endif
namespace fs = nana::experimental::filesystem; namespace fs = std::experimental::filesystem;
namespace nana namespace nana
{ {
@ -528,8 +527,6 @@ namespace nana
if((path.size() == 0) || (path[path.size() - 1] != '/')) if((path.size() == 0) || (path[path.size() - 1] != '/'))
path += '/'; path += '/';
namespace fs = ::nana::experimental::filesystem;
auto beg_node = tree_.selected(); auto beg_node = tree_.selected();
while(!beg_node.empty() && (beg_node != nodes_.home) && (beg_node != nodes_.filesystem)) while(!beg_node.empty() && (beg_node != nodes_.home) && (beg_node != nodes_.filesystem))
beg_node = beg_node.owner(); beg_node = beg_node.owner();

View File

@ -13,8 +13,8 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_BMP_HPP #ifndef NANA_PAINT_DETAIL_IMAGE_BMP_HPP
#define NANA_PAINT_DETAIL_IMAGE_BMP_HPP #define NANA_PAINT_DETAIL_IMAGE_BMP_HPP
#include "image_pixbuf.hpp"
#include <memory> #include <memory>
#include "image_pixbuf.hpp"
namespace nana{ namespace paint namespace nana{ namespace paint
{ {
@ -309,7 +309,7 @@ namespace nana{ namespace paint
return true; 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); std::ifstream ifs(filename.string(), std::ios::binary);
if(ifs) if(ifs)

View File

@ -1,8 +1,8 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_ICO_HPP #ifndef NANA_PAINT_DETAIL_IMAGE_ICO_HPP
#define NANA_PAINT_DETAIL_IMAGE_ICO_HPP #define NANA_PAINT_DETAIL_IMAGE_ICO_HPP
#include <nana/filesystem/filesystem_ext.hpp>
#include <nana/paint/detail/image_impl_interface.hpp> #include <nana/paint/detail/image_impl_interface.hpp>
#include <nana/filesystem/filesystem.hpp>
namespace nana{ namespace paint namespace nana{ namespace paint
{ {
@ -24,7 +24,7 @@ namespace nana{ namespace paint
image_ico(bool is_ico); 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 open(const void* data, std::size_t bytes) override;
bool alpha_channel() const override; bool alpha_channel() const override;
bool empty() const override; bool empty() const override;

View File

@ -21,7 +21,7 @@
#include <nana/paint/detail/image_impl_interface.hpp> #include <nana/paint/detail/image_impl_interface.hpp>
#include <nana/paint/pixel_buffer.hpp> #include <nana/paint/pixel_buffer.hpp>
#include <nana/filesystem/filesystem.hpp> #include <nana/filesystem/filesystem_ext.hpp>
#if defined(NANA_ENABLE_JPEG) #if defined(NANA_ENABLE_JPEG)
#include "detail/image_jpeg.hpp" #include "detail/image_jpeg.hpp"
@ -36,7 +36,7 @@
#include "image_accessor.hpp" #include "image_accessor.hpp"
namespace fs = nana::experimental::filesystem; namespace fs = std::experimental::filesystem;
namespace nana namespace nana
{ {