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::str_filebuff Class Reference

#include <filebuff.hpp>

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

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.
 

Detailed Description

Definition at line 456 of file filebuff.hpp.

Constructor & Destructor Documentation

◆ str_filebuff()

CBuild::str_filebuff::str_filebuff ( std::string file,
bool refresh = false,
bool new_file = false )
inline

Definition at line 474 of file filebuff.hpp.

References load_buffer().

Member Function Documentation

◆ del_char()

void CBuild::str_filebuff::del_char ( unsigned int pos)
inlinevirtual

Remove character from file.

Parameters
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.

◆ del_str()

void CBuild::str_filebuff::del_str ( unsigned int pos,
unsigned int size )
inlinevirtual

Remove sequence of characters from file.

Parameters
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.

◆ get_char()

char CBuild::str_filebuff::get_char ( unsigned int pos)
inlinevirtual

Get character from file, return -1 on error.

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

Implements CBuild::filebuff.

Definition at line 480 of file filebuff.hpp.

References buff.

◆ get_str()

std::string CBuild::str_filebuff::get_str ( unsigned int pos,
unsigned int size )
inlinevirtual

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

Implements CBuild::filebuff.

Definition at line 487 of file filebuff.hpp.

References buff.

◆ load_buffer()

void CBuild::str_filebuff::load_buffer ( )
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().

◆ save_buffer()

void CBuild::str_filebuff::save_buffer ( )
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().

◆ set_char()

void CBuild::str_filebuff::set_char ( char ch,
unsigned int pos )
inlinevirtual

Set character in file.

Parameters
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.

◆ set_str()

void CBuild::str_filebuff::set_str ( std::string str,
unsigned int pos )
inlinevirtual

Set string in file.

Parameters
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.

◆ update()

void CBuild::str_filebuff::update ( )
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.

Member Data Documentation

◆ buff

std::string CBuild::str_filebuff::buff
protected

Definition at line 458 of file filebuff.hpp.

Referenced by get_char(), get_str(), and set_char().


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