Class Hierarchy
AcHeapOperators AcString
C++
class AcString : public AcHeapOperators;
File
AcString.h
Description
AcString is a compiler-neutral string class. It provides functions for converting between multibyte (ANSI) strings and Unicode, and it is MIF (M+nxxyy) and CIF (U+xxxx) aware.
Remarks
All char arguments are assumed to be codes in the current code page, unless otherwise specified.
In places where a single char value is passed, the value cannot be a leading byte of a double-byte char, except where noted.
Notes
- All wchar_t arguments are assumed to be "widechar" Unicode values.
- Short strings are saved directly into the class using small object optimization.
- All ref-counting was removed, allowing AcString to be used in threads much more safely.
- The pointer returned from utf8Ptr() is now saved and has a long lifespan but it is not updated as the string is modified. Users should use it as before - consider it invalid after any modification - but the long life span will help prevent user lifetime bugs. This storage is around until destructor, setEmpty(), or copy assignment. Move constructor or assignment will move the utf8Ptr storage to the new container.
- Never cast away const from a pointer returned in order to modify the buffer directly. If you must modify the contents, use GetBuffer/ReleaseBuffer or make a copy.
- Legacy has utf8Ptr() as a const member function however internally it must modify internal data. It is the only method that is const that modifies internal data.
- c_str() is the preferred method to get a pointer to the null term string. All other methods are just wrappers to c_str() for legacy purposes. It will never return a nullptr.
- All index values (also known as position values) are 0-based. For example, in the string "abcd", the 'c' character has position 2.
- Input wchar_t * or char * can be nullstr or point to empty string - both are considered an empty string.
- An internal private assert system is used to avoid any conflict with assert/ASSERT.
Links
AcString Constructor, AcString Enumerations, AcString Data Members, AcString Methods, AcString Operators, AcString Classes
History
AutoCAD 2025
Notes for using the class have been updated. Be sure to read and understand the changes as they might impact your applications.