|
CBuild
C++ build system with scripts written in c++
|
#include <filebuff.hpp>
Public Member Functions | |
| str_filebuff (std::string file, bool refresh=false, bool new_file=false) | |
| char | get_char (unsigned int pos) |
| Get character from file, return -1 on error. | |
| std::string | get_str (unsigned int pos, unsigned int size) |
| Get sequence of characters from file. | |
| void | set_char (char ch, unsigned int pos) |
| Set character in file. | |
| void | set_str (std::string str, unsigned int pos) |
| Set string in file. | |
| void | del_char (unsigned int pos) |
| Remove character from file. | |
| void | del_str (unsigned int pos, unsigned int size) |
| Remove sequence of characters from file. | |
| void | update () |
| Update file/buffer based on internal state variable. | |
Public Member Functions inherited from CBuild::filebuff | |
| filebuff (std::string file, bool autorefresh=true) | |
| Create filebuffer, simply store some vars. | |
| CBuild::buffer_state | get_state () |
| Get state of file. | |
Protected Member Functions | |
| void | load_buffer () |
| Load buffer from file. | |
| void | save_buffer () |
| Save buffer to file. | |
Protected Attributes | |
| std::string | buff |
Protected Attributes inherited from CBuild::filebuff | |
| 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. | |
Definition at line 456 of file filebuff.hpp.
|
inline |
Definition at line 474 of file filebuff.hpp.
References load_buffer().
|
inlinevirtual |
Remove character from file.
| pos | => unsigned int -> Position of character thet need to be removed |
Implements CBuild::filebuff.
Definition at line 520 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inlinevirtual |
Remove sequence of characters from file.
| pos | => unsigned int -> Postion of first character of sequence |
| size | => unsigned int -> Number of character to remove |
Implements CBuild::filebuff.
Definition at line 531 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inlinevirtual |
Get character from file, return -1 on error.
| pos | => unsigned int -> Position of character in file |
Implements CBuild::filebuff.
Definition at line 480 of file filebuff.hpp.
References buff.
|
inlinevirtual |
Get sequence of characters from file.
| pos | => unsigned int -> Postion of first character of line |
| size | => unsigned int -> Number of characters in line |
Implements CBuild::filebuff.
Definition at line 487 of file filebuff.hpp.
References buff.
|
inlineprotectedvirtual |
Load buffer from file.
Implements CBuild::filebuff.
Definition at line 459 of file filebuff.hpp.
References CBuild::MATCH, CBuild::filebuff::path, and CBuild::filebuff::state.
Referenced by str_filebuff(), and update().
|
inlineprotectedvirtual |
Save buffer to file.
Implements CBuild::filebuff.
Definition at line 466 of file filebuff.hpp.
References CBuild::MATCH, CBuild::filebuff::path, and CBuild::filebuff::state.
Referenced by del_char(), del_str(), set_char(), set_str(), and update().
|
inlinevirtual |
Set character in file.
| ch | => char -> Character |
| pos | => unsigned int -> Character will be appended to file on this pos |
Implements CBuild::filebuff.
Definition at line 496 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, buff, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inlinevirtual |
Set string in file.
| str | => std::string -> String |
| pos | => unsigned int -> String will be appended to file on this pos |
Implements CBuild::filebuff.
Definition at line 509 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inlinevirtual |
Update file/buffer based on internal state variable.
Implements CBuild::filebuff.
Definition at line 542 of file filebuff.hpp.
References CBuild::BUFFER_NEWER, CBuild::FILE_NEWER, load_buffer(), CBuild::MATCH, save_buffer(), and CBuild::filebuff::state.
|
protected |
Definition at line 458 of file filebuff.hpp.
Referenced by get_char(), get_str(), and set_char().