| 78 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
| 79 | |
| 80 | bool Foam::dictionary::read(Istream& is, const bool keepHeader) |
| 81 | { |
| 82 | // Check for empty dictionary |
| 83 | if (is.eof()) |
| 84 | { |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | if (!is.good()) |
| 89 | { |
| 90 | FatalIOErrorInFunction(is) |
| 91 | << "Istream not OK for reading dictionary " |
| 92 | << exit(FatalIOError); |
| 93 | |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | token currToken(is); |
| 98 | if (currToken != token::BEGIN_BLOCK) |
| 99 | { |
| 100 | is.putBack(currToken); |
| 101 | } |
| 102 | |
| 103 | while (!is.eof() && entry::New(*this, is)) |
| 104 | {} |
| 105 | |
| 106 | // normally remove the FoamFile header entry if it exists |
| 107 | if (!keepHeader) |
| 108 | { |
| 109 | remove("FoamFile"); |
| 110 | } |
| 111 | |
| 112 | if (is.bad()) |
| 113 | { |
| 114 | InfoInFunction |
| 115 | << "Istream not OK after reading dictionary " << name() |
| 116 | << endl; |
| 117 | |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | return true; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | bool Foam::dictionary::read(Istream& is) |