|
Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
|
Zero-copy value view for efficient read access. More...
#include <value_view.h>

Public Member Functions | |
| value_view (const char *name_data, size_t name_length, const char *value_data, size_t value_length, value_types type) noexcept | |
| Construct a value view. | |
| std::string_view | name () const noexcept |
| Get the value name as string_view (zero-copy) | |
| value_types | type () const noexcept |
| Get the value type. | |
| std::string_view | as_string_view () const noexcept |
| Get string value as string_view (zero-copy) | |
| std::string | as_string () const |
| Get string value as owned copy. | |
| template<typename T > | |
| std::optional< T > | as () const noexcept |
| Type-safe value extraction. | |
| bool | is_null () const noexcept |
| Check if this is a null value. | |
| const char * | data () const noexcept |
| Get raw value data pointer. | |
| size_t | size () const noexcept |
| Get value data length. | |
Private Member Functions | |
| template<typename T > | |
| std::optional< T > | parse_integral () const noexcept |
| Parse integral value from string data. | |
| template<typename T > | |
| std::optional< T > | parse_floating () const noexcept |
| Parse floating-point value from string data. | |
Static Private Member Functions | |
| static bool | is_integral_type (value_types t) noexcept |
| Check if type is an integral type. | |
Private Attributes | |
| const char * | name_data_ |
| size_t | name_length_ |
| const char * | value_data_ |
| size_t | value_length_ |
| value_types | type_ |
Zero-copy value view for efficient read access.
value_view provides a non-owning view into serialized data, enabling zero-copy access to string and numeric values. The underlying buffer must remain valid for the lifetime of the view.
Key features:
Definition at line 55 of file value_view.h.
|
inlinenoexcept |
Construct a value view.
| name_data | Pointer to the name string data |
| name_length | Length of the name string |
| value_data | Pointer to the value data |
| value_length | Length of the value data |
| type | The value type |
Definition at line 66 of file value_view.h.
|
inlinenodiscardnoexcept |
Type-safe value extraction.
| T | The expected value type |
Definition at line 117 of file value_view.h.
References as_string(), as_string_view(), parse_floating(), parse_integral(), type_, value_data_, and value_length_.

|
inlinenodiscard |
Get string value as owned copy.
Definition at line 106 of file value_view.h.
References value_data_, and value_length_.
Referenced by as().

|
inlinenodiscardnoexcept |
Get string value as string_view (zero-copy)
Definition at line 97 of file value_view.h.
References value_data_, and value_length_.
Referenced by as().

|
inlinenodiscardnoexcept |
|
inlinestaticnodiscardprivatenoexcept |
Check if type is an integral type.
Definition at line 245 of file value_view.h.
Referenced by parse_integral().

|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Get the value name as string_view (zero-copy)
Definition at line 79 of file value_view.h.
References name_data_, and name_length_.
|
inlinenodiscardprivatenoexcept |
Parse floating-point value from string data.
Definition at line 213 of file value_view.h.
References type_, value_data_, and value_length_.
Referenced by as().

|
inlinenodiscardprivatenoexcept |
Parse integral value from string data.
Definition at line 180 of file value_view.h.
References is_integral_type(), type_, value_data_, and value_length_.
Referenced by as().


|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
private |
Definition at line 262 of file value_view.h.
Referenced by name().
|
private |
Definition at line 263 of file value_view.h.
Referenced by name().
|
private |
Definition at line 266 of file value_view.h.
Referenced by as(), is_null(), parse_floating(), parse_integral(), and type().
|
private |
Definition at line 264 of file value_view.h.
Referenced by as(), as_string(), as_string_view(), data(), parse_floating(), and parse_integral().
|
private |
Definition at line 265 of file value_view.h.
Referenced by as(), as_string(), as_string_view(), parse_floating(), parse_integral(), and size().