fix compile errors under Linux

This commit is contained in:
Jinhao
2015-12-16 01:21:44 +08:00
parent c260eebbc3
commit 2ca11d4e25
21 changed files with 274 additions and 279 deletions

View File

@@ -67,7 +67,8 @@ namespace nana
}
};
typedef std::basic_string<wchar_t, casei_char_traits<wchar_t> > cistring;
using cistring = std::basic_string<char, casei_char_traits<char>>;
using ciwstring = std::basic_string<wchar_t, casei_char_traits<wchar_t>>;
namespace detail

View File

@@ -20,7 +20,6 @@
#include <nana/config.hpp>
#include <nana/charset.hpp>
//Implement workarounds for GCC/MinGW which version is below 4.8.2
#if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED)
namespace std
@@ -91,6 +90,7 @@ namespace nana
bool is_utf8(const char* str, unsigned len);
void throw_not_utf8(const std::string& text);
void throw_not_utf8(const char*, unsigned len);
void throw_not_utf8(const char*);
std::wstring utf8_cast(const std::string&);
std::string utf8_cast(const std::wstring&);
@@ -105,7 +105,7 @@ namespace nana
#if defined(NANA_WINDOWS)
std::string to_osmbstr(const std::string& text_utf8);
#else
std::string to_osmbstr(std::string text_utf8)
std::string to_osmbstr(std::string text_utf8);
#endif

View File

@@ -1,12 +1,12 @@
/*
* A File Iterator Implementation
* Copyright(C) 2003 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2015 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: stdex/filesystem/file_iterator.hpp
* @file: filesystem/file_iterator.hpp
* @description:
* file_iterator is a toolkit for applying each file and directory in a
* specified path.
@@ -39,7 +39,7 @@ namespace filesystem
#ifdef NANA_WINDOWS
fileinfo(const WIN32_FIND_DATA& wfd);
#elif defined(NANA_POSIX)
fileinfo(const nana::string& filename, const struct stat &);
fileinfo(const std::string& filename, const struct stat &);
#endif
::std::string name;
@@ -119,10 +119,10 @@ namespace filesystem
}
value_ = value_type(wfd_);
#elif defined(NANA_LINUX) || defined(NANA_MACOS)
auto path = file_path;
if(path.size() && path.back() != '/')
path += '/';
auto handle = opendir(path.c_str());
path_ = file_path;
if(path_.size() && path_.back() != '/')
path_ += '/';
auto handle = opendir(path_.c_str());
end_ = true;
if(handle)
@@ -141,9 +141,9 @@ namespace filesystem
}
struct stat fst;
if(stat((path + dnt->d_name).c_str(), &fst) == 0)
if(stat((path_ + dnt->d_name).c_str(), &fst) == 0)
{
value_ = value_type(nana::charset(dnt->d_name), fst);
value_ = value_type(dnt->d_name, fst);
}
else
{
@@ -226,6 +226,8 @@ namespace filesystem
#if defined(NANA_WINDOWS)
WIN32_FIND_DATA wfd_;
#else
std::string path_;
#endif
std::shared_ptr<find_handle_t> find_ptr_;

View File

@@ -448,17 +448,16 @@ namespace filesystem
//bool create_directory(const path& p, error_code& ec) noexcept;
bool create_directory(const path& p, const path& attributes);
//bool create_directory(const path& p, const path& attributes, error_code& ec) noexcept;
bool create_directory(const nana::string& dir, bool & if_exist);
bool create_directory(const std::wstring& p, bool & if_exist);
inline bool create_directory(const path& p, bool & if_exist)
{
return create_directory(p.filename(), if_exist);
};
{
return create_directory(p.filename(), if_exist);
};
bool modified_file_time(const nana::string& file, struct tm&);
bool modified_file_time(const std::wstring& file, struct tm&);
nana::string path_user();
path path_user();
path current_path();
@@ -468,14 +467,14 @@ namespace filesystem
//nana::string path_current();
//bool remove(const path& p);
//bool remove(const path& p, error_code& ec) noexcept;
bool rmfile(const char* file);
//bool remove(const path& p);
//bool remove(const path& p, error_code& ec) noexcept;
bool rmfile(const path& p);
//uintmax_t remove_all(const path& p);
//uintmax_t remove_all(const path& p, error_code& ec) noexcept;
bool rmdir(const char* dir, bool fails_if_not_empty);
bool rmdir(const wchar_t* dir, bool fails_if_not_empty);
//uintmax_t remove_all(const path& p);
//uintmax_t remove_all(const path& p, error_code& ec) noexcept;
bool rmdir(const path& p, bool fails_if_not_empty);
template<typename CharType>
std::basic_string<CharType> parent_path(const std::basic_string<CharType>& path)

View File

@@ -28,10 +28,10 @@ namespace filesystem
long long filesize(const nana::string& file);
bool mkdir(const ::std::string& dir, bool & if_exist);
bool modified_file_time(const nana::string& file, struct tm&);
bool modified_file_time(const ::std::string& file, struct tm&);
nana::string path_user();
nana::string path_current();
std::wstring path_user();
std::wstring path_current();
bool rmfile(const char* file_utf8);
bool rmdir(const char* dir, bool fails_if_not_empty);
@@ -59,6 +59,7 @@ namespace filesystem
std::string text_;
#endif
};
}//end namespace filesystem
}//end namespace nana

View File

@@ -155,8 +155,9 @@ namespace nana
: public widget_object<category::widget_tag, drawerbase::categorize::trigger, drawerbase::categorize::categorize_events<T>>
{
public:
typedef T value_type; ///< The type of objects stored
typedef drawerbase::categorize::renderer renderer; ///< The interface for user-defined renderer.
using native_string_type = widget::native_string_type;
using value_type = T; ///< The type of objects stored
using renderer = drawerbase::categorize::renderer; ///< The interface for user-defined renderer.
categorize()
{
@@ -177,13 +178,13 @@ namespace nana
categorize(window wd, const std::string& text_utf8, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
this->caption(text_utf8);
}
categorize(window wd, const char* text_utf8, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
this->caption(text_utf8);
}
categorize(window wd, const std::wstring& text, bool visible = true)