本文整理汇总了C++中st::string::is_empty方法的典型用法代码示例。如果您正苦于以下问题:C++ string::is_empty方法的具体用法?C++ string::is_empty怎么用?C++ string::is_empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st::string
的用法示例。
在下文中一共展示了string::is_empty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cdUp
ST::string cdUp(ST::string path) {
// Check for root paths, we can't go up from there!
#ifdef _WIN32
if (path.substr(1) == ":\\")
return path;
#else
if (path == "/")
return path;
#endif
// Not very robust, but it works for one level of parent scanning
if (path.is_empty())
return ".." PATHSEPSTR;
// Strip the ending slash, if necessary, and then go up one dir
if (path.char_at(path.size()-1) == PATHSEP)
path = path.left(path.size() - 1);
ST::string up = path.before_last(PATHSEP);
if (path.char_at(0) == PATHSEP) {
// Absolute path specified -- make sure we keep it that way
return up + PATHSEPSTR;
} else {
// Relative path specified
return up.is_empty() ? "" : up + PATHSEPSTR;
}
}
示例2: GetIfaceSegmentName
ST::string plAnimComponentBase::GetIfaceSegmentName( bool allowNil )
{
ST::string name = GetAnimName();
if( allowNil || !name.is_empty() )
return name;
return ENTIRE_ANIMATION_NAME;
}
示例3: FindPackages
void FindPackages(std::vector<plFileName>& fileNames, std::vector<plFileName>& pathNames, const plFileName& path, const ST::string& parent_package=ST::null)
{
std::vector<plFileName> packages;
FindSubDirs(packages, path);
for (int i = 0; i < packages.size(); i++)
{
ST::string packageName;
if (!parent_package.is_empty())
packageName = parent_package + ".";
packageName += packages[i].AsString();
std::vector<plFileName> packageFileNames;
std::vector<plFileName> packagePathNames;
plFileName packagePath = plFileName::Join(path, packages[i]);
FindFiles(packageFileNames, packagePathNames, packagePath);
// Check for the magic file to make sure this is really a package...
if (std::find(packageFileNames.begin(), packageFileNames.end(), kModuleFile) != packageFileNames.end()) {
for (int j = 0; j < packageFileNames.size(); j++) {
fileNames.push_back(packageName+"."+packageFileNames[j].AsString());
pathNames.push_back(packagePathNames[j]);
}
FindPackages(fileNames, pathNames, packagePath, packageName);
}
}
}
示例4: GetSegStart
void plAnimStealthNode::GetLoopPoints( float &start, float &end ) const
{
start = GetSegStart();
end = GetSegEnd();
ST::string loopName = GetLoopName();
if( !loopName.is_empty() && fCachedSegMap != nil )
GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end );
}
示例5: FixSlashes
ST::string FixSlashes(const ST::string& src) {
if (src.is_empty())
return src;
ST::char_buffer dest;
char* pbuf = dest.create_writable_buffer(src.size());
memcpy(pbuf, src.c_str(), src.size() + 1);
for (char* pc = pbuf; *pc != 0; pc++) {
if (*pc == '/' || *pc == '\\')
*pc = PATHSEP;
}
return dest;
}
示例6: GetSegmentName
void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength )
{
ST::string segName = GetSegmentName();
bool isEntire = ( segName.is_empty() || segName.compare( ENTIRE_ANIMATION_NAME ) == 0 );
if( isEntire )
{
convert.SetBegin( 0 );
convert.SetEnd( maxLength );
}
else
{
SegmentSpec *spec = IGetSegmentSpec();
convert.SetBegin( ( spec != nil ) ? spec->fStart : 0.f );
convert.SetEnd( ( spec != nil ) ? spec->fEnd : 0.f );
}
// Even if we're not looping, set the loop points. (A responder
// could tell us later to start looping.)
if( isEntire )
convert.SetLoopPoints( 0, maxLength );
else
{
float loopStart, loopEnd;
GetLoopPoints( loopStart, loopEnd );
convert.SetLoopPoints( loopStart, loopEnd );
}
convert.Loop( GetLoop() );
// Auto-start
if( GetAutoStart() )
convert.Start( 0 );
else
convert.Stop( true );
// Stuff stop points
GetAllStopPoints( convert.GetStopPoints() );
// Ease curve stuff
if( GetEaseInType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( true, GetEaseInType(), GetEaseInMin(), GetEaseInMax(), GetEaseInLength() );
}
if( GetEaseOutType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( false, GetEaseOutType(), GetEaseOutMin(), GetEaseOutMax(), GetEaseOutLength() );
}
}
示例7: GetSegMapAnimTime
bool GetSegMapAnimTime(const ST::string &animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end)
{
if (segMap)
{
if (!animName.is_empty() && segMap->find(animName) != segMap->end())
{
SegmentSpec *spec = (*segMap)[animName];
if (spec->fType == type)
{
if (spec->fStart != -1)
begin = spec->fStart;
if (spec->fEnd != -1)
end = spec->fEnd;
return true;
}
}
}
return false;
}
示例8: IParseVarDesc
//
// Parse a variable descriptor.
// read type, name, count [default]
// return true to skip the next token read
//
bool plSDLParser::IParseVarDesc(const plFileName& fileName, hsStream* stream, char token[],
plStateDescriptor*& curDesc, plVarDescriptor*& curVar) const
{
hsAssert(curDesc, ST::format("Syntax problem with .sdl file, fileName={}", fileName).c_str());
if ( !curDesc )
return false;
bool skipNext=false;
ST::string dbgStr;
static char seps[] = "( ,)[]";
// read type, name, cnt, [default]
//
// TYPE
// create new state var, make current
//
if (*token == '$')
{
// nested sdls
char* sdlName = token+1;
plStateDescriptor* stateDesc = plSDLMgr::GetInstance()->FindDescriptor(sdlName, plSDL::kLatestVersion);
hsAssert(stateDesc, ST::format("can't find nested state desc reference {}, fileName={}",
sdlName, fileName).c_str());
curVar = new plSDVarDescriptor(stateDesc);
}
else
curVar = new plSimpleVarDescriptor;
curDesc->AddVar(curVar);
bool ok=curVar->SetType(token);
hsAssert(ok, ST::format("Variable 'type' syntax problem with .sdl file, type={}, fileName={}",
token, fileName).c_str());
dbgStr = ST::format("\tVAR Type={} ", token);
//
// NAME (foo[1])
//
if (stream->GetToken(token, kTokenLen))
{
hsAssert(strstr(token, "[") != nullptr && strstr(token, "]") != nullptr,
ST::format("invalid var syntax, missing [x], fileName={}", fileName).c_str());
char* ptr = strtok( token, seps ); // skip [
hsAssert(curVar, ST::format("Missing current var. Syntax problem with .sdl file, fileName={}", fileName).c_str());
curVar->SetName(token);
//
// COUNT
//
char* cntTok=strtok(nil, seps); // kill ]
int cnt = cntTok ? atoi(cntTok) : 0;
curVar->SetCount(cnt);
if (cnt==0)
curVar->SetVariableLength(true);
dbgStr += ST::format("Name={}[{}]", curVar->GetName(), cnt);
}
//
// optional tokens: DEFAULT, INTERNAL
//
while (stream->GetToken(token, kTokenLen))
{
if (!strcmp(token, "DEFAULT"))
{
hsAssert(curVar, ST::format("Syntax problem with .sdl file, fileName={}", fileName).c_str());
// read state var type
ST::string defaultStr;
plSimpleVarDescriptor* sVar=(plSimpleVarDescriptor*)curVar;
if (sVar)
{
int i;
for(i=0;i<sVar->GetAtomicCount();i++)
{
if (stream->GetToken(token, kTokenLen))
{
defaultStr += token;
if (i!=sVar->GetAtomicCount()-1)
defaultStr += ",";
}
}
}
if (!defaultStr.is_empty())
{
curVar->SetDefault(defaultStr);
dbgStr += " DEFAULT=" + defaultStr;
}
}
else
if (!strcmp(token, "DISPLAYOPTION"))
{
hsAssert(curVar, ST::format("Syntax problem with .sdl file, fileName={}", fileName).c_str());
dbgStr += ST_LITERAL(" ") + token;
bool read=stream->GetToken(token, kTokenLen);
if (read)
//.........这里部分代码省略.........
示例9: ISendUpdates
void plSimulationMgr::ISendUpdates()
{
for (CollisionVec::iterator it = fCollideMsgs.begin(); it != fCollideMsgs.end(); ++it)
{
plCollideMsg* pMsg = *it;
DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", pMsg->GetReceiver(0)->GetName().c_str(),
pMsg->fOtherKey ? pMsg->fOtherKey->GetName().c_str() : "(nil)" , pMsg->fEntering ? "'enter'" : "'exit'");
plgDispatch::Dispatch()->MsgSend(pMsg);
}
fCollideMsgs.clear();
SceneMap::iterator it = fScenes.begin();
for (; it != fScenes.end(); it++)
{
NxScene* scene = it->second;
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
plPXPhysical* physical = (plPXPhysical*)actors[i]->userData;
if (physical)
{
if (physical->GetSceneNode())
{
physical->SendNewLocation();
}
else
{
// if there's no scene node, it's not active (probably about to be collected)
const plKey physKey = physical->GetKey();
if (physKey)
{
ST::string physName = physical->GetKeyName();
if (!physName.is_empty())
{
plSimulationMgr::Log("Removing physical <%s> because of missing scene node.\n", physName.c_str());
}
}
// Remove(physical);
}
}
}
// // iterate through the db types, which are powers-of-two enums.
// for( plLOSDB db = static_cast<plLOSDB>(1) ;
// db < plSimDefs::kLOSDBMax;
// db = static_cast<plLOSDB>(db << 1) )
// {
// fLOSSolvers[db]->Resolve(fSubspace);
// }
// if(fNeedLOSCullPhase)
// {
// for( plLOSDB db = static_cast<plLOSDB>(1) ;
// db < plSimDefs::kLOSDBMax;
// db = static_cast<plLOSDB>(db << 1) )
// {
// fLOSSolvers[db]->Resolve(fSubspace);
// }
// fNeedLOSCullPhase = false;
// }
}
}
示例10: PreConvert
bool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
{
// If this is the first time in the preconvert, reset the map
if (fNeedReset)
{
fNeedReset = false;
}
// If this node is animated, create it's modifier and key now so we can give
// it out to anyone that needs it
// if (node->IsTMAnimated() || node->IsAnimatedLight())
// {
const char *name = node->GetName();
plAGMasterMod *mod = node->GetAGMasterMod();
if (mod == nil)
{
if (!node->HasAGMod()) // Need to add this before the MasterMod, if it doesn't have one already.
{
node->AddModifier(new plAGModifier(ST::string::from_utf8(node->GetName())), IGetUniqueName(node));
}
mod = new plAGMasterMod();
plKey modKey = node->AddModifier(mod, IGetUniqueName(node));
}
fMods[node] = mod;
// }
// Small change here. We're setting up the timing specs on the
// plAGAnim object during preconvert, so that the info is available
// when actually converting the anim (and for other components
// that need it, but may or may not actually convert before us.)
// Note: if the component uses the "(Entire Animation)" segment for
// the main start/end, the start/end times won't be valid until
// we've added all keys during convert. Some cleanup might
// be necessary in this case.
ST::string animName = ST::string::from_utf8(fCompPB->GetStr(kAnimName));
if (animName.is_empty())
animName = ST_LITERAL(ENTIRE_ANIMATION_NAME);
if (fCompPB->GetInt(ParamID(kAnimUseGlobal)))
{
plAgeGlobalAnim *ageAnim = new plAgeGlobalAnim(animName, 0, 0);
ageAnim->SetGlobalVarName((char*)fCompPB->GetStr(ParamID(kAnimGlobalName)));
fAnims[node] = ageAnim;
}
else
{
plATCAnim *ATCAnim = new plATCAnim(animName, 0, 0);
plNotetrackAnim noteAnim(node, pErrMsg);
plAnimInfo info = noteAnim.GetAnimInfo(animName);
ATCAnim->SetAutoStart(fCompPB->GetInt(kAnimAutoStart));
float start = info.GetAnimStart();
float end = info.GetAnimEnd();
float initial = info.GetAnimInitial();
if (start != -1)
ATCAnim->SetStart(start);
if (end != -1)
ATCAnim->SetEnd(end);
if (initial != -1)
ATCAnim->SetInitial(initial);
if (fCompPB->GetInt(kAnimLoop))
{
ATCAnim->SetLoop(true);
ST::string loopName = ST::string::from_utf8(fCompPB->GetStr(kAnimLoopName));
float loopStart = info.GetLoopStart(loopName);
float loopEnd = info.GetLoopEnd(loopName);
ATCAnim->SetLoopStart(loopStart == -1 ? ATCAnim->GetStart() : loopStart);
ATCAnim->SetLoopEnd(loopEnd == -1 ? ATCAnim->GetEnd() : loopEnd);
}
ST::string loop;
while (!(loop = info.GetNextLoopName()).is_empty())
ATCAnim->AddLoop(loop, info.GetLoopStart(loop), info.GetLoopEnd(loop));
ST::string marker;
while (!(marker = info.GetNextMarkerName()).is_empty())
ATCAnim->AddMarker(marker, info.GetMarkerTime(marker));
float stopPoint = -1;
while ((stopPoint = info.GetNextStopPoint()) != -1)
ATCAnim->AddStopPoint(stopPoint);
ATCAnim->SetEaseInType(fCompPB->GetInt(kAnimEaseInType));
ATCAnim->SetEaseOutType(fCompPB->GetInt(kAnimEaseOutType));
ATCAnim->SetEaseInLength(fCompPB->GetFloat(kAnimEaseInLength));
ATCAnim->SetEaseInMin(fCompPB->GetFloat(kAnimEaseInMin));
ATCAnim->SetEaseInMax(fCompPB->GetFloat(kAnimEaseInMax));
ATCAnim->SetEaseOutLength(fCompPB->GetFloat(kAnimEaseOutLength));
ATCAnim->SetEaseOutMin(fCompPB->GetFloat(kAnimEaseOutMin));
ATCAnim->SetEaseOutMax(fCompPB->GetFloat(kAnimEaseOutMax));
fAnims[node] = ATCAnim;
//.........这里部分代码省略.........