![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
A short uppercase code (letters, digits, _), stored inline without allocation. More...
#include <algotradelib/src/core/types.hpp>
Public Member Functions | |
| Code ()=default | |
| Constructs an empty code. | |
| Code (std::string_view text) | |
| Constructs a code. | |
| std::string_view | view () const noexcept |
| Returns the code's characters. | |
| std::string | str () const |
| Returns the code as a string. | |
| bool | empty () const noexcept |
| Tests whether the code is empty. | |
| std::size_t | size () const noexcept |
| Returns the number of characters. | |
Static Public Member Functions | |
| static std::optional< Code > | try_make (std::string_view text) |
| Makes a code without throwing. | |
| static constexpr std::size_t | capacity () noexcept |
| Returns the maximum number of characters. | |
Friends | |
| bool | operator== (const Code &lhs, const Code &rhs) |
| Compares two codes' characters. | |
| bool | operator!= (const Code &lhs, const Code &rhs) |
| Compares two codes for inequality. | |
A short uppercase code (letters, digits, _), stored inline without allocation.
The length is stored in one byte, so N must be at most 255.
Holds a broker code the library may not recognize (a market segment, an exchange id) exactly as sent, so it can be carried, compared and displayed.
| N | The maximum number of characters. |
|
default |
Constructs an empty code.
Referenced by operator!=, operator==, and try_make().
|
inlineexplicit |
|
inlinestaticconstexprnoexcept |
|
inlinenoexcept |
Tests whether the code is empty.
Definition at line 198 of file types.hpp.
Referenced by algotradelib::CommissionRate::normalized(), and algotradelib::MarketSegment::str().
|
inlinenoexcept |
|
inline |
Returns the code as a string.
Definition at line 192 of file types.hpp.
Referenced by algotradelib::MarketSegment::str().
|
inlinestatic |
Makes a code without throwing.
| text | Up to N characters, each A-Z, 0-9 or _. |
Definition at line 163 of file types.hpp.
Referenced by algotradelib::market_segment(), and algotradelib::VenueKey::raw().
|
inlinenoexcept |
Returns the code's characters.
Definition at line 184 of file types.hpp.
Referenced by operator==, and str().