本文整理汇总了C++中FileName类的典型用法代码示例。如果您正苦于以下问题:C++ FileName类的具体用法?C++ FileName怎么用?C++ FileName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadData
// DataIO_OpenDx::ReadData()
int DataIO_OpenDx::ReadData(FileName const& fname,
DataSetList& datasetlist, std::string const& dsname)
{
// Add grid data set. Default to float for now.
DataSet* ds = datasetlist.AddSet( DataSet::GRID_FLT, dsname, "GRID" );
if (ds==0) return 1;
if (LoadGrid(fname.full(), *ds)) {
// Load failed. Erase grid data set.
datasetlist.RemoveSet( ds );
return 1;
}
return 0;
}
示例2: qmakeBuildConfiguration
///
/// Returns all arguments
/// That is: possbile subpath
/// spec
/// config arguemnts
/// moreArguments
/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path());
else if (shorted)
arguments << QDir::toNativeSeparators(QFileInfo(project()->projectFilePath()).fileName());
else
arguments << QDir::toNativeSeparators(project()->projectFilePath());
arguments << QLatin1String("-r");
bool userProvidedMkspec = false;
for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) {
userProvidedMkspec = true;
break;
}
}
}
FileName specArg = mkspec();
if (!userProvidedMkspec && !specArg.isEmpty())
arguments << QLatin1String("-spec") << specArg.toUserOutput();
// Find out what flags we pass on to qmake
arguments << bc->configCommandLineArguments();
arguments << deducedArguments();
QString args = QtcProcess::joinArgs(arguments);
// User arguments
QtcProcess::addArgs(&args, m_userArgs);
// moreArgumentsAfter
foreach (const QString &arg, deducedArgumentsAfter())
QtcProcess::addArg(&args, arg);
return args;
}
示例3: makeCommand
QString AndroidToolChain::makeCommand(const Environment &env) const
{
FileName makePath = AndroidConfigurations::currentConfig().makePath();
if (makePath.exists())
return makePath.toString();
const Utils::FileNameList extraDirectories
= Utils::transform(AndroidConfigurations::currentConfig().makeExtraSearchDirectories(),
[](const QString &s) { return Utils::FileName::fromString(s); });
if (HostOsInfo::isWindowsHost()) {
makePath = env.searchInPath("ma-make.exe", extraDirectories);
if (!makePath.isEmpty())
return makePath.toString();
makePath = env.searchInPath("mingw32-make", extraDirectories);
return makePath.isEmpty() ? QLatin1String("mingw32-make") : makePath.toString();
}
makePath = env.searchInPath("make", extraDirectories);
return makePath.isEmpty() ? "make" : makePath.toString();
}
示例4: main
/* main function in embree namespace */
int main(int argc, char** argv)
{
/* create stream for parsing */
Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));
/* parse command line */
parseCommandLine(stream, FileName());
if (g_numThreads)
g_rtcore += ",threads=" + std::stringOf(g_numThreads);
if (g_numBenchmarkFrames)
g_rtcore += ",benchmark=1";
/* load scene */
if (filename.str() != "")
loadOBJ(filename,one,g_obj_scene);
/* initialize ray tracing core */
init(g_rtcore.c_str());
/* send model */
set_scene(&g_obj_scene);
/* benchmark mode */
if (g_numBenchmarkFrames)
renderBenchmark(outFilename);
/* render to disk */
if (outFilename.str() != "")
renderToFile(outFilename);
/* interactive mode */
if (g_interactive) {
initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
enterWindowRunLoop();
}
return 0;
}
示例5: runSvn
SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
const QStringList &arguments, int timeOut,
unsigned flags, QTextCodec *outputCodec) const
{
const FileName executable = m_settings.binaryPath();
SubversionResponse response;
if (executable.isEmpty()) {
response.error = true;
response.message =tr("No subversion executable specified.");
return response;
}
const SynchronousProcessResponse sp_resp =
VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOut,
flags, outputCodec);
response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error)
response.message = sp_resp.exitMessage(executable.toString(), timeOut);
response.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut;
return response;
}
示例6: loadHairBin
int loadHairBin(const FileName& fileName, OBJScene::HairSet* hairset, Vec3fa& offset)
{
FILE* fin = fopen(fileName.c_str(),"rb");
if (!fin) THROW_RUNTIME_ERROR("could not open " + fileName.str());
int magick; fread(&magick,sizeof(int),1,fin);
if (magick != hair_bin_magick)
THROW_RUNTIME_ERROR("invalid binary hair file " + fileName.str());
int numHairs; fread(&numHairs,sizeof(int),1,fin);
int numPoints; fread(&numPoints,sizeof(int),1,fin);
int numSegments; fread(&numSegments,sizeof(int),1,fin);
hairset->v.resize(numPoints);
hairset->hairs.resize(numSegments);
if (numPoints) fread(&hairset->v[0],sizeof(Vec3fa),numPoints,fin);
if (numSegments) fread(&hairset->hairs[0],sizeof(OBJScene::Hair),numSegments,fin);
fclose(fin);
for (size_t i=0; i<numPoints; i++) {
hairset->v[i].x-=offset.x;
hairset->v[i].y-=offset.y;
hairset->v[i].z-=offset.z;
}
return numHairs;
}
示例7: parse
void TestProject::checkCurrent()
{
Project* project = SessionManager::startupProject ();
CustomRunConfiguration* configuration = parse (project);
if (configuration == NULL)
{
return;
}
IDocument* document = EditorManager::currentDocument ();
if (document == NULL)
{
return;
}
FileName file = document->filePath();
QStringList files = project->files (Project::ExcludeGeneratedFiles);
if (!files.contains (file.toString ()))
{
return;
}
runTestsForFiles (FileNameList () << file, configuration);
}
示例8: setup
void QmakeKitInformation::setup(Kit *k)
{
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version)
return;
FileName spec = QmakeKitInformation::mkspec(k);
if (spec.isEmpty())
spec = version->mkspec();
ToolChain *tc = ToolChainKitInformation::toolChain(k);
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
ToolChain *possibleTc = 0;
foreach (ToolChain *current, ToolChainManager::toolChains()) {
if (version->qtAbis().contains(current->targetAbi())) {
possibleTc = current;
if (current->suggestedMkspecList().contains(spec))
break;
}
}
ToolChainKitInformation::setToolChain(k, possibleTc);
}
示例9: storeExr
/*! store an EXR file to disk */
void storeExr(const Ref<Image>& img, const FileName& filename)
{
Imf::Array2D<Imf::Rgba> pixels(img->height,img->width);
for (size_t y=0; y<img->height; y++) {
for (size_t x=0; x<img->width; x++) {
const Color4 c = img->get(x,y);
pixels[y][x] = Imf::Rgba(c.r,c.g,c.b,c.a);
}
}
Imf::RgbaOutputFile file(filename.c_str(), img->width, img->height, Imf::WRITE_RGBA);
file.setFrameBuffer(&pixels[0][0], 1, img->width);
file.writePixels(img->height);
}
示例10: loadMap
bool IOMapOTMM::loadMap(Map& map, const FileName& identifier, bool showdialog) {
if(showdialog) gui.CreateLoadBar(wxT("Loading OTMM map..."));
DiskNodeFileReadHandle f(nstr(identifier.GetFullPath()));
if(f.isOk() == false) {
error(wxT("Couldn't open file for reading\nThe error reported was: ") + wxstr(f.getErrorMessage()));
return false;
}
bool ret = loadMap(map, f, identifier, showdialog);
if(showdialog) gui.DestroyLoadBar();
return ret;
}
示例11: as_lower_str
bool Materials::unserializeMaterials(const FileName& filename, pugi::xml_node node, wxString& error, wxArrayString& warnings)
{
wxString warning;
pugi::xml_attribute attribute;
for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) {
const std::string& childName = as_lower_str(childNode.name());
if(childName == "include") {
if(!(attribute = childNode.attribute("file"))) {
continue;
}
FileName includeName;
includeName.SetPath(filename.GetPath());
includeName.SetFullName(wxString(attribute.as_string(), wxConvUTF8));
wxString subError;
if(!loadMaterials(includeName, subError, warnings)) {
warnings.push_back("Error while loading file \"" + includeName.GetFullName() + "\": " + subError);
}
} else if(childName == "metaitem") {
g_items.loadMetaItem(childNode);
} else if(childName == "border") {
g_brushes.unserializeBorder(childNode, warnings);
if(warning.size()) {
warnings.push_back("materials.xml: " + warning);
}
} else if(childName == "brush") {
g_brushes.unserializeBrush(childNode, warnings);
if(warning.size()) {
warnings.push_back("materials.xml: " + warning);
}
} else if(childName == "tileset") {
unserializeTileset(childNode, warnings);
}
}
return true;
}
示例12: LYXERR
bool ConverterCache::copy(FileName const & orig_from, string const & to_format,
FileName const & dest) const
{
if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty())
return false;
LYXERR(Debug::FILES, orig_from << ' ' << to_format << ' ' << dest);
// FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") {
FileName const dest_eps(changeExtension(dest.absFileName(), "eps"));
if (!copy(orig_from, "eps", dest_eps))
return false;
} else if (to_format == "pdftex") {
FileName const dest_pdf(changeExtension(dest.absFileName(), "pdf"));
if (!copy(orig_from, "pdf", dest_pdf))
return false;
}
CacheItem * const item = pimpl_->find(orig_from, to_format);
LASSERT(item, /**/);
Mover const & mover = getMover(to_format);
return mover.copy(item->cache_name, dest,
onlyFileName(dest.absFileName()));
}
示例13: clear
int MetaDataTable::read(const FileName &filename, const std::string &name, std::vector<EMDLabel> *desiredLabels)
{
// Clear current table
clear();
std::ifstream in(filename.data(), std::ios_base::in);
if (in.fail())
REPORT_ERROR( (std::string) "MetaDataTable::read: File " + filename + " does not exists" );
FileName ext = filename.getFileFormat();
if (ext =="star")
{
//REPORT_ERROR("readSTAR not implemented yet...");
return readStar(in, name, desiredLabels);
}
else
{
REPORT_ERROR("MetaDataTable::read ERROR: metadatatable should have .star extension");
}
in.close();
}
示例14: restoreQtVersions
void QtVersionManager::extensionsInitialized()
{
bool success = restoreQtVersions();
m_instance->updateFromInstaller(false);
if (!success) {
// We did neither restore our settings or upgraded
// in that case figure out if there's a qt in path
// and add it to the Qt versions
findSystemQt();
}
emit m_instance->qtVersionsLoaded();
emit m_instance->qtVersionsChanged(m_versions.keys(), QList<int>(), QList<int>());
saveQtVersions();
const FileName configFileName = globalSettingsFileName();
if (configFileName.toFileInfo().exists()) {
m_configFileWatcher = new FileSystemWatcher(m_instance);
connect(m_configFileWatcher, SIGNAL(fileChanged(QString)),
m_fileWatcherTimer, SLOT(start()));
m_configFileWatcher->addFile(configFileName.toString(),
FileSystemWatcher::WatchModifiedDate);
} // exists
}
示例15: lock
AbstractFSProvider::status_t ZIPProvider::dir(const FileName & url, std::list<
FileName> & result, uint8_t flags) {
std::lock_guard<std::mutex> lock(handlesMutex);
std::string archiveFileName;
FileName localPath;
decomposeURL(url, archiveFileName, localPath);
ZIPHandle * handle = getZIPHandle(archiveFileName);
if (handle == nullptr) {
return FAILURE;
}
// Make sure all data has been written.
if (handle->isChanged()) {
delete handle;
openHandles.erase(archiveFileName);
handle = getZIPHandle(archiveFileName);
}
if (handle == nullptr) {
return OK;
}
return handle->dir(localPath.getDir(), result, flags);
}