本文整理汇总了C++中FileName::append方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::append方法的具体用法?C++ FileName::append怎么用?C++ FileName::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addExtension
// Add at the end ..........................................................
FileName FileName::addExtension(const String &ext) const
{
if (ext == "")
return *this;
else
{
FileName retval = *this;
retval = retval.append((String) "." + ext);
return retval;
}
}
示例2: itos
vector<KeyFrame> ModelLoaderMD3::buildKeyFrame(Surface * surfaces,
const FileName &fileName,
const FileName &skinName,
const Header &header,
TextureFactory &textureFactory) {
vector<KeyFrame> keyFrames;
const FileName directory = fileName.getPath();
/*
Only the first frame loads texture files.
The other frames use a copy of the handles and that copy is stored in here.
*/
Material md3Material;
// Take the all the surfaces and push each frame into the mesh manager
for (int i=0; i<surfaces[0].header.numFrames; ++i) {
string name = fileName.str() + "#" + itos(i);
// Create a mesh from the surface
Mesh *mesh = surfaces[0].getObject(i);
// Load a material for the first mesh in the first model.
// First model only! Ignored for subsequent models
if (i==0) {
if (header.numSurfaces > 0) {
mesh->material.clear();
#if 0
if (surfaces[0].header.numShaders > 0) {
const char *shaderName=(char*)surfaces[0].shaders[0].name;
FileName skin = directory.append(FileName(shaderName));
mesh->material.setTexture(textureFactory.load(skin));
} else {
mesh->material.setTexture(textureFactory.load(skinName));
}
#else
mesh->material.setTexture(textureFactory.load(skinName));
#endif
// Keep a copy of the material to propagate to the subsequent frames
md3Material = mesh->material;
}
} else {
mesh->material = md3Material; // shallow copy
}
keyFrames.push_back(KeyFrame(mesh));
}
return keyFrames;
}
示例3: buildLists
/*! Injects the info gathered by the XML parser into the Entry tree.
* This tree contains the information extracted from the input in a
* "unrelated" form.
*/
void TagFileParser::buildLists(Entry *root)
{
// build class list
TagClassInfo *tci = m_tagFileClasses.first();
while (tci)
{
Entry *ce = new Entry;
ce->section = Entry::CLASS_SEC;
switch (tci->kind)
{
case TagClassInfo::Class: break;
case TagClassInfo::Struct: ce->spec = Entry::Struct; break;
case TagClassInfo::Union: ce->spec = Entry::Union; break;
case TagClassInfo::Interface: ce->spec = Entry::Interface; break;
case TagClassInfo::Exception: ce->spec = Entry::Exception; break;
case TagClassInfo::Protocol: ce->spec = Entry::Protocol; break;
case TagClassInfo::Category: ce->spec = Entry::Category; break;
}
ce->name = tci->name;
if (tci->kind==TagClassInfo::Protocol)
{
ce->name+="-p";
}
addDocAnchors(ce,tci->docAnchors);
TagInfo *ti = new TagInfo;
ti->tagName = m_tagName;
ti->fileName = tci->filename;
ce->tagInfo = ti;
ce->lang = tci->isObjC ? SrcLangExt_ObjC : SrcLangExt_Unknown;
// transfer base class list
if (tci->bases)
{
delete ce->extends;
ce->extends = tci->bases; tci->bases = 0;
}
if (tci->templateArguments)
{
if (ce->tArgLists==0)
{
ce->tArgLists = new QList<ArgumentList>;
ce->tArgLists->setAutoDelete(TRUE);
}
ArgumentList *al = new ArgumentList;
ce->tArgLists->append(al);
QListIterator<QCString> sli(*tci->templateArguments);
QCString *argName;
for (;(argName=sli.current());++sli)
{
Argument *a = new Argument;
a->type = "class";
a->name = *argName;
al->append(a);
}
}
buildMemberList(ce,tci->members);
root->addSubEntry(ce);
tci = m_tagFileClasses.next();
}
// build file list
TagFileInfo *tfi = m_tagFileFiles.first();
while (tfi)
{
Entry *fe = new Entry;
fe->section = guessSection(tfi->name);
fe->name = tfi->name;
addDocAnchors(fe,tfi->docAnchors);
TagInfo *ti = new TagInfo;
ti->tagName = m_tagName;
ti->fileName = tfi->filename;
fe->tagInfo = ti;
QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name);
fe->fileName = fullName;
//printf("new FileDef() filename=%s\n",tfi->filename.data());
FileDef *fd = new FileDef(m_tagName+":"+tfi->path,
tfi->name,m_tagName,
tfi->filename
);
FileName *mn;
if ((mn=Doxygen::inputNameDict->find(tfi->name)))
{
mn->append(fd);
}
else
{
mn = new FileName(fullName,tfi->name);
mn->append(fd);
Doxygen::inputNameList->inSort(mn);
Doxygen::inputNameDict->insert(tfi->name,mn);
}
buildMemberList(fe,tfi->members);
root->addSubEntry(fe);
tfi = m_tagFileFiles.next();
//.........这里部分代码省略.........
示例4: animationSequence
AnimationController*
ModelLoaderSingle::loadFromFile(const FileName &fileName,
TextureFactory &textureFactory) const
{
PropertyBag xml = PropertyBag::fromFile(fileName);
const FileName directory = fileName.getPath();
// Winding of polygons, either "CCW" or "CW"
string polygonWinding = "CW";
xml.get("polygonWinding", polygonWinding);
// Allocate a blank animation controller
AnimationController *controller = new AnimationController();
// Get key frames from the first source
PropertyBag fileBag = xml.getBag("model", 0);
const FileName file = directory.append(fileBag.getFileName("file"));
FileName skinName;
if(fileBag.get("skin", skinName))
{
skinName = directory.append(skinName);
}
vector<KeyFrame> keyFrames = loadKeyFrames(file, skinName, textureFactory);
// Get the rest of the key frames
for(size_t i = 1, numMD3 = xml.getNumInstances("model"); i<numMD3; ++i)
{
PropertyBag fileBag = xml.getBag("model", i);
const FileName file = directory.append(fileBag.getFileName("file"));
FileName skinName;
if(fileBag.get("skin", skinName))
{
skinName = directory.append(skinName);
}
vector<KeyFrame> k = loadKeyFrames(file, skinName, textureFactory);
for(size_t i=0; i<k.size(); ++i)
{
KeyFrame &keyFrame = keyFrames[i];
keyFrame.merge(k[i]);
// set polygon windings according to data file
setPolygonWinding(keyFrame, polygonWinding);
}
}
// Build the animations from these keyframes
for(size_t i = 0, numAnimations = xml.getNumInstances("animation");
i<numAnimations;
++i)
{
PropertyBag animation;
string name;
bool looping=false;
int start=0;
float priority=0;
int length=0;
float fps=0;
xml.get("animation", animation, i);
animation.get("name", name);
animation.get("priority", priority);
animation.get("looping", looping);
animation.get("start", start);
animation.get("length", length);
animation.get("fps", fps);
// Add it to the controller
AnimationSequence animationSequence(keyFrames,
name,
priority,
looping,
start,
length,
fps);
controller->addAnimation(animationSequence);
}
return controller;
}
示例5: insertBeforeExtension
// Insert before extension .................................................
FileName FileName::insertBeforeExtension(const String &str) const
{
FileName retval = *this;
size_t pos = find_last_of('.');
return pos != npos ? retval.insert(pos, str) : retval.append(str);
}