- /// A string representation
- struct Srep {
- ///
- static lyxstring::size_type const xtra =
- static_cast<lyxstring::size_type>(8);
- /// size
- lyxstring::size_type sz;
- /// Reference count
- unsigned short ref;
- /// The total amount of data reserved for this representaion
- lyxstring::size_type res;
- /// Data. At least 1 char for trailing null.
- lyxstring::value_type * s;
-
- ///
- Srep(lyxstring::size_type nsz, const lyxstring::value_type * p);
- ///
- Srep(lyxstring::size_type nsz, lyxstring::value_type ch);
- ///
- ~Srep() { delete[] s; }
- ///
- Srep * get_own_copy()
- {
- if (ref == 1) return this;
- ref--;
- return new Srep(sz, s);
- }
-
- ///
- void assign(lyxstring::size_type nsz, const lyxstring::value_type * p);
- ///
- void assign(lyxstring::size_type nsz, lyxstring::value_type ch);
- ///
- void append(lyxstring::size_type asz, const lyxstring::value_type * p);
- ///
- void push_back(lyxstring::value_type c);
- ///
- void insert(lyxstring::size_type pos,
- const lyxstring::value_type * p,
- lyxstring::size_type n);
- ///
- void resize(lyxstring::size_type n, lyxstring::value_type c);
- ///
- void reserve(lyxstring::size_type res_arg);
- ///
- void replace(lyxstring::size_type i, lyxstring::size_type n,
- lyxstring::value_type const * p, lyxstring::size_type n2);
- private:
- Srep(const Srep &);
- Srep & operator=(const Srep &);
- };
-
- /** The empty_rep is a local static in each function that