introvoyz042's picture
Migrated from GitHub
5a600cf verified
Raw History Blame Contribute Delete
6.03 kB
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::OTstream
Description
Output token stream.
SourceFiles
OTstream.C
See also
Foam::ITstream
\*---------------------------------------------------------------------------*/
#ifndef OTstream_H
#define OTstream_H
#include "Ostream.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class OTstream Declaration
\*---------------------------------------------------------------------------*/
class OTstream
:
public Ostream,
public DynamicList<token>
{
// Private Data
//- Name of OTstream
fileName name_;
public:
// Constructors
//- Construct given name write format and IO version
OTstream
(
const string& name,
const streamFormat format = ASCII,
const versionNumber version = currentVersion,
const bool global = false
);
//- Destructor
virtual ~OTstream();
// Member Functions
// Inquiry
//- Return the name of the stream
virtual const fileName& name() const
{
return name_;
}
//- Return non-const access to the name of the stream
virtual fileName& name()
{
return name_;
}
//- Return flags of output stream
ios_base::fmtflags flags() const
{
return ios_base::fmtflags(0);
}
// Write functions
//- Write token
virtual Ostream& write(const token&);
//- No need to write the compound token tag for an OTstream
virtual Ostream& writeCompoundTag(const word& typeName)
{
return *this;
}
//- Write character
virtual Ostream& write(const char);
//- Parse raw C-string and append tokens
virtual Ostream& write(const char*);
//- Write word
virtual Ostream& write(const word&);
//- Write string
virtual Ostream& write(const string&);
//- Write keyType
virtual Ostream& write(const keyType&);
//- Write verbatimString
virtual Ostream& write(const verbatimString&);
//- Write std::string surrounded by quotes.
// Optional write without quotes.
virtual Ostream& writeQuoted
(
const std::string&,
const bool quoted=true
);
//- Write int32_t
virtual Ostream& write(const int32_t);
//- Write int64_t
virtual Ostream& write(const int64_t);
//- Write uint32_t
virtual Ostream& write(const uint32_t);
//- Write uint64_t
virtual Ostream& write(const uint64_t);
//- Write floatScalar
virtual Ostream& write(const floatScalar);
//- Write doubleScalar
virtual Ostream& write(const doubleScalar);
//- Write longDoubleScalar
virtual Ostream& write(const longDoubleScalar);
//- Write binary block
virtual Ostream& write(const char*, std::streamsize);
//- Add indentation characters
virtual void indent()
{}
// Stream state functions
//- Flush stream
virtual void flush()
{}
//- Add newline and flush stream
virtual void endl()
{}
//- Get width of output field
virtual int width() const
{
return 0;
}
//- Set width of output field (and return old width)
virtual int width(const int)
{
return 0;
}
//- Get precision of output field
virtual int precision() const
{
return 0;
}
//- Set precision of output field (and return old precision)
virtual int precision(const int)
{
return 0;
}
// Edit
//- Set flags of stream
ios_base::fmtflags flags(const ios_base::fmtflags)
{
return ios_base::fmtflags(0);
}
// Print
//- Print description of IOstream to Ostream
void print(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //