本文整理汇总了C++中StringVectorPtr类的典型用法代码示例。如果您正苦于以下问题:C++ StringVectorPtr类的具体用法?C++ StringVectorPtr怎么用?C++ StringVectorPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringVectorPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringVectorPtr
//-----------------------------------------------------------------------
StringVectorPtr ZipArchive::find(const String& pattern, bool recursive)
{
StringVectorPtr ret = StringVectorPtr(new StringVector());
FileInfoList::iterator i, iend;
iend = mFileList.end();
for (i = mFileList.begin(); i != iend; ++i)
{
if (recursive || i->path.empty())
{
// Check basename matches pattern (zip is case insensitive)
if (StringUtil::match(i->basename, pattern, false))
{
ret->push_back(i->filename);
}
}
else
{
// Check full name
if (StringUtil::match(i->filename, pattern, false))
{
ret->push_back(i->filename);
}
}
}
return ret;
}
示例2: bNormalMap
MaterialFactory::MaterialFactory() :
bNormalMap(1), bEnvMap(1), bShadows(1), bShadowsDepth(1), bShadowsSoft(1), bShadowsFade(0),
iTexSize(4096), iNumShadowTex(3), iShadowsFilterSize(4), fShaderQuality(0.5), fShadowsFadeDistance(20.f),
bReflect(0), bRefract(0),
bSettingsChanged(1), // always have to generate at start
mSceneMgr(0), mTerrain(0), mPSSM(0)
{
QTimer ti; ti.update(); /// time
// find all files with *.matdef extension in all resource groups
StringVector resourceGroups = ResourceGroupManager::getSingleton().getResourceGroups();
for (StringVector::iterator it = resourceGroups.begin();
it != resourceGroups.end(); ++it)
{
StringVectorPtr files = ResourceGroupManager::getSingleton().findResourceNames(
(*it),
"*.matdef");
for (StringVector::iterator fit = files->begin();
fit != files->end(); ++fit)
{
loadDefsFromFile( (*fit) );
}
}
// create our generators
mGenerator = new MaterialGenerator();
mGenerator->mParent = this;
MaterialGenerator* glass = static_cast<MaterialGenerator*>(new GlassMaterialGenerator());
glass->mParent = this;
mCustomGenerators.push_back(glass);
MaterialGenerator* pipeglass = static_cast<MaterialGenerator*>(new PipeGlassMaterialGenerator());
pipeglass->mParent = this;
mCustomGenerators.push_back(pipeglass);
MaterialGenerator* arrow = static_cast<MaterialGenerator*>(new ArrowMaterialGenerator());
arrow->mParent = this;
mCustomGenerators.push_back(arrow);
MaterialGenerator* water = static_cast<MaterialGenerator*>(new WaterMaterialGenerator());
water->mParent = this;
mCustomGenerators.push_back(water);
MaterialGenerator* impostor = static_cast<MaterialGenerator*>(new ImpostorMaterialGenerator());
impostor->mParent = this;
mCustomGenerators.push_back(impostor);
MaterialGenerator* particle = static_cast<MaterialGenerator*>(new ParticleMaterialGenerator());
particle->mParent = this;
mCustomGenerators.push_back(particle);
ti.update(); /// time
float dt = ti.dt * 1000.f;
LogO(String("::: Time loading material definitions: ") + toStr(dt) + " ms");
}
示例3: loadScriptLibrary
void loadScriptLibrary()
{
StringVectorPtr names = ResourceGroupManager::getSingleton().listResourceNames("DefaultLuaScripts");
for(int i = 0; i < names->size(); ++i)
{
loadScript(names->at(i));
}
names.setNull();
}
示例4: arch
void ZipArchiveTests::testFindNonRecursive()
{
ZipArchive arch(testPath, "Zip");
arch.load();
StringVectorPtr vec = arch.find("*.txt", false);
CPPUNIT_ASSERT_EQUAL((size_t)2, vec->size());
CPPUNIT_ASSERT_EQUAL(String("rootfile.txt"), vec->at(0));
CPPUNIT_ASSERT_EQUAL(String("rootfile2.txt"), vec->at(1));
}
示例5:
//-----------------------------------------------------------------------
StringVectorPtr Utf8Archive::list(bool _recursive, bool _dirs)
{
StringVectorPtr ret = mBaseArchive->list(_recursive, _dirs);
for(size_t i = 0; i != ret->size(); ++i)
{
String& elem = (*ret)[i];
StringUtil::ansiToUtf8(elem);
}
return ret;
}
示例6: findLadders0
vector<vector<string> > findLadders0(string start, string end, unordered_set<string> &dict) {
dict.insert(start);
StringVectorQ q;
q.push_back( StringVectorPtr(new StringVector(1, start)) );
const int L = end.size();
StringVectorQ result;
StringSet visitedS = {start};
while( !q.empty() ) {
StringVectorPtr pv = q.front();
q.pop_front();
if( pv->size() > shortest )
continue;
string s = pv->back();
for(int i=0; i<L; ++i) {
string newStr = s;
char ch = s[i];
do {
ch++;
if( ch > 'z') ch = 'a';
if( ch == s[i]) break;
newStr[i] = ch;
if( newStr == end ) { // found it
StringVectorPtr newV(new StringVector(*pv));
newV->push_back(newStr);
result.push_back(newV);
if( newV->size() < shortest)
shortest = newV->size();
} if( dict.end() != dict.find(newStr) && std::find(pv->begin(), pv->end(), newStr) == pv->end() ) { // continue with next search
StringVectorPtr newV(new StringVector(*pv));
newV->push_back(newStr);
visitedS.insert(newStr);
q.push_back(newV);
}
}while(true);
}
}
struct Smaller{
int x;
Smaller(int a):x(a){}
bool operator()(StringVectorPtr& v) {
return v->size() < x;
}
};
StringVectorVector vv;
// std::copy_if(result.begin(), result.end(), std::back_inserter(vv), Smaller(shortest));
for(StringVectorQ::iterator it=result.begin(); it!=result.end(); ++it) {
if( (**it).size() <= shortest )
vv.push_back(std::move(**it));
}
return std::move(vv);
}
示例7:
void MeshSerializerTests::testMesh_Version_1_2()
{
// Exporting legacy Mesh not supported!
// testMesh(MESH_VERSION_LEGACY);
#ifdef I_HAVE_LOT_OF_FREE_TIME
// My sandboxing test. Takes a long time to complete!
// Runs on all meshes and exports all to every Lod version.
char* groups [] = { "Popular", "General", "Tests" };
for (int i = 0; i < 3; i++) {
StringVectorPtr meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.mesh");
StringVector::iterator it, itEnd;
it = meshes->begin();
itEnd = meshes->end();
for (; it != itEnd; it++) {
try {
mMesh = MeshManager::getSingleton().load(*it, groups[i]);
}
catch(std::exception e)
{
// OutputDebugStringA(e.what());
}
getResourceFullPath(mMesh, mMeshFullPath);
if (!copyFile(mMeshFullPath + ".bak", mMeshFullPath)) {
// If there is no backup, create one.
copyFile(mMeshFullPath, mMeshFullPath + ".bak");
}
mOrigMesh = mMesh->clone(mMesh->getName() + ".orig.mesh", mMesh->getGroup());
testMesh_XML();
testMesh(MESH_VERSION_1_10);
testMesh(MESH_VERSION_1_8);
testMesh(MESH_VERSION_1_7);
testMesh(MESH_VERSION_1_4);
testMesh(MESH_VERSION_1_0);
}
meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.skeleton");
it = meshes->begin();
itEnd = meshes->end();
for (; it != itEnd; it++) {
mSkeleton = SkeletonManager::getSingleton().load(*it, groups[i]);
getResourceFullPath(mSkeleton, mSkeletonFullPath);
if (!copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath)) {
// If there is no backup, create one.
copyFile(mSkeletonFullPath, mSkeletonFullPath + ".bak");
}
SkeletonSerializer skeletonSerializer;
skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_8);
mSkeleton->reload();
skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_0);
mSkeleton->reload();
}
}
#endif /* ifdef I_HAVE_LOT_OF_FREE_TIME */
}
示例8: parseCapabilitiesFromArchive
//-----------------------------------------------------------------------
void RenderSystemCapabilitiesManager::parseCapabilitiesFromArchive(const String& filename, const String& archiveType, bool recursive)
{
// get the list of .rendercaps files
Archive* arch = ArchiveManager::getSingleton().load(filename, archiveType);
StringVectorPtr files = arch->find(mScriptPattern, recursive);
// loop through .rendercaps files and load each one
for (StringVector::iterator it = files->begin(), end = files->end(); it != end; it++)
{
DataStreamPtr stream = arch->open(*it);
mSerializer->parseScript(stream);
stream->close();
}
}
示例9: StringVectorPtr
//-----------------------------------------------------------------------
StringVectorPtr ZipArchive::list(bool recursive, bool dirs) const
{
OGRE_LOCK_AUTO_MUTEX;
StringVectorPtr ret = StringVectorPtr(OGRE_NEW_T(StringVector, MEMCATEGORY_GENERAL)(), SPFM_DELETE_T);
FileInfoList::const_iterator i, iend;
iend = mFileList.end();
for (i = mFileList.begin(); i != iend; ++i)
if ((dirs == (i->compressedSize == size_t (-1))) &&
(recursive || i->path.empty()))
ret->push_back(i->filename);
return ret;
}
示例10: precreateMeshes
void ContentModule::precreateMeshes() const
{
StringVectorPtr meshes = ResourceGroupManager::getSingleton()
.findResourceNames(getId(), "*.mesh");
for (size_t i = 0; i < meshes->size(); ++i)
{
ResourcePtr res = MeshManager::getSingleton().getByName((*meshes)[i]);
if (res.isNull())
{
MeshPtr mesh = MeshManager::getSingleton().create((*meshes)[i],
getId());
}
}
}
示例11: arch
void FileSystemArchiveTests::testListNonRecursive()
{
try {
FileSystemArchive arch(testPath, "FileSystem");
arch.load();
StringVectorPtr vec = arch.list(false);
CPPUNIT_ASSERT_EQUAL((unsigned int)2, (unsigned int)vec->size());
CPPUNIT_ASSERT_EQUAL(String("rootfile.txt"), vec->at(0));
CPPUNIT_ASSERT_EQUAL(String("rootfile2.txt"), vec->at(1));
}
catch (Exception& e)
{
std::cout << e.getFullDescription();
}
}
示例12: getExtension
/**
* @author JoSch
* @date 04-27-2004
*/
void SoundManager::addSounds(const Ogre::String& group)
{
StringList extlist = getExtension();
StringList::const_iterator cit;
for(cit = extlist.begin(); cit != extlist.end(); cit++)
{
StringVectorPtr sl = ResourceGroupManager::getSingleton().findResourceNames(
group, *cit );
StringVector::const_iterator it;
for(it = sl->begin(); it != sl->end(); it++)
{
try {
create(*it, group);
} catch(...)
{}
}
}
}
示例13: getBaseArchive
//-----------------------------------------------------------------------------------
String RecursiveArchive::getPath(const String& _filename)
{
String filepath = _filename;
if(!getBaseArchive()->exists(_filename))
{
StringVectorPtr vecptr = getBaseArchive()->find(_filename, true, false);
if(!vecptr->empty())
{
filepath = (*vecptr)[0];
if(vecptr->size() != 1)
{
GOTHOGRE_LOG(Warning, "RecursiveArchive: Found two files"
" with the same name '" << _filename << "'"
<< ": '" << (*vecptr)[0] << "', '" << (*vecptr)[1] << "'."
<< "One of these files will be unavailable.");
}
}
}
return filepath;
}
示例14: operator
bool operator()(StringVectorPtr& v) {
return v->size() < x;
}
示例15: cleanupControls
void Sample_MeshLod::setupControls( int uimode /*= 0*/ )
{
cleanupControls();
SelectMenu* models = mTrayMgr->createLongSelectMenu(TL_TOPLEFT, "cmbModels", "Model:", 150, 8);
models->addItem("Sinbad.mesh");
models->addItem("ogrehead.mesh");
models->addItem("knot.mesh");
models->addItem("fish.mesh");
models->addItem("penguin.mesh");
models->addItem("ninja.mesh");
models->addItem("dragon.mesh");
models->addItem("athene.mesh");
models->addItem("sibenik.mesh");
// Add all meshes from popular:
StringVectorPtr meshes = ResourceGroupManager::getSingleton().findResourceNames("General", "*.mesh");
StringVector::iterator it, itEnd;
it = meshes->begin();
itEnd = meshes->end();
for(; it != itEnd; it++){
models->addItem(*it);
}
// Basic options:
mWireframe = mTrayMgr->createCheckBox(TL_TOPLEFT, "chkShowWireframe", "Show wireframe", 200);
mUseVertexNormals = mTrayMgr->createCheckBox(TL_TOPLEFT, "chkUseVertexNormals", "Use vertex normals", 200);
mOutsideWeightSlider = mTrayMgr->createThickSlider(TL_TOPLEFT, "sldOutsideWeight", "Weighten outside", 200, 50, 0, 100, 101);
mOutsideWalkAngle = mTrayMgr->createThickSlider(TL_TOPLEFT, "sldOutsideWalkAngle", "Outside angle", 200, 50, -1, 1, 201);
mManualMeshes = mTrayMgr->createLongSelectMenu(TL_TOPLEFT, "cmbManualMesh", "Manual LOD:", 100, 8);
mManualMeshes->copyItemsFrom(models);
mManualMeshes->insertItem(0,"");
mReductionSlider = mTrayMgr->createThickSlider(TL_TOPLEFT, "sldReductionValue", "Reduced vertices", 200, 50, 0, 100, 101);
mTrayMgr->createButton(TL_TOPLEFT, "btnReduceMore","Reduce More");
mTrayMgr->createButton(TL_TOPLEFT, "btnReduceLess","Reduce Less");
// Level options:
mDistanceLabel = mTrayMgr->createLabel(TL_TOPRIGHT, "lblDistance", "Distance: ", 250);
mLodLevelList = mTrayMgr->createLongSelectMenu(TL_TOPRIGHT, "cmbLodLevels", "Lod level:", 150, 4);
mTrayMgr->createButton(TL_TOPRIGHT, "btnAddLodLevel","Add level", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnRemoveSelectedLodLevel","Remove level", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnRemoveInitialLodLevel","Remove level #0", 220);
// Serializer options:
mTrayMgr->createButton(TL_TOPRIGHT, "btnShowAll", "Show all levels", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnAutoconfigure", "Show autoconfigured LODs", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnShowMesh", "Show LODs stored in mesh", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnSaveMesh", "Save mesh", 220);
mTrayMgr->createButton(TL_TOPRIGHT, "btnRestoreMesh", "Restore original mesh", 220);
// Profile options
mProfileList = mTrayMgr->createLongSelectMenu(TL_TOPRIGHT, "cmbProfiledVertices", "Profile:", 180, 4);
mTrayMgr->createButton(TL_TOPRIGHT, "btnRemoveFromProfile","Remove from profile", 220.0);
mTrayMgr->createButton(TL_TOPRIGHT, "btnAddToProfile","Add to profile", 220.0);
//mTrayMgr->createTextBox(TL_TOPRIGHT, "Help","Help", 200, 200)
// ->setText("The last reduced vertex is the selected vertex. Use the slider to select the vertex, then decide to keep or remove it. You can export the Lod buffers into the .mesh file after configuration.");
mTrayMgr->showCursor();
}