CXStringEdit

From cxwiki

Revision as of 00:16, 24 February 2018 by Windwalkr (talk | contribs) (Created page with "<div class="mw-parser-output"> The CXStringEdit class is a string class optimised for simple editing. As compared to the standard CXString, it offers vastly superior gener...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The CXStringEdit class is a string class optimised for simple editing. As compared to the standard CXString, it offers vastly superior general edit performance for short strings, vastly superior append performance even for long strings, and a variety of helper methods for string editing.

A CXStringEdit object nominally stores UTF-8 encoded text with a zero termination byte. Short strings are stored in an internal buffer, while long strings are stored in an allocated buffer. CXStringEdit objects do not distinguish "null" and "empty" strings.

 

In practice, CXString objects can contain any binary data at all with little overhead:

  • The UTF-8 encoding of the payload is not checked or enforced, except by functions which explicitly deal with UTF-8 glyphs. 
  • While they do have a guaranteed zero terminator byte, nothing prevents additional zero bytes within the payload. 
  • The zero terminator byte is not considered part of the payload, so will not be accidentally appended to a "non-zero-terminated" binary payload.