Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
usher_cv_json::Value Class Reference

C++ value interface with explicit conversions and OpenCV JSON I/O. More...

#include <opencv_json.hpp>

Data Structures

class  exception
 Adapter errors exposed independently of OpenCV's exception type. More...
struct  is_std_array
 False primary trait; unsupported conversions must not masquerade as arrays. More...
struct  is_std_array< std::array< Type, Count > >
 Recognize fixed arrays so get() can require their exact length. More...
struct  is_std_vector
 False primary trait for dynamic-vector conversion detection. More...
struct  is_std_vector< std::vector< Type, Allocator > >
 Recognize vectors without fixing their element allocator. More...

Public Types

using Field = std::pair<std::string, Value>
 One named value supplied to an object factory.

Public Member Functions

 Value ()
 Allocate a fresh null node instead of using a shared mutable singleton.
 Value (std::nullptr_t)
 Construct null from the C++ nullptr tag.
 Value (bool value)
 Construct a boolean without confusing it with an integral payload.
 Value (const char *value)
 Copy a terminated string; a null pointer selects an empty string.
 Value (const std::string &value)
 Own a complete byte string rather than borrowing external storage.
template<typename Number, typename = std::enable_if_t<std::is_integral_v<Number> && !std::is_same_v<Number, bool>>>
 Value (Number value)
 Store native integral input in its signed or unsigned 64-bit category.
template<typename Number, typename = std::enable_if_t<std::is_floating_point_v<Number>>, typename = void>
 Value (Number value)
 Store floating-point input as a double, not an integer-shaped value.
 Value (const Value &other)
 Recursively detach a copy so later mutation does not alias the source.
 Value (Value &&) noexcept=default
 Transfer node ownership; only destruction/reassignment is assumed for the source.
Value & operator= (const Value &other)
 Deep-copy and rebind this handle without modifying any former parent slot.
Value & operator= (Value &&) noexcept=default
 Move/rebind ownership without recursively cloning nodes.
bool is_null () const
 Inspect the null tag.
bool is_object () const
 Inspect the object tag.
bool is_array () const
 Inspect the array tag.
bool is_string () const
 Inspect the string tag.
bool is_number () const
 Test all three numeric categories without treating bool as numeric.
bool is_number_integer () const
 Test signed/unsigned storage without accepting a real such as 1.0.
bool is_number_unsigned () const
 Inspect unsigned storage rather than testing a number's sign.
bool contains (const char *key) const
 Check member presence without interpreting a null value as missing.
bool contains (const std::string &key) const
 Check a member name through the C-string lookup interface.
size_t size () const
 Count container entries, not string bytes or scalar payload size.
Value operator[] (const char *key) const
 Look up a shared child handle, using null for a missing member.
Value operator[] (const std::string &key) const
 Perform optional lookup through the terminated-name overload.
Value at (const char *key) const
 Require an object member instead of substituting null.
Value at (const std::string &key) const
 Require a member through the terminated-name interface.
Value operator[] (int index) const
 Check signed array indices before conversion to an unsigned extent.
Value operator[] (size_t index) const
 Select an array element with the same bounds policy as at().
Value at (int index) const
 Reject a negative position before any size_t cast can wrap it.
Value at (size_t index) const
 Check both the array kind and its actual vector extent.
template<typename Type>
Type get () const
 Convert explicitly while preserving the distinction between types.
template<typename Type>
Type value (const char *key, Type fallback) const
 Use a default only for absence, never to hide an invalid present value.
std::string value (const char *key, const char *fallback) const
 Provide a string-valued default rather than returning a borrowed pointer.
std::vector< std::pair< std::string, Value > > items () const
 Snapshot object names and shared child handles in map order.
void set (const std::string &key, const Value &value)
 Clone a member value, replace any matching key and select object kind.
template<typename Type>
void set (const std::string &key, Type value)
 Construct a supported native value before applying member insertion policy.
void push_back (const Value &value)
 Clone an element, append it in order and select array kind.
template<typename Type>
void push_back (Type value)
 Construct a native value before applying array insertion policy.
void update (const Value &other)
 Shallow-merge object members while deep-copying each replacement value.
std::string dump (int indent=-1, char=' ', bool=false) const
 Serialize with OpenCV and restore native JSON scalar tokens.
std::string dump_sorted () const
 Produce compact map-ordered output without FileStorage formatting.

Static Public Member Functions

static Value object ()
 Make an empty object.
static Value object (std::initializer_list< Field > fields)
 Build an object by cloning each supplied member value.
static Value array ()
 Make an empty array.
static Value array (std::initializer_list< Value > values)
 Build an ordered array by cloning each supplied value.
template<typename Iterator>
static Value parse (Iterator first, Iterator last)
 Copy a byte range and delegate parsing to the string overload.
static Value parse (const char *input)
 Parse terminated input; use a range/std::string for an explicit extent.
static Value parse (const std::string &input)
 Normalize compatibility tokens, parse with OpenCV and detach the tree.

Private Member Functions

 Value (std::shared_ptr< Node > node)
 Construct a shared child view without invoking public deep-copy semantics.
Value lookup (const char *key, bool required) const
 Centralize required/optional member policy without copying a found child.

Static Private Member Functions

static Value from_node (const cv::FileNode &source)
 Recursively detach a FileNode and restore compatibility sentinel types.
static std::string normalize_for_opencv (const std::string &input)
 Adapt tokens outside strings and decode string escapes for FileStorage.
static std::string write_opencv (const Value &value, int indent)
 Write through FileStorage, restore marked scalars and optionally compact.
static void write_node (cv::FileStorage &storage, const std::string &key, const Value &value, bool has_key)
 Recursively emit containers and protect types unsupported by FileStorage.
static void require_unreserved (const Value &value)
 Reject the marker namespace in a directly supplied string value.
static std::shared_ptr< Node > clone (const std::shared_ptr< Node > &source)
 Clone child nodes recursively to implement ordinary value-copy semantics.
static bool equal_nodes (const std::shared_ptr< Node > &left, const std::shared_ptr< Node > &right)
 Compare active payloads and recursively compare container contents.

Private Attributes

std::shared_ptr< Node > node_

Friends

bool operator== (const Value &left, const Value &right)
 Compare tree contents rather than shared-pointer identity.
bool operator!= (const Value &left, const Value &right)
 Negate structural equality using the same numeric policy.
bool operator< (const Value &left, const Value &right)
 Order string values only, rather than inventing an ordering across JSON kinds.

Detailed Description

C++ value interface with explicit conversions and OpenCV JSON I/O.

Copy construction/assignment are deep; lookup-produced handles share a selected node until copied or rebound. Conversion failures throw rather than silently turning missing, differently typed or out-of-range data into defaults.

Note
Allocation failures may additionally propagate standard-library exceptions.

Definition at line 107 of file opencv_json.hpp.

Member Typedef Documentation

◆ Field

using usher_cv_json::Value::Field = std::pair<std::string, Value>

One named value supplied to an object factory.

Definition at line 116 of file opencv_json.hpp.

Constructor & Destructor Documentation

◆ Value() [1/10]

usher_cv_json::Value::Value ( )
inline

Allocate a fresh null node instead of using a shared mutable singleton.

Definition at line 119 of file opencv_json.hpp.

◆ Value() [2/10]

usher_cv_json::Value::Value ( std::nullptr_t )
inline

Construct null from the C++ nullptr tag.

Definition at line 121 of file opencv_json.hpp.

◆ Value() [3/10]

usher_cv_json::Value::Value ( bool value)
inline

Construct a boolean without confusing it with an integral payload.

Parameters
[in]valueBoolean to store.

Definition at line 126 of file opencv_json.hpp.

◆ Value() [4/10]

usher_cv_json::Value::Value ( const char * value)
inline

Copy a terminated string; a null pointer selects an empty string.

Parameters
[in]valueC string, or nullptr; embedded NULs require the std::string overload.

Definition at line 134 of file opencv_json.hpp.

◆ Value() [5/10]

usher_cv_json::Value::Value ( const std::string & value)
inline

Own a complete byte string rather than borrowing external storage.

Parameters
[in]valueString copied with its explicit byte length.

Definition at line 139 of file opencv_json.hpp.

◆ Value() [6/10]

template<typename Number, typename = std::enable_if_t<std::is_integral_v<Number> && !std::is_same_v<Number, bool>>>
usher_cv_json::Value::Value ( Number value)
inline

Store native integral input in its signed or unsigned 64-bit category.

Template Parameters
NumberIntegral source type other than bool.
Parameters
[in]valueNumber converted to the corresponding 64-bit storage type.
Note
bool is excluded so overload resolution preserves boolean semantics.

Definition at line 153 of file opencv_json.hpp.

◆ Value() [7/10]

template<typename Number, typename = std::enable_if_t<std::is_floating_point_v<Number>>, typename = void>
usher_cv_json::Value::Value ( Number value)
inline

Store floating-point input as a double, not an integer-shaped value.

Template Parameters
NumberFloating-point source type.
Parameters
[in]valueNumber converted to double; this constructor does not check finiteness.

Definition at line 170 of file opencv_json.hpp.

◆ Value() [8/10]

usher_cv_json::Value::Value ( const Value & other)
inline

Recursively detach a copy so later mutation does not alias the source.

Parameters
[in]otherAccessible source value, not a moved-from handle.

Definition at line 179 of file opencv_json.hpp.

◆ Value() [9/10]

usher_cv_json::Value::Value ( Value && )
defaultnoexcept

Transfer node ownership; only destruction/reassignment is assumed for the source.

◆ Value() [10/10]

usher_cv_json::Value::Value ( std::shared_ptr< Node > node)
inlineexplicitprivate

Construct a shared child view without invoking public deep-copy semantics.

Parameters
[in]nodeExisting child ownership transferred into this handle.

Definition at line 768 of file opencv_json.hpp.

Member Function Documentation

◆ array() [1/2]

Value usher_cv_json::Value::array ( )
inlinestatic

Make an empty array.

Returns
Independently owned array value.

Definition at line 216 of file opencv_json.hpp.

◆ array() [2/2]

Value usher_cv_json::Value::array ( std::initializer_list< Value > values)
inlinestatic

Build an ordered array by cloning each supplied value.

Parameters
[in]valuesElements in their desired order.
Returns
Independently owned array value.

Definition at line 226 of file opencv_json.hpp.

◆ at() [1/4]

Value usher_cv_json::Value::at ( const char * key) const
inline

Require an object member instead of substituting null.

Parameters
[in]keyNon-null terminated member name.
Returns
Handle initially sharing the selected child node.
Exceptions
exceptionFor a nonobject or missing key.

Definition at line 345 of file opencv_json.hpp.

◆ at() [2/4]

Value usher_cv_json::Value::at ( const std::string & key) const
inline

Require a member through the terminated-name interface.

Parameters
[in]keyName; an embedded NUL terminates lookup.
Returns
Shared child handle.
Exceptions
exceptionFor a nonobject or missing key.

Definition at line 352 of file opencv_json.hpp.

◆ at() [3/4]

Value usher_cv_json::Value::at ( int index) const
inline

Reject a negative position before any size_t cast can wrap it.

Parameters
[in]indexSigned zero-based array position.
Returns
Shared child handle.
Exceptions
exceptionFor invalid array access.

Definition at line 373 of file opencv_json.hpp.

◆ at() [4/4]

Value usher_cv_json::Value::at ( size_t index) const
inline

Check both the array kind and its actual vector extent.

Parameters
[in]indexZero-based array position.
Returns
Handle sharing the selected node, not a recursive copy.
Exceptions
exceptionFor a nonarray or out-of-range position.

Definition at line 384 of file opencv_json.hpp.

◆ clone()

std::shared_ptr< Node > usher_cv_json::Value::clone ( const std::shared_ptr< Node > & source)
inlinestaticprivate

Clone child nodes recursively to implement ordinary value-copy semantics.

Parameters
[in]sourceNon-null source node and its accessible descendants.
Returns
Independent node tree, not shared child pointers from source.

Definition at line 836 of file opencv_json.hpp.

◆ contains() [1/2]

bool usher_cv_json::Value::contains ( const char * key) const
inline

Check member presence without interpreting a null value as missing.

Parameters
[in]keyNon-null terminated member name.
Returns
True for an existing object member; false for nonobjects/missing keys.

Definition at line 304 of file opencv_json.hpp.

◆ contains() [2/2]

bool usher_cv_json::Value::contains ( const std::string & key) const
inline

Check a member name through the C-string lookup interface.

Parameters
[in]keyName; an embedded NUL ends the portion used for lookup.
Returns
Whether the object contains the selected name.

Definition at line 312 of file opencv_json.hpp.

◆ dump()

std::string usher_cv_json::Value::dump ( int indent = -1,
char = ' ',
bool = false ) const
inline

Serialize with OpenCV and restore native JSON scalar tokens.

Parameters
[in]indentNegative selects compact output; nonnegative keeps OpenCV formatting. Its numeric magnitude is not an indentation-width setting.
Returns
Owned serialized text.
Exceptions
exceptionFor adapter-detected writer or reserved-string failures.
Note
The unnamed character/bool arguments are ignored compatibility slots. OpenCV writer exceptions may propagate as cv::Exception rather than exception.

Definition at line 565 of file opencv_json.hpp.

◆ dump_sorted()

std::string usher_cv_json::Value::dump_sorted ( ) const
inline

Produce compact map-ordered output without FileStorage formatting.

Returns
Owned text with non-ASCII strings expressed as Unicode escapes.
Exceptions
exceptionFor malformed/truncated UTF-8 sequence shapes or failed number formatting.
Precondition
Use finite real values and valid Unicode strings when strict JSON is needed.
Note
This is deterministic map-key ordering, not RFC 8785 canonicalization. UTF-8 checks cover lead/continuation shape and truncation, not every scalar validity rule; real-tagged integral spellings keep a .0 suffix for round trips.

Definition at line 577 of file opencv_json.hpp.

◆ equal_nodes()

bool usher_cv_json::Value::equal_nodes ( const std::shared_ptr< Node > & left,
const std::shared_ptr< Node > & right )
inlinestaticprivate

Compare active payloads and recursively compare container contents.

Parameters
[in]leftNon-null first node.
[in]rightNon-null second node.
Returns
Equality under the adapter's numeric/structural comparison rules.

Definition at line 848 of file opencv_json.hpp.

◆ from_node()

Value usher_cv_json::Value::from_node ( const cv::FileNode & source)
inlinestaticprivate

Recursively detach a FileNode and restore compatibility sentinel types.

Parameters
[in]sourceOpenCV node valid for the duration of conversion.
Returns
Independent native tree, with later duplicate map keys replacing earlier ones.
Exceptions
exceptionFor unsupported nodes or invalid/out-of-range integer markers.

Definition at line 1089 of file opencv_json.hpp.

◆ get()

template<typename Type>
Type usher_cv_json::Value::get ( ) const
inline

Convert explicitly while preserving the distinction between types.

Template Parameters
TypeValue, string, bool, arithmetic type, std::array or std::vector; container elements are converted recursively using their value_type.
Returns
Converted value; requesting Value makes a deep copy.
Exceptions
exceptionFor incompatible tags, nonfinite/out-of-range numeric conversion or a fixed-size array whose length does not match.
Note
Integer targets reject real-tagged inputs even if mathematically integral. Floating conversions use double and do not promise integer precision. Unsupported target types produce a compile-time error, not a runtime fallback.

Definition at line 401 of file opencv_json.hpp.

◆ is_array()

bool usher_cv_json::Value::is_array ( ) const
inline

Inspect the array tag.

Returns
True only for an array node.

Definition at line 281 of file opencv_json.hpp.

◆ is_null()

bool usher_cv_json::Value::is_null ( ) const
inline

Inspect the null tag.

Returns
True only for a null node.

Definition at line 277 of file opencv_json.hpp.

◆ is_number()

bool usher_cv_json::Value::is_number ( ) const
inline

Test all three numeric categories without treating bool as numeric.

Returns
Numeric tag status.

Definition at line 285 of file opencv_json.hpp.

◆ is_number_integer()

bool usher_cv_json::Value::is_number_integer ( ) const
inline

Test signed/unsigned storage without accepting a real such as 1.0.

Returns
Integer tag status.

Definition at line 291 of file opencv_json.hpp.

◆ is_number_unsigned()

bool usher_cv_json::Value::is_number_unsigned ( ) const
inline

Inspect unsigned storage rather than testing a number's sign.

Returns
Unsigned tag status.

Definition at line 296 of file opencv_json.hpp.

◆ is_object()

bool usher_cv_json::Value::is_object ( ) const
inline

Inspect the object tag.

Returns
True only for an object node.

Definition at line 279 of file opencv_json.hpp.

◆ is_string()

bool usher_cv_json::Value::is_string ( ) const
inline

Inspect the string tag.

Returns
True only for a string node.

Definition at line 283 of file opencv_json.hpp.

◆ items()

std::vector< std::pair< std::string, Value > > usher_cv_json::Value::items ( ) const
inline

Snapshot object names and shared child handles in map order.

Returns
Newly allocated member vector; child nodes initially remain shared.
Exceptions
exceptionIf this value is not an object.
Note
The vector is detached from later map insertion/removal, but a returned child's in-place mutation can still affect the source node it shares.

Definition at line 493 of file opencv_json.hpp.

◆ lookup()

Value usher_cv_json::Value::lookup ( const char * key,
bool required ) const
inlineprivate

Centralize required/optional member policy without copying a found child.

Parameters
[in]keyNon-null terminated member name.
[in]requiredWhether absence is an error instead of a fresh null value.
Returns
Shared child view, or fresh null for an optional missing member.
Exceptions
exceptionFor a nonobject or a missing required member.

Definition at line 916 of file opencv_json.hpp.

◆ normalize_for_opencv()

std::string usher_cv_json::Value::normalize_for_opencv ( const std::string & input)
inlinestaticprivate

Adapt tokens outside strings and decode string escapes for FileStorage.

Parameters
[in]inputOriginal bytes, left unchanged.
Returns
OpenCV-readable text with typed scalar markers.
Exceptions
exceptionFor reserved raw marker text or invalid Unicode/string escapes.
Note
This is a compatibility pass, not a complete JSON grammar validator; OpenCV processes the resulting document structure.

Definition at line 934 of file opencv_json.hpp.

◆ object() [1/2]

Value usher_cv_json::Value::object ( )
inlinestatic

Make an empty object.

Returns
Independently owned object value.

Definition at line 199 of file opencv_json.hpp.

◆ object() [2/2]

Value usher_cv_json::Value::object ( std::initializer_list< Field > fields)
inlinestatic

Build an object by cloning each supplied member value.

Parameters
[in]fieldsNamed values; later repeated keys replace earlier members.
Returns
Object in map key order rather than initializer/source order.

Definition at line 209 of file opencv_json.hpp.

◆ operator=() [1/2]

Value & usher_cv_json::Value::operator= ( const Value & other)
inline

Deep-copy and rebind this handle without modifying any former parent slot.

Parameters
[in]otherSource value; self-assignment is permitted.
Returns
This handle after assignment.

Definition at line 187 of file opencv_json.hpp.

◆ operator=() [2/2]

Value & usher_cv_json::Value::operator= ( Value && )
defaultnoexcept

Move/rebind ownership without recursively cloning nodes.

Returns
This handle; the moved-from source must be reassigned before inspection.

◆ operator[]() [1/4]

Value usher_cv_json::Value::operator[] ( const char * key) const
inline

Look up a shared child handle, using null for a missing member.

Parameters
[in]keyNon-null terminated name.
Returns
Handle initially sharing the child, or a fresh null value if absent.
Exceptions
exceptionIf this value is not an object; lookup does not insert.

Definition at line 329 of file opencv_json.hpp.

◆ operator[]() [2/4]

Value usher_cv_json::Value::operator[] ( const std::string & key) const
inline

Perform optional lookup through the terminated-name overload.

Parameters
[in]keyName; lookup stops at its first embedded NUL.
Returns
Shared child handle or a fresh null for a missing member.
Exceptions
exceptionIf this value is not an object.

Definition at line 336 of file opencv_json.hpp.

◆ operator[]() [3/4]

Value usher_cv_json::Value::operator[] ( int index) const
inline

Check signed array indices before conversion to an unsigned extent.

Parameters
[in]indexZero-based array position.
Returns
Shared child handle.
Exceptions
exceptionFor a negative/out-of-range index or nonarray value.

Definition at line 359 of file opencv_json.hpp.

◆ operator[]() [4/4]

Value usher_cv_json::Value::operator[] ( size_t index) const
inline

Select an array element with the same bounds policy as at().

Parameters
[in]indexZero-based array position.
Returns
Shared child handle.
Exceptions
exceptionFor a nonarray or out-of-range position.

Definition at line 366 of file opencv_json.hpp.

◆ parse() [1/3]

Value usher_cv_json::Value::parse ( const char * input)
inlinestatic

Parse terminated input; use a range/std::string for an explicit extent.

Parameters
[in]inputTerminated bytes; nullptr selects an empty input string.
Returns
Parsed tree, independent of the input buffer.
Exceptions
exceptionIf the selected input cannot be read.

Definition at line 251 of file opencv_json.hpp.

◆ parse() [2/3]

Value usher_cv_json::Value::parse ( const std::string & input)
inlinestatic

Normalize compatibility tokens, parse with OpenCV and detach the tree.

Parameters
[in]inputJSON input whose original bytes remain unchanged.
Returns
Independently owned tree with restored bool/null/integer categories.
Exceptions
exceptionFor rejected sentinels/escapes, conversion or OpenCV parse errors.
Note
cv::Exception is translated at this boundary so callers can use the adapter's error type without depending on OpenCV's parser diagnostics API.

Definition at line 262 of file opencv_json.hpp.

◆ parse() [3/3]

template<typename Iterator>
Value usher_cv_json::Value::parse ( Iterator first,
Iterator last )
inlinestatic

Copy a byte range and delegate parsing to the string overload.

Template Parameters
IteratorIterator type accepted by std::string's range constructor.
Parameters
[in]firstBeginning of the input range.
[in]lastOne-past-end iterator.
Returns
Tree detached from OpenCV's temporary storage.
Exceptions
exceptionIf normalization or OpenCV input processing fails.

Definition at line 242 of file opencv_json.hpp.

◆ push_back() [1/2]

void usher_cv_json::Value::push_back ( const Value & value)
inline

Clone an element, append it in order and select array kind.

Parameters
[in]valueSource element, whose later mutation must not alter this copy.
Exceptions
exceptionIf a directly supplied string uses the reserved namespace.
Note
Other-kind payload storage is retained but no longer selected by kind.

Definition at line 531 of file opencv_json.hpp.

◆ push_back() [2/2]

template<typename Type>
void usher_cv_json::Value::push_back ( Type value)
inline

Construct a native value before applying array insertion policy.

Template Parameters
TypeType accepted by a Value constructor.
Parameters
[in]valueNative element to convert and clone.
Exceptions
exceptionUnder the same reserved-string policy as push_back().

Definition at line 542 of file opencv_json.hpp.

◆ require_unreserved()

void usher_cv_json::Value::require_unreserved ( const Value & value)
inlinestaticprivate

Reject the marker namespace in a directly supplied string value.

Parameters
[in]valueValue checked only if its active kind is String.
Exceptions
exceptionIf that string contains the reserved prefix.
Note
This helper is not a recursive tree or object-key validator.

Definition at line 928 of file opencv_json.hpp.

◆ set() [1/2]

void usher_cv_json::Value::set ( const std::string & key,
const Value & value )
inline

Clone a member value, replace any matching key and select object kind.

Parameters
[in]keyOwned member name copied into the map.
[in]valueSource value cloned rather than linked into this tree.
Exceptions
exceptionIf a directly supplied string uses a reserved bridge marker.
Note
Existing other-kind payload storage is not cleared by this operation.

Definition at line 510 of file opencv_json.hpp.

◆ set() [2/2]

template<typename Type>
void usher_cv_json::Value::set ( const std::string & key,
Type value )
inline

Construct a supported native value before applying member insertion policy.

Template Parameters
TypeType accepted by a Value constructor.
Parameters
[in]keyMember name.
[in]valueNative value to convert and clone.
Exceptions
exceptionUnder the same reserved-string policy as set().

Definition at line 522 of file opencv_json.hpp.

◆ size()

size_t usher_cv_json::Value::size ( ) const
inline

Count container entries, not string bytes or scalar payload size.

Returns
Array length, object member count, or zero for a scalar/null.

Definition at line 317 of file opencv_json.hpp.

◆ update()

void usher_cv_json::Value::update ( const Value & other)
inline

Shallow-merge object members while deep-copying each replacement value.

Parameters
[in]otherObject whose keys replace matching keys in this value.
Exceptions
exceptionIf other is not an object or an inserted string is reserved.
Note
This merges one member level, not nested objects recursively.

Definition at line 551 of file opencv_json.hpp.

◆ value() [1/2]

std::string usher_cv_json::Value::value ( const char * key,
const char * fallback ) const
inline

Provide a string-valued default rather than returning a borrowed pointer.

Parameters
[in]keyNon-null terminated member name.
[in]fallbackNon-null terminated default string.
Returns
Owned member/default string.
Exceptions
exceptionIf a present member is not a string.

Definition at line 482 of file opencv_json.hpp.

◆ value() [2/2]

template<typename Type>
Type usher_cv_json::Value::value ( const char * key,
Type fallback ) const
inline

Use a default only for absence, never to hide an invalid present value.

Template Parameters
TypeConversion/default type supported by get().
Parameters
[in]keyNon-null terminated member name.
[in]fallbackResult when no member exists (including on a nonobject).
Returns
Converted member or fallback.
Exceptions
exceptionIf a present member cannot be converted to Type.

Definition at line 472 of file opencv_json.hpp.

◆ write_node()

void usher_cv_json::Value::write_node ( cv::FileStorage & storage,
const std::string & key,
const Value & value,
bool has_key )
inlinestaticprivate

Recursively emit containers and protect types unsupported by FileStorage.

Parameters
[in,out]storageActive OpenCV JSON writer.
[in]keyName used when has_key is true.
[in]valueCurrent value to emit.
[in]has_keyDistinguishes named object members from anonymous array elements.
Exceptions
exceptionFor reserved string payloads.

Definition at line 1152 of file opencv_json.hpp.

◆ write_opencv()

std::string usher_cv_json::Value::write_opencv ( const Value & value,
int indent )
inlinestaticprivate

Write through FileStorage, restore marked scalars and optionally compact.

Parameters
[in]valueTree to serialize.
[in]indentNegative removes insignificant whitespace; otherwise OpenCV formats.
Returns
Owned output text.
Exceptions
exceptionFor adapter-detected writer/marker failures.

Definition at line 1203 of file opencv_json.hpp.

◆ operator!=

bool operator!= ( const Value & left,
const Value & right )
friend

Negate structural equality using the same numeric policy.

Parameters
[in]leftFirst value.
[in]rightSecond value.
Returns
True exactly when equality returns false.

Definition at line 727 of file opencv_json.hpp.

◆ operator<

bool operator< ( const Value & left,
const Value & right )
friend

Order string values only, rather than inventing an ordering across JSON kinds.

Parameters
[in]leftFirst string value.
[in]rightSecond string value.
Returns
Lexicographic std::string comparison result.
Exceptions
exceptionIf either operand is not a string.

Definition at line 737 of file opencv_json.hpp.

◆ operator==

bool operator== ( const Value & left,
const Value & right )
friend

Compare tree contents rather than shared-pointer identity.

Parameters
[in]leftFirst value.
[in]rightSecond value.
Returns
Structural equality with numeric cross-category comparison.
Note
Real/integer comparisons use native long double precision, not an arbitrary-precision decimal equivalence relation.

Definition at line 718 of file opencv_json.hpp.

Field Documentation

◆ node_

std::shared_ptr<Node> usher_cv_json::Value::node_
private

Current owned/shared node; may be empty after a move.

Definition at line 769 of file opencv_json.hpp.


The documentation for this class was generated from the following file: