namedDictionary Class Reference

A tuple of keyType and dictionary, which can be used when reading named or unnamed dictionary entries or simply a name. More...

Inheritance diagram for namedDictionary:
Collaboration diagram for namedDictionary:

Public Member Functions

 namedDictionary ()=default
 Default construct. More...
 
 namedDictionary (Istream &is)
 Construct from Istream. More...
 
 ~namedDictionary ()=default
 Destructor. More...
 
void clear ()
 Clear keyword and dictionary. More...
 
bool empty () const noexcept
 Empty if both keyword and dictionary are empty. More...
 
const keyTypekeyword () const noexcept
 Return keyword. More...
 
keyTypekeyword () noexcept
 Return non-const access to keyword. More...
 
const dictionarydict () const noexcept
 Read-access to the dictionay. More...
 
dictionarydict () noexcept
 Write access to the dictionay. More...
 
- Public Member Functions inherited from Tuple2< keyType, dictionary >
 Tuple2 ()=default
 Default construct. More...
 
 Tuple2 (const Tuple2 &)=default
 Copy construct. More...
 
 Tuple2 (Tuple2 &&)=default
 Move construct. More...
 
 Tuple2 (const keyType &f, const dictionary &s)
 Copy construct from components. More...
 
 Tuple2 (keyType &&f, dictionary &&s)
 Move construct from components. More...
 
 Tuple2 (const std::pair< keyType, dictionary > &tup)
 Copy construct from std::pair. More...
 
 Tuple2 (std::pair< keyType, dictionary > &&tup)
 Move construct from std::pair. More...
 
 Tuple2 (Istream &is)
 Construct from Istream. More...
 
Tuple2operator= (const Tuple2 &)=default
 Copy assignment. More...
 
Tuple2operator= (Tuple2 &&)=default
 Move assignment. More...
 
constexpr const keyTypefirst () const noexcept
 Access the first element. More...
 
constexpr keyTypefirst () noexcept
 Access the first element. More...
 
constexpr const dictionarysecond () const noexcept
 Access the second element. More...
 
constexpr dictionarysecond () noexcept
 Access the second element. More...
 
bool operator== (const Tuple2 &other) const
 Compare for equality. More...
 
bool operator< (const Tuple2 &other) const
 Compare lexicographically. More...
 
bool operator!= (const Tuple2 &other) const
 
bool operator<= (const Tuple2 &other) const
 
bool operator> (const Tuple2 &other) const
 
bool operator>= (const Tuple2 &other) const
 

Friends

Istreamoperator>> (Istream &, namedDictionary &)
 
Ostreamoperator<< (Ostream &, const namedDictionary &)
 

Additional Inherited Members

- Public Types inherited from Tuple2< keyType, dictionary >
typedef keyType first_type
 Type of member first, the first template parameter (T1) More...
 
typedef dictionary second_type
 Type of member second, the second template parameter (T2) More...
 

Detailed Description

A tuple of keyType and dictionary, which can be used when reading named or unnamed dictionary entries or simply a name.

For example,

fields
(
    U
    T { relax  false; }
);

The namedDictionary can also be used in situations where an individual dictionary entry should be read. The keyword() and dict() methods correspond to Foam::entry naming conventions.

actions
(
    testing { action new; ... }   // An action with a name
    { action subset;  }           // Unnamed action
);

Normal dictionary reading would fail for this type of input since the leading 'testing' keyword would cause the entire content to be considered a single dictionary.

Note
No distinction currently made between a missing and an empty dictionary.
Source files

Definition at line 81 of file namedDictionary.H.

Constructor & Destructor Documentation

◆ namedDictionary() [1/2]

namedDictionary ( )
default

Default construct.

◆ namedDictionary() [2/2]

namedDictionary ( Istream is)
explicit

Construct from Istream.

Definition at line 26 of file namedDictionary.C.

◆ ~namedDictionary()

~namedDictionary ( )
default

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Clear keyword and dictionary.

Definition at line 34 of file namedDictionary.C.

Referenced by Foam::operator>>().

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
noexcept

Empty if both keyword and dictionary are empty.

Definition at line 41 of file namedDictionary.C.

◆ keyword() [1/2]

const keyType& keyword ( ) const
inlinenoexcept

Return keyword.

Definition at line 126 of file namedDictionary.H.

References Tuple2< keyType, dictionary >::first().

Referenced by Foam::operator<<(), and Foam::operator>>().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyword() [2/2]

keyType& keyword ( )
inlinenoexcept

Return non-const access to keyword.

Definition at line 131 of file namedDictionary.H.

References Tuple2< keyType, dictionary >::first().

Here is the call graph for this function:

◆ dict() [1/2]

const dictionary& dict ( ) const
inlinenoexcept

Read-access to the dictionay.

Definition at line 136 of file namedDictionary.H.

References Tuple2< keyType, dictionary >::second().

Referenced by Foam::operator<<(), and Foam::operator>>().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dict() [2/2]

dictionary& dict ( )
inlinenoexcept

Write access to the dictionay.

Definition at line 141 of file namedDictionary.H.

References Tuple2< keyType, dictionary >::second().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
namedDictionary  
)
friend

◆ operator<<

Ostream& operator<< ( Ostream ,
const namedDictionary  
)
friend

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