FreeFOAM The Cross-Platform CFD Toolkit
dictionaryEntry Class Reference

A keyword and a list of tokens is a 'dictionaryEntry'. More...

#include <OpenFOAM/dictionaryEntry.H>


Detailed Description

A keyword and a list of tokens is a 'dictionaryEntry'.

An dictionaryEntry can be read, written and printed, and the types and values of its tokens analysed. A dictionaryEntry is a high-level building block for data description. It is a front-end for the token parser. A list of entries can be used as a set of keyword syntax elements, for example.

Source files

Definition at line 58 of file dictionaryEntry.H.

+ Inheritance diagram for dictionaryEntry:
+ Collaboration diagram for dictionaryEntry:

List of all members.

Public Member Functions

 dictionaryEntry (const dictionary &parentDict, Istream &)
 Construct from the parent dictionary and Istream.
 dictionaryEntry (const keyType &, const dictionary &parentDict, Istream &)
 Construct from the keyword, parent dictionary and a Istream.
 dictionaryEntry (const keyType &, const dictionary &parentDict, const dictionary &dict)
 Construct from the keyword, parent dictionary and a dictionary.
 dictionaryEntry (const dictionary &parentDict, const dictionaryEntry &)
 Construct as copy for the given parentDict.
autoPtr< entryclone (const dictionary &parentDict) const
 Construct on freestore as copy with reference to the.
const fileNamename () const
 Return the dictionary name.
fileNamename ()
 Return the dictionary name.
label startLineNumber () const
 Return line number of first token in dictionary.
label endLineNumber () const
 Return line number of last token in dictionary.
ITstreamstream () const
 This entry is not a primitive,.
bool isDict () const
 Return true because this entry is a dictionary.
const dictionarydict () const
 Return dictionary.
dictionarydict ()
 Return non-const access to dictionary.
void write (Ostream &) const
 Write.
InfoProxy< dictionaryEntryinfo () const
 Return info proxy.
- Public Member Functions inherited from entry
 entry (const keyType &)
 Construct from keyword.
 entry (const entry &)
 Construct as copy.
virtual autoPtr< entryclone () const
 Construct on freestore as copy.
virtual ~entry ()
 Destructor.
const keyTypekeyword () const
 Return keyword.
keyTypekeyword ()
 Return non-const access to keyword.
virtual bool isStream () const
 Return true if this entry is a stream.
void operator= (const entry &)
bool operator== (const entry &) const
bool operator!= (const entry &) const
- Public Member Functions inherited from dictionary
 ClassName ("dictionary")
 dictionary ()
 Construct top-level dictionary null.
 dictionary (const fileName &name)
 Construct top-level empty dictionary with given name.
 dictionary (const fileName &name, const dictionary &parentDict, Istream &)
 Construct given the entry name, parent dictionary and Istream,.
 dictionary (Istream &)
 Construct top-level dictionary from Istream, reading entries.
 dictionary (const dictionary &parentDict, const dictionary &)
 Construct as copy given the parent dictionary.
 dictionary (const dictionary &)
 Construct top-level dictionary as copy.
 dictionary (const dictionary *)
 Construct top-level dictionary as copy from pointer to dictionary.
 dictionary (const dictionary &parentDict, const Xfer< dictionary > &)
 Construct by transferring parameter contents given parent dictionary.
 dictionary (const Xfer< dictionary > &)
 Construct top-level dictionary by transferring parameter contents.
autoPtr< dictionaryclone () const
 Construct and return clone.
 ~dictionary ()
const dictionaryparent () const
 Return the parent dictionary.
SHA1Digest digest () const
 Return the SHA1 digest of the dictionary contents.
bool found (const word &, bool recursive=false) const
 Search dictionary for given keyword.
const entrylookupEntryPtr (const word &, bool recursive, bool patternMatch) const
 Find and return an entry data stream pointer if present.
entrylookupEntryPtr (const word &, bool recursive, bool patternMatch)
 Find and return an entry data stream pointer for manipulation.
const entrylookupEntry (const word &, bool recursive, bool patternMatch) const
 Find and return an entry data stream if present otherwise error.
ITstreamlookup (const word &, bool recursive=false, bool patternMatch=true) const
 Find and return an entry data stream.
template<class T >
T lookupOrDefault (const word &, const T &, bool recursive=false, bool patternMatch=true) const
 Find and return a T,.
template<class T >
T lookupOrAddDefault (const word &, const T &, bool recursive=false, bool patternMatch=true)
 Find and return a T, if not found return the given.
template<class T >
bool readIfPresent (const word &, T &, bool recursive=false, bool patternMatch=true) const
 Find an entry if present, and assign to T.
bool isDict (const word &) const
 Check if entry is a sub-dictionary.
const dictionarysubDictPtr (const word &) const
 Find and return a sub-dictionary pointer if present.
const dictionarysubDict (const word &) const
 Find and return a sub-dictionary.
dictionarysubDict (const word &)
 Find and return a sub-dictionary for manipulation.
dictionary subOrEmptyDict (const word &) const
 Find and return a sub-dictionary as a copy, or.
wordList toc () const
 Return the table of contents.
List< keyTypekeys (bool patterns=false) const
 Return the list of available keys or patterns.
bool substituteKeyword (const word &keyword)
 Substitute the given keyword prepended by '$' with the.
bool add (entry *, bool mergeEntry=false)
 Add a new entry.
void add (const entry &, bool mergeEntry=false)
 Add an entry.
void add (const keyType &, const word &, bool overwrite=false)
 Add a word entry.
void add (const keyType &, const string &, bool overwrite=false)
 Add a string entry.
void add (const keyType &, const label, bool overwrite=false)
 Add a label entry.
void add (const keyType &, const scalar, bool overwrite=false)
 Add a scalar entry.
void add (const keyType &, const dictionary &, bool mergeEntry=false)
 Add a dictionary entry.
template<class T >
void add (const keyType &, const T &, bool overwrite=false)
 Add a T entry.
void set (entry *)
 Assign a new entry, overwrite any existing entry.
void set (const entry &)
 Assign a new entry, overwrite any existing entry.
void set (const keyType &, const dictionary &)
 Assign a dictionary entry, overwrite any existing entry.
template<class T >
void set (const keyType &, const T &)
 Assign a T entry, overwrite any existing entry.
bool remove (const word &)
 Remove an entry specified by keyword.
bool changeKeyword (const keyType &oldKeyword, const keyType &newKeyword, bool forceOverwrite=false)
 Change the keyword for an entry,.
bool merge (const dictionary &)
 Merge entries from the given dictionary.
void clear ()
 Clear the dictionary.
void transfer (dictionary &)
 Transfer the contents of the argument and annul the argument.
Xfer< dictionaryxfer ()
 Transfer contents to the Xfer container.
bool read (Istream &)
 Read dictionary from Istream.
void write (Ostream &, bool subDict=true) const
ITstreamoperator[] (const word &) const
 Find and return entry.
void operator= (const dictionary &)
void operator+= (const dictionary &)
 Include entries from the given dictionary.
void operator|= (const dictionary &)
 Conditionally include entries from the given dictionary.
void operator<<= (const dictionary &)
 Unconditionally include entries from the given dictionary.
- Public Member Functions inherited from dictionaryName
 dictionaryName ()
 Construct dictionaryName null.
 dictionaryName (const fileName &name)
 Construct dictionaryName as copy of the given fileName.
- Public Member Functions inherited from IDLList< entry >
 IDLList ()
 Null construct.
 IDLList (const entry &a)
 Construct given initial T.
 IDLList (Istream &is, const INew &inewt)
 Construct from Istream using given Istream constructor class.
 IDLList (Istream &is)
 Construct from Istream.
 IDLList (const IDLList< entry > &idll, const CloneArg &cloneArg)
 Copy constructor with additional argument for clone.
- Public Member Functions inherited from ILList< DLListBase, entry >
 ILList ()
 Null construct.
 ILList (entry *a)
 Construct given initial T.
 ILList (Istream &)
 Construct from Istream.
 ILList (const ILList< DLListBase, entry > &)
 Construct as copy.
 ILList (const ILList< DLListBase, entry > &lst, const CloneArg &cloneArg)
 Copy constructor with additional argument for clone.
 ILList (Istream &, const INew &)
 Construct from Istream using given Istream constructor class.
 ~ILList ()
bool eraseHead ()
 Remove the head element specified from the list and delete it.
bool erase (entry *p)
 Remove the specified element from the list and delete it.
void transfer (ILList< DLListBase, entry > &)
 Transfer the contents of the argument into this List.
void operator= (const ILList< DLListBase, entry > &)
- Public Member Functions inherited from UILList< DLListBase, entry >
 UILList ()
 Null construct.
 UILList (entry *a)
 Construct given initial T.
 UILList (const UILList< DLListBase, entry > &)
 Construct as copy.
entryfirst ()
 Return the first entry.
const entryfirst () const
 Return the first entry.
entrylast ()
 Return the last entry.
const entrylast () const
 Return the last entry.
entryremoveHead ()
 Remove and return head.
entryremove (entry *p)
 Remove and return element.
entryremove (iterator &it)
 Remove and return specified by iterator.
void operator= (const UILList< DLListBase, entry > &)
bool operator== (const UILList< DLListBase, entry > &) const
 Equality operation on ULists of the same type.
bool operator!= (const UILList< DLListBase, entry > &) const
 The opposite of the equality operation. Takes linear time.
- Public Member Functions inherited from DLListBase
 DLListBase ()
 Null construct.
 DLListBase (link *)
 Construct given initial entry.
 ~DLListBase ()
label size () const
 Return number of elements in list.
bool empty () const
 Return true if the list is empty.
void insert (link *)
 Add at head of list.
void append (link *)
 Add at tail of list.
bool swapUp (link *)
 Swap this element with the one above unless it is at the top.
bool swapDown (link *)
 Swap this element with the one below unless it is at the bottom.
linkremove (link *)
 Remove and return element.
linkreplace (link *oldLink, link *newLink)
 Replace oldLink with newLink and return element.
linkreplace (iterator &oldIter, link *newLink)
 Replace oldIter with newLink and return element.
void transfer (DLListBase &)
 Transfer the contents of the argument into this List.
iterator begin ()
const iteratorend ()
const_iterator cbegin () const
const const_iteratorcend () const
const_iterator begin () const
const const_iteratorend () const

Friends

Ostreamoperator<< (Ostream &, const dictionaryEntry &)

Additional Inherited Members

- Static Public Member Functions inherited from entry
static bool New (dictionary &parentDict, Istream &)
 Construct from Istream and insert into dictionary.
static autoPtr< entryNew (Istream &is)
 Construct on freestore from Istream and return.
- Static Public Member Functions inherited from dictionary
static autoPtr< dictionaryNew (Istream &)
 Construct top-level dictionary on freestore from Istream.
- Static Public Attributes inherited from dictionary
static const dictionary null
 Null dictionary.

Constructor & Destructor Documentation

dictionaryEntry ( const dictionary parentDict,
Istream is 
)

Construct from the parent dictionary and Istream.

Definition at line 36 of file dictionaryEntryIO.C.

References IOstream::fatalCheck().

dictionaryEntry ( const keyType key,
const dictionary parentDict,
Istream is 
)

Construct from the keyword, parent dictionary and a Istream.

Definition at line 53 of file dictionaryEntryIO.C.

References IOstream::fatalCheck().

dictionaryEntry ( const keyType key,
const dictionary parentDict,
const dictionary dict 
)

Construct from the keyword, parent dictionary and a dictionary.

Definition at line 31 of file dictionaryEntry.C.

dictionaryEntry ( const dictionary parentDict,
const dictionaryEntry dictEnt 
)

Construct as copy for the given parentDict.

Definition at line 43 of file dictionaryEntry.C.


Member Function Documentation

autoPtr<entry> clone ( const dictionary parentDict) const
inlinevirtual

Construct on freestore as copy with reference to the.

dictionary the copy belongs to

Implements entry.

Definition at line 101 of file dictionaryEntry.H.

const fileName& name ( ) const
inlinevirtual

Return the dictionary name.

Implements entry.

Definition at line 110 of file dictionaryEntry.H.

Referenced by dictionaryEntry::name().

fileName& name ( )
inlinevirtual

Return the dictionary name.

Implements entry.

Definition at line 116 of file dictionaryEntry.H.

References dictionaryEntry::name().

Foam::label startLineNumber ( ) const

Return line number of first token in dictionary.

Reimplemented from dictionary.

Definition at line 55 of file dictionaryEntry.C.

References UILList< DLListBase, entry >::first(), DLListBase::size(), and entry::startLineNumber().

Foam::label endLineNumber ( ) const

Return line number of last token in dictionary.

Reimplemented from dictionary.

Definition at line 67 of file dictionaryEntry.C.

Foam::ITstream & stream ( ) const
virtual

This entry is not a primitive,.

calling this function generates a FatalError

Implements entry.

Definition at line 80 of file dictionaryEntry.C.

References Foam::abort(), Foam::FatalIOError, and FatalIOErrorIn.

bool isDict ( ) const
inlinevirtual

Return true because this entry is a dictionary.

Reimplemented from entry.

Definition at line 132 of file dictionaryEntry.H.

const Foam::dictionary & dict ( ) const
virtual

Return dictionary.

Implements entry.

Definition at line 90 of file dictionaryEntry.C.

Foam::dictionary & dict ( )
virtual

Return non-const access to dictionary.

Implements entry.

Definition at line 96 of file dictionaryEntry.C.

void write ( Ostream ) const
virtual

Write.

Implements entry.

Definition at line 72 of file dictionaryEntryIO.C.

References Ostream::indent(), entry::keyword(), and Ostream::write().

InfoProxy<dictionaryEntry> info ( ) const
inline

Return info proxy.

Used to print token information to a stream

Definition at line 148 of file dictionaryEntry.H.


Friends And Related Function Documentation

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

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