FLCBYTBF-API FLUC C++ Stream Buffer Interface

FLCBYTBF.hpp
Go to the documentation of this file.
1
30#ifndef FLCBYT_BUFFER_HPP
31#define FLCBYT_BUFFER_HPP
32
33#include <streambuf>
34#include <vector>
35#include <cstdlib>
36#include <iostream>
37
38#if defined(__BORLANDC__)
39#include <stdio.h>
40#else
41#include <cstdio>
42#endif
45#include "FLMDEF.h"
46
47/**********************************************************************/
49#define FCB_READ_FILE FLC_READ_FILE
50#define FCB_READ_FORMAT FLC_READ_FORMAT
51#define FCB_WRITE_FILE FLC_WRITE_FILE
52#define FCB_WRITE_FORMAT FLC_WRITE_FORMAT
53#define FCB_INPUT_FILE FLC_INPUT_FILE
54#define FCB_OUTPUT_FILE FLC_OUTPUT_FILE
55#define FCB_INFO FLC_INFO
56#define FCB_STATE FLC_STATE
58/**********************************************************************/
59
68 class flcbyt_buffer: public std::streambuf {
69 public:
181 explicit flcbyt_buffer(const char* filstr, const char* fmtstr, char** state=NULL, size_t buff_sz=4096, size_t put_back=1);
189 ~flcbyt_buffer();
208 std::string close(const int statfmt=FLMOUT_FORMAT_LST);
219 int error();
230 std::string errormsg();
241 static std::string errortrace();
250 static std::string version();
260 static std::string about();
269 static std::string license();
285 static std::string help(const int what, const int depth, const char* path);
301 static std::string syntax(const int what, const int depth, const char* path);
302
303 private:
304 // overrides base class functions underflow(), overflow(), sync()
305 int_type underflow();
306 int_type overflow(int_type ch);
307 int sync();
308 //xsputn() // TODO: overwrite, else each several byte is copied
309
310 // copy constructor and assignment not implemented;
311 flcbyt_buffer(const flcbyt_buffer &);
312 // copying not allowed
313 flcbyt_buffer &operator=(const flcbyt_buffer &);
314
315 private:
316 const char* filstr_;
317 const char* fmtstr_;
318 const std::size_t put_back_;
319 std::vector<char> buffer_;
320 void* handle;
321};
322
323/**********************************************************************/
324
326#endif /*FLCBYT_BUFFER_HPP*/
FLMDEF.h
FLMDEF - External FLAM definitions.
flcbyt_buffer
A C++ stream buffer to use with istream/ostream.
Definition: FLCBYTBF.hpp:68
flcbyt_buffer::help
static std::string help(const int what, const int depth, const char *path)
Returns help information about the file and format strings.
flcbyt_buffer::error
int error()
Returns an error code for the last byte interface operation.
flcbyt_buffer::~flcbyt_buffer
~flcbyt_buffer()
Flushes buffers and closes the file.
flcbyt_buffer::license
static std::string license()
Retrieves license information.
flcbyt_buffer::version
static std::string version()
Retrieves version information.
flcbyt_buffer::errortrace
static std::string errortrace()
Returns a FLAM error trace.
flcbyt_buffer::close
std::string close(const int statfmt=FLMOUT_FORMAT_LST)
Flushes all internal buffers and closes the file.
flcbyt_buffer::errormsg
std::string errormsg()
Returns an error message for the last byte interface operation.
flcbyt_buffer::flcbyt_buffer
flcbyt_buffer(const char *filstr, const char *fmtstr, char **state=NULL, size_t buff_sz=4096, size_t put_back=1)
Constructor for a FLUC byte interface streambuf implementation.
flcbyt_buffer::syntax
static std::string syntax(const int what, const int depth, const char *path)
Returns syntax information about the file and format strings.
flcbyt_buffer::about
static std::string about()
Retrieves about information.
FLMOUT_FORMAT_LST
#define FLMOUT_FORMAT_LST
Simple list of lines with each line separated by '\n' and the whole string terminated by 0x00.
Definition: FLMDEF.h:33