Loading...
Searching...
No Matches
dictionary::Searcher< Const > Class Template Reference

Generic const/non-const dictionary entry searcher. More...

#include <dictionary.H>

Inheritance diagram for dictionary::Searcher< Const >:

Public Types

using dict_type
 The const/non-const type for the context and sub-dictionaries.
using value_type
 The const/non-const type for entries.
using dict_pointer = dict_type*
 A pointer to a const/non-const dictionary.
using dict_reference = dict_type&
 A reference to a const/non-const dictionary.
using pointer = value_type*
 A pointer to a const/non-const entry.
using reference = value_type&
 A reference to a const/non-const entry.

Public Member Functions

constexpr Searcher () noexcept
 Default construct.
bool good () const noexcept
 True if entry was found.
bool found () const noexcept
 True if entry was found.
dict_reference context () const
 The containing dictionary context.
pointer ptr () const noexcept
 A pointer to the entry (nullptr if not found).
reference ref () const
 A reference to the entry (Error if not found).
bool isDict () const noexcept
 True if found entry is a dictionary.
bool isStream () const noexcept
 True if found entry is a stream.
dict_pointer dictPtr () const noexcept
 Pointer to the found entry as a dictionary, nullptr otherwise.
ITstreamstreamPtr () const noexcept
 Pointer to the found entry as a stream, nullptr otherwise.
dict_reference dict () const
 Return the found entry as a dictionary. Error if not found, or not a dictionary.
ITstreamstream () const
 Return the found entry as a ITstream. Error if not found, or not a stream.
 operator const Searcher<!Const > & () const
 Permit an explicit cast to the other (const/non-const) searcher.
pointer operator-> () const noexcept
 A pointer to the entry (nullptr if not found).
reference operator* () const
 A reference to the entry (Error if not found).

Public Attributes

friend dictionary

Protected Member Functions

 Searcher (dict_pointer dict) noexcept
 Implicit construct for the given dictionary context.
void set (pointer eptr) noexcept
 Assign the entry.

Protected Attributes

dict_pointer dict_
 The dictionary context for the entry.
pointer eptr_
 The entry or nullptr.

Detailed Description

template<bool Const>
class Foam::dictionary::Searcher< Const >

Generic const/non-const dictionary entry searcher.

A searcher provides a uniform means of finding and returning an entry pointer as well as the dictionary context in which the entry was located.

Note that the constructors and set methods are protected such that only friends of the class can set things. This safeguards against inconsistencies in context/entry.

Definition at line 150 of file dictionary.H.

Member Typedef Documentation

◆ dict_type

template<bool Const>
using dict_type
Initial value:
std::conditional_t<Const, const dictionary, dictionary>

The const/non-const type for the context and sub-dictionaries.

Definition at line 158 of file dictionary.H.

◆ value_type

template<bool Const>
using value_type
Initial value:
std::conditional_t<Const, const entry, entry>

The const/non-const type for entries.

Definition at line 164 of file dictionary.H.

◆ dict_pointer

template<bool Const>
using dict_pointer = dict_type*

A pointer to a const/non-const dictionary.

Definition at line 170 of file dictionary.H.

◆ dict_reference

template<bool Const>
using dict_reference = dict_type&

A reference to a const/non-const dictionary.

Definition at line 175 of file dictionary.H.

◆ pointer

template<bool Const>
using pointer = value_type*

A pointer to a const/non-const entry.

Definition at line 180 of file dictionary.H.

◆ reference

template<bool Const>
using reference = value_type&

A reference to a const/non-const entry.

Definition at line 185 of file dictionary.H.

Constructor & Destructor Documentation

◆ Searcher() [1/2]

template<bool Const>
Searcher ( dict_pointer dict)
inlineprotectednoexcept

Implicit construct for the given dictionary context.

Definition at line 204 of file dictionary.H.

◆ Searcher() [2/2]

template<bool Const>
Searcher ( )
inlineconstexprnoexcept

Default construct.

Definition at line 224 of file dictionary.H.

Member Function Documentation

◆ set()

template<bool Const>
void set ( pointer eptr)
inlineprotectednoexcept

Assign the entry.

Definition at line 213 of file dictionary.H.

Referenced by dictionary::csearch().

Here is the caller graph for this function:

◆ good()

template<bool Const>
bool good ( ) const
inlinenoexcept

True if entry was found.

Definition at line 234 of file dictionary.H.

Referenced by dictionary::csearchCompat(), dictionary::optionalSubDict(), dictionary::subDict(), dictionary::subDict(), dictionary::subDictOrAdd(), dictionary::subOrEmptyDict(), and dictionary::substituteKeyword().

Here is the caller graph for this function:

◆ found()

template<bool Const>
bool found ( ) const
inlinenoexcept

True if entry was found.

Deprecated
(2019-01) - prefer good() method

Definition at line 241 of file dictionary.H.

◆ context()

template<bool Const>
dict_reference context ( ) const
inline

The containing dictionary context.

Definition at line 246 of file dictionary.H.

◆ ptr()

template<bool Const>
pointer ptr ( ) const
inlinenoexcept

A pointer to the entry (nullptr if not found).

Definition at line 251 of file dictionary.H.

◆ ref()

template<bool Const>
reference ref ( ) const
inline

A reference to the entry (Error if not found).

Definition at line 256 of file dictionary.H.

◆ isDict()

template<bool Const>
bool isDict ( ) const
inlinenoexcept

True if found entry is a dictionary.

Definition at line 261 of file dictionary.H.

◆ isStream()

template<bool Const>
bool isStream ( ) const
inlinenoexcept

True if found entry is a stream.

Definition at line 269 of file dictionary.H.

◆ dictPtr()

template<bool Const>
dict_pointer dictPtr ( ) const
inlinenoexcept

Pointer to the found entry as a dictionary, nullptr otherwise.

Definition at line 277 of file dictionary.H.

Referenced by dictionary::optionalSubDict(), dictionary::set(), dictionary::subDictOrAdd(), and dictionary::subOrEmptyDict().

Here is the caller graph for this function:

◆ streamPtr()

template<bool Const>
ITstream * streamPtr ( ) const
inlinenoexcept

Pointer to the found entry as a stream, nullptr otherwise.

Definition at line 285 of file dictionary.H.

◆ dict()

template<bool Const>
dict_reference dict ( ) const
inline

Return the found entry as a dictionary. Error if not found, or not a dictionary.

Definition at line 294 of file dictionary.H.

Referenced by dictionary::subDict(), dictionary::subDict(), and dictionary::substituteKeyword().

Here is the caller graph for this function:

◆ stream()

template<bool Const>
ITstream & stream ( ) const
inline

Return the found entry as a ITstream. Error if not found, or not a stream.

Definition at line 300 of file dictionary.H.

◆ operator const Searcher<!Const > &()

template<bool Const>
operator const Searcher<!Const > & ( ) const
inlineexplicit

Permit an explicit cast to the other (const/non-const) searcher.

Definition at line 305 of file dictionary.H.

◆ operator->()

template<bool Const>
pointer operator-> ( ) const
inlinenoexcept

A pointer to the entry (nullptr if not found).

Definition at line 313 of file dictionary.H.

◆ operator*()

template<bool Const>
reference operator* ( ) const
inline

A reference to the entry (Error if not found).

Definition at line 318 of file dictionary.H.

Member Data Documentation

◆ dictionary

template<bool Const>
friend dictionary

Definition at line 153 of file dictionary.H.

◆ dict_

template<bool Const>
dict_pointer dict_
protected

The dictionary context for the entry.

Definition at line 193 of file dictionary.H.

◆ eptr_

template<bool Const>
pointer eptr_
protected

The entry or nullptr.

Definition at line 198 of file dictionary.H.


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