Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class uistring

boost::ui::uistring — Helper class to convert string between UI and application logic only.

Synopsis

// In header: <boost/ui/string.hpp>


class uistring {
public:
  // types
  typedef std::size_t size_type;           // Unsigned integral type. 
  typedef void *      native_handle_type;  // Implementation-defined string type. 

  // construct/copy/destruct
  uistring(const uistring &);
  uistring(uistring &&);
  uistring(const wchar_t *);
  uistring(const std::wstring &);
  uistring(std::initializer_list< wchar_t >);
  uistring(const char16_t *);
  uistring(const std::u16string &);
  uistring(std::initializer_list< char16_t >);
  uistring(const char32_t *);
  uistring(const std::u32string &);
  uistring(std::initializer_list< char32_t >);
  uistring();
  uistring & operator=(const uistring &);
  uistring & operator=(uistring &&);
  uistring & operator=(std::initializer_list< wchar_t >);
  ~uistring();

  // public member functions
  void swap(const uistring &);
  bool empty() const noexcept;
  void clear() noexcept;
  void shrink_to_fit();
  template<typename charT> std::basic_string< charT > utf() const;
  template<typename charT> std::basic_string< charT > basic_string() const;
  std::string u8string() const;
  std::wstring wstring() const;
  std::u16string u16string() const;
  template<> std::basic_string< char > utf() const;
  template<> std::wstring basic_string() const;

  // private member functions
  void init();
  void init(const std::wstring &);
  template<typename String> void init(const String &);
  template<typename String> String xstring() const;

  // private static functions
  static uistring make_from_utf8(const char *);
  static uistring make_from_ascii(const char *);
};

Description

uistring public construct/copy/destruct

  1. uistring(const uistring & other);
    Constructs uistring from other uistring.
  2. uistring(uistring && other);
    Constructs uistring from other uistring.
  3. uistring(const wchar_t * str);
    Constructs uistring from Unicode wide char string.
  4. uistring(const std::wstring & str);
    Constructs uistring from Unicode wide char string.
  5. uistring(std::initializer_list< wchar_t > list);
    Constructs uistring from Unicode wide char string.
  6. uistring(const char16_t * str);
    Constructs uistring from UTF-16 string.
  7. uistring(const std::u16string & str);
    Constructs uistring from UTF-16 string.
  8. uistring(std::initializer_list< char16_t > list);
    Constructs uistring from UTF-16 string.
  9. uistring(const char32_t * str);
    Constructs uistring from UTF-32 string.
  10. uistring(const std::u32string & str);
    Constructs uistring from UTF-32 string.
  11. uistring(std::initializer_list< char32_t > list);
    Constructs uistring from UTF-32 string.
  12. uistring();
  13. uistring & operator=(const uistring & other);
    Assigns other string to this string.
  14. uistring & operator=(uistring && other);
    Assigns other string to this string.
  15. uistring & operator=(std::initializer_list< wchar_t > list);
    Assigns other string to this string.
  16. ~uistring();

uistring public member functions

  1. void swap(const uistring & other);
    Exchanges the contents of strings.
  2. bool empty() const noexcept;
    Checks whether the string is empty.
  3. void clear() noexcept;
    Clears the contents.
  4. void shrink_to_fit();
    Requests the removal of unused capacity.
  5. template<typename charT> std::basic_string< charT > utf() const;
    Returns UTF-8/16/32 encoded string Returns UTF-8 encoded string if charT is char, returns UTF-16 encoded string if charT is char16_t, returns UTF-32 encoded string if charT is char32_t, returns std::wstring if charT is wchar_t.
  6. template<typename charT> std::basic_string< charT > basic_string() const;
    Returns std::basic_string<charT>
  7. std::string u8string() const;
    Returns UTF-8 encoded string.
  8. std::wstring wstring() const;
    Returns Unicode wide std::wstring.
  9. std::u16string u16string() const;
    Returns UTF-16 std::u16string.
  10. template<> std::basic_string< char > utf() const;
    Returns UTF-8 encoded string.

    Returns UTF-32 encoded string.

    Returns UTF-16 encoded string.

    Returns std::wstring.

  11. template<> std::wstring basic_string() const;
    Returns std::wstring.

    Returns std::u32string.

    Returns std::u16string.

uistring private member functions

  1. void init();
  2. void init(const std::wstring & str);
  3. template<typename String> void init(const String & str);
  4. template<typename String> String xstring() const;

uistring private static functions

  1. static uistring make_from_utf8(const char * str);
  2. static uistring make_from_ascii(const char * str);

PrevUpHomeNext