| 170 | // * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * // |
| 171 | |
| 172 | void Foam::dictionary::write(Ostream& os, bool subDict) const |
| 173 | { |
| 174 | if (subDict) |
| 175 | { |
| 176 | os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; |
| 177 | } |
| 178 | |
| 179 | forAllConstIter(IDLList<entry>, *this, iter) |
| 180 | { |
| 181 | const entry& e = *iter; |
| 182 | |
| 183 | // Write entry |
| 184 | os << e; |
| 185 | |
| 186 | // Add extra new line between entries for "top-level" dictionaries |
| 187 | if (!subDict && parent() == dictionary::null && e != *last()) |
| 188 | { |
| 189 | os << nl; |
| 190 | } |
| 191 | |
| 192 | // Check stream before going to next entry. |
| 193 | if (!os.good()) |
| 194 | { |
| 195 | WarningInFunction |
| 196 | << "Can't write entry " << iter().keyword() |
| 197 | << " for dictionary " << name() |
| 198 | << endl; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | if (subDict) |
| 203 | { |
| 204 | os << decrIndent << indent << token::END_BLOCK << endl; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | |
| 209 | Foam::Ostream& Foam::operator<<(Ostream& os, const dictionary& dict) |
no test coverage detected