本文整理汇总了C++中gkString类的典型用法代码示例。如果您正苦于以下问题:C++ gkString类的具体用法?C++ gkString怎么用?C++ gkString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gkString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getTok
bool getTok(const gkString& buf, const gkString& dim, gkString& tok, size_t &start)
{
const size_t size = buf.size();
const size_t dimsize = dim.size();
size_t pos = gkString::npos;
while (start < size)
{
pos = buf.find(dim, start);
if (pos == gkString::npos)
pos = size;
if (start == pos)
start += dimsize;
else
break;
}
if (start >= size) return false;
tok.assign(&buf[start], pos-start);
start = pos + dimsize;
return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:27,代码来源:liUtils.cpp
示例2: getTextBom
BOM getTextBom(gkString& line, bool removeBom)
{
size_t len = line.size();
BOM bom = getTextEncoding(line.c_str(), len);
if (bom != BOM_NONE && removeBom) {
//strip bom
line = line.substr(getBOMLength(bom));
}
return bom;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:10,代码来源:liUtils.cpp
示例3: splitFileName
void splitFileName(const gkString& path, gkString& dir, gkString& base, gkString& ext)
{
if (path.empty()) return;
if (path == "." || path == "..")
{
dir = path;
return;
}
gkString fpath = path, fname;
char delim = '/';
bool bdelim = fpath.find_last_of('\\') != gkString::npos;
bool fdelim = fpath.find_last_of('/') != gkString::npos;
if (bdelim)
{
if (fdelim) //normalize to \ to /
std::replace(fpath.begin(), fpath.end(), '\\', '/');
else
delim = '\\';
}
size_t i = fpath.find_last_of(delim);
if (i != gkString::npos)
{
dir = fpath.substr(0, i);
fname = fpath.substr(i+1, path.size()-1);
}
else
{
dir.clear();
fname = fpath;
}
i = fname.find_last_of('.');
if (i != gkString::npos)
{
base = fname.substr(0, i);
ext = fname.substr(i+1, fname.size()-1);
}
else
{
base = fname;
ext.clear();
}
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:49,代码来源:liUtils.cpp
示例4: gkPrintf
bool OgreKit::init(const gkString& blend)
{
gkPrintf("----------- OgreKit Android Demo init -----------------");
LOG_FOOT;
gkString cfgfname;
// Parse command line
m_blend = gkDefaultBlend;
if (!blend.empty()) m_blend = blend;
getPrefs().debugFps = true;
getPrefs().wintitle = gkString("OgreKit Demo (Press Escape to exit)[") + m_blend + gkString("]");
getPrefs().blendermat=true;
//getPrefs().shaderCachePath="/sdcard/gamekit";
getPrefs().enableshadows=false;
getPrefs().viewportOrientation="portrait";
// m_prefs.disableSound=false;
gkPath path = cfgfname;
LOG_FOOT;
// overide settings if found
if (path.isFileInBundle())
getPrefs().load(path.getPath());
LOG_FOOT;
m_inited = initialize();
LOG_FOOT;
//gkMessageManager::getSingleton().addListener(this);
return m_inited;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:32,代码来源:Main.cpp
示例5: getAttrib
bool getAttrib(const TiXmlElement* XMLNode, const gkString& attrib, bool& value)
{
if (!XMLNode || !XMLNode->Attribute(attrib)) return false;
value = parseBool(XMLNode->Attribute(attrib.c_str()));
return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:7,代码来源:liXmlUtils.cpp
示例6: initRTShaderSystem
bool gkResourceGroupManager::initRTShaderSystem(const gkString& shaderLang, const gkString& shaderCachePath, bool hasFixedCapability)
{
#ifdef OGREKIT_USE_RTSHADER_SYSTEM
GK_ASSERT( m_materialLoader == 0);
m_materialLoader = new gkMaterialLoader();
Ogre::RTShader::ShaderGenerator::initialize();
Ogre::RTShader::ShaderGenerator::getSingleton().setTargetLanguage(shaderLang);
if (!shaderCachePath.empty())
Ogre::RTShader::ShaderGenerator::getSingleton().setShaderCachePath(shaderCachePath);
Ogre::RTShader::ShaderGenerator* shaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
GK_ASSERT(shaderGenerator);
if (!hasFixedCapability)
{
gkMaterialLoader::createRTSSMaterial("BaseWhite");
gkMaterialLoader::createRTSSMaterial("BaseWhiteNoLighting", false);
gkMaterialLoader::createRTSSMaterial("World", false);
}
return true;
#else
return false;
#endif
}
开发者ID:Draion,项目名称:Gamekit,代码行数:29,代码来源:gkResourceGroupManager.cpp
示例7: cast
bool gsRayTest::cast(gsRay& ray, const gkString& prop, gsGameObject* excludeObj)
{
if (prop.empty() && !excludeObj)
return m_ray->collides(ray);
else{
xrayFilter xray(excludeObj?excludeObj->get():0, prop, "");
gkVector3 from(ray.getOrigin());
gkVector3 to(ray.getOrigin()+ray.getDirection()*100);
return m_ray->collides(from,to,xray);
}
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:11,代码来源:gsPhysics.cpp
示例8: parseScalarArray
int parseScalarArray(liScalarVec &v, const gkString& str, const gkString& delims)
{
if (str.empty()) return 0;
liStrVec sv = strSplit(str, delims);
v.clear(); v.reserve(sv.size());
for (size_t i = 0; i < sv.size(); i++)
v.push_back(Ogre::StringConverter::parseReal(sv[i]));
return v.size();
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:11,代码来源:liUtils.cpp
示例9: strSplit
//-- gkString
//from ogre3d StringUtil
liStrVec strSplit( const gkString& str, const gkString& delims, UTuint32 maxSplits)
{
liStrVec ret;
// Pre-allocate some space for performance
ret.reserve(maxSplits ? maxSplits+1 : 10); // 10 is guessed capacity for most case
unsigned int numSplits = 0;
// Use STL methods
size_t start, pos;
start = 0;
do
{
pos = str.find_first_of(delims, start);
if (pos == start)
{
// Do nothing
start = pos + 1;
}
else if (pos == gkString::npos || (maxSplits && numSplits == maxSplits))
{
// Copy the rest of the gkString
ret.push_back( str.substr(start) );
break;
}
else
{
// Copy up to delimiter
ret.push_back( str.substr(start, pos - start) );
start = pos + 1;
}
// parse up to next real data
start = str.find_first_not_of(delims, start);
++numSplits;
} while (pos != gkString::npos);
return ret;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:43,代码来源:liUtils.cpp
示例10: getTextType
int gkTextManager::getTextType(const gkString& name)
{
int i = 0;
while (TextItemMap[i].name != 0)
{
if (name.find(TextItemMap[i].name) != name.npos)
return TextItemMap[i].type;
++i;
}
return TT_ANY;
}
开发者ID:carriercomm,项目名称:gamekit,代码行数:12,代码来源:gkTextManager.cpp
示例11: loadFont
void gkGUIManager::loadFont(const gkString& name) {
gkFont *fnt = gkFontManager::getSingleton().getByName<gkFont>(name);
if (fnt)
{
Rocket::Core::FontDatabase::LoadFontFace((const unsigned char*)fnt->getData(), fnt->getSize());
}
else
{
Rocket::Core::FontDatabase::LoadFontFace(name.c_str());
}
}
开发者ID:JobsSteve,项目名称:gamekit,代码行数:12,代码来源:gkGUIManager.cpp
示例12: load
bool xmlConfig::load(const gkString &fileName)
{
if (!openSections(fileName, mSections, "config")) {
gkPrintf("[XML] Can't open file: '%s'", fileName.c_str());
return false;
}
mLoaded = true;
mFileName = fileName;
return mLoaded;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:12,代码来源:liXmlConfig.cpp
示例13: exportBullet
void gkDynamicsWorld::exportBullet(const gkString& fileName)
{
int maxSerializeBufferSize = 1024 * 1024 * 5;
btDefaultSerializer* serializer = new btDefaultSerializer(maxSerializeBufferSize);
m_dynamicsWorld->serialize(serializer);
FILE* file = fopen(fileName.c_str(), "wb");
fwrite(serializer->getBufferPointer(), serializer->getCurrentBufferSize(), 1, file);
fclose(file);
delete serializer;
}
开发者ID:Draion,项目名称:Gamekit,代码行数:13,代码来源:gkDynamicsWorld.cpp
示例14: while
bool gkPhysicsController::collidesWith(const gkString& name, gkContactInfo* cpy, bool emptyFilter)
{
if (!m_localContacts.empty())
{
if (name.empty() && emptyFilter)
{
if (cpy) *cpy = m_localContacts.at(0);
return true;
}
UTsize i, s;
gkContactInfo::Array::Pointer p;
i = 0;
s = m_localContacts.size();
p = m_localContacts.ptr();
while (i < s)
{
GK_ASSERT(p[i].collider);
gkGameObject* gobj = p[i].collider->getObject();
if (name.find(gobj->getName()) != gkString::npos)
{
if (cpy) *cpy = p[i];
return true;
}
++i;
}
}
return false;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:36,代码来源:gkPhysicsController.cpp
示例15: sensorTest
bool gkPhysicsController::sensorTest(gkGameObject* ob, const gkString& prop, const gkString& material, bool onlyActor, bool testAllMaterials)
{
GK_ASSERT(ob);
if (onlyActor)
{
if (ob->getProperties().isActor())
{
if (prop.empty() && material.empty())
return true;
if (!prop.empty())
{
if (ob->hasVariable(prop))
return true;
}
else if (!material.empty())
{
if (ob->hasSensorMaterial(material, !testAllMaterials))
return true;
}
}
}
else
{
if (prop.empty() && material.empty())
return true;
if (!prop.empty())
{
if (ob->hasVariable(prop))
return true;
}
else if (!material.empty())
{
if (ob->hasSensorMaterial(material, !testAllMaterials))
return true;
}
}
return false;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:42,代码来源:gkPhysicsController.cpp
示例16: create
bool luProjectFile::create(const gkString& fileName, const gkString& projName)
{
m_projFileName = luFile::getAbsolutePath(fileName);
m_projDir = luFile::getDirName(m_projFileName);
if (projName.empty())
m_projName = luFile::getFileNameBase(fileName);
else
m_projName = projName;
m_projVer = VERSION;
m_startLuaFile = "";
m_files.clear();
setModified();
return true;
}
开发者ID:Draion,项目名称:Gamekit,代码行数:19,代码来源:luFile.cpp
示例17: openXMLDocument
bool openXMLDocument(const gkString& fileName, TiXmlDocument &XMLDoc, const gkString& resGroupName)
{
try
{
//open from file
if (!Ogre::ResourceGroupManager::getSingletonPtr())
return openXMLDocumentOnFile(fileName, XMLDoc);
//open from resource
// Strip the path
gkString basename, path;
Ogre::StringUtil::splitFilename(fileName, basename, path);
Ogre::DataStreamPtr pStream = Ogre::ResourceGroupManager::getSingleton().
openResource( basename, resGroupName );
gkString data = pStream->getAsString();
// Open the .scene File
XMLDoc.Parse( data.c_str() );
pStream->close();
pStream.setNull();
if (XMLDoc.Error())
{
gkPrintf("[XML] Error - The TiXmlDocument reported an error: %s", XMLDoc.ErrorDesc());
return false;
}
}
catch(Ogre::Exception &e)
{
gkPrintf("[XML] Error - creating TiXmlDocument %s %s", fileName.c_str(), e.getDescription().c_str());
return false;
}
return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:38,代码来源:liXmlUtils.cpp
示例18: strToUpper
gkString strToUpper(const gkString& str)
{
gkString ss(str);
std::transform(str.begin(), str.end(), ss.begin(), toupper);
return ss;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:6,代码来源:liUtils.cpp
示例19: isSameFile
bool luFile::isSameFile(const gkString& file1,const gkString& file2)
{
return wxFileName(file1.c_str()).SameAs(wxFileName(file2));
}
开发者ID:Draion,项目名称:Gamekit,代码行数:4,代码来源:luFile.cpp
示例20: sensorCollides
bool gkPhysicsController::sensorCollides(const gkString& prop, const gkString& material, bool onlyActor, bool testAllMaterials, utArray<gkGameObject*>* collisionList)
{
if (collisionList){
collisionList->clear();
}
if (onlyActor && !m_object->getProperties().isActor())
return false;
if (!m_localContacts.empty())
{
if (!collisionList && prop.empty() && material.empty())
{
// there are contacts and we do not care about property, nor empty, nor we need a list of objects (list = NULL)
// any filter
return true;
}
UTsize i, s;
gkContactInfo::Array::Pointer p;
i = 0;
s = m_localContacts.size();
p = m_localContacts.ptr();
while (i < s)
{
GK_ASSERT(p[i].collider);
gkGameObject* gobj = p[i].collider->getObject();
if (onlyActor)
{
if (prop.empty() && material.empty())
return true;
if (gobj->getProperties().isActor())
{
if (!prop.empty())
{
if (gobj->hasVariable(prop)){
if (!collisionList){
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
collisionList->push_back(gobj);
}
}
else if (!material.empty())
{
if (gobj->hasSensorMaterial(material, !testAllMaterials))
{
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS){
collisionList->push_back(gobj);
}
}
}
}
}
else
{
if (prop.empty() && material.empty())
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
}
if (!prop.empty())
{
if (gobj->hasVariable(prop))
{
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
}
}
}
else if (!material.empty())
{
if (gobj->hasSensorMaterial(material, !testAllMaterials)){
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
//.........这里部分代码省略.........
开发者ID:Ali-il,项目名称:gamekit,代码行数:101,代码来源:gkPhysicsController.cpp
注:本文中的gkString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论