std::string_view

This commit is contained in:
Jinhao
2018-06-09 01:21:10 +08:00
parent ffee0e5a3b
commit fc7743cbe2
8 changed files with 263 additions and 56 deletions

View File

@@ -1,7 +1,7 @@
/*
* A Label Control Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-208 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -564,6 +564,16 @@ namespace nana
_m_change_font(graph, fblock_ptr);
#ifdef _nana_std_has_string_view
std::wstring_view text_sv{ data_ptr->text() };
if (text_range.second != text_sv.size())
{
text_sv = text_sv.substr(text_range.first, text_range.second);
sz = graph.text_extent_size(text_sv);
}
graph.string({ rs.pos.x, y }, text_sv, _m_fgcolor(fblock_ptr));
#else
if (text_range.second == data_ptr->text().length())
{
graph.string({ rs.pos.x, y }, data_ptr->text(), _m_fgcolor(fblock_ptr));
@@ -575,6 +585,7 @@ namespace nana
graph.string({ rs.pos.x, y }, str, _m_fgcolor(fblock_ptr));
}
#endif
_m_insert_if_traceable(rs.pos.x, y, sz, fblock_ptr);