dictionary::Searcher< Const > Class Template Reference

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

Public Types

typedef std::conditional< Const, const dictionary, dictionary >::type dict_type
 The const/non-const type for the context and sub-dictionaries. More...
 
typedef std::conditional< Const, const entry, entry >::type value_type
 The const/non-const type for entries. More...
 
typedef dict_typedict_pointer
 A pointer to a const/non-const dictionary. More...
 
typedef dict_typedict_reference
 A reference to a const/non-const dictionary. More...
 
typedef value_typepointer
 A pointer to a const/non-const entry. More...
 
typedef value_typereference
 A reference to a const/non-const entry. More...
 

Public Member Functions

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

Public Attributes

friend dictionary
 

Protected Member Functions

 Searcher (dict_pointer dict)
 Construct for the given dictionary context. More...
 
void set (pointer eptr)
 Assign the entry. More...
 

Protected Attributes

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

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 140 of file dictionary.H.

Member Typedef Documentation

◆ dict_type

typedef std::conditional<Const, const dictionary, dictionary>::type dict_type

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

Definition at line 147 of file dictionary.H.

◆ value_type

typedef std::conditional<Const, const entry, entry>::type value_type

The const/non-const type for entries.

Definition at line 151 of file dictionary.H.

◆ dict_pointer

A pointer to a const/non-const dictionary.

Definition at line 154 of file dictionary.H.

◆ dict_reference

A reference to a const/non-const dictionary.

Definition at line 157 of file dictionary.H.

◆ pointer

typedef value_type* pointer

A pointer to a const/non-const entry.

Definition at line 160 of file dictionary.H.

◆ reference

A reference to a const/non-const entry.

Definition at line 163 of file dictionary.H.

Constructor & Destructor Documentation

◆ Searcher() [1/2]

Searcher ( dict_pointer  dict)
inlineprotected

Construct for the given dictionary context.

Allow implicit conversion

Definition at line 177 of file dictionary.H.

◆ Searcher() [2/2]

Searcher ( )
inline

Default construct.

Definition at line 193 of file dictionary.H.

Member Function Documentation

◆ set()

void set ( pointer  eptr)
inlineprotected

Assign the entry.

Definition at line 184 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

Referenced by dictionary::csearch().

Here is the caller graph for this function:

◆ good()

◆ found()

bool found ( ) const
inlinenoexcept

True if entry was found.

Definition at line 207 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

◆ context()

dict_reference context ( ) const
inline

The containing dictionary context.

Definition at line 213 of file dictionary.H.

References dictionary::Searcher< Const >::dict_.

◆ ptr()

pointer ptr ( ) const
inlinenoexcept

A pointer to the entry (nullptr if not found)

Definition at line 219 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

Referenced by dictionary::getCheckOrAdd(), dictionary::getCheckOrDefault(), dictionary::getOrAdd(), dictionary::getOrDefault(), dictionary::getOrDefaultCompat(), dictionary::readCheck(), dictionary::readCompat(), and dictionary::readEntry().

Here is the caller graph for this function:

◆ ref()

reference ref ( ) const
inline

A reference to the entry (Error if not found)

Definition at line 225 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

Referenced by dictionary::lookupEntry(), and dictionary::lookupEntryCompat().

Here is the caller graph for this function:

◆ isDict()

bool isDict ( ) const
inlinenoexcept

True if found entry is a dictionary.

Definition at line 231 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

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

Here is the caller graph for this function:

◆ dictPtr()

dict_pointer dictPtr ( ) const
inlinenoexcept

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

Definition at line 237 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

Referenced by dictionary::subDictOrAdd().

Here is the caller graph for this function:

◆ dict()

dict_reference dict ( ) const
inline

Reference the found entry as a dictionary.

(Error if not found, or not a dictionary).

Definition at line 244 of file dictionary.H.

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

Here is the caller graph for this function:

◆ operator const Searcher<!Const > &()

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

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

Definition at line 250 of file dictionary.H.

◆ operator->()

pointer operator-> ( ) const
inlinenoexcept

A pointer to the entry (nullptr if not found)

Definition at line 256 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

◆ operator*()

reference operator* ( ) const
inline

A reference to the entry (Error if not found)

Definition at line 262 of file dictionary.H.

References dictionary::Searcher< Const >::eptr_.

Member Data Documentation

◆ dictionary

friend dictionary

Definition at line 143 of file dictionary.H.

◆ dict_

dict_pointer dict_
protected

The dictionary context for the entry.

Definition at line 169 of file dictionary.H.

Referenced by dictionary::Searcher< Const >::context().

◆ eptr_


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