diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index f1196852bf163e4d3d261ca4f86db034fcea6c01..cb3b03b00fe21baf167226a981874cc849242da0 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -477,7 +477,8 @@ public: // Write - void write(Ostream&, bool subDict=true) const; + //- Write dictionary, normally with sub-dictionary formatting + void write(Ostream&, const bool subDict=true) const; // Member Operators diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H index 050840c5e4c97fcc6b394cac1b60ce2bd07af60c..7713e503af342442a8290eaa5cf9f4f36339ceb1 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,7 +146,7 @@ public: //- Return non-const access to dictionary dictionary& dict(); - // Write + //- Write void write(Ostream&) const; //- Return info proxy. diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C index b090188a0dee10366f0c5faafcb06d35e2334932..2477f0450b5893d490c486fb5252e9e2c93f3986 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H index 6edf2c621c583a4ef1ffaa08c006b68732a08984..01f08cea5b313662dcca3f0d5c07bc77e4922ef8 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -168,6 +168,9 @@ public: //- Write void write(Ostream&) const; + //- Write, optionally with contents only (no keyword, etc) + void write(Ostream&, const bool contentsOnly) const; + //- Return info proxy. // Used to print token information to a stream InfoProxy<primitiveEntry> info() const diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C index fa9a50efdb15b6dc603d17abfdb4295f5e6a51ac..33c3dc8ff7ced441d8612b56a5fc8a0d3255d19e 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C @@ -210,31 +210,43 @@ Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::primitiveEntry::write(Ostream& os) const +void Foam::primitiveEntry::write(Ostream& os, const bool contentsOnly) const { - os.writeKeyword(keyword()); + if (!contentsOnly) + { + os.writeKeyword(keyword()); + } for (label i=0; i<size(); ++i) { const token& t = operator[](i); if (t.type() == token::VERBATIMSTRING) { - os << token::HASH << token::BEGIN_BLOCK; + os << token::HASH << token::BEGIN_BLOCK; os.writeQuoted(t.stringToken(), false); - os << token::HASH << token::END_BLOCK; + os << token::HASH << token::END_BLOCK; } else { - os << t; + os << t; } if (i < size()-1) { - os << token::SPACE; + os << token::SPACE; } } - os << token::END_STATEMENT << endl; + if (!contentsOnly) + { + os << token::END_STATEMENT << endl; + } +} + + +void Foam::primitiveEntry::write(Ostream& os) const +{ + this->write(os, false); } diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H index d9756a27056067dc224bd5a134800e2a316bd8e6..6d416dd6e814d800df3ec32c7a11ce2548e5e842 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H +++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H @@ -128,19 +128,15 @@ namespace stringOps string& inplaceTrimLeft(string&); //- Return string trimmed of trailing whitespace - // NOT IMPLEMENTED string trimRight(const string&); //- Trim trailing whitespace inplace - // NOT IMPLEMENTED string& inplaceTrimRight(string&); //- Return string trimmed of leading and trailing whitespace - // NOT IMPLEMENTED string trim(const string&); //- Trim leading and trailing whitespace inplace - // NOT IMPLEMENTED string& inplaceTrim(string&);