本文整理汇总了C++中fileName类的典型用法代码示例。如果您正苦于以下问题:C++ fileName类的具体用法?C++ fileName怎么用?C++ fileName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fileName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dstFile
bool Foam::dynamicCode::createMakeFiles() const
{
// Create Make/files
if (compileFiles_.empty())
{
return false;
}
const fileName dstFile(this->codePath()/"Make/files");
// Create dir
mkDir(dstFile.path());
OFstream os(dstFile);
//Info<< "Writing to " << dstFile << endl;
if (!os.good())
{
FatalErrorInFunction
<< "Failed writing " << dstFile
<< exit(FatalError);
}
writeCommentSHA1(os);
// Write compile files
forAll(compileFiles_, fileI)
{
os.writeQuoted(compileFiles_[fileI], false) << nl;
}
开发者ID:rezads1,项目名称:OpenFOAM-dev,代码行数:29,代码来源:dynamicCode.C
示例2: WarningIn
// Create a softlink. dst should not exist. Returns true if successful.
bool Foam::ln(const fileName& src, const fileName& dst)
{
if (POSIX::debug)
{
Info<< "Create softlink from : " << src << " to " << dst
<< endl;
}
if (exists(dst))
{
WarningIn("ln(const fileName&, const fileName&)")
<< "destination " << dst << " already exists. Not linking."
<< endl;
return false;
}
if (!exists(src))
{
WarningIn("ln(const fileName&, const fileName&)")
<< "source " << src << " does not exist." << endl;
return false;
}
if (symlink(src.c_str(), dst.c_str()) == 0)
{
return true;
}
else
{
WarningIn("ln(const fileName&, const fileName&)")
<< "symlink from " << src << " to " << dst << " failed." << endl;
return false;
}
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:35,代码来源:POSIX.C
示例3: readSurface
void triSurf::readSurface(const fileName& fName)
{
if( fName.ext() == "fms" || fName.ext() == "FMS" )
{
readFromFMS(fName);
}
else if( fName.ext() == "ftr" || fName.ext() == "FTR" )
{
readFromFTR(fName);
}
else
{
triSurface copySurface(fName);
//- copy the points
triSurfPoints::points_.setSize(copySurface.points().size());
forAll(copySurface.points(), pI)
triSurfPoints::points_[pI] = copySurface.points()[pI];
//- copy the triangles
triSurfFacets::triangles_.setSize(copySurface.size());
forAll(copySurface, tI)
triSurfFacets::triangles_[tI] = copySurface[tI];
//- copy patches
triSurfFacets::patches_ = copySurface.patches();
}
}
开发者ID:kel85uk,项目名称:cfMesh,代码行数:28,代码来源:triSurf.C
示例4: base
void Foam::ensightSetWriter<Type>::write
(
const coordSet& points,
const wordList& valueSetNames,
const List<const Field<Type>*>& valueSets,
Ostream& os
) const
{
const fileName base(os.name().lessExt());
const fileName meshFile(base + ".mesh");
// Write .case file
os << "FORMAT" << nl
<< "type: ensight gold" << nl
<< nl
<< "GEOMETRY" << nl
<< "model: 1 " << meshFile.name().c_str() << nl
<< nl
<< "VARIABLE"
<< nl;
forAll(valueSetNames, setI)
{
fileName dataFile(base + ".***." + valueSetNames[setI]);
os.setf(ios_base::left);
os << pTraits<Type>::typeName
<< " per node: 1 "
<< setw(15) << valueSetNames[setI]
<< " " << dataFile.name().c_str()
<< nl;
}
开发者ID:ADGlassby,项目名称:OpenFOAM-2.2.x,代码行数:31,代码来源:ensightSetWriter.C
示例5: ifPtr_
Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
:
ifPtr_(NULL),
compression_(IOstream::UNCOMPRESSED)
{
if (pathname.empty())
{
if (IFstream::debug)
{
Info<< "IFstreamAllocator::IFstreamAllocator(const fileName&) : "
"cannot open null file " << endl;
}
}
ifPtr_ = new ifstream(pathname.c_str());
// If the file is compressed, decompress it before reading.
if (!ifPtr_->good() && isFile(pathname + ".gz", false))
{
if (IFstream::debug)
{
Info<< "IFstreamAllocator::IFstreamAllocator(const fileName&) : "
"decompressing " << pathname + ".gz" << endl;
}
delete ifPtr_;
ifPtr_ = new igzstream((pathname + ".gz").c_str());
if (ifPtr_->good())
{
compression_ = IOstream::COMPRESSED;
}
}
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:35,代码来源:IFstream.C
示例6: New
Foam::autoPtr<Foam::edgeMesh> Foam::edgeMesh::New(const fileName& name)
{
word ext = name.ext();
if (ext == "gz")
{
ext = name.lessExt().ext();
}
return New(name, ext);
}
开发者ID:petebachant,项目名称:OpenFOAM-dev,代码行数:9,代码来源:edgeMeshNew.C
示例7: New
Foam::autoPtr<Foam::UnsortedMeshedSurface<Face>>
Foam::UnsortedMeshedSurface<Face>::New(const fileName& name)
{
word ext = name.ext();
if (ext == "gz")
{
ext = name.lessExt().ext();
}
return New(name, ext);
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:11,代码来源:UnsortedMeshedSurfaceNew.C
示例8: canReadType
bool Foam::UnsortedMeshedSurface<Face>::canRead
(
const fileName& name,
const bool verbose
)
{
word ext = name.ext();
if (ext == "gz")
{
ext = name.lessExt().ext();
}
return canReadType(ext, verbose);
}
开发者ID:degirmen,项目名称:openfoam-extend-OpenFOAM-1.6-ext,代码行数:13,代码来源:UnsortedMeshedSurface.C
示例9: read
bool Foam::edgeMesh::read(const fileName& name)
{
word ext = name.ext();
if (ext == "gz")
{
fileName unzipName = name.lessExt();
return read(unzipName, unzipName.ext());
}
else
{
return read(name, ext);
}
}
开发者ID:AmaneShino,项目名称:OpenFOAM-2.0.x,代码行数:13,代码来源:edgeMeshIO.C
示例10: canReadType
bool Foam::edgeMesh::canRead
(
const fileName& name,
const bool verbose
)
{
word ext = name.ext();
if (ext == "gz")
{
ext = name.lessExt().ext();
}
return canReadType(ext, verbose);
}
开发者ID:will-bainbridge,项目名称:OpenFOAM-dev,代码行数:13,代码来源:edgeMesh.C
示例11: mkDir
bool mkDir(const fileName& pathName, const mode_t mode)
{
if (pathName.empty())
{
return false;
}
bool success = ::CreateDirectory(pathName.c_str(), NULL);
if (success)
{
chMod(pathName, mode);
}
else
{
const DWORD error = ::GetLastError();
switch (error)
{
case ERROR_ALREADY_EXISTS:
{
success = true;
break;
}
case ERROR_PATH_NOT_FOUND:
{
// Part of the path does not exist so try to create it
const fileName& parentName = pathName.path();
if (parentName.size() && mkDir(parentName, mode))
{
success = mkDir(pathName, mode);
}
break;
}
}
if (!success)
{
FatalErrorIn("mkDir(const fileName&, mode_t)")
<< "Couldn't create directory: " << pathName
<< " " << MSwindows::getLastError()
<< exit(FatalError);
}
}
return success;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:foam-extend-foam-extend-3.2,代码行数:50,代码来源:MSwindows.C
示例12: exit
void Foam::edgeMesh::write
(
const fileName& name,
const edgeMesh& mesh
)
{
if (debug)
{
Info<< "edgeMesh::write"
"(const fileName&, const edgeMesh&) : "
"writing to " << name
<< endl;
}
const word ext = name.ext();
writefileExtensionMemberFunctionTable::iterator mfIter =
writefileExtensionMemberFunctionTablePtr_->find(ext);
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
{
FatalErrorIn
(
"MeshedSurface::write"
"(const fileName&, const MeshedSurface&)"
) << "Unknown file extension " << ext << nl << nl
<< "Valid types are :" << endl
<< writefileExtensionMemberFunctionTablePtr_->sortedToc()
<< exit(FatalError);
}
else
{
mfIter()(name, mesh);
}
}
开发者ID:AmaneShino,项目名称:OpenFOAM-2.0.x,代码行数:35,代码来源:edgeMeshIO.C
示例13: ostr
void writePointSet
(
const bool binary,
const vtkMesh& vMesh,
const pointSet& set,
const fileName& fileName
)
{
std::ofstream ostr(fileName.c_str());
writeFuns::writeHeader
(
ostr,
binary,
set.name()
);
ostr<< "DATASET POLYDATA" << std::endl;
//------------------------------------------------------------------
//
// Write topology
//
//------------------------------------------------------------------
// Write points
ostr<< "POINTS " << set.size() << " float" << std::endl;
DynamicList<floatScalar> ptField(3*set.size());
writeFuns::insert
(
UIndirectList<point>(vMesh.mesh().points(), set.toc())(),
ptField
);
writeFuns::write(ostr, binary, ptField);
//-----------------------------------------------------------------
//
// Write data
//
//-----------------------------------------------------------------
// Write faceID
ostr
<< "POINT_DATA " << set.size() << std::endl
<< "FIELD attributes 1" << std::endl;
// Cell ids first
ostr<< "pointID 1 " << set.size() << " int" << std::endl;
labelList pointIDs(set.toc());
writeFuns::write(ostr, binary, pointIDs);
}
开发者ID:EricAlex,项目名称:OpenFOAM-dev,代码行数:60,代码来源:writePointSet.C
示例14: getRootCase
void getRootCase(fileName& casePath)
{
casePath.clean();
if (casePath.empty() || casePath == ".")
{
// handle degenerate form and '.'
casePath = cwd();
}
else if (casePath[0] != '/' && casePath.name() == "..")
{
// avoid relative cases ending in '..' - makes for very ugly names
casePath = cwd()/casePath;
casePath.clean();
}
}
开发者ID:Mat-moran,项目名称:OpenFOAM-2.0.x,代码行数:16,代码来源:mergeMeshes.C
示例15: dstName
//- Rename to a corresponding backup file
// If the backup file already exists, attempt with "01" .. "99" index
bool Foam::mvBak(const fileName& src, const std::string& ext)
{
if (POSIX::debug)
{
Info<< "mvBak : " << src << " to extension " << ext << endl;
}
if (exists(src, false))
{
const int maxIndex = 99;
char index[3];
for (int n = 0; n <= maxIndex; n++)
{
fileName dstName(src + "." + ext);
if (n)
{
sprintf(index, "%02d", n);
dstName += index;
}
// avoid overwriting existing files, except for the last
// possible index where we have no choice
if (!exists(dstName, false) || n == maxIndex)
{
return rename(src.c_str(), dstName.c_str()) == 0;
}
}
}
// fall-through: nothing to do
return false;
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:36,代码来源:POSIX.C
示例16: writeTypes
void Foam::MeshedSurfaceProxy<Face>::write
(
const fileName& name,
const MeshedSurfaceProxy& surf
)
{
if (debug)
{
Info<< "MeshedSurfaceProxy::write"
"(const fileName&, const MeshedSurfaceProxy&) : "
"writing to " << name
<< endl;
}
word ext = name.ext();
typename writefileExtensionMemberFunctionTable::iterator mfIter =
writefileExtensionMemberFunctionTablePtr_->find(ext);
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
{
FatalErrorIn
(
"MeshedSurfaceProxy::write(const fileName&)"
) << "Unknown file extension " << ext << nl << nl
<< "Valid types are :" << endl
<< writeTypes()
<< exit(FatalError);
}
mfIter()(name, surf);
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例17: IFstream
bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
(
const fileName& filename
)
{
const bool mustTriangulate = this->isTri();
this->clear();
fileName baseName = filename.lessExt();
// STAR-CD index of points
List<label> pointId;
// read points from .vrt file
readPoints
(
IFstream(baseName + ".vrt")(),
this->storedPoints(),
pointId
);
// Build inverse mapping (STAR-CD pointId -> index)
Map<label> mapPointId(2*pointId.size());
forAll(pointId, i)
{
mapPointId.insert(pointId[i], i);
}
开发者ID:,项目名称:,代码行数:27,代码来源:
示例18: isDir
// Does the directory exist
bool isDir(const fileName& name)
{
const DWORD attrs = ::GetFileAttributes(name.c_str());
bool success = (attrs != INVALID_FILE_ATTRIBUTES) &&
(attrs & FILE_ATTRIBUTE_DIRECTORY);
return success;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:foam-extend-foam-extend-3.2,代码行数:9,代码来源:MSwindows.C
示例19: exists
// Does the name exist in the filing system?
bool exists(const fileName& name, const bool checkGzip)
{
const DWORD attrs = ::GetFileAttributes(name.c_str());
const bool success = (attrs != INVALID_FILE_ATTRIBUTES) ||
(checkGzip && isGzFile(name));
return success;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:foam-extend-foam-extend-3.2,代码行数:9,代码来源:MSwindows.C
示例20: dlSym
void Foam::codedFunctionObject::unloadLibrary
(
const fileName& libPath,
const string& globalFuncName,
const dictionary& contextDict
) const
{
void* lib = 0;
if (libPath.empty())
{
return;
}
dlLibraryTable& libs = const_cast<Time&>(time_).libs();
lib = libs.findLibrary(libPath);
if (!lib)
{
return;
}
// provision for manual execution of code before unloading
if (dlSymFound(lib, globalFuncName))
{
loaderFunctionType function =
reinterpret_cast<loaderFunctionType>
(
dlSym(lib, globalFuncName)
);
if (function)
{
(*function)(false); // force unload
}
else
{
FatalIOErrorIn
(
"codedFunctionObject::unloadLibrary()",
contextDict
) << "Failed looking up symbol " << globalFuncName << nl
<< "from " << libPath << exit(FatalIOError);
}
}
if (!libs.close(libPath, false))
{
FatalIOErrorIn
(
"codedFunctionObject::"
"updateLibrary()",
contextDict
) << "Failed unloading library " << libPath
<< exit(FatalIOError);
}
}
开发者ID:,项目名称:,代码行数:58,代码来源:
注:本文中的fileName类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论