code reviews
This commit is contained in:
parent
e721cfa51f
commit
9fbe14e2de
@ -21,6 +21,56 @@
|
||||
#undef NANA_WINDOWS
|
||||
#endif
|
||||
|
||||
//Implement workarounds for MinGW
|
||||
#if defined(NANA_MINGW)
|
||||
namespace std
|
||||
{
|
||||
//Workaround for no implemenation of std::stoi in MinGW.
|
||||
int stoi(const std::string&, std::size_t * pos = nullptr, int base = 10);
|
||||
int stoi(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::stof in MinGW.
|
||||
float stof(const std::string&, std::size_t * pos = nullptr);
|
||||
float stof(const std::wstring&, std::size_t* pos = nullptr);
|
||||
|
||||
//Workaround for no implemenation of std::stod in MinGW.
|
||||
double stod(const std::string&, std::size_t * pos = nullptr);
|
||||
double stod(const std::wstring&, std::size_t* pos = nullptr);
|
||||
|
||||
//Workaround for no implemenation of std::stold in MinGW.
|
||||
long double stold(const std::string&, std::size_t * pos = nullptr);
|
||||
long double stold(const std::wstring&, std::size_t* pos = nullptr);
|
||||
|
||||
//Workaround for no implemenation of std::stol in MinGW.
|
||||
long stol(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||
long stol(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::stoll in MinGW.
|
||||
long long stoll(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||
long long stoll(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::stoul in MinGW.
|
||||
unsigned long stoul(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||
unsigned long stoul(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::stoull in MinGW.
|
||||
unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||
unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::to_wstring in MinGW.
|
||||
std::wstring to_wstring(long double);
|
||||
std::wstring to_wstring(double);
|
||||
std::wstring to_wstring(unsigned);
|
||||
std::wstring to_wstring(int);
|
||||
std::wstring to_wstring(long);
|
||||
std::wstring to_wstring(unsigned long);
|
||||
std::wstring to_wstring(long long);
|
||||
std::wstring to_wstring(unsigned long long);
|
||||
std::wstring to_wstring(float);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NANA_UNICODE
|
||||
namespace nana
|
||||
{
|
||||
@ -40,28 +90,7 @@
|
||||
namespace nana
|
||||
{
|
||||
std::size_t strlen(const char_t* str);
|
||||
double strtod(const char_t* str, char_t** endptr);
|
||||
char_t* strcpy(char_t* dest, const char_t* source);
|
||||
|
||||
//Workaround for no implemenation of std::stoi in MinGW.
|
||||
int stoi(const std::string&, std::size_t * pos = nullptr, int base = 10);
|
||||
int stoi(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
|
||||
//Workaround for no implemenation of std::stod in MinGW.
|
||||
double stod(const std::string&, std::size_t * pos = nullptr);
|
||||
double stod(const std::wstring&, std::size_t* pos = nullptr);
|
||||
|
||||
//Workaround for no implemenation of std::to_wstring in MinGW.
|
||||
std::wstring to_wstring(long double);
|
||||
std::wstring to_wstring(double);
|
||||
std::wstring to_wstring(unsigned);
|
||||
std::wstring to_wstring(int);
|
||||
std::wstring to_wstring(long);
|
||||
std::wstring to_wstring(unsigned long);
|
||||
std::wstring to_wstring(long long);
|
||||
std::wstring to_wstring(unsigned long long);
|
||||
std::wstring to_wstring(float);
|
||||
|
||||
}
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
|
@ -558,7 +558,6 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
|
||||
private:
|
||||
drawerbase::listbox::essence_t & _m_ess() const;
|
||||
nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const;
|
||||
size_type _m_headers() const;
|
||||
drawerbase::listbox::category_t* _m_at_key(std::shared_ptr<nana::detail::key_interface>);
|
||||
void _m_ease_key(nana::detail::key_interface*);
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ namespace nana
|
||||
if ((endpos - pos != 4) && (endpos - pos != 7))
|
||||
throw std::invalid_argument(excpt_what);
|
||||
|
||||
auto n = ::nana::stoi(css_color.substr(pos + 1, endpos - pos - 1), nullptr, 16);
|
||||
auto n = std::stoi(css_color.substr(pos + 1, endpos - pos - 1), nullptr, 16);
|
||||
|
||||
if (endpos - pos == 4)
|
||||
{
|
||||
@ -301,24 +301,24 @@ namespace nana
|
||||
|
||||
if (is_real)
|
||||
{
|
||||
auto pr = ::nana::stod(rgb[0].substr(0, rgb[0].size() - 1));
|
||||
auto pr = std::stod(rgb[0].substr(0, rgb[0].size() - 1));
|
||||
r_ = (pr > 100 ? 255.0 : 2.55 * pr);
|
||||
|
||||
pr = ::nana::stod(rgb[1].substr(0, rgb[1].size() - 1));
|
||||
pr = std::stod(rgb[1].substr(0, rgb[1].size() - 1));
|
||||
g_ = (pr > 100 ? 255.0 : 2.55 * pr);
|
||||
|
||||
pr = ::nana::stod(rgb[2].substr(0, rgb[2].size() - 1));
|
||||
pr = std::stod(rgb[2].substr(0, rgb[2].size() - 1));
|
||||
b_ = (pr > 100 ? 255.0 : 2.55 * pr);
|
||||
}
|
||||
else
|
||||
{
|
||||
r_ = ::nana::stod(rgb[0]);
|
||||
r_ = std::stod(rgb[0]);
|
||||
if (r_ > 255.0) r_ = 255;
|
||||
|
||||
g_ = ::nana::stod(rgb[1]);
|
||||
g_ = std::stod(rgb[1]);
|
||||
if (g_ > 255.0) g_ = 255;
|
||||
|
||||
b_ = ::nana::stod(rgb[2]);
|
||||
b_ = std::stod(rgb[2]);
|
||||
if (b_ > 255.0) b_ = 255;
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ namespace nana
|
||||
if (str.back() == '%')
|
||||
throw std::invalid_argument(excpt_what);
|
||||
|
||||
auto h = ::nana::stod(str);
|
||||
auto h = std::stod(str);
|
||||
|
||||
pos = css_color.find_first_not_of(' ', pos);
|
||||
if (pos == css_color.npos || css_color[pos] != ',')
|
||||
@ -337,7 +337,7 @@ namespace nana
|
||||
if (str.empty() || str.back() != '%')
|
||||
throw std::invalid_argument(excpt_what);
|
||||
|
||||
auto s = ::nana::stod(str.substr(0, str.size() - 1));
|
||||
auto s = std::stod(str.substr(0, str.size() - 1));
|
||||
|
||||
pos = css_color.find_first_not_of(' ', pos);
|
||||
if (pos == css_color.npos || css_color[pos] != ',')
|
||||
@ -347,7 +347,7 @@ namespace nana
|
||||
if (str.empty() || str.back() != '%')
|
||||
throw std::invalid_argument(excpt_what);
|
||||
|
||||
auto l = ::nana::stod(str.substr(0, str.size() - 1));
|
||||
auto l = std::stod(str.substr(0, str.size() - 1));
|
||||
|
||||
from_hsl(h, s / 100, l / 100);
|
||||
}
|
||||
@ -360,7 +360,7 @@ namespace nana
|
||||
if (str.empty() || str.back() == '%')
|
||||
throw std::invalid_argument(excpt_what); //invalid alpha value
|
||||
|
||||
a_ = ::nana::stod(str);
|
||||
a_ = std::stod(str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <nana/deploy.hpp>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
#include <windows.h>
|
||||
#elif defined(NANA_LINUX)
|
||||
@ -22,38 +23,12 @@
|
||||
#include PLATFORM_SPEC_HPP
|
||||
#endif
|
||||
|
||||
namespace nana
|
||||
#if defined(NANA_MINGW)
|
||||
#include <sstream>
|
||||
namespace std
|
||||
{
|
||||
std::size_t strlen(const char_t* str)
|
||||
{
|
||||
#if defined(NANA_UNICODE)
|
||||
return ::wcslen(str);
|
||||
#else
|
||||
return ::strlen(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
double strtod(const char_t* str, char_t** endptr)
|
||||
{
|
||||
#if defined(NANA_UNICODE)
|
||||
return ::wcstod(str, endptr);
|
||||
#else
|
||||
return ::strtod(str, endptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
char_t* strcpy(char_t* dest, const char_t* source)
|
||||
{
|
||||
#if defined(NANA_UNICODE)
|
||||
return ::wcscpy(dest, source);
|
||||
#else
|
||||
return ::strcpy(dest, source);
|
||||
#endif
|
||||
}
|
||||
|
||||
int stoi(const std::string& str, std::size_t * pos, int base)
|
||||
{
|
||||
#if defined(NANA_MINGW)
|
||||
auto sptr = str.c_str();
|
||||
char *end;
|
||||
errno = 0;
|
||||
@ -67,14 +42,10 @@ namespace nana
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - sptr);
|
||||
return ((int)result);
|
||||
#else
|
||||
return std::stoi(str, pos, base);
|
||||
#endif
|
||||
}
|
||||
|
||||
int stoi(const std::wstring& str, std::size_t* pos, int base)
|
||||
{
|
||||
#if defined(NANA_MINGW)
|
||||
auto sptr = str.data();
|
||||
wchar_t *end;
|
||||
errno = 0;
|
||||
@ -88,14 +59,42 @@ namespace nana
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - sptr);
|
||||
return ((int)result);
|
||||
#else
|
||||
return std::stoi(str, pos, base);
|
||||
#endif
|
||||
}
|
||||
|
||||
float stof(const std::string& str, std::size_t * pos)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char *end;
|
||||
auto result = std::strtof(ptr, &end);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stof argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
float stof(const std::wstring& str, std::size_t* pos)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t *end;
|
||||
auto result = std::wcstof(ptr, &end);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stof argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
double stod(const std::string& str, std::size_t * pos)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char *end;
|
||||
@ -108,14 +107,10 @@ namespace nana
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
#else
|
||||
return std::stod(str, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
double stod(const std::wstring& str, std::size_t* pos)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t *end;
|
||||
@ -128,110 +123,258 @@ namespace nana
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
#else
|
||||
return std::stod(str, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
long double stold(const std::string& str, std::size_t * pos)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char *end;
|
||||
auto result = std::strtold(ptr, &end);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stold argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
long double stold(const std::wstring& str, std::size_t* pos)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t *end;
|
||||
auto result = std::wcstold(ptr, &end);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stold argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
long stol(const std::string& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char *end;
|
||||
auto result = std::strtol(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stol argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
long stol(const std::wstring& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t *end;
|
||||
auto result = std::wcstol(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stol argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
//Workaround for no implemenation of std::stoll in MinGW.
|
||||
long long stoll(const std::string& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char* end;
|
||||
auto result = std::strtoll(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoll argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
long long stoll(const std::wstring& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t* end;
|
||||
auto result = std::wcstoll(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoll argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned long long stoull(const std::string& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char* end;
|
||||
auto result = std::strtoull(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoull argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned long long stoull(const std::wstring& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t* end;
|
||||
auto result = std::wcstoull(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoull argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
//Workaround for no implemenation of std::stoul in MinGW.
|
||||
unsigned long stoul(const std::string& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
char* end;
|
||||
auto result = std::strtoul(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoul argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned long stoul(const std::wstring& str, std::size_t* pos, int base)
|
||||
{
|
||||
auto *ptr = str.data();
|
||||
errno = 0;
|
||||
wchar_t* end;
|
||||
auto result = std::wcstoul(ptr, &end, base);
|
||||
|
||||
if (ptr == end)
|
||||
throw std::invalid_argument("invalid stod argument");
|
||||
if (errno == ERANGE)
|
||||
throw std::out_of_range("stoul argument out of range");
|
||||
if (pos)
|
||||
*pos = (std::size_t)(end - ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring to_wstring(double v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(long double v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(unsigned v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(int v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(long v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(unsigned long v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(long long v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(unsigned long long v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring to_wstring(float v)
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
std::wstringstream ss;
|
||||
ss << v;
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace nana
|
||||
{
|
||||
std::size_t strlen(const char_t* str)
|
||||
{
|
||||
#if defined(NANA_UNICODE)
|
||||
return ::wcslen(str);
|
||||
#else
|
||||
return std::to_wstring(v);
|
||||
#endif
|
||||
return ::strlen(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
char_t* strcpy(char_t* dest, const char_t* source)
|
||||
{
|
||||
#if defined(NANA_UNICODE)
|
||||
return ::wcscpy(dest, source);
|
||||
#else
|
||||
return ::strcpy(dest, source);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
namespace nana
|
||||
{
|
||||
bool is_incomplete(const nana::string& str, unsigned pos)
|
||||
{
|
||||
#ifndef NANA_UNICODE
|
||||
|
@ -701,12 +701,12 @@ namespace nana
|
||||
//get the longest value
|
||||
int longest = (std::abs((impl->begin < 0 ? impl->begin * 10 : impl->begin)) < std::abs(impl->last < 0 ? impl->last * 10 : impl->last) ? impl->last : impl->begin);
|
||||
paint::graphics graph{ ::nana::size{ 10, 10 } };
|
||||
auto value_px = graph.text_extent_size(::nana::to_wstring(longest)).width + 34;
|
||||
auto value_px = graph.text_extent_size(std::to_wstring(longest)).width + 34;
|
||||
|
||||
impl->spinbox.create(impl->dock, rectangle{ static_cast<int>(label_px + 10), 0, value_px, 0 });
|
||||
impl->spinbox.range(impl->begin, impl->last, impl->step);
|
||||
|
||||
impl->spinbox.value(::nana::to_wstring(impl->value));
|
||||
impl->spinbox.value(std::to_wstring(impl->value));
|
||||
|
||||
impl->dock.events().resized.connect_unignorable([impl, label_px, value_px](const ::nana::arg_resized& arg)
|
||||
{
|
||||
@ -779,12 +779,12 @@ namespace nana
|
||||
//get the longest value
|
||||
auto longest = (std::abs((impl->begin < 0 ? impl->begin * 10 : impl->begin)) < std::abs(impl->last < 0 ? impl->last * 10 : impl->last) ? impl->last : impl->begin);
|
||||
paint::graphics graph{ ::nana::size{ 10, 10 } };
|
||||
auto value_px = graph.text_extent_size(::nana::to_wstring(longest)).width + 34;
|
||||
auto value_px = graph.text_extent_size(std::to_wstring(longest)).width + 34;
|
||||
|
||||
impl->spinbox.create(impl->dock, rectangle{ static_cast<int>(label_px + 10), 0, value_px, 0 });
|
||||
impl->spinbox.range(impl->begin, impl->last, impl->step);
|
||||
|
||||
impl->spinbox.value(::nana::to_wstring(impl->value));
|
||||
impl->spinbox.value(std::to_wstring(impl->value));
|
||||
|
||||
impl->dock.events().resized.connect_unignorable([impl, label_px, value_px](const ::nana::arg_resized& arg)
|
||||
{
|
||||
@ -947,7 +947,7 @@ namespace nana
|
||||
|
||||
::nana::string inputbox::date::value() const
|
||||
{
|
||||
return nana::to_wstring(impl_->month) + L'-' + nana::to_wstring(impl_->day) + L", " + nana::to_wstring(impl_->year);
|
||||
return std::to_wstring(impl_->month) + L'-' + std::to_wstring(impl_->day) + L", " + std::to_wstring(impl_->year);
|
||||
}
|
||||
|
||||
int inputbox::date::year() const
|
||||
@ -1008,8 +1008,8 @@ namespace nana
|
||||
|
||||
impl->wdg_month.option(today.month - 1);
|
||||
|
||||
impl->wdg_day.value(::nana::to_wstring(today.day));
|
||||
impl->wdg_year.value(::nana::to_wstring(today.year));
|
||||
impl->wdg_day.value(std::to_wstring(today.day));
|
||||
impl->wdg_year.value(std::to_wstring(today.year));
|
||||
|
||||
impl->dock.events().resized.connect_unignorable([impl, label_px](const ::nana::arg_resized& arg)
|
||||
{
|
||||
@ -1050,7 +1050,7 @@ namespace nana
|
||||
if (day > days)
|
||||
day = days;
|
||||
|
||||
impl->wdg_day.value(::nana::to_wstring(day));
|
||||
impl->wdg_day.value(std::to_wstring(day));
|
||||
};
|
||||
|
||||
impl->wdg_year.events().text_changed.connect_unignorable(make_days);
|
||||
|
@ -133,7 +133,7 @@ namespace nana
|
||||
str = ::nana::internationalization()(monthstr[chmonth_.month - 1]);
|
||||
str += STR(" ");
|
||||
}
|
||||
str += ::nana::to_wstring(chmonth_.year);
|
||||
str += std::to_wstring(chmonth_.year);
|
||||
|
||||
nana::size txt_s = graph.text_extent_size(str);
|
||||
|
||||
@ -203,7 +203,7 @@ namespace nana
|
||||
|
||||
void trigger::_m_draw_pos(drawing_basis & dbasis, graph_reference graph, int x, int y, int number, bool primary, bool sel)
|
||||
{
|
||||
_m_draw_pos(dbasis, graph, x, y, ::nana::to_wstring(number), primary, sel);
|
||||
_m_draw_pos(dbasis, graph, x, y, std::to_wstring(number), primary, sel);
|
||||
}
|
||||
|
||||
void trigger::_m_draw_ex_days(drawing_basis & dbasis, graph_reference graph, int begx, int begy, bool before)
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
namespace nana
|
||||
@ -87,66 +86,66 @@ namespace nana
|
||||
}
|
||||
oresolver& oresolver::operator<<(short n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(unsigned short n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(int n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(unsigned int n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(long n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(unsigned long n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
oresolver& oresolver::operator<<(long long n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(unsigned long long n)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(n));
|
||||
cells_.emplace_back(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(float f)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(f));
|
||||
cells_.emplace_back(std::to_wstring(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(double f)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(f));
|
||||
cells_.emplace_back(std::to_wstring(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
oresolver& oresolver::operator<<(long double f)
|
||||
{
|
||||
cells_.emplace_back(::nana::to_wstring(f));
|
||||
cells_.emplace_back(std::to_wstring(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -201,117 +200,82 @@ namespace nana
|
||||
iresolver& iresolver::operator>>(bool& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = (std::stoi(cells_[pos_++].text) == 0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(short& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoi(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(unsigned short& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = static_cast<unsigned short>(std::stoul(cells_[pos_++].text));
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(int& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoi(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(unsigned int& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoul(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(long& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stol(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(unsigned long& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoul(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(long long& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoll(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
iresolver& iresolver::operator>>(unsigned long long& n)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> n;
|
||||
}
|
||||
n = std::stoull(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
iresolver& iresolver::operator>>(float& f)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> f;
|
||||
}
|
||||
f = std::stof(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(double& f)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> f;
|
||||
}
|
||||
f = std::stod(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iresolver& iresolver::operator>>(long double& f)
|
||||
{
|
||||
if (pos_ < cells_.size())
|
||||
{
|
||||
std::wstringstream ss(cells_[pos_++].text);
|
||||
ss >> f;
|
||||
}
|
||||
f = std::stold(cells_[pos_++].text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1183,8 +1147,9 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void item_checked(selection& vec) const
|
||||
selection item_checked() const
|
||||
{
|
||||
selection vec;
|
||||
index_pair id;
|
||||
for(auto & cat : list_)
|
||||
{
|
||||
@ -1197,6 +1162,7 @@ namespace nana
|
||||
}
|
||||
++id.cat;
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
void select_range(index_pair fr, index_pair to, bool sel)
|
||||
@ -2595,7 +2561,7 @@ namespace nana
|
||||
|
||||
graph->string({ x + 20, y + txtoff }, categ.text, txt_color);
|
||||
|
||||
::nana::string str = L'(' + ::nana::to_wstring(categ.items.size()) + L')';
|
||||
::nana::string str = L'(' + std::to_wstring(categ.items.size()) + L')';
|
||||
|
||||
unsigned str_w = graph->text_extent_size(str).width;
|
||||
|
||||
@ -3699,8 +3665,7 @@ namespace nana
|
||||
auto & ess = _m_ess();
|
||||
if (ess.lister.insert(pos, std::move(text)))
|
||||
{
|
||||
window wd = handle();
|
||||
if (false == API::empty_window(wd))
|
||||
if (! empty())
|
||||
{
|
||||
auto & item = ess.lister.at(pos);
|
||||
item.bgcolor = bgcolor();
|
||||
@ -3722,9 +3687,7 @@ namespace nana
|
||||
|
||||
auto listbox::checked() const -> selection
|
||||
{
|
||||
selection s;
|
||||
_m_ess().lister.item_checked(s);
|
||||
return std::move(s);
|
||||
return _m_ess().lister.item_checked();
|
||||
}
|
||||
|
||||
void listbox::clear(size_type cat)
|
||||
@ -3891,11 +3854,6 @@ namespace nana
|
||||
return _m_ess().lister.anyobj(index_pair{cat, index}, allocate_if_empty);
|
||||
}
|
||||
|
||||
auto listbox::_m_headers() const -> size_type
|
||||
{
|
||||
return _m_ess().header.cont().size();
|
||||
}
|
||||
|
||||
drawerbase::listbox::category_t* listbox::_m_at_key(std::shared_ptr<nana::detail::key_interface> ptr)
|
||||
{
|
||||
auto & ess = _m_ess();
|
||||
|
@ -73,7 +73,7 @@ namespace nana
|
||||
|
||||
std::wstring value() const override
|
||||
{
|
||||
return ::nana::to_wstring(value_);
|
||||
return std::to_wstring(value_);
|
||||
}
|
||||
|
||||
bool value(const std::wstring& value_str, bool & diff) override
|
||||
@ -663,12 +663,12 @@ namespace nana
|
||||
|
||||
int spinbox::to_int() const
|
||||
{
|
||||
return ::nana::stoi(value());
|
||||
return std::stoi(value());
|
||||
}
|
||||
|
||||
double spinbox::to_double() const
|
||||
{
|
||||
return ::nana::stod(value());
|
||||
return std::stod(value());
|
||||
}
|
||||
|
||||
void spinbox::modifier(std::wstring prefix, std::wstring suffix)
|
||||
|
@ -456,13 +456,13 @@ namespace drawerbase {
|
||||
|
||||
textbox& textbox::from(int n)
|
||||
{
|
||||
_m_caption(::nana::to_wstring(n));
|
||||
_m_caption(std::to_wstring(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
textbox& textbox::from(double d)
|
||||
{
|
||||
_m_caption(::nana::to_wstring(d));
|
||||
_m_caption(std::to_wstring(d));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ namespace nana
|
||||
erase_n = str.size() - offset;
|
||||
|
||||
//If there is not a parameter for %argNNN, the %argNNN will be erased.
|
||||
std::size_t arg = static_cast<std::size_t>(::nana::stoi(str.substr(offset + 4, arg_n)));
|
||||
std::size_t arg = static_cast<std::size_t>(std::stoi(str.substr(offset + 4, arg_n)));
|
||||
|
||||
if (arg_strs && arg < arg_strs->size())
|
||||
str.replace(offset, erase_n, (*arg_strs)[arg]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user