PrevUpHomeNext

Struct template basic_rope

boost::text::basic_rope

Synopsis

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

template<nf Normalization, typename Char, typename String> 
struct basic_rope {
  // types
  typedef Char                                                char_type;             
  typedef String                                              string;                
  typedef basic_unencoded_rope< char_type, string >           unencoded_rope;        
  typedef basic_text< normalization, char_type, string >      text;                  
  typedef basic_string_view< char_type >                      string_view;           
  typedef basic_rope_view< normalization, char_type, string > rope_view;             
  typedef grapheme                                            value_type;            
  typedef std::size_t                                         size_type;             
  typedef unspecified                                         iterator;              
  typedef iterator                                            const_iterator;        
  typedef stl_interfaces::reverse_iterator< iterator >        reverse_iterator;      
  typedef reverse_iterator                                    const_reverse_iterator;
  typedef typename const_iterator::reference                  reference;             
  typedef reference                                           const_reference;       

  // construct/copy/destruct
  basic_rope();
  basic_rope(const_iterator, const_iterator);
  basic_rope(char_type const *);
  explicit basic_rope(rope_view);
  explicit basic_rope(text);
  template<code_unit_range< utf_format > R> explicit basic_rope(R const &);
  template<typename CUIter, typename Sentinel> 
    basic_rope(CUIter, Sentinel, unspecified = 0);
  template<grapheme_range_code_unit< utf_format > R> 
    explicit basic_rope(R const &);
  template<grapheme_iter_code_unit< utf_format > I> explicit basic_rope(I, I);
  basic_rope & operator=(char_type const *);
  basic_rope & operator=(rope_view);
  basic_rope & operator=(string_view);
  basic_rope & operator=(string);
  basic_rope & operator=(text);

  // public member functions
   BOOST_TEXT_STATIC_ASSERT_NORMALIZATION();
  operator rope_view() const;
  const_reference front() const;
  const_reference back() const;
  void push_back(grapheme const &);
  template<typename CPIter> void push_back(grapheme_ref< CPIter >);
  void pop_back();
  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;
  size_type max_code_units() const;
  bool equal_root(basic_rope) const;
  void clear();
  replace_result< const_iterator > erase(const_iterator, const_iterator);
  replace_result< const_iterator > erase(const_iterator);
  replace_result< const_iterator > 
  replace(const_iterator, const_iterator, const_iterator, const_iterator);
  replace_result< const_iterator > 
  replace(const_iterator, const_iterator, char_type const *);
  replace_result< const_iterator > 
  replace(const_iterator, const_iterator, string_view);
  replace_result< const_iterator > 
  replace(const_iterator, const_iterator, rope_view);
  template<code_unit_range< utf_format > R> 
    replace_result< const_iterator > 
    replace(const_iterator, const_iterator, R const &);
  template<code_unit_iter< utf_format > I> 
    replace_result< const_iterator > 
    replace(const_iterator, const_iterator, I, I);
  replace_result< const_iterator > 
  replace(const_iterator, const_iterator, grapheme const &);
  template<typename CPIter> 
    replace_result< const_iterator > 
    replace(const_iterator, const_iterator, grapheme_ref< CPIter >);
  replace_result< const_iterator > 
  insert(const_iterator, const_iterator, const_iterator);
  template<typename T> auto insert(const_iterator, T const &);
  template<typename I> auto insert(const_iterator, I, I);
  void assign(const_iterator, const_iterator);
  template<typename T> auto assign(T const &);
  template<typename I> auto assign(I, I);
  void append(const_iterator, const_iterator);
  template<typename T> auto append(T const &);
  template<typename I> auto append(I, I);
  void swap(basic_rope &);
  unencoded_rope extract();
  void replace(unencoded_rope &&);
  template<typename T> auto operator+=(T &&);

  // friend functions
  std::ostream & operator<<(std::ostream &, basic_rope const &);
  std::wostream & operator<<(std::wostream &, basic_rope const &);
  template<typename T> bool operator==(basic_rope const &, T const &);
  template<typename T> bool operator==(T const &, basic_rope const &);
  template<typename T> bool operator!=(basic_rope const &, T const &);
  template<typename T> bool operator!=(T const &, basic_rope const &);

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

Description

A mutable sequence of graphemes with copy-on-write semantics. A basic_rope is non-contiguous and is not null-terminated. The underlying storage is an unencoded_rope that is UTF-8-encoded and kept in normalization form Normalization.

basic_rope public types

  1. typedef Char char_type;

    The type of code unit used in the underlying storage.

  2. typedef String string;

    The type of the container used in the underlying storage.

  3. typedef basic_unencoded_rope< char_type, string > unencoded_rope;

    A specialization of basic_unencoded_rope with the same char_type and string.

  4. typedef basic_text< normalization, char_type, string > text;

    A specialization of basic_text with the same normalization, char_type, and string.

  5. typedef basic_string_view< char_type > string_view;

    A specialization of std::basic_string_view with the same char_type.

  6. typedef basic_rope_view< normalization, char_type, string > rope_view;

    A specialization of basic_rope_view with the same normalization, char_type, and string.

basic_rope public construct/copy/destruct

  1. basic_rope();

    Default ctor.

  2. basic_rope(const_iterator first, const_iterator last);

    Constructs a basic_rope from a pair of iterators.

  3. basic_rope(char_type const * c_str);

    Constructs a basic_rope from a null-terminated string.

  4. explicit basic_rope(rope_view rv);

    Constructs a basic_rope from a rope_view.

  5. explicit basic_rope(text t);

    Constructs a basic_rope from a text.

  6. template<code_unit_range< utf_format > R> explicit basic_rope(R const & r);

    Constructs a basic_rope from a range of char_type.

  7. template<typename CUIter, typename Sentinel> 
      basic_rope(CUIter first, Sentinel last, unspecified = 0);

    Constructs a basic_rope from a sequence of char_type.

  8. template<grapheme_range_code_unit< utf_format > R> 
      explicit basic_rope(R const & r);

    Constructs a basic_rope from a range of graphemes.

  9. template<grapheme_iter_code_unit< utf_format > I> 
      explicit basic_rope(I first, I last);

    Constructs a basic_rope from a sequence of graphemes.

  10. basic_rope & operator=(char_type const * c_str);

    Assignment from a null-terminated string.

  11. basic_rope & operator=(rope_view rv);

    Assignment from a rope_view.

  12. basic_rope & operator=(string_view sv);

    Assignment from a string_view.

  13. basic_rope & operator=(string s);

    Assignment from a string.

  14. basic_rope & operator=(text t);

    Move-assignment from a text.

basic_rope public member functions

  1.  BOOST_TEXT_STATIC_ASSERT_NORMALIZATION();
  2. operator rope_view() const;
  3. const_reference front() const;
  4. const_reference back() const;
  5. void push_back(grapheme const & g);
  6. template<typename CPIter> void push_back(grapheme_ref< CPIter > g);
  7. void pop_back();
  8. const_iterator begin() const;
  9. const_iterator end() const;
  10. const_iterator cbegin() const;
  11. const_iterator cend() const;
  12. const_reverse_iterator rbegin() const;
  13. const_reverse_iterator rend() const;
  14. const_reverse_iterator crbegin() const;
  15. const_reverse_iterator crend() const;
  16. bool empty() const;

    Returns true iff begin() == end().

  17. size_type storage_code_units() const;

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

  18. size_type distance() const;

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

  19. size_type max_code_units() const;

    Returns the maximum size in code units a basic_rope can have.

  20. bool equal_root(basic_rope rhs) const;

    Returns true if *this and rhs contain the same root node pointer. This is useful when you want to check for equality between two basic_ropes that are likely to have originated from the same initial basic_rope, and may have since been mutated.

  21. void clear();

    Clear.

  22. replace_result< const_iterator > 
    erase(const_iterator first, const_iterator last);

    Erases the portion of *this delimited by [first, last).

    Requires:

    first <= last

  23. replace_result< const_iterator > erase(const_iterator at);

    Erases the grapheme at position at.

    Requires:

    at != end()

  24. replace_result< const_iterator > 
    replace(const_iterator first1, const_iterator last1, const_iterator first2, 
            const_iterator last2);

    Replaces the portion of *this delimited by [first1, last1) with the sequence [first2, last2).

    Requires:

    !std::less(first1.base().base(), begin().base().base()) && !std::less(end().base().base(), last1.base().base())

  25. replace_result< const_iterator > 
    replace(const_iterator first, const_iterator last, char_type const * c_str);

    Replaces the portion of *this delimited by [first, last) with c_str.

    Requires:

    !std::less(first.base().base(), begin().base().base()) && !std::less(end().base().base(), last.base().base())

  26. replace_result< const_iterator > 
    replace(const_iterator first, const_iterator last, string_view new_substr);

    Replaves the portion of *this delimited by [first, last) with new_substr.

    Requires:

    !std::less(first.base().base(), begin().base().base()) && !std::less(end().base().base(), last.base().base())

  27. replace_result< const_iterator > 
    replace(const_iterator first, const_iterator last, rope_view new_substr);

    Replaces the portion of *this delimited by [first, last) with new_substr.

    Requires:

    !std::less(first.base().base(), begin().base().base()) && !std::less(end().base().base(), last.base().base())

  28. template<code_unit_range< utf_format > R> 
      replace_result< const_iterator > 
      replace(const_iterator first, const_iterator last, R const & r);

    Replaces the portion of *this delimited by [first, last) with r.

    Requires:

    !std::less(first.base().base(), begin().base().base()) && !std::less(end().base().base(), last.base().base())

  29. template<code_unit_iter< utf_format > I> 
      replace_result< const_iterator > 
      replace(const_iterator first1, const_iterator last1, I first2, I last2);

    Replaces the portion of *this delimited by [first1, last1) with [first2, last2).

    Requires:

    !std::less(first1.base().base(), begin().base().base()) && !std::less(end().base().base(), last1.base().base())

  30. replace_result< const_iterator > 
    replace(const_iterator first, const_iterator last, grapheme const & g);

    Replaces the portion of *this delimited by [first, last) with g.

  31. template<typename CPIter> 
      replace_result< const_iterator > 
      replace(const_iterator first, const_iterator last, grapheme_ref< CPIter > g);

    Replaces the portion of *this delimited by [first, last) with g.

  32. replace_result< const_iterator > 
    insert(const_iterator at, const_iterator first, const_iterator last);

    Inserts the sequence [first, last) into *this starting at position at.

  33. template<typename T> auto insert(const_iterator at, T const & x);

    Inserts the sequence of char_type from x into *this starting at position at.

  34. template<typename I> auto insert(const_iterator at, I first, I last);

    Inserts the sequence [first, last) into *this starting at position at.

  35. void assign(const_iterator first, const_iterator last);

    Assigns the sequence [first, last) to *this.

  36. template<typename T> auto assign(T const & x);

    Assigns the sequence of char_type from x to *this.

  37. template<typename I> auto assign(I first, I last);

    Assigns the sequence [first, last) to *this.

  38. void append(const_iterator first, const_iterator last);

    Appends the sequence [first, last) to *this.

  39. template<typename T> auto append(T const & x);

    Appends the sequence of char_type from x to *this.

  40. template<typename I> auto append(I first, I last);

    Appends the sequence [first, last) to *this.

  41. void swap(basic_rope & rhs);

    Swaps *this with rhs.

  42. unencoded_rope extract();

    Removes and returns the underlying unencoded_rope from *this.

  43. void replace(unencoded_rope && ur);

    Replaces the underlying unencoded_rope in *this.

    Requires:

    ur is in normalization form normalization.

  44. template<typename T> auto operator+=(T && x);

    Appends x to *this. T may be any type for which *this = x is well-formed.

basic_rope friend functions

  1. std::ostream & operator<<(std::ostream & os, basic_rope const & r);

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

  2. std::wostream & operator<<(std::wostream & os, basic_rope const & r);

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

  3. template<typename T> bool operator==(basic_rope const & lhs, T const & rhs);

    Returns true iff lhs == rhs, where rhs is an object for which lhs = rhs is well-formed.

  4. template<typename T> bool operator==(T const & lhs, basic_rope const & rhs);

    Returns true iff lhs == rhs, where rhs is an object for which rhs = lhs is well-formed.

  5. template<typename T> bool operator!=(basic_rope const & lhs, T const & rhs);

    Returns true iff lhs != rhs, where rhs is an object for which lhs = rhs is well-formed.

  6. template<typename T> bool operator!=(T const & lhs, basic_rope const & rhs);

    Returns true iff lhs != rhs, where rhs is an object for which rhs = lhs is well-formed.

basic_rope public public data members

  1. static constexpr nf normalization;

    The normalization form used in this basic_rope.

  2. static constexpr format utf_format;

    The UTF format used in the underlying storage.


PrevUpHomeNext