wex  v21.04.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
wex::stream Class Reference

Adds run_tool methods and statistics to a file stream. More...

#include <wex/stream.h>

Inheritance diagram for wex::stream:
Inheritance graph
[legend]

Public Member Functions

 stream (const path &filename, const tool &tool)
 Constructor.
 
virtual ~stream ()
 Destructor.
 
const auto & get_filename () const
 Returns the filename.
 
const auto & get_statistics () const
 Returns the statistics.
 
const auto & get_tool () const
 Returns the tool.
 
bool run_tool ()
 Runs the tool.
 

Static Public Member Functions

static void reset ()
 Resets static members.
 

Protected Member Functions

virtual bool process (std::string &text, size_t line_no)
 Processes line. More...
 
virtual bool process_begin ()
 Override to do action before processing begins. More...
 
virtual void process_end ()
 Override to do action after processing has ended.
 
virtual void process_match (const std::string &line, size_t line_no, int pos)
 Override to do action for a match. More...
 
auto inc_actions_completed (int inc_value=1)
 Increments the actions completed.
 
auto inc_statistics (const std::string &keyword)
 Increments statistics keyword.
 

Detailed Description

Adds run_tool methods and statistics to a file stream.

Member Function Documentation

◆ process()

virtual bool wex::stream::process ( std::string &  text,
size_t  line_no 
)
protectedvirtual

Processes line.

The default performs a ID_TOOL_REPORT_FIND or REPLACE.

Parameters
textcontents to be processed (depends on std::getline)
line_noline number

◆ process_begin()

virtual bool wex::stream::process_begin ( )
protectedvirtual

Override to do action before processing begins.

The default checks correct tool for find and replace.

◆ process_match()

virtual void wex::stream::process_match ( const std::string &  line,
size_t  line_no,
int  pos 
)
inlineprotectedvirtual

Override to do action for a match.

Data is available in find replace data.

Parameters
linematching line
line_noline number containing match
pospos on line where match starts, -1 not known