CBuild
C++ build system with scripts written in c++
|
Base class of filebuffer. More...
#include <filebuff.hpp>
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. | |
Base class of filebuffer.
Definition at line 75 of file filebuff.hpp.
|
inline |
Create filebuffer, simply store some vars.
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.
|
pure virtual |
Remove character from file.
pos | => unsigned int -> Position of character thet need to be removed |
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
pure virtual |
Remove sequence of characters from file.
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.
|
pure virtual |
Get character from file, return -1 on error.
pos | => unsigned int -> Position of character in file |
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
inline |
Get state of file.
Definition at line 167 of file filebuff.hpp.
References state.
|
pure virtual |
Get sequence of characters from file.
pos | => unsigned int -> Postion of first character of line |
size | => unsigned int -> Number of characters in line |
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
protectedpure virtual |
Load buffer from file.
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
protectedpure virtual |
Save buffer to file.
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
pure virtual |
Set character in file.
ch | => char -> Character |
pos | => unsigned int -> Character will be appended to file on this pos |
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
pure virtual |
Set string in file.
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.
|
pure virtual |
Update file/buffer based on internal state variable.
Implemented in CBuild::line_filebuff, and CBuild::str_filebuff.
|
protected |
Does file need to be automaticly.
Definition at line 84 of file filebuff.hpp.
Referenced by CBuild::line_filebuff::del_char(), CBuild::str_filebuff::del_char(), CBuild::line_filebuff::del_line(), CBuild::line_filebuff::del_str(), CBuild::str_filebuff::del_str(), filebuff(), CBuild::line_filebuff::set_char(), CBuild::str_filebuff::set_char(), CBuild::line_filebuff::set_line(), CBuild::line_filebuff::set_str(), and CBuild::str_filebuff::set_str().
|
protected |
Path to file.
Definition at line 80 of file filebuff.hpp.
Referenced by CBuild::line_filebuff::load_buffer(), CBuild::str_filebuff::load_buffer(), CBuild::line_filebuff::save_buffer(), and CBuild::str_filebuff::save_buffer().
|
protected |
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.
Definition at line 91 of file filebuff.hpp.
Referenced by CBuild::line_filebuff::del_char(), CBuild::str_filebuff::del_char(), CBuild::line_filebuff::del_line(), CBuild::line_filebuff::del_str(), CBuild::str_filebuff::del_str(), get_state(), CBuild::line_filebuff::load_buffer(), CBuild::str_filebuff::load_buffer(), CBuild::str_filebuff::save_buffer(), CBuild::line_filebuff::set_char(), CBuild::str_filebuff::set_char(), CBuild::line_filebuff::set_line(), CBuild::line_filebuff::set_str(), CBuild::str_filebuff::set_str(), CBuild::line_filebuff::update(), and CBuild::str_filebuff::update().