Public Member Functions | List of all members
ustl::ofstream Class Reference

A string stream that writes to an fd. Implements cout and cerr. More...

Inheritance diagram for ustl::ofstream:
ustl::ostringstream ustl::ostream ustl::memlink ustl::ios_base ustl::cmemlink

Public Member Functions

 ofstream (void)
 Default constructor.
 
 ofstream (int ofd)
 Constructs a stream for writing to ofd.
 
 ofstream (const char *filename, openmode mode=out)
 Constructs a stream for writing to filename.
 
virtual ~ofstream (void) noexcept
 Default destructor.
 
void open (const char *filename, openmode mode=out)
 
void close (void)
 Flushes the buffer and closes the file.
 
bool is_open (void) const
 
iostate exceptions (iostate v)
 
void setstate (iostate v)
 
void clear (iostate v=goodbit)
 
off_t tellp (void) const
 
int fd (void) const
 
void stat (struct stat &rs) const
 
void set_nonblock (bool v=true)
 
int ioctl (const char *rname, int request, long argument=0)
 
int ioctl (const char *rname, int request, int argument)
 
int ioctl (const char *rname, int request, void *argument)
 
ofstreamseekp (off_t p, seekdir d=beg)
 Seeks to p based on d.
 
ofstreamflush (void)
 Flushes the buffer to the file.
 
virtual size_type overflow (size_type n=1) override
 Called when more buffer space (n bytes) is needed.
 
- Public Member Functions inherited from ustl::ostringstream
 ostringstream (const string &v="")
 Creates an output string stream, initializing the buffer with v.
 
 ostringstream (void *p, size_t n) noexcept
 Creates an output string stream linked to the given memory area.
 
void iwrite (uint8_t v)
 Writes a single character into the stream.
 
void iwrite (wchar_t v)
 Writes v into the stream as utf8.
 
void iwrite (int v)
 
void iwrite (unsigned int v)
 
void iwrite (long int v)
 
void iwrite (unsigned long int v)
 
void iwrite (float v)
 
void iwrite (double v)
 
void iwrite (bool v)
 Writes value v into the stream as text.
 
void iwrite (const char *s)
 
void iwrite (const string &v)
 
void iwrite (fmtflags f)
 Sets the flag f in the stream.
 
void iwrite (long long v)
 
void iwrite (unsigned long long v)
 
size_type max_size (void) const
 
ostringstreamput (char c)
 
int vformat (const char *fmt, va_list args)
 Equivalent to a vsprintf on the string.
 
int format (const char *fmt,...) __attribute__((__format__(__printf__
 Equivalent to a sprintf on the string.
 
int void set_base (uint16_t b)
 
void set_width (uint16_t w)
 
void set_decimal_separator (char)
 
void set_thousand_separator (char)
 
void set_precision (uint16_t v)
 
void link (void *p, size_type n) noexcept
 Links to string l as resizable.
 
void link (memlink &l)
 
const stringstr (void)
 
void str (const string &s)
 Copies s to the internal buffer.
 
ostringstreamwrite (const void *buffer, size_type size)
 Writes the contents of buffer of size into the stream.
 
ostringstreamwrite (const cmemlink &buf)
 
ostringstreamseekp (off_t p, seekdir d=beg)
 
ostringstreamflush (void)
 
- Public Member Functions inherited from ustl::ostream
 ostream (void *p, streamsize n)
 
 ostream (const memlink &source)
 
iterator end (void)
 
const_iterator end (void) const
 
void seek (uoff_t newPos)
 Move the write pointer to newPos.
 
void iseek (const_iterator newPos)
 Sets the current write position to newPos.
 
void skip (streamsize nBytes)
 Skips nBytes without writing anything.
 
uoff_t pos (void) const
 
iterator ipos (void)
 
const_iterator ipos (void) const
 
streamsize remaining (void) const
 Returns number of bytes remaining in the write buffer.
 
bool aligned (streamsize grain=c_DefaultAlignment) const
 Returns true if the write pointer is aligned on grain.
 
bool verify_remaining (const char *op, const char *type, size_t n)
 Checks that n bytes are available in the stream, or else throws.
 
streamsize align_size (streamsize grain=c_DefaultAlignment) const
 Returns the number of bytes to skip to be aligned on grain.
 
void align (streamsize grain=c_DefaultAlignment)
 Aligns the write pointer on grain. The skipped bytes are zeroed.
 
void write (const void *buffer, streamsize size)
 Writes n bytes from buffer.
 
void write (const cmemlink &buf)
 Writes the contents of buf into the stream as a raw dump.
 
void write_strz (const char *str)
 Writes str as a null-terminated string.
 
void read (istream &is)
 Writes all available data from is.
 
void write (ostream &os) const
 
void text_write (ostringstream &os) const
 Writes all written data to os.
 
size_t stream_size (void) const
 
void insert (iterator start, streamsize size)
 Inserts an empty area of size, at start.
 
void erase (iterator start, streamsize size)
 Erases an area of size, at start.
 
void swap (ostream &os)
 Swaps with os.
 
template<typename T >
void iwrite (const T &v)
 Writes type T into the stream via a direct pointer cast.
 
virtual void unlink (void) noexcept override
 
void link (void *p, streamsize n)
 
void link (memlink &l)
 
void link (void *f, void *l)
 
void relink (void *p, streamsize n)
 
void relink (memlink &l)
 
void seekp (off_t p, seekdir d=beg)
 Sets the current write position to p based on d.
 
off_t tellp (void) const
 
- Public Member Functions inherited from ustl::ios_base
iostate rdstate (void) const
 
bool bad (void) const
 
bool good (void) const
 
bool fail (void) const
 
bool eof (void) const
 
bool operator! (void) const
 
 operator void * (void) const
 
void clear (iostate v=goodbit)
 
void setstate (iostate v)
 
iostate exceptions (void) const
 
iostate exceptions (iostate v)
 

Additional Inherited Members

- Public Types inherited from ustl::ios_base
enum  fmtflags {
  boolalpha = (1 << 0),
  dec = (1 << 1),
  fixed = (1 << 2),
  hex = (1 << 3),
  internal = (1 << 4),
  left = (1 << 5),
  oct = (1 << 6),
  right = (1 << 7),
  scientific = (1 << 8),
  showbase = (1 << 9),
  showpoint = (1 << 10),
  showpos = (1 << 11),
  skipws = (1 << 12),
  unitbuf = (1 << 13),
  uppercase = (1 << 14),
  adjustfield = (1 << 15),
  basefield = (1 << 16),
  floatfield = (1 << 17)
}
 Used to set parameters for stringstreams. More...
 
enum  openmode_bits {
  in = (1 << 0),
  out = (1 << 1),
  app = (1 << 2),
  ate = (1 << 3),
  binary = (1 << 4),
  trunc = (1 << 5)
}
 For file-based streams, specifies fd mode.
 
enum  seekdir {
  beg,
  cur,
  end
}
 Seek directions, equivalent to SEEK_SET, SEEK_CUR, and SEEK_END.
 
enum  iostate_bits {
  goodbit = 0,
  badbit = (1 << 0),
  eofbit = (1 << 1),
  failbit = (1 << 2)
}
 I/O state bitmasks.
 
typedef uint32_t openmode
 Holds openmode_bits.
 
typedef uint32_t iostate
 Holds iostate_bits for a file stream.
 
typedef file_exception failure
 Thrown by fstream on errors.
 
- Static Public Attributes inherited from ustl::ios_base
static const char c_DefaultDelimiters [16] = DEFAULT_DELIMITERS
 Default word delimiters for stringstreams.
 
- Protected Member Functions inherited from ustl::ostringstream
void reserve (size_type n)
 
size_type capacity (void) const
 
- Protected Member Functions inherited from ustl::ostream
void SetPos (uoff_t newPos)
 
- Protected Member Functions inherited from ustl::ios_base
bool set_and_throw (iostate v)
 
void overrun (const char *op, const char *type, uint32_t n, uint32_t p, uint32_t rem)
 Checks that n bytes are available in the stream, or else throws.
 

Detailed Description

A string stream that writes to an fd. Implements cout and cerr.


The documentation for this class was generated from the following files:

Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10