PrevUpHomeNext

Struct template basic_text_view

boost::text::basic_text_view

Synopsis

// In header: <boost/text/text_view.hpp>

template<nf Normalization, typename Char> 
struct basic_text_view {
  // types
  typedef Char                                               char_type;             
  typedef unspecified                                        value_type;            
  typedef std::size_t                                        size_type;             
  typedef unspecified                                        iterator;              
  typedef iterator                                           const_iterator;        
  typedef stl_interfaces::reverse_iterator< const_iterator > reverse_iterator;      
  typedef reverse_iterator                                   const_reverse_iterator;
  typedef unspecified                                        text_iterator;         
  typedef const_iterator                                     const_text_iterator;   

  // construct/copy/destruct
  basic_text_view();
  basic_text_view(const_text_iterator, const_text_iterator);

  // public member functions
   BOOST_TEXT_STATIC_ASSERT_NORMALIZATION();
  const_iterator begin() const;
  const_iterator end() const;
  const_iterator cbegin() const;
  const_iterator cend() const;
  const_reverse_iterator rbegin() const;
  const_reverse_iterator rend() const;
  const_reverse_iterator crbegin() const;
  const_reverse_iterator crend() const;
  bool empty() const;
  size_type storage_code_units() const;
  size_type distance() const;
  void swap(basic_text_view &);

  // friend functions
  std::ostream & operator<<(std::ostream &, basic_text_view);
  std::wostream & operator<<(std::wostream &, basic_text_view);

  // public data members
  static constexpr nf normalization;
  static constexpr format utf_format;
};

Description

A reference to a constant sequence of graphemes over an underlying container of contiguous null-terminated code units. The underlying storage is a String, and is kept in normalization form Normalization. The String is responsible for maintaining null-termination.

basic_text_view public types

  1. typedef Char char_type;

    The type of code unit used in the underlying storage.

basic_text_view public construct/copy/destruct

  1. basic_text_view();

    Default ctor.

  2. basic_text_view(const_text_iterator first, const_text_iterator last);

    Constructs a basic_text_view from a pair of const_text_iterators.

    Requires:

    boost::text::normalized<normalization>(first.base(), last.base())

basic_text_view public member functions

  1.  BOOST_TEXT_STATIC_ASSERT_NORMALIZATION();
  2. const_iterator begin() const;
  3. const_iterator end() const;
  4. const_iterator cbegin() const;
  5. const_iterator cend() const;
  6. const_reverse_iterator rbegin() const;
  7. const_reverse_iterator rend() const;
  8. const_reverse_iterator crbegin() const;
  9. const_reverse_iterator crend() const;
  10. bool empty() const;
  11. size_type storage_code_units() const;

    Returns the number of code units referred to by *this, not including the null terminator.

  12. size_type distance() const;

    Returns the number of graphemes in *this. This operation is O(n).

  13. void swap(basic_text_view & rhs);

    Swaps *this with rhs.

basic_text_view friend functions

  1. std::ostream & operator<<(std::ostream & os, basic_text_view tv);

    Stream inserter; performs formatted output, in UTF-8 encoding.

  2. std::wostream & operator<<(std::wostream & os, basic_text_view tv);

    Stream inserter; performs formatted output, in UTF-16 encoding. Defined on Windows only.

basic_text_view public public data members

  1. static constexpr nf normalization;

    The normalization form used in this basic_text_view.

  2. static constexpr format utf_format;

    The UTF format used in the underlying storage.


PrevUpHomeNext