Immutable owning launch text with allocation-free empty, copy and move operations. Nonempty construction copies bytes into shared immutable storage and may throw std::bad_alloc. Default construction retains no string object, including on MSVC Debug. Views/pointers remain valid while any copy retaining the same storage remains alive.
More...
#include <ui_app.hpp>
Immutable owning launch text with allocation-free empty, copy and move operations. Nonempty construction copies bytes into shared immutable storage and may throw std::bad_alloc. Default construction retains no string object, including on MSVC Debug. Views/pointers remain valid while any copy retaining the same storage remains alive.
◆ LaunchText() [1/5]
| portals::ui::LaunchText::LaunchText |
( |
std::string_view | bytes | ) |
|
|
inline |
- Parameters
-
| bytes | Bytes borrowed only during this owning copy; empty text allocates nothing. |
- Exceptions
-
| std::bad_alloc | If nonempty storage cannot be allocated. |
◆ LaunchText() [2/5]
| portals::ui::LaunchText::LaunchText |
( |
const std::string & | bytes | ) |
|
|
inline |
- Parameters
-
| bytes | Borrowed string, including rvalues; bytes are copied without invoking a string move. |
- Exceptions
-
| std::bad_alloc | If nonempty storage cannot be allocated. |
◆ LaunchText() [3/5]
| portals::ui::LaunchText::LaunchText |
( |
const char * | bytes | ) |
|
|
inline |
- Parameters
-
| bytes | NUL-terminated text borrowed only during copying; nullptr denotes empty text. |
- Exceptions
-
| std::bad_alloc | If nonempty storage cannot be allocated. |
◆ LaunchText() [4/5]
| portals::ui::LaunchText::LaunchText |
( |
const LaunchText & | other | ) |
|
|
defaultnoexcept |
- Parameters
-
| other | Immutable text whose ownership is shared without allocation. |
◆ LaunchText() [5/5]
| portals::ui::LaunchText::LaunchText |
( |
LaunchText && | other | ) |
|
|
defaultnoexcept |
- Parameters
-
| other | Text whose storage is transferred; the source becomes empty. |
◆ data()
| const char * portals::ui::LaunchText::data |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Read-only NUL-terminated bytes; empty text returns a static empty buffer.
◆ empty()
| bool portals::ui::LaunchText::empty |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- True when the owning text has no bytes.
◆ find()
| std::size_t portals::ui::LaunchText::find |
( |
std::string_view | text, |
|
|
std::size_t | position = 0 ) const |
|
inlinenoexcept |
- Parameters
-
| text | Borrowed bytes to find. |
| position | First byte position to inspect. |
- Returns
- Matching byte position, or std::string_view::npos; no allocation occurs.
◆ operator=() [1/2]
- Parameters
-
| other | Immutable text whose ownership replaces this value without allocation. |
- Returns
- This owning text after sharing the storage.
◆ operator=() [2/2]
- Parameters
-
| other | Text whose storage is transferred; the source becomes empty. |
- Returns
- This owning text after transferring the storage.
◆ size()
| std::size_t portals::ui::LaunchText::size |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Number of owned bytes, excluding the trailing NUL.
◆ view()
| std::string_view portals::ui::LaunchText::view |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Borrowed read-only view, retained by this value or another copy sharing its storage.
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | stream, |
|
|
const LaunchText & | text ) |
|
friend |
- Parameters
-
| stream | Borrowed output stream. |
| text | Immutable owning text to write. |
- Returns
- The same output stream after writing the complete byte view.
◆ operator== [1/4]
| bool operator== |
( |
const LaunchText & | left, |
|
|
const char * | right ) |
|
friend |
- Parameters
-
| left | Owning immutable text. |
| right | NUL-terminated bytes to compare; nullptr denotes empty text. |
- Returns
- True for equal bytes, without allocating.
◆ operator== [2/4]
- Parameters
-
| left | Owning immutable text. |
| right | Owning immutable text to compare by byte value. |
- Returns
- True for equal bytes, independently of storage identity.
◆ operator== [3/4]
| bool operator== |
( |
const LaunchText & | left, |
|
|
const std::string & | right ) |
|
friend |
- Parameters
-
| left | Owning immutable text. |
| right | Borrowed string to compare. |
- Returns
- True for equal bytes, without constructing another owning value.
◆ operator== [4/4]
| bool operator== |
( |
const LaunchText & | left, |
|
|
std::string_view | right ) |
|
friend |
- Parameters
-
| left | Owning immutable text. |
| right | Borrowed bytes to compare. |
- Returns
- True for equal bytes, without allocating.
The documentation for this class was generated from the following file: