|
CBuild
C++ build system with scripts written in c++
|
#include <filebuff.hpp>
Public Member Functions | |
| line_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. | |
| std::string | get_line (unsigned int pos) |
| Get line from buffer. | |
| void | set_line (std::string str, unsigned int pos) |
| Set line in file. | |
| void | del_line (unsigned int pos) |
| Delete line 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::list< 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 171 of file filebuff.hpp.
|
inline |
Definition at line 192 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 306 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inline |
Delete line from file.
| std::runtime_error | -> If pos is bigger then file |
| pos | => unsigned int -> Linenumber |
Definition at line 428 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, buff, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
Referenced by CBuild::ccj_out::generate().
|
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 331 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 198 of file filebuff.hpp.
References buff.
|
inline |
Get line from buffer.
| std::runtime_error | -> If pos is bigger then file |
| pos | => unsigned int -> Linenumber |
Definition at line 390 of file filebuff.hpp.
References buff.
Referenced by CBuild::ccj_out::generate().
|
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 209 of file filebuff.hpp.
|
inlineprotectedvirtual |
Load buffer from file.
Implements CBuild::filebuff.
Definition at line 174 of file filebuff.hpp.
References CBuild::MATCH, CBuild::filebuff::path, and CBuild::filebuff::state.
Referenced by line_filebuff(), and update().
|
inlineprotectedvirtual |
Save buffer to file.
Implements CBuild::filebuff.
Definition at line 183 of file filebuff.hpp.
References buff, and CBuild::filebuff::path.
Referenced by del_char(), del_line(), del_str(), set_char(), set_line(), 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 249 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
|
inline |
Set line in file.
| std::runtime_error | -> If pos is bigger then file |
| str | => std::string -> Line |
| pos | => unsigned int -> Linenumber of new line |
Definition at line 407 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, buff, CBuild::BUFFER_NEWER, save_buffer(), and CBuild::filebuff::state.
Referenced by CBuild::ccj_out::generate().
|
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 275 of file filebuff.hpp.
References CBuild::filebuff::autorefresh, CBuild::BUFFER_NEWER, CBuild::parse_lines(), save_buffer(), and CBuild::filebuff::state.
|
inlinevirtual |
Update file/buffer based on internal state variable.
Implements CBuild::filebuff.
Definition at line 442 of file filebuff.hpp.
References CBuild::BUFFER_NEWER, CBuild::FILE_NEWER, load_buffer(), CBuild::MATCH, save_buffer(), and CBuild::filebuff::state.
Referenced by CBuild::ccj_out::generate().
|
protected |
Definition at line 173 of file filebuff.hpp.
Referenced by del_line(), get_char(), get_line(), save_buffer(), and set_line().