std::string_view
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The Deploy Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef _nana_std_has_string_view
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
namespace nana
|
||||
{
|
||||
/// move to *.h ??
|
||||
@@ -44,10 +48,15 @@ namespace nana
|
||||
|
||||
|
||||
/// Checks whether a specified text is utf8 encoding
|
||||
#ifdef _nana_std_has_string_view
|
||||
bool is_utf8(std::string_view str);
|
||||
void throw_not_utf8(std::string_view str);
|
||||
#else
|
||||
bool is_utf8(const char* str, std::size_t len);
|
||||
void throw_not_utf8(const std::string& text);
|
||||
void throw_not_utf8(const char*, std::size_t len);
|
||||
void throw_not_utf8(const char*);
|
||||
#endif
|
||||
|
||||
/// this text needed change, it needed review ??
|
||||
bool review_utf8(const std::string& text);
|
||||
@@ -58,7 +67,12 @@ namespace nana
|
||||
const std::string& to_utf8(const std::string&);
|
||||
std::string to_utf8(const std::wstring&);
|
||||
|
||||
#ifdef _nana_std_has_string_view
|
||||
std::wstring to_wstring(std::string_view utf8_str);
|
||||
#else
|
||||
std::wstring to_wstring(const std::string& utf8_str);
|
||||
#endif
|
||||
|
||||
const std::wstring& to_wstring(const std::wstring& wstr);
|
||||
std::wstring&& to_wstring(std::wstring&& wstr);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Platform Implementation
|
||||
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -32,8 +32,11 @@ namespace detail
|
||||
//dw color = dw color * fade_rate + bdcolor * (1 - fade_rate)
|
||||
void blend(drawable_type dw, const nana::rectangle& r, pixel_color_t bdcolor, double fade_rate);
|
||||
|
||||
nana::size raw_text_extent_size(drawable_type, const wchar_t*, std::size_t len);
|
||||
nana::size real_text_extent_size(drawable_type, const char*, std::size_t len);
|
||||
nana::size real_text_extent_size(drawable_type, const wchar_t*, std::size_t len);
|
||||
nana::size text_extent_size(drawable_type, const char*, std::size_t len);
|
||||
nana::size text_extent_size(drawable_type, const wchar_t*, std::size_t len);
|
||||
|
||||
void draw_string(drawable_type, const nana::point&, const wchar_t *, std::size_t len);
|
||||
}//end namespace detail
|
||||
}//end namespace paint
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "detail/ptdefs.hpp"
|
||||
|
||||
#ifdef _nana_std_has_string_view
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace paint
|
||||
@@ -108,12 +112,20 @@ namespace nana
|
||||
void resize(const ::nana::size&);
|
||||
void typeface(const font&); ///< Selects a specified font type into the graphics object.
|
||||
font typeface() const;
|
||||
|
||||
#ifdef _nana_std_has_string_view
|
||||
::nana::size text_extent_size(std::string_view text) const;
|
||||
::nana::size text_extent_size(std::wstring_view text) const;
|
||||
#else
|
||||
::nana::size text_extent_size(const ::std::string&) const;
|
||||
::nana::size text_extent_size(const char*, std::size_t len) const;
|
||||
|
||||
::nana::size text_extent_size(const wchar_t*) const; ///< Computes the width and height of the specified string of text.
|
||||
::nana::size text_extent_size(const ::std::wstring&) const; ///< Computes the width and height of the specified string of text.
|
||||
::nana::size text_extent_size(const wchar_t*, std::size_t length) const; ///< Computes the width and height of the specified string of text with the specified length.
|
||||
::nana::size text_extent_size(const ::std::wstring&, std::size_t length) const; ///< Computes the width and height of the specified string of text with the specified length.
|
||||
#endif
|
||||
|
||||
::nana::size glyph_extent_size(const wchar_t*, std::size_t length, std::size_t begin, std::size_t end) const;
|
||||
::nana::size glyph_extent_size(const ::std::wstring&, std::size_t length, std::size_t begin, std::size_t end) const;
|
||||
bool glyph_pixels(const wchar_t *, std::size_t length, unsigned* pxbuf) const;
|
||||
|
||||
Reference in New Issue
Block a user