本文整理汇总了C++中StringVectorPtr::size方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVectorPtr::size方法的具体用法?C++ StringVectorPtr::size怎么用?C++ StringVectorPtr::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVectorPtr
的用法示例。
在下文中一共展示了StringVectorPtr::size方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadScriptLibrary
void loadScriptLibrary()
{
StringVectorPtr names = ResourceGroupManager::getSingleton().listResourceNames("DefaultLuaScripts");
for(int i = 0; i < names->size(); ++i)
{
loadScript(names->at(i));
}
names.setNull();
}
示例2:
//-----------------------------------------------------------------------
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;
}
示例3: testFindNonRecursive
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));
}
示例4: newV
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);
}
示例5: testFindRecursive
void ZipArchiveTests::testFindRecursive()
{
ZipArchive arch(testPath, "Zip");
arch.load();
StringVectorPtr vec = arch.find("*.material", true);
CPPUNIT_ASSERT_EQUAL((size_t)4, vec->size());
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file.material"), vec->at(0));
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file2.material"), vec->at(1));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file3.material"), vec->at(2));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file4.material"), vec->at(3));
}
示例6: testListRecursive
void ZipArchiveTests::testListRecursive()
{
ZipArchive arch(testPath, "Zip");
arch.load();
StringVectorPtr vec = arch.list(true);
CPPUNIT_ASSERT_EQUAL((size_t)6, vec->size());
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file.material"), vec->at(0));
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file2.material"), vec->at(1));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file3.material"), vec->at(2));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file4.material"), vec->at(3));
CPPUNIT_ASSERT_EQUAL(String("rootfile.txt"), vec->at(4));
CPPUNIT_ASSERT_EQUAL(String("rootfile2.txt"), vec->at(5));
}
示例7: testListRecursive
void FileSystemArchiveTests::testListRecursive()
{
FileSystemArchive arch(testPath, "FileSystem");
arch.load();
StringVectorPtr vec = arch.list(true);
CPPUNIT_ASSERT_EQUAL((size_t)48, vec->size()); // 48 including CVS folders!
CPPUNIT_ASSERT_EQUAL(String("rootfile.txt"), vec->at(0));
CPPUNIT_ASSERT_EQUAL(String("rootfile2.txt"), vec->at(1));
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file.material"), vec->at(2));
CPPUNIT_ASSERT_EQUAL(String("level1/materials/scripts/file2.material"), vec->at(3));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file3.material"), vec->at(22));
CPPUNIT_ASSERT_EQUAL(String("level2/materials/scripts/file4.material"), vec->at(23));
}
示例8: 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());
}
}
}
示例9: testListNonRecursive
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();
}
}
示例10: getPath
//-----------------------------------------------------------------------------------
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;
}
示例11: createStandardMaterial
//-----------------------------------------------------------------------
void MaterialService::createStandardMaterial(unsigned int idx, std::string matName, std::string textureName,
std::string resourceGroup) {
Image tex;
bool loaded = false; // indicates we were successful finding the texture
StringVectorPtr texnames = ResourceGroupManager::getSingleton().findResourceNames(resourceGroup, textureName
+ ".*");
if (texnames->size() <= 0) {
// no results, try the localised version
// prev. path + /language/filename
String locresname = mConfigService->getLocalisedResourcePath(textureName);
LOG_INFO("Specified resource (%s) was not found, trying localized version: %s", textureName.c_str(), locresname.c_str());
texnames = ResourceGroupManager::getSingleton().findResourceNames(resourceGroup, locresname
+ ".*");
}
String txtfile;
// Let's try the extensions from the extensions vector
StringVector::iterator it = texnames->begin();
for (; it != texnames->end(); it++) { // Try loading every given
try {
tex.load((*it), resourceGroup);
TextureManager::getSingleton().loadImage(textureName, resourceGroup, tex, TEX_TYPE_2D, 5, 1.0f);
txtfile = (*it);
loaded = true;
break; // we got it!
} catch (Ogre::Exception) {
// Nothing. We are trying more extensions
}
}
if (!loaded)
LOG_ERROR("Image %s was not found, texture will be invalid!", textureName.c_str());
// Construct a material out of this texture. We'll just clone the material upstairs to enable lmap-txture combinations
MaterialPtr shadMat = MaterialManager::getSingleton().create(matName, resourceGroup);
shadMat->setReceiveShadows(true);
Pass *shadPass = shadMat->getTechnique(0)->getPass(0);
shadPass->setAmbient(0.5, 0.5, 0.5);
shadPass->setDiffuse(1, 1, 1, 1);
shadPass->setSpecular(1, 1, 1, 1);
TextureUnitState* tus = createAnimatedTextureState(shadPass, txtfile, resourceGroup, 5);
// Set replace on all first layer textures for now
// tus->setColourOperation(LBO_REPLACE);
tus->setTextureAddressingMode(TextureUnitState::TAM_WRAP);
tus->setTextureCoordSet(0);
tus->setTextureFiltering(TFO_BILINEAR);
tus->setTextureUScale(1.0f);
tus->setTextureVScale(1.0f);
// tus->setTextureFiltering(TFO_NONE);
// Set culling mode to none
// shadMat->setCullingMode(CULL_ANTICLOCKWISE);
// No dynamic lighting
shadMat->setLightingEnabled(false);
// DYNL:
shadMat->load();
// standard size
addWorldMaterialTemplate(idx, shadMat);
}
示例12: operator
bool operator()(StringVectorPtr& v) {
return v->size() < x;
}