oeisstream¶
class oeisstream : public oeistream
This class represents oeisstream.
Implements an input stream that uses a string of data already in memory as the input source.
The following methods are publicly inherited from oeistream:
The following methods are publicly inherited from oestream:
Constructors¶
oeisstream()
oeisstream(const oeisstream &rhs)
oeisstream(const std::string &buffer)
oeisstream(char *buffer, oesize_t len, bool copy=true)
oeisstream(const char *buffer, oesize_t len, bool copy=true)
Creates a new oeisstream.
Passing any of the specified parameters
to the one of the non-default constructors is equivalent to
creating a new oeisstream with the default
constructor and then
calling the appropriate oeisstream.set
method
on that stream.
If the copy constructor is used, the newly created oeisstream will
read from the same data string as the stream being copied from. If
the ‘copy’ parameter was set to true
on the stream being copied from,
the new stream will create its own local copy to read from,
otherwise it will just point to the same place in memory as the
original stream. In addition, the newly constructed stream’s
reading pointer will be set to the same location as the one in the
stream being copied from.
Regardless of whether or not a local copy is made, the stream takes no responsibility for the management of the original input source’s memory.
operator=¶
oeisstream &operator=(const oeisstream &rhs)
Clears the current stream and sets the input source of this stream
to be the same as the one in the assigned stream. If the copy
parameter was set to true
on the assigned stream, the stream will
create its own local copy to read from, otherwise it will just
point to the same place in memory as the assigned stream. In
addition, the stream’s reading pointer will be set to the same
location as the one in the assigned stream.
clear¶
void clear()
Clears the association with input source associated with this
stream. If the copy parameter was set to false
when this stream was
assigned or constructed, no changes will be made to the original
data source.
getbuffer¶
bool getbuffer(std::string &buffer) const
Copies the entire contents of the input source into the specified string regardless of the current location of the reading pointer and returns whether or not this was successful.
reset¶
bool reset()
Resets the reading pointer to the beginning of the input stream and
returns whether or not this was successful. This is equivalent to
calling the oestream.rewind
method of
oestream.
set¶
bool set(const std::string &)
bool set(char *, oesize_t, bool)
bool set(const char *, oesize_t, bool)
Sets the input source of this stream based on the specified
parameters. The buffer parameter specifies the data string to be
used as the input source. If the char *
constructors are used, the
length of the input buffer must be specified as well as whether or
not a local copy of the buffer should be made and used as the input
source. If the std::string
method is used, a local copy of the
input string will be made and used as the input source.
Regardless of whether or not a local copy is made, the stream takes no responsibility for the management of the original input source’s memory.