FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

dictionaryEntryIO.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025     DictionaryEntry constructor from Istream and Ostream output operator.
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include <OpenFOAM/keyType.H>
00030 #include "dictionaryEntry.H"
00031 #include <OpenFOAM/IOstreams.H>
00032 
00033 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00034 
00035 Foam::dictionaryEntry::dictionaryEntry
00036 (
00037     const dictionary& parentDict,
00038     Istream& is
00039 )
00040 :
00041     entry(keyType(is)),
00042     dictionary(parentDict, is)
00043 {
00044     is.fatalCheck
00045     (
00046         "dictionaryEntry::dictionaryEntry"
00047         "(const dictionary& parentDict, Istream&)"
00048     );
00049 }
00050 
00051 
00052 Foam::dictionaryEntry::dictionaryEntry
00053 (
00054     const keyType& key,
00055     const dictionary& parentDict,
00056     Istream& is
00057 )
00058 :
00059     entry(key),
00060     dictionary(key, parentDict, is)
00061 {
00062     is.fatalCheck
00063     (
00064         "dictionaryEntry::dictionaryEntry"
00065         "(const keyType&, const dictionary& parentDict, Istream&)"
00066     );
00067 }
00068 
00069 
00070 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00071 
00072 void Foam::dictionaryEntry::write(Ostream& os) const
00073 {
00074     // write keyword with indent but without trailing spaces
00075     os.indent();
00076     os.write(keyword());
00077     dictionary::write(os);
00078 }
00079 
00080 
00081 // * * * * * * * * * * * * * Ostream operator  * * * * * * * * * * * * * * * //
00082 
00083 Foam::Ostream& Foam::operator<<(Ostream& os, const dictionaryEntry& de)
00084 {
00085     de.write(os);
00086     return os;
00087 }
00088 
00089 
00090 #if defined (__GNUC__)
00091 template<>
00092 #endif
00093 Foam::Ostream& Foam::operator<<
00094 (
00095     Ostream& os,
00096     const InfoProxy<dictionaryEntry>& ip
00097 )
00098 {
00099     const dictionaryEntry& e = ip.t_;
00100 
00101     os  << "    dictionaryEntry '" << e.keyword() << "'" << endl;
00102 
00103     return os;
00104 }
00105 
00106 
00107 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines