MCPcopy Create free account
hub / github.com/davisking/dlib / obtain_list_of_files

Function obtain_list_of_files

tools/htmlify/to_xml.cpp:63–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61// ----------------------------------------------------------------------------------------
62
63void obtain_list_of_files (
64 const cmd_line_parser<char>::check_1a_c& parser,
65 const std::string& filter,
66 const unsigned long search_depth,
67 std::vector<std::pair<string,string> >& files
68)
69{
70 for (unsigned long i = 0; i < parser.option("i").count(); ++i)
71 {
72 const directory dir(parser.option("i").argument(0,i));
73
74 const std::vector<file>& temp = get_files_in_directory_tree(dir, file_filter(filter), search_depth);
75
76 // figure out how many characters need to be removed from the path of each file
77 const string parent = dir.get_parent().full_name();
78 unsigned long strip = parent.size();
79 if (parent.size() > 0 && parent[parent.size()-1] != '\\' && parent[parent.size()-1] != '/')
80 strip += 1;
81
82 for (unsigned long i = 0; i < temp.size(); ++i)
83 {
84 files.push_back(make_pair(temp[i].full_name().substr(strip), temp[i].full_name()));
85 }
86 }
87
88 for (unsigned long i = 0; i < parser.number_of_arguments(); ++i)
89 {
90 files.push_back(make_pair(parser[i], parser[i]));
91 }
92
93 std::sort(files.begin(), files.end());
94}
95
96// ----------------------------------------------------------------------------------------
97

Callers 1

generate_xml_markupFunction · 0.85

Calls 8

file_filterClass · 0.85
countMethod · 0.80
number_of_argumentsMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected