本文整理汇总了C++中utString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ utString::size方法的具体用法?C++ utString::size怎么用?C++ utString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utString
的用法示例。
在下文中一共展示了utString::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replace
void utStringUtils::replace( utString &in, const utString &from, const utString &to )
{
if ( !from.empty() && from != to )
{
// erase
if ( to.empty() )
{
size_t pos= 0;
while ( pos != utString::npos )
{
pos= in.find( from );
if ( pos != utString::npos )
in.erase( pos, from.size() );
}
}
else
{
size_t pos= 0;
while ( pos != utString::npos )
{
pos= in.find( from );
if ( pos != utString::npos )
{
in.erase( pos, from.size() );
in.insert( pos, to );
}
}
}
}
}
示例2:
const char *platform_getWritablePath()
{
static utString path;
if (path.size())
{
return path.c_str();
}
const char *tmp = LoomJni::getPackageName();
if (!tmp)
{
return "";
}
// the path is: /data/data/ + package name
path = "/data/data/";
if (tmp)
{
path += tmp;
}
else
{
return "";
}
return path.c_str();
}
示例3: lmLog
const char *LoomJni::getPackageName()
{
static utString packageName;
if (packageName.size())
{
return packageName.c_str();
}
loomJniMethodInfo t;
if (getStaticMethodInfo(t,
"co/theengine/loomdemo/LoomDemo",
"getActivityPackageName",
"()Ljava/lang/String;"))
{
jstring str = (jstring)t.getEnv()->CallStaticObjectMethod(t.classID, t.methodID);
t.getEnv()->DeleteLocalRef(t.classID);
packageName = jstring2string(str);
t.getEnv()->DeleteLocalRef(str);
lmLog(jniLogGroup, "package name %s", packageName.c_str());
return packageName.c_str();
}
return 0;
}
示例4: loom_asset_recognizeAssetTypeFromPath
// Helper to recognize an asset's type from its path/name.
static int loom_asset_recognizeAssetTypeFromPath(utString& path)
{
// Easy out - empty strings are no good!
if (path.length() == 0)
{
return 0;
}
// Walk backwards to first dot.
size_t firstDotPos = path.size() - 1;
for (size_t pos = path.size() - 1; pos > 0; pos--)
{
if (path.at(pos) != '.')
{
continue;
}
firstDotPos = pos;
break;
}
// Split out the extension.
utString pathExt = path.substr(firstDotPos + 1);
// See if we can get a type out of any of the recognizers.
int type = 0;
for (UTsize i = 0; i < gRecognizerList.size(); i++)
{
type = gRecognizerList[i](pathExt.c_str());
if (type)
{
break;
}
}
// No match, so let's use text.
if (type == 0)
{
lmLogInfo(gAssetLogGroup, "Couldn't recognize '%s', defaulting to LATText...", path.c_str());
type = LATText;
}
return type;
}
示例5:
const char *platform_getSettingsPath()
{
static utString path;
if (path.size())
{
return path.c_str();
}
path = LoomJni::getSettingsPath();
return path.c_str();
}