![]() |
OGS
|
|
Read-only view of a child produced by getAllChildren().
A thin move-only wrapper around the child's own ConfigTree subtree. getAllChildren() marks every child tag as consumed in the parent, so the parent does not additionally warn about the tags themselves; instead each child polices itself.
A child counts as read once it is dereferenced via operator->() / operator*(). A child that is never dereferenced warns on destruction as unread whatever its content - this catches a whole child that was silently ignored, e.g. one whose tag name was mistyped. Once dereferenced, the child behaves exactly like a ConfigTree obtained from getConfigSubtree(): it owns its subtree and runs the normal checkAndInvalidate() on destruction, so any of its sub-children / attributes / immediate data that were not read produce the usual unread-element warnings.
Like a getConfigSubtree() result, a Child keeps the underlying tree alive through its shared top-level pointer, so it may safely outlive the ConfigTree it came from.
Definition at line 57 of file ConfigTree-impl.h.
#include <ConfigTree-impl.h>
Public Member Functions | |
| Child (Child &&other) noexcept | |
| Child (Child const &)=delete | |
| ConfigTree const * | operator-> () const |
| ConfigTree const & | operator* () const |
| ~Child () | |
Private Member Functions | |
| Child (ConfigTree &&ct) | |
Private Attributes | |
| ConfigTree | ct_ |
| bool | accessed_ = false |
Friends | |
| class | ConfigTree |
|
inlinenoexcept |
|
inline |
A child returned by getAllChildren() but never dereferenced counts as unread and warns on destruction, whatever its content.
This is what makes getAllChildren() catch a whole child that was silently ignored - e.g. one whose tag name was mistyped - which the subtree's own content check cannot: a content-less child has nothing to report. A dereferenced child instead defers to that content check (its unread sub-children / attributes / immediate data warn as usual), so the warning here is suppressed and not duplicated.
Definition at line 87 of file ConfigTree-impl.h.
|
inlineexplicitprivate |
Definition at line 104 of file ConfigTree-impl.h.
References ConfigTree, and ct_.
|
inline |
Definition at line 71 of file ConfigTree-impl.h.
References accessed_, ConfigTree, and ct_.
|
inline |
Definition at line 66 of file ConfigTree-impl.h.
References accessed_, ConfigTree, and ct_.
|
friend |
Definition at line 103 of file ConfigTree-impl.h.
References ConfigTree.
Referenced by Child(), ConfigTree, operator*(), and operator->().
|
mutableprivate |
Whether operator->() / operator*() was ever called. Mutable because both are const accessors; a Child is logically const while being read.
Definition at line 109 of file ConfigTree-impl.h.
Referenced by ~Child(), operator*(), and operator->().
|
private |
Definition at line 106 of file ConfigTree-impl.h.
Referenced by Child(), ~Child(), operator*(), and operator->().