CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CBuild::filebuff Class Referenceabstract

Base class of filebuffer. More...

#include <filebuff.hpp>

Inheritance diagram for CBuild::filebuff:
CBuild::line_filebuff CBuild::str_filebuff

Public Member Functions

 filebuff (std::string file, bool autorefresh=true)
 Create filebuffer, simply store some vars.
 
virtual char get_char (unsigned int pos)=0
 Get character from file, return -1 on error.
 
virtual std::string get_str (unsigned int pos, unsigned int size)=0
 Get sequence of characters from file.
 
virtual void set_char (char ch, unsigned int pos)=0
 Set character in file.
 
virtual void set_str (std::string str, unsigned int pos)=0
 Set string in file.
 
virtual void del_char (unsigned int pos)=0
 Remove character from file.
 
virtual void del_str (unsigned int pos, unsigned int size)=0
 Remove sequence of characters from file.
 
virtual void update ()=0
 Update file/buffer based on internal state variable.
 
CBuild::buffer_state get_state ()
 Get state of file.
 

Protected Member Functions

virtual void load_buffer ()=0
 Load buffer from file.
 
virtual void save_buffer ()=0
 Save buffer to file.
 

Protected Attributes

std::string path
 Path to file.
 
bool autorefresh
 Does file need to be automaticly.
 
CBuild::buffer_state state
 Currennt state of buffer. All operation that change buffer need to set state to CBuild::BUFFER_NEWER or update file based on autorefresh variable. All function that update buffer/file and synchronise it need to set state to CBuild::MATCH.
 

Detailed Description

Base class of filebuffer.

Definition at line 75 of file filebuff.hpp.

Constructor & Destructor Documentation

◆ filebuff()

CBuild::filebuff::filebuff ( std::string file,
bool autorefresh = true )
inline

Create filebuffer, simply store some vars.

Parameters
file=> std::string -> Path to file
autorefresh=> bool -> set autorefresh var

Definition at line 108 of file filebuff.hpp.

References autorefresh, and CBuild::FILE_NEWER.

Member Function Documentation

◆ del_char()

virtual void CBuild::filebuff::del_char ( unsigned int pos)
pure virtual

Remove character from file.

Parameters
pos=> unsigned int -> Position of character thet need to be removed

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ del_str()

virtual void CBuild::filebuff::del_str ( unsigned int pos,
unsigned int size )
pure virtual

Remove sequence of characters from file.

Parameters
pos=> unsigned int -> Postion of first character of sequence
size=> unsigned int -> Number of character to remove

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ get_char()

virtual char CBuild::filebuff::get_char ( unsigned int pos)
pure virtual

Get character from file, return -1 on error.

Parameters
pos=> unsigned int -> Position of character in file
Returns
char -> Symbol

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ get_state()

CBuild::buffer_state CBuild::filebuff::get_state ( )
inline

Get state of file.

Returns
CBuild::buffer_state -> Current state of filebuffer

Definition at line 167 of file filebuff.hpp.

References state.

◆ get_str()

virtual std::string CBuild::filebuff::get_str ( unsigned int pos,
unsigned int size )
pure virtual

Get sequence of characters from file.

Parameters
pos=> unsigned int -> Postion of first character of line
size=> unsigned int -> Number of characters in line
Returns
std::string -> String

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ load_buffer()

virtual void CBuild::filebuff::load_buffer ( )
protectedpure virtual

Load buffer from file.

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ save_buffer()

virtual void CBuild::filebuff::save_buffer ( )
protectedpure virtual

Save buffer to file.

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ set_char()

virtual void CBuild::filebuff::set_char ( char ch,
unsigned int pos )
pure virtual

Set character in file.

Parameters
ch=> char -> Character
pos=> unsigned int -> Character will be appended to file on this pos

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ set_str()

virtual void CBuild::filebuff::set_str ( std::string str,
unsigned int pos )
pure virtual

Set string in file.

Parameters
str=> std::string -> String
pos=> unsigned int -> String will be appended to file on this pos

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

◆ update()

virtual void CBuild::filebuff::update ( )
pure virtual

Update file/buffer based on internal state variable.

Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.

Member Data Documentation

◆ autorefresh

bool CBuild::filebuff::autorefresh
protected

◆ path

std::string CBuild::filebuff::path
protected

◆ state

CBuild::buffer_state CBuild::filebuff::state
protected

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