本文整理汇总了C++中FileNode::LocalName方法的典型用法代码示例。如果您正苦于以下问题:C++ FileNode::LocalName方法的具体用法?C++ FileNode::LocalName怎么用?C++ FileNode::LocalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileNode
的用法示例。
在下文中一共展示了FileNode::LocalName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFileNode
IFileNode* FileCollectorImpl::AddFileNode(const file_id_t& id, file_size_t pos, bool_t bFinish, const char_t* strDir, const char_t* strName) {
if (NULL == strDir || NULL == strName) { return NULL; }
if (IFileNode::INVALID_FILE_ID == id) { return NULL; }
hash_value_t hash = char_t_hash()(strDir);
/* find */
FileNode* pFileNode = findFileNode(hash, strName);
if (NULL == pFileNode) {
pFileNode = new FileNode(strDir, NULL, strName, id, pos, bFinish);
if (NULL == pFileNode) { return NULL; }
// add to map
addFileNode(hash, pFileNode->LocalName(), pFileNode);
}
if (IFileNode::INVALID_FILE_ID != id) {
// update id
pFileNode->SetID(id);
addFileNode(id, pFileNode);
}
return pFileNode;
}
示例2: searchAllFile
bool_t FileCollectorImpl::searchAllFile(collector_log_type_e collector_log_type
,CollectRule* pCollectRule, file_collect_callback_t pfn_cb, void* context) {
ASSERT(pCollectRule);
ASSERT(pfn_cb);
// now
struct tm today;
time_t now = time(NULL);
LOCALTIME(today, now);
WIN32_FIND_DATA find_file_data;
//__try
{
HANDLE find_handle = FindFirstFile(pCollectRule->find_dir, &find_file_data);
if (find_handle != INVALID_HANDLE_VALUE) {
do {
// Don't count current or parent directories.
if ((STRCMP(find_file_data.cFileName, _STR("..")) == 0) ||
(STRCMP(find_file_data.cFileName, _STR(".")) == 0))
continue;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { continue; }
/*
long result = CompareFileTime(&find_file_data.ftCreationTime, // NOLINT
&comparison_filetime);
// File was created after or on comparison time
if ((result == 1) || (result == 0))
++file_count;
*/
// is we need file
//uint32_t nMatchLen = STRLEN(find_file_data.cFileName);
if (TRUE == pCollectRule->regExExclude.didCompile()
&& TRUE == pCollectRule->regExExclude.isMatchOnly(find_file_data.cFileName)
) { continue; }
if (FALSE == pCollectRule->regExInclude.isMatchOnly(find_file_data.cFileName)) { continue; }
// test file
// char_t strPath[MAX_PATH + 1] = {0};
// SNPRINTF(strPath, MAX_PATH, MAX_PATH, "%s/%s", pCollectRule->dir, find_file_data.cFileName);
// AutoReleaseFile autoRelFile(OpenFile(strPath, strAttrOpenRead));
// if (NULL == autoRelFile) { continue; }
// find map
FileNode* pFileNode;
if (MEM_NINI_LOG == collector_log_type) {
pFileNode = findFileNode(pCollectRule->mml_hash, find_file_data.cFileName);
}
else {
pFileNode = findFileNode(pCollectRule->hash, find_file_data.cFileName);
}
if (NULL == pFileNode) {
if (TRUE == m_bAfterToDay) {
// time control
SYSTEMTIME nCreateTime;
SYSTEMTIME stUTC;
if (FALSE == FileTimeToSystemTime(&(find_file_data.ftCreationTime), &stUTC)
|| FALSE == SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &nCreateTime)
) { continue; }
if (nCreateTime.wYear != today.tm_year + 1900
|| nCreateTime.wMonth != today.tm_mon + 1
|| nCreateTime.wDay != today.tm_mday
) { continue; }
}
// char_t strPath[MAX_PATH + 1] = {0};
// SNPRINTF(strPath, MAX_PATH, MAX_PATH, "%s/%s", pCollectRule->dir, find_file_data.cFileName);
// AutoReleaseFile AutoRelFile(::OpenFile(strPath, strAttrOpenRead));
// if (NULL == AutoRelFile) { continue; }
//
pFileNode = new FileNode(pCollectRule->dir
, MEM_NINI_LOG == collector_log_type ? pCollectRule->GetMMLDir() : NULL
, find_file_data.cFileName);
if (NULL == pFileNode) { continue; }
// update file info
FindData2FileInfo(&pFileNode->FileInfo(), find_file_data);
// add to map
addFileNode(pCollectRule->hash, pFileNode->LocalName(), pFileNode);
// new file
if (RC_S_OK != (pfn_cb)(/*this, */pFileNode, context)) { break; }
}
else {
ASSERT(pFileNode);
// update file info
PlatformFileInfo& fileInfo = pFileNode->FileInfo();
//.........这里部分代码省略.........