39#ifndef Foam_ISstream_H
40#define Foam_ISstream_H
76 virtual bool readCompoundToken(
token& tok,
const word& compoundType);
79 void operator=(
const ISstream&) =
delete;
91 const string& streamName,
99 const string& streamName,
111 const string& streamName,
131 virtual const fileName&
name()
const override {
return name_; }
142 virtual const std::istream&
stdStream()
const {
return is_; }
145 virtual std::istream&
stdStream() {
return is_; }
151 virtual std::ios_base::fmtflags
flags()
const override
157 virtual std::ios_base::fmtflags
flags
159 std::ios_base::fmtflags
f
187 const bool stripComments =
true
207 inline std::streamsize
getLine(std::nullptr_t,
char delim =
'\n');
250 virtual Istream&
read(
char* data, std::streamsize count)
override;
258 std::streamsize count
268 virtual void rewind()
override;
Representation of a major/minor version number.
A simple container for options an IOstream can normally have.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
streamFormat
Data format (ascii | binary | coherent).
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
@ UNCOMPRESSED
compression = false
void setState(std::ios_base::iostate state) noexcept
Set stream state.
virtual const fileName & name() const override
The name of the input serial stream. (eg, the name of the Fstream file name).
virtual std::ios_base::fmtflags flags() const override
Return current stream flags.
ISstream & get(char &c)
Raw, low-level get character function.
virtual fileName & name()
The name of the input serial stream, for modification.
virtual void rewind() override
Rewind the stream so that it may be read again.
virtual std::ios_base::fmtflags flags(std::ios_base::fmtflags f) override
Set stream flags, return old stream flags.
virtual std::istream & stdStream()
Access to underlying std::istream.
ISstream & putback(const char c)
Raw, low-level putback character function.
virtual bool endRawRead() override
End of low-level raw binary read.
virtual void print(Ostream &os) const override
Print stream description to Ostream.
ISstream(std::istream &is, const string &streamName, IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
Construct wrapper around std::istream, set stream status.
virtual ~ISstream()=default
Destructor.
int peek()
Raw, low-level peek function.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
void syncState()
Set stream state to match that of the std::istream.
virtual bool beginRawRead() override
Start of low-level raw binary read.
**return False if stream exhausted before finding the comment end *bool seekCommentEnd_Cstyle()
Discard until end of C-style comment '.
ISstream(std::istream &is, const string &streamName, IOstreamOption streamOpt=IOstreamOption())
Construct wrapper around std::istream, set stream status.
virtual Istream & read(token &t) override
Return next token from stream.
bool continueReadUntilRightBrace(std::string &str, const bool stripComments=true)
Raw, low-level get into a string. Continues reading after an initial left-brace until it finds the ma...
virtual Istream & readRaw(char *data, std::streamsize count) override
Low-level raw binary read (without possible block delimiters). Reading into a null pointer behaves li...
ISstream(std::istream &is, const string &streamName, IOstreamOption::streamFormat fmt, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
Construct wrapper around std::istream, set stream status.
virtual const std::istream & stdStream() const
Const access to underlying std::istream.
Istream(const Istream &)=default
Copy construct.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A class for handling file names.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)