Merge branch 'develop-c++17' into develop

This commit is contained in:
Jinhao
2018-06-04 02:29:55 +08:00
35 changed files with 270 additions and 86 deletions

View File

@@ -1294,8 +1294,10 @@ namespace nana
min_width_entry_field_pixels_ = pixels;
}
#ifndef _nana_cxx_folding_expression
void inputbox::_m_fetch_args(std::vector<abstract_content*>&)
{}
#endif
bool inputbox::_m_open(std::vector<abstract_content*>& contents, bool modal)
{

View File

@@ -260,7 +260,7 @@ namespace API
}
}
::nana::detail::native_string_type window_caption(window wd) throw()
::nana::detail::native_string_type window_caption(window wd) noexcept
{
auto const iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard isg;
@@ -838,7 +838,7 @@ namespace API
}
}
nana::optional<rectangle> window_rectangle(window wd)
std::optional<rectangle> window_rectangle(window wd)
{
auto iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard lock;
@@ -1476,7 +1476,7 @@ namespace API
restrict::wd_manager().set_safe_place(reinterpret_cast<basic_window*>(wd), std::move(fn));
}
optional<std::pair<size, size>> content_extent(window wd, unsigned limited_px, bool limit_width)
std::optional<std::pair<size, size>> content_extent(window wd, unsigned limited_px, bool limit_width)
{
auto iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard lock;

View File

@@ -27,7 +27,7 @@ namespace nana{ namespace drawerbase
: trigger_{ t }
{}
optional<size> measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override
std::optional<size> measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override
{
//Button doesn't provide a support of vfit and hfit
if (limit_pixels)

View File

@@ -90,7 +90,7 @@ namespace nana
: drw_{ drwimpl }
{}
optional<size> measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override
std::optional<size> measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override
{
//Combox doesn't provide a support of vfit and hfit
if (limit_pixels)
@@ -1037,7 +1037,7 @@ namespace nana
API::refresh_window(*this);
}
auto combox::_m_caption() const throw() -> native_string_type
auto combox::_m_caption() const noexcept -> native_string_type
{
internal_scope_guard lock;
auto editor = _m_impl().editor();

View File

@@ -271,7 +271,7 @@ namespace nana{
_m_init();
}
auto group::_m_caption() const throw() -> native_string_type
auto group::_m_caption() const noexcept -> native_string_type
{
return impl_->caption.caption_native();
}

View File

@@ -653,7 +653,7 @@ namespace nana
: impl_{ impl }
{}
optional<size> measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const override
std::optional<size> measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const override
{
//Label now doesn't support to measure content with a specified height.
if (graph && ((0 == limit_pixels) || limit_width))
@@ -825,7 +825,7 @@ namespace nana
return *this;
}
bool label::transparent() const throw()
bool label::transparent() const noexcept
{
return API::is_transparent_background(*this);
}
@@ -849,7 +849,7 @@ namespace nana
return *this;
}
label& label::click_for(window associated_window) throw()
label& label::click_for(window associated_window) noexcept
{
get_drawer_trigger().impl()->for_associated_wd = associated_window;
return *this;

View File

@@ -74,7 +74,7 @@ namespace nana
: impl_{impl}
{}
optional<size> measure(graph_reference /*graph*/, unsigned limit_pixels, bool /*limit_width*/) const override
std::optional<size> measure(graph_reference /*graph*/, unsigned limit_pixels, bool /*limit_width*/) const override
{
//Picture doesn't provide a support of vfit and hfit
if (!limit_pixels)

View File

@@ -82,10 +82,39 @@ namespace nana
bool check_value(const std::string& str) const override
{
#ifdef __cpp_if_constexpr
auto i = str.c_str();
if ('+' == *i || '-' == *i)
++i;
if constexpr(std::is_same<T, int>::value)
{
for (; 0 != *i; ++i)
{
if (*i < '0' || '9' < *i)
return false;
}
}
else
{
bool dot = false;
for (; 0 != *i; ++i)
{
if (('.' == *i) && (!dot))
{
dot = true;
continue;
}
if (*i < '0' || '9' < *i)
return false;
}
}
#else
if (str.empty())
return true;
auto size = str.size();
auto const size = str.size();
std::size_t pos = 0;
if (str[0] == '+' || str[0] == '-')
pos = 1;
@@ -115,6 +144,7 @@ namespace nana
return false;
}
}
#endif
return true;
}
@@ -744,7 +774,7 @@ namespace nana
modifier(to_utf8(prefix), to_utf8(suffix));
}
auto spinbox::_m_caption() const throw() -> native_string_type
auto spinbox::_m_caption() const noexcept -> native_string_type
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().impl()->editor();

View File

@@ -1533,7 +1533,7 @@ namespace nana
delete model_;
}
model* driver::get_model() const throw()
model* driver::get_model() const noexcept
{
return model_;
}

View File

@@ -785,7 +785,7 @@ namespace drawerbase {
}
//Override _m_caption for caption()
auto textbox::_m_caption() const throw() -> native_string_type
auto textbox::_m_caption() const noexcept -> native_string_type
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();

View File

@@ -54,12 +54,12 @@ namespace nana
widget& wdg_;
};
std::string widget::caption() const throw()
std::string widget::caption() const noexcept
{
return to_utf8(_m_caption());
}
std::wstring widget::caption_wstring() const throw()
std::wstring widget::caption_wstring() const noexcept
{
#if defined(NANA_WINDOWS)
return _m_caption();
@@ -68,7 +68,7 @@ namespace nana
#endif
}
auto widget::caption_native() const throw() -> native_string_type
auto widget::caption_native() const noexcept -> native_string_type
{
return _m_caption();
}
@@ -287,7 +287,7 @@ namespace nana
void widget::_m_complete_creation()
{}
auto widget::_m_caption() const throw() -> native_string_type
auto widget::_m_caption() const noexcept -> native_string_type
{
return API::dev::window_caption(handle());
}