本文整理汇总了C++中FileManager::getFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::getFiles方法的具体用法?C++ FileManager::getFiles怎么用?C++ FileManager::getFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::getFiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
string a = Directory::getCurrentDirectory();
cout << a;
FileManager fileManager;
vector<string> files = fileManager.getFiles(a, "*.h");
for (int i = 0; i < files.size(); i++)
cout << endl << files[i];
return 0;
}
示例2: main
int main(int argc, char* argv[])
{
//collecting tokens from files, named on the command line
if (argc < 2)
{
std::cout<< "\n please enter name of file to process on command line\n\n";
return 1;
}
FileManager fileManager;
std::vector<std::string> patterns = { "*.h" , "*.cpp" };
std::vector<std::string> files = fileManager.getFiles("..//", patterns);
for (int i = 1; i<argc; ++i)
{
std::string fileSpec = FileSystem::Path::getFullFileSpec(argv[i]);
std::string msg = "Processing file" + fileSpec;
ConfigParseToConsole configure;
Parser* pParser = configure.Build();
MetricAnalyzer *test = new MetricAnalyzer;
try {
if (pParser) {
if (!configure.Attach(argv[i]))
{
std::cout << "\n could not open file " << fileSpec << std::endl;
continue;
}
}
else
{
std::cout << "\n\n Parser not built\n\n";
return 1;
}
while (pParser->next())
{
pParser->parse();
}
std::cout << "\n";
configure.printTree();
test->setRoot(configure.getRoot());
test->getComplexity(test->getRoot());
test->getComplexity(test->getRoot());
}
catch (std::exception& ex)
{
std::cout << "\n\n " << ex.what() << "\n\n";
}
}
}
示例3:
//Get filepaths for a particular version
vector<string> Repository::getFilesinVersion(string version) {
vector<sPtr> versionVector = _packagesInfo->element("Version").select();
string resultDirectory;
for (auto eachVersion : versionVector) {
string versionName = eachVersion->getAttrib("Name");
if (versionName == version) {
resultDirectory = eachVersion->getAttrib("Directory");
break;
}
}
vector<string> files;
if (resultDirectory != ""&&resultDirectory != " ") {
FileManager fileManager;
vector<string> patterns = { "*.h", "*.cpp" };
files = fileManager.getFiles(resultDirectory, patterns);
}
return files;
}
示例4: getLatestPackageVersion
//Return filepaths for files in package
vector<string> Repository::getPathsforFilesinPackage(string dirctry, bool recursion) {
string resultDirectory;
sPtr resultVersion = getLatestPackageVersion(dirctry);
if (resultVersion) {
resultDirectory = resultVersion->getAttrib("Directory");
}
vector<string> files;
cout << "\nChecking files in directory:" << resultDirectory;
if (resultDirectory != ""&&resultDirectory != " ") {
FileManager fileManager;
vector<string> patterns = { "*.h", "*.cpp" };
files = fileManager.getFiles(resultDirectory, patterns);
}
if (recursion) {
vector<string> dependentFiles = getDependentFiles(resultDirectory);
if (dependentFiles.size() > 0) {
files.insert(files.end(), dependentFiles.begin(), dependentFiles.end());
}
}
return files;
}