本文整理汇总了C++中processFile函数的典型用法代码示例。如果您正苦于以下问题:C++ processFile函数的具体用法?C++ processFile怎么用?C++ processFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processFileList
/*
* processFileList - process a possible file list
*/
static void processFileList( const char *ptr )
{
DIR *dirp;
struct dirent *dirent;
const char *tmp;
bool has_wild = false;
char buff1[_MAX_PATH2];
char buff2[_MAX_PATH2];
char *drive;
char *dir;
char *fname;
char *ext;
char path[_MAX_PATH];
tmp = ptr;
while( *tmp != '\0' ) {
if( *tmp == '*' || *tmp == '?' ) {
has_wild = true;
break;
}
tmp++;
}
if( !has_wild ) {
processFile( ptr );
return;
}
_splitpath2( ptr, buff1, &drive, &dir, &fname, &ext );
dirp = opendir( ptr );
if( dirp == NULL ) {
return;
}
while( (dirent = readdir( dirp )) != NULL ) {
#ifdef __UNIX__
{
struct stat buf;
stat( dirent->d_name, &buf );
if ( S_ISDIR( buf.st_mode ) )
continue;
}
#else
if( dirent->d_attr & (_A_SUBDIR | _A_VOLID) ) {
continue;
}
#endif
_splitpath2( dirent->d_name, buff2, NULL, NULL, &fname, &ext );
_makepath( path, drive, dir, fname, ext );
strlwr( path );
processFile( path );
}
closedir( dirp );
} /* processFileList */
示例2: main
int
main(int argc, char *argv[])
{
int i;
int opt;
while(1) {
opt = getopt_long(argc, argv, "DvVTBtPs", long_options, NULL);
if(opt == -1)
break;
switch(opt) {
case 'v':
verbose = 1;
break;
case 's':
rsgt_read_showVerified = 1;
break;
case 'V':
fprintf(stderr, "rsgtutil " VERSION "\n");
exit(0);
case 'D':
mode = MD_DUMP;
break;
case 'B':
mode = MD_SHOW_SIGBLK_PARAMS;
break;
case 'P':
rsgt_read_puburl = optarg;
break;
case 'T':
mode = MD_DETECT_FILE_TYPE;
break;
case 't':
mode = MD_VERIFY;
break;
case 'e':
mode = MD_EXTEND;
break;
case '?':
break;
default:fprintf(stderr, "getopt_long() returns unknown value %d\n", opt);
return 1;
}
}
if(optind == argc)
processFile("-");
else {
for(i = optind ; i < argc ; ++i)
processFile(argv[i]);
}
return 0;
}
示例3: composeFile
void TableGenerator::findComposeFile()
{
bool found = false;
// check if XCOMPOSEFILE points to a Compose file
if (qEnvironmentVariableIsSet("XCOMPOSEFILE")) {
QString composeFile(qgetenv("XCOMPOSEFILE"));
if (composeFile.endsWith(QLatin1String("Compose")))
found = processFile(composeFile);
else
qWarning("Qt Warning: XCOMPOSEFILE doesn't point to a valid Compose file");
#ifdef DEBUG_GENERATOR
if (found)
qDebug() << "Using Compose file from: " << composeFile;
#endif
}
// check if user’s home directory has a file named .XCompose
if (!found && cleanState()) {
QString composeFile = qgetenv("HOME") + QStringLiteral("/.XCompose");
if (QFile(composeFile).exists())
found = processFile(composeFile);
#ifdef DEBUG_GENERATOR
if (found)
qDebug() << "Using Compose file from: " << composeFile;
#endif
}
// check for the system provided compose files
if (!found && cleanState()) {
QString table = composeTableForLocale();
if (cleanState()) {
if (table.isEmpty())
// no table mappings for the system's locale in the compose.dir
m_state = UnsupportedLocale;
else
found = processFile(systemComposeDir() + QLatin1Char('/') + table);
#ifdef DEBUG_GENERATOR
if (found)
qDebug() << "Using Compose file from: " <<
systemComposeDir() + QLatin1Char('/') + table;
#endif
}
}
if (found && m_composeTable.isEmpty())
m_state = EmptyTable;
if (!found)
m_state = MissingComposeFile;
}
示例4: opendir
void MakePageLib::traversDirectoryWithRecursion(const std::string &path)
{
DIR *dir = opendir(path.c_str());
if(dir == NULL)
{
LOG_FATAL << "open dir error:" << path;
}
chdir(path.c_str()); //更改工作目录
struct dirent *pd;
while((pd = readdir(dir)) != NULL)
{
if(pd->d_name[0] == '.') // . ..
continue;
//int lstat(const char *path, struct stat *buf);
struct stat buf;
if(lstat(pd->d_name, &buf) == -1)
{
LOG_ERROR << "lstat file :" << pd->d_name << " error";
continue;
}
if(S_ISDIR(buf.st_mode))
traversDirectoryWithRecursion(pd->d_name);
else if(S_ISREG(buf.st_mode))
processFile(pd->d_name);
}
closedir(dir);
chdir(".."); //退出到上一层
}
示例5: newStringStackItem
void MagicFolderCache::startElement(XML_CSTR name, const XMLAttributes& atts)
{
if( IN_STATE( PS_FOLDER ) )
{
if( MATCH("MagicFolder") )
{
_depth++;
// Push this folder path onto the path stack...
_pathStack = newStringStackItem(_pathStack, atts.getValue(_T("name")));
// Store a folder object which will hold configuration etc.
_current = new Folder(_pathStack->val.c_str(), _T(""));
_map->insert(MagicFolderCache::FolderMap::value_type(_pathStack->val, _current));
}
else if( MATCH("File") )
{
STATE(PS_FILE);
processFile(atts);
}
else
{
processUserData(name, atts);
}
}
else if( IN_STATE( PS_FILE ) || IN_STATE( PS_USERDATA ) )
{
processUserData(name, atts);
}
}
示例6: processFile
/**
Parses the file with the given name and adds it to the database.
@param path: path to the file to process
@param name: name of the file to process
@param parseBody: boolean value stating whether the body must be parsed or not
*/
void DatasetGenerator::parseFile(const string &filePath, const string &fileName, bool parseBody)
{
aParseBody=parseBody;
DB.connect();
processFile(filePath, fileName);
DB.close();
}
开发者ID:marta123456,项目名称:ReferenceRecommendationForScientificArticles,代码行数:13,代码来源:DatasetGenerator.cpp
示例7: processChunk
static void processChunk(Regex* re, SearchOutput* output, unsigned int chunkIndex, const char* data, size_t fileCount, Regex* includeRe, Regex* excludeRe)
{
const DataChunkFileHeader* files = reinterpret_cast<const DataChunkFileHeader*>(data);
OrderedOutput::Chunk* chunk = output->output.begin(chunkIndex);
if (!output->isLimitReached())
{
HighlightBuffer hlbuf;
for (size_t i = 0; i < fileCount; ++i)
{
const DataChunkFileHeader& f = files[i];
if (includeRe && !includeRe->search(data + f.nameOffset, f.nameLength))
continue;
if (excludeRe && excludeRe->search(data + f.nameOffset, f.nameLength))
continue;
processFile(re, output, chunk, hlbuf, data + f.nameOffset, f.nameLength, data + f.dataOffset, f.dataSize, f.startLine);
}
}
output->output.end(chunk);
}
示例8: CWriteSink
bool CMailViewTpl::SaveToFile( LPCSTR fileName )
{
FarFile f;
if ( !f.CreateForWrite( fileName ) )
return false;
class CWriteSink : public IWriteSink
{
private:
FarFile * f;
public:
CWriteSink( FarFile * ff ) : f( ff )
{
}
virtual ~CWriteSink()
{
}
virtual void write( LPCSTR str, int len )
{
f->Write( str, len );
}
};
CWriteSink ws( &f );
processFile( m_fileName, &ws );
f.Close();
return true;
}
示例9: processFileArgument
void processFileArgument(char* name) {
if (!table.lookup(name)) {
fprintf(stderr, "File %s is not present in baseline.\n", name);
return;
}
File localfile(name);
if (localfile.exists()) {
processFile(name);
} else {
if (forced_revision()) {
File tempfile("forced_mergefile.tmp");
File rcsfile(dirs.baseline, dirs.subdir->path, "RCS",
localfile.path);
char line[LINE_LENGTH];
char* version = forced_revision_number ? forced_revision_number :
rcsfile.getRevisionFromDate(forced_revision_date);
sprintf(line, "co -q -p%s %s,v > %s",
version, rcsfile.path, tempfile.path);
if (execute(line)) {
tempfile.un_link();
exit(-1);
}
localfile.become(tempfile, save);
tempfile.un_link();
} else {
File basefile(dirs.baseline, dirs.subdir->path, localfile.path);
localfile.become(basefile, save);
}
}
}
示例10: processFile
unsigned int CppCheck::check(const std::string &path, const std::string &content)
{
_fileContent = content;
const unsigned int retval = processFile(path,true); //
_fileContent.clear();
return retval;
}
示例11: processFile
bool StorageDistributedDirectoryMonitor::findFiles()
{
std::map<UInt64, std::string> files;
Poco::DirectoryIterator end;
for (Poco::DirectoryIterator it{path}; it != end; ++it)
{
const auto & file_path_str = it->path();
Poco::Path file_path{file_path_str};
if (!it->isDirectory() && startsWith(file_path.getExtension().data(), "bin"))
files[parse<UInt64>(file_path.getBaseName())] = file_path_str;
}
if (files.empty())
return false;
for (const auto & file : files)
{
if (quit)
return true;
processFile(file.second);
}
return true;
}
示例12: while
void CollectionScanner::scanDirectory(QDir directory) {
QStack<QDir> stack;
stack.push(directory);
while(!stack.empty()) {
const QDir dir = stack.pop();
const QFileInfoList flist = dir.entryInfoList(
QDir::NoDotAndDotDot |
QDir::Dirs | QDir::Files | QDir::Readable
);
QFileInfo fileInfo;
Q_FOREACH(fileInfo, flist) {
if(fileInfo.isFile() ) {
processFile(fileInfo);
} else if (fileInfo.isDir()) {
QString subDirPath = fileInfo.absoluteFilePath();
#ifdef APP_MAC
if (directoryBlacklist.contains(subDirPath)) {
qDebug() << "Skipping directory" << subDirPath;
continue;
}
#endif
QDir subDir(subDirPath);
stack.push(subDir);
}
}
}
}
示例13: strlen
AREXPORT void ArDataLogger::addString(
const char *name, ArTypes::UByte2 maxLength,
ArFunctor2<char *, ArTypes::UByte2> *functor)
{
ArTypes::UByte2 len;
myMutex.lock();
if (maxLength < strlen(name))
len = strlen(name);
else
len = maxLength;
if (myMaxMaxLength < len)
myMaxMaxLength = len;
myStrings.push_back(new ArStringInfoHolder(name, len, functor));
bool *boolPtr;
boolPtr = new bool;
// if we've added to config we default to true
if (myAddedToConfig)
*boolPtr = true;
else
*boolPtr = false;
myStringsEnabled.push_back(boolPtr);
myStringsCount++;
myMutex.unlock();
if (myAddedToConfig)
processFile(NULL, 0);
}
示例14: showStdIn
/**
* \brief Process the contents of stdin.
* \result 0 if all OK.
*/
void showStdIn (void)
{
/*------------------------------------------------------------------------*
* First display a table with the file name and size. *
*------------------------------------------------------------------------*/
if (!displayColumnInit (1, ptrFileColumn, 0))
{
fprintf (stderr, "ERROR in: displayColumnInit\n");
return;
}
if (!displayQuiet)
{
displayDrawLine (0);
displayHeading (0);
displayNewLine (0);
displayInColumn (0, "stdin");
displayNewLine (DISPLAY_INFO);
displayAllLines ();
}
displayTidy ();
if (!displayColumnInit (displayCols, ptrDumpColumn, displayFlags))
{
fprintf (stderr, "ERROR in: displayColumnInit\n");
return;
}
if (!displayQuiet) displayDrawLine (0);
if (!displayQuiet) displayHeading (0);
processFile (stdin);
++filesFound;
}
示例15: killOp
void UploadOperation::startUpload()
{
if (isTerminating()) {
killOp();
return ;
} // terminate operation is needed
// Current file info
FileInfo *fileInfo = m_toCopy->getFileInfo();
// Logging
if (m_toCopy->getFirst()->getParent() == NULL) {
StringStorage message;
message.format(_T("Uploading '%s' %s"), m_pathToSourceFile.getString(),
fileInfo->isDirectory() ? _T("folder") : _T("file"));
notifyInformation(message.getString());
} // logging
if (fileInfo->isDirectory()) {
processFolder();
} else {
processFile();
} // if not directory
if (isTerminating()) {
killOp();
return ;
} // terminate operation is needed
} // void