replace string parameter of image's constructor with filesystem::path

This commit is contained in:
Jinhao
2015-11-30 00:58:29 +08:00
parent c86a00bea5
commit b35f293b9e
11 changed files with 103 additions and 67 deletions

View File

@@ -67,7 +67,7 @@ namespace nana
}
};
typedef std::basic_string<nana::char_t, casei_char_traits<nana::char_t> > cistring;
typedef std::basic_string<wchar_t, casei_char_traits<wchar_t> > cistring;
namespace detail

View File

@@ -146,12 +146,18 @@ namespace filesystem
using string_type = std::basic_string<value_type>;
path();
path(const value_type* source);
path(const string_type& source);
template<typename Source>
path(const Source& source)
{
_m_assign(source);
}
int compare(const path& other) const;
bool empty() const;
path extension() const;
path parent_path() const;
file_type what() const;
@@ -160,6 +166,9 @@ namespace filesystem
const value_type*c_str() const;
const string_type& native() const;
operator string_type() const;
private:
void _m_assign(const std::string& source_utf8);
void _m_assign(const std::wstring& source);
private:
string_type pathstr_;
};

View File

@@ -15,7 +15,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::char_t* filename) = 0;
virtual bool open(const nana::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;

View File

@@ -15,6 +15,7 @@
#define NANA_PAINT_IMAGE_HPP
#include "graphics.hpp"
#include "../filesystem/filesystem.hpp"
namespace nana
{
@@ -31,12 +32,21 @@ namespace paint
image();
image(const image&);
image(image&&);
image(const nana::char_t* file);
image(const nana::string& filename);
//image(const nana::char_t* file);
//image(const nana::string& filename); //deprecated
image(const ::nana::experimental::filesystem::path& file);
template<typename Source>
image(const Source& source)
{
open(source);
}
~image();
image& operator=(const image& rhs);
image& operator=(image&&);
bool open(const nana::string& filename);
//bool open(const nana::string& filename); //deprecated
bool open(const ::nana::experimental::filesystem::path& file);
/// Opens an icon from a specified buffer
bool open_icon(const void* data, std::size_t bytes);