FLCBYTBF-API
FLUC C++ Stream Buffer Interface Version: 5.2.0-37009
FLCBYTBF.hpp
Go to the documentation of this file.
1
28
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
44
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
68class 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);
208 std::string close(const int statfmt=FLMOUT_FORMAT_LST);
219 int error(void);
230 std::string errormsg(void);
241 static std::string errortrace(void);
250 static std::string version(void);
260 static std::string about(void);
269 static std::string license(void);
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(void);
306 int_type overflow(int_type ch);
307 int sync(void);
308 //xsputn() // TODO: overwrite, else each several byte is copied
309
310 // copy constructor and assignment not implemented;
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 - External FLAM definitions.
static std::string help(const int what, const int depth, const char *path)
Returns help information about the file and format strings.
int error(void)
Returns an error code for the last byte interface operation.
static std::string license(void)
Retrieves license information.
~flcbyt_buffer(void)
Flushes buffers and closes the file.
std::string close(const int statfmt=FLMOUT_FORMAT_LST)
Flushes all internal buffers and closes the file.
static std::string version(void)
Retrieves version information.
std::string errormsg(void)
Returns an error message for the last byte interface operation.
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.
static std::string syntax(const int what, const int depth, const char *path)
Returns syntax information about the file and format strings.
static std::string errortrace(void)
Returns a FLAM error trace.
static std::string about(void)
Retrieves about information.
#define FLMOUT_FORMAT_LST
Simple list of lines with each line separated by '\n' and the whole string terminated by 0x00.
Definition FLMDEF.h:34