79 if (extensions.length()) {
81 size_t comma = extensions.find_first_of(
',');
82 for ( ; comma != string::npos;
83 comma = extensions.find_first_of(
',',start = comma + 1)) {
85 extensions.substr(start,comma - start));
94 if (!_filter_extensions.size()) {
97 size_t leaf_off = filename.find_last_of(
PATH_DELIM);
98 if (leaf_off == string::npos) {
101 string::const_reverse_iterator start = filename.rbegin();
102 string::const_reverse_iterator end(filename.begin() + leaf_off);
103 string::const_reverse_iterator extn_pos = std::find(start,end,
'.');
104 if (extn_pos != end) {
105 string extension(extn_pos.base(),filename.end());
106 verdict = find(_filter_extensions.begin(),
107 _filter_extensions.end(),extension) !=
108 _filter_extensions.end();
114 "To do (" << _files <<
") \"" << filename <<
'\"' <<
emit();
125 ++_done_files <<
") \"" << filename <<
'\"' <<
emit();
136 }
catch(
unsigned ex) {
static parsed_line & cur_line()
Get a reference to the current output line.
progress_msg< 3 > progress_added_file
Report added a file to input.
static selector _selector_
The selector for including files in the dataset
selector(std::string const &extensions=std::string())
Construct from a filter string.
static void add(std::string const &path)
Add files to the dataset.
static void line_debug(int line)
static line_type next()
Process the current input line and return its line type.
static void close(unsigned error)
Finalise the current pairing of source input and processed output, if any.
unsigned num() const
Get the greatest source line number spanned by this line.
Encapsulates a set of directory/file trees.
progress_msg< 1 > progress_processing_file
Report file being processed.
bool operator()(std::string const &filename)
Say whether a file is selected for processing.
static driver _driver_
The driver for traversing dataset
void add(std::string const &path, Filter &filter)
Add files from a path to the file_tree.
A directive line of no more specific type than that is to be dropped.
Encapsulates the selection of files for processing.
The tag class is inserted in a diagnostic_base to tell it to emit itself.
std::vector< std::string > _filter_extensions
A vector of the file extensions that are to be selected.
static void drop()
Drop the current output line.
void at_file(std::string const &filename)
Process a file in the dataset.
static void top()
Reset the depth of #if-nesting to 0.
struct driver encapsulates traversal of an input dataset to select and process files.
Encapsulates a filesystem path.
line_type
Enumeration of types of input lines.
static void open(std::string const &fname)
Open an input file and the appropriate output file.
static file_tree _ftree_
The tree of input files.
static void transition(line_type linetype)
Transition the if-control state given an evaluated line type.