tap_name Class
A name prepared for a single TAP line, without a copy when it needs no change. More...
Declaration
Public Constructors Index
| tap_name (const char *text, bool escape) | |
|
Prepares a name. More... | |
| tap_name (const tap_name &)=delete | |
|
Deleted copy constructor. More... | |
| tap_name (tap_name &&)=delete | |
|
Deleted move constructor. More... | |
Public Destructor Index
| ~tap_name ()=default | |
|
Destructor. More... | |
Public Operators Index
| tap_name & | operator= (const tap_name &)=delete |
|
Deleted copy assignment operator. More... | |
| tap_name & | operator= (tap_name &&)=delete |
|
Deleted move assignment operator. More... | |
Public Member Functions Index
| const char * | c_str (void) const noexcept |
|
Retrieves the prepared name. More... | |
Private Member Attributes Index
| bool | is_copy_ { false } |
| std::string | prepared_ {} |
|
The changed copy of the name. More... | |
| const char * | text_ |
|
The original name. More... | |
Description
A name prepared for a single TAP line, without a copy when it needs no change.
The names of the suites and of the test cases rarely contain a character that tap_text() changes, so the name is searched, and only copied (with tap_text()) when it must be changed; otherwise c_str() returns the original name, which must outlive the object. The object is neither copyable nor movable.
Definition at line 151 of file reporter-tap.cpp.
Public Constructors
tap_name()
| inline |
Prepares a name.
- Parameters
-
text The null-terminated name.
escape Whether to escape the \\ and # characters, as tap_text() does.
The name is copied, through tap_text(), only when it contains a line break, or, when escaping, a \\ or a #; otherwise the original pointer is kept, and nothing is allocated.
Definition at line 166 of file reporter-tap.cpp.
References is_copy_, prepared_, micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::tap_text and text_.
tap_name()
| delete |
Deleted copy constructor.
The object is used only as a local variable of the function that writes the line.
Definition at line 186 of file reporter-tap.cpp.
Reference tap_name.
tap_name()
| delete |
Deleted move constructor.
The object is used only as a local variable of the function that writes the line.
Definition at line 195 of file reporter-tap.cpp.
Reference tap_name.
Public Destructor
~tap_name()
| default |
Destructor.
Releases the copy of the name, if one was made.
Definition at line 225 of file reporter-tap.cpp.
Public Operators
operator=()
| delete |
Deleted copy assignment operator.
The object is used only as a local variable of the function that writes the line.
Definition at line 205 of file reporter-tap.cpp.
Reference tap_name.
operator=()
| delete |
Deleted move assignment operator.
The object is used only as a local variable of the function that writes the line.
Definition at line 216 of file reporter-tap.cpp.
Reference tap_name.
Public Member Functions
c_str()
| inline nodiscard noexcept |
Retrieves the prepared name.
- Parameters
None.
- Returns
The null-terminated name, valid as long as this object and the original name.
Returns the copy, when the name had to be changed, or the original name otherwise.
Definition at line 240 of file reporter-tap.cpp.
Private Member Attributes
is_copy_
|
Whether the name was copied into prepared_.
Set by the constructor, when the name contains a character that tap_text() changes.
Definition at line 269 of file reporter-tap.cpp.
prepared_
|
text_
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.