]> OCCT Git - occt.git/commit
Foundation Classes - Optimize AsciiString with pre-defined string (#752)
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Wed, 22 Oct 2025 11:39:48 +0000 (12:39 +0100)
committerGitHub <noreply@github.com>
Wed, 22 Oct 2025 11:39:48 +0000 (12:39 +0100)
commit3b67b4b5da9d215b73ecbaa4d77e14a70224585d
tree770b5a42c4ace379be69c3d87c5ebe9f22927338
parent4ca8112dabbb17db668e28570c32f2eb2992080e
Foundation Classes - Optimize AsciiString with pre-defined string (#752)

- Rename internal members mystring/mylength -> myString/myLength across AsciiString
  implementation and related files to improve naming consistency.
- Add std::string_view support and efficient overloads:
  - constructor from string_view, AssignCat/Copy/Insert/SetValue from string_view
  - Cat, operators (+, +=) and comparison helpers accepting string_view
  - Token/StartsWith/EndsWith/Search helpers and literal-template overloads
  - operator std::string_view() to obtain a non-owning view
  - IsEqual/IsSameString/IsDifferent variants for string_view/C-string combinations
  - optimized literal templates to avoid runtime strlen for compile-time literals
- Improve memory handling and allocation helpers (allocate/reallocate/deallocate)
  and keep padding strategy consistent.
- Add Insert/AssignCat implementations that accept string_view and use memmove/memcpy.
- Fix calls in HAsciiString to use direct method instead of members
- Adjust misc. parameter names and small code-style/clarity improvements.

These changes enable zero-copy interop with std::string_view, reduce redundant C-string
operations for literals, and unify internal naming for maintainability.
src/FoundationClasses/TKernel/GTests/TCollection_AsciiString_Test.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.hxx
src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.lxx
src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_HAsciiString.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_HAsciiString.lxx