本文整理汇总了C++中FileInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ FileInfo函数的具体用法?C++ FileInfo怎么用?C++ FileInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FileInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char* argv[])
{
FileInfo info(argv[1]);
cout << "1 -- " << endl;
cout << " Basename = " << info.Basename() << endl;
cout << " dirname = " << info.dirname() << endl;
cout << " realpath = " << info.realpath() << endl;
cout << endl << "2 -- " << endl;
cout << " Basename = " << FileInfo(argv[1]).Basename() << endl;
cout << " dirname = " << FileInfo(argv[1]).dirname() << endl;
cout << " realpath = " << FileInfo(argv[1]).realpath() << endl;
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:13,代码来源:FileInfo.cpp
示例2: AddModelReference
bool CModelManager::AddModelReference(const std::string& fileName, bool mirrored, int objRank)
{
auto it = m_models.find(FileInfo(fileName, mirrored));
if (it == m_models.end())
{
if (!LoadModel(fileName, mirrored))
return false;
it = m_models.find(FileInfo(fileName, mirrored));
}
m_engine->SetObjectBaseRank(objRank, (*it).second.baseObjRank);
return true;
}
开发者ID:pol51,项目名称:colobot,代码行数:15,代码来源:modelmanager.cpp
示例3: File
bool TPluginSpecPrivate::Read(const QString &SpecFile)
{
Name = Version = /*CompatVersion =*/ Vendor = Copyright = License = Description = Url = /*Location =*/ "";
State = TPluginSpec::Invalid;
HasError = false;
ErrorString = "";
Dependencies.clear();
QFile File(SpecFile);
if(!File.exists())
return ReportError(QString("TPluginSpecPrivate::Read(const QString &SpecFile): File does not exist: %1").arg(File.fileName()));
if(!File.open(QIODevice::ReadOnly))
return ReportError(QString("TPluginSpecPrivate::Read(const QString &SpecFile): Could not open file for read: %1").arg(File.fileName()));
QFileInfo FileInfo(File);
Location = FileInfo.absolutePath();
//FilePath = fileInfo.absoluteFilePath();
QXmlStreamReader XmlReader(&File);
while(!XmlReader.atEnd())
{
XmlReader.readNext();
if(XmlReader.tokenType() == QXmlStreamReader::StartElement)
ReadPluginSpec(XmlReader);
}
if(XmlReader.hasError())
return ReportError(QString("TPluginSpecPrivate::Read(const QString &SpecFile): Error parsing file %1: %2, at line %3, column %4")
.arg(File.fileName()).arg(XmlReader.errorString()).arg(XmlReader.lineNumber()).arg(XmlReader.columnNumber()));
State = TPluginSpec::Read;
return true;
}
开发者ID:DimanNe,项目名称:eventmanager,代码行数:34,代码来源:TPluginSpec.cpp
示例4: s
bool DatabaseWrapperBase::LookupAttachment(FileInfo& attachment,
int64_t id,
FileContentType contentType)
{
SQLite::Statement s(db_, SQLITE_FROM_HERE,
"SELECT uuid, uncompressedSize, compressionType, compressedSize, uncompressedMD5, compressedMD5 FROM AttachedFiles WHERE id=? AND fileType=?");
s.BindInt64(0, id);
s.BindInt(1, contentType);
if (!s.Step())
{
return false;
}
else
{
attachment = FileInfo(s.ColumnString(0),
contentType,
s.ColumnInt64(1),
s.ColumnString(4),
static_cast<CompressionType>(s.ColumnInt(2)),
s.ColumnInt64(3),
s.ColumnString(5));
return true;
}
}
开发者ID:ming-hai,项目名称:orthanc,代码行数:25,代码来源:DatabaseWrapperBase.cpp
示例5: getFileListFromZip
void getFileListFromZip(VectorFileInfo& _result, const char*_zipfile, const std::string& _folder, const std::string& filename)
{
unzFile pFile = NULL;
std::string path = _folder + filename;
bool isDir = false;
pFile = unzOpen(_zipfile);
if (!pFile)
return;
do
{
int nRet = unzLocateFile(pFile, path.c_str(), 1);
CC_BREAK_IF(UNZ_OK != nRet);
char szFilePathA[260];
unz_file_info unzInfo;
nRet = unzGetCurrentFileInfo(pFile, &unzInfo, szFilePathA, sizeof(szFilePathA), NULL, 0, NULL, 0);
CC_BREAK_IF(UNZ_OK != nRet);
if (szFilePathA[unzInfo.size_filename - 1] == '/' ||
szFilePathA[unzInfo.size_filename - 1] == '\\')
isDir = true;
else
isDir = false;
_result.push_back(FileInfo(filename, isDir));
} while (0);
unzClose(pFile);
}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:31,代码来源:FileSystemInfo_android.cpp
示例6: Voxels
void QVolumeSocketData::Send(QBaseSocket* Socket, QByteArray& Data)
{
QByteArray Voxels((char*)this->Voxels, this->NoBytes);
QByteArray ByteArray;
QDataStream DataStream(&ByteArray, QIODevice::WriteOnly);
DataStream.setVersion(QDataStream::Qt_4_0);
QFileInfo FileInfo(this->FileName);
DataStream << FileInfo.fileName();
DataStream << this->Resolution[0];
DataStream << this->Resolution[1];
DataStream << this->Resolution[2];
DataStream << this->Spacing[0];
DataStream << this->Spacing[1];
DataStream << this->Spacing[2];
DataStream << Voxels;
DataStream << this->NoBytes;
QSocketData::Send(Socket, ByteArray);
}
开发者ID:ChuckDanglars,项目名称:exposure-render.exposurerender,代码行数:25,代码来源:volumesocketdata.cpp
示例7: ListFilesInDirectory
bool ListFilesInDirectory(const String & directoryPath, std::vector<FileInfo> & fi)
{
WIN32_FIND_DATA findData;
HANDLE hFind;
// "C:\Windows" needs to be "C:\Windows\*" for FindFirstFile to work
String workingDirPath = directoryPath;
workingDirPath.append(L"\\*");
hFind = FindFirstFile(workingDirPath.c_str(), &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
return false;
}
do
{
// exclude '.' & '..'
String filename (findData.cFileName);
if (filename != L"." && filename != L"..")
{
fi.push_back(FileInfo(directoryPath, filename));
}
}
while (FindNextFile(hFind, &findData));
DWORD err = GetLastError();
// no files left, we listed all of them
return err == ERROR_NO_MORE_FILES;
}
开发者ID:pdoogs,项目名称:mealplan,代码行数:32,代码来源:fileio.cpp
示例8: PrepareForGeneration
// Calls all writing functions and generates 3D files.
void TrackGen::Generate()
{
PrepareForGeneration();
CreateSegment();
// Decides whether to generate X segments, or keep adding until a minimum length is met.
if (_segmentLimit != -1)
_totalLength = std::numeric_limits<float>::max();
else
_segmentLimit = INT_MAX;
CreateSegment();
while (_totalLength < _lengthLowerLimit)// && _sectionNumber < _segmentLimit)
{
if (rand() % 100 < 70)
CreateCurveSegment();
else
CreateSegment();
}
ConnectToEnd();
if (_returnCode)
{
std::cout << "Intersection";
return;
}
// If X position of final segment is not within 0.01 of starting point, the track is deemed to have not connected.
if (_segmentList.back()->GetEndPos().x > 0.01 || _segmentList.at(_segmentList.size()-1)->GetEndPos().x < -0.01)
{
std::cout << "No end meet.";
_returnCode = true;
return;
}
WriteSegmentsToXML();
// Generate 3D files and copy files.
std::string generateName;
// Copy files into track directory.
if (_torcsDirectory.length() > 0)
{
generateName = "\"" + _torcsDirectory + "//trackgen.exe\" -c road -n " + _trackName;
system(generateName.c_str());
std::string copyCommand = "copy \"tracks\\road\\" + _trackName + "\" \"" + _torcsDirectory + "\\tracks\\road\\" + _trackName;
system(copyCommand.c_str());
// Remove temporary folder from directory.
std::string removeFolder = "RD tracks /S /Q";
system(removeFolder.c_str());
}
else
{
generateName = "trackgen.exe -c road -n " + _trackName;
system(generateName.c_str());
}
FileInfo();
}
开发者ID:jblakeLincoln,项目名称:TORCStrackgen,代码行数:61,代码来源:TrackGen.cpp
示例9: main
int main(int argc, char** argv)
{
const s_plf_version_info * libplf_version;
printf("\n\nplfinfo\n");
printf("****************\n");
printf("2011 & 2015 scorp2kk & @SteveClement\n");
printf("\n\n");
libplf_version = plf_lib_get_version();
printf("libplf Version: %d.%d.%d\n\n", libplf_version->major, libplf_version->minor, libplf_version->bugfix);
if (parse_options(argc, argv) < 0 || input_file_name == 0)
{
print_help("plfinfo");
return 0;
}
printf("Input file: %s\n", input_file_name);
FileInfo(input_file_name);
printf("==> DONE <==\n\n");
return 0;
}
开发者ID:Rafiot,项目名称:ardrone-tool,代码行数:27,代码来源:plfinfo.c
示例10: RemoveAllFiles
void
CBFileListTable::ReadSetup
(
istream& input,
const JFileVersion vers
)
{
RemoveAllFiles();
JSize fileCount;
input >> fileCount;
StopListening(GetFullNameDataList());
JString fileName;
for (JIndex i=1; i<=fileCount; i++)
{
JFAID_t id;
time_t t;
input >> fileName >> id >> t;
JIndex index;
const JBoolean isNew = JXFileListTable::AddFile(fileName, &index);
assert( isNew );
itsFileInfo->InsertElementAtIndex(index, FileInfo(id, t));
}
ListenTo(GetFullNameDataList());
if (vers >= 80)
{
input >> itsLastUniqueID;
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:34,代码来源:CBFileListTable.cpp
示例11: opendir
void DirectoryNavigation::SetDestinationPath(const string& path)
{
_currentDirectory = path;
_dirName.clear();
DIR *d = opendir(path.c_str());
dirent* dir;
if(d)
{
while((dir = readdir(d)) != NULL)
{
IconType icon = FindType(dir);
_dirName.push_back(FileInfo(dir->d_name, icon));
}
closedir(d);
}
_dirName.pop_front();
_dirName.pop_front();
std::sort(_dirName.begin(), _dirName.end());
}
开发者ID:EQ4,项目名称:axLib,代码行数:25,代码来源:main.cpp
示例12: chunk
void Manifest::awaken(Origin origin) const
{
if (!m_remote.at(origin)) return;
const std::size_t chunk(origin / m_chunkSize * m_chunkSize);
const auto m(m_endpoint.getSubEndpoint("m"));
const auto bytes(io::ensureGet(m, std::to_string(chunk)));
const auto json(parse(bytes->data()));
std::lock_guard<std::mutex> lock(m_mutex);
if (!json.isArray())
{
throw std::runtime_error(
"Invalid file-info chunk - expected array: " +
json.toStyledString());
}
else if (json.size() != std::min(m_chunkSize, size() - chunk))
{
throw std::runtime_error("Invalid file-info chunk - unexpected size");
}
std::size_t i(chunk);
for (const auto& f : json)
{
m_fileInfo.at(i) = FileInfo(f);
m_remote.at(i) = false;
++i;
}
}
开发者ID:json87,项目名称:entwine,代码行数:30,代码来源:manifest.cpp
示例13: IsDirectory
// Returns true if the path exists and is a directory
bool IsDirectory(const std::string& path)
{
#ifdef _WIN32
return PathIsDirectory(UTF8ToUTF16(path).c_str());
#else
return FileInfo(path).IsDirectory();
#endif
}
开发者ID:Tilka,项目名称:dolphin,代码行数:9,代码来源:FileUtil.cpp
示例14: GetModelBaseObjRank
int CModelManager::GetModelBaseObjRank(const std::string& fileName, bool mirrored)
{
auto it = m_models.find(FileInfo(fileName, mirrored));
if (it == m_models.end())
return -1;
return (*it).second.baseObjRank;
}
开发者ID:pol51,项目名称:colobot,代码行数:8,代码来源:modelmanager.cpp
示例15: FileInfo
SourceIndex::FileInfo FileInfo::getFileInfo(ConstStrW fname)
{
IFileIOServices &svc = IFileIOServices::getIOServices();
PFolderIterator iter = svc.getFileInfo(fname);
return FileInfo(FilePath(iter->getFullPath(), false), iter->getModifiedTime());
}
开发者ID:ondra-novak,项目名称:sourceIndex,代码行数:8,代码来源:fileInfo.cpp
示例16: FileInfo
FileInfo RunManager_Util::dirFile(QFileInfo fi)
{
fi.refresh();
return FileInfo(toString(fi.fileName()),
(fi.exists()&&fi.lastModified().isValid())?toDateTime(fi.lastModified()):openstudio::DateTime(),
toString(fi.fileName()), /* The default key is the filename */
toPath(fi.absoluteFilePath()),
fi.exists());
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:9,代码来源:RunManager_Util.cpp
示例17: getInfo
static const FileInfo * getInfo(const char *filename) {
set<FileInfo>::iterator it = FileInfo::cActiveFileInfo.find(FileInfo(filename));
if(it != FileInfo::cActiveFileInfo.end()) {
return &(*it);
}
else {
return NULL;
}
}
开发者ID:LuaAV,项目名称:LuaAV,代码行数:9,代码来源:luaav_filewatcher_linux.cpp
示例18: tpath
FileInfoMap FileSystem::filesInfoFromPath( const std::string& path )
{
FileInfoMap files;
String tpath( path );
if ( tpath[ tpath.size() - 1 ] == '/' || tpath[ tpath.size() - 1 ] == '\\' )
{
tpath += "*";
}
else
{
tpath += "\\*";
}
WIN32_FIND_DATAW findFileData;
HANDLE hFind = FindFirstFileW( (LPCWSTR)tpath.toWideString().c_str(), &findFileData );
if( hFind != INVALID_HANDLE_VALUE )
{
std::string name( String( findFileData.cFileName ).toUtf8() );
std::string fpath( path + name );
if ( name != "." && name != ".." )
{
files[ name ] = FileInfo( fpath );
}
while( FindNextFileW( hFind, &findFileData ) )
{
name = String( findFileData.cFileName ).toUtf8();
fpath = path + name;
if ( name != "." && name != ".." )
{
files[ name ] = FileInfo( fpath );
}
}
FindClose( hFind );
}
return files;
}
开发者ID:090809,项目名称:TrinityCore,代码行数:44,代码来源:FileSystemImpl.cpp
示例19: UnloadModel
void CModelManager::UnloadModel(const std::string& fileName, bool mirrored)
{
auto it = m_models.find(FileInfo(fileName, mirrored));
if (it == m_models.end())
return;
m_engine->DeleteBaseObject((*it).second.baseObjRank);
m_models.erase(it);
}
开发者ID:pol51,项目名称:colobot,代码行数:10,代码来源:modelmanager.cpp
示例20: search
void FileEx::ListDirectory()
{
pos = 0;
topline = 0;
std::tstring search(path);
search += _T("\\*");
WIN32_FIND_DATA fd;
HANDLE hFile = ::FindFirstFile(search.c_str(), &fd);
if (hFile == INVALID_HANDLE_VALUE)
{
DWORD dwError = ::GetLastError();
std::tcerr << _T("::FindFirstFile failed. : ") << dwError << std::endl;
path = path.substr(0, path.find_last_of(_T("\\")));
::FindClose(hFile);
return;
}
filelist.clear();
std::list<FileInfo> dirlist;
std::list<FileInfo> normallist;
do {
if (fd.cFileName == std::tstring(_T(".")))
continue;
bool bDir = ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
if (bDir)
dirlist.push_back(FileInfo(fd.cFileName, bDir));
else
normallist.push_back(FileInfo(fd.cFileName, bDir));
} while (::FindNextFile(hFile, &fd));
filelist.insert(filelist.cend(), dirlist.begin(), dirlist.end());
filelist.insert(filelist.cend(), normallist.begin(), normallist.end());
::FindClose(hFile);
}
开发者ID:JustKnownOne,项目名称:WindowsPlatform,代码行数:41,代码来源:FileEx.cpp
注:本文中的FileInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论