本文整理汇总了C++中plString::CompareI方法的典型用法代码示例。如果您正苦于以下问题:C++ plString::CompareI方法的具体用法?C++ plString::CompareI怎么用?C++ plString::CompareI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plString
的用法示例。
在下文中一共展示了plString::CompareI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerIdByName
unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const {
// local case
if (name.CompareI(NetCommGetPlayer()->playerName) == 0)
return NetCommGetPlayer()->playerInt;
unsigned n = TransportMgr().GetNumMembers();
for (unsigned i = 0; i < n; ++i)
if (plNetTransportMember * member = TransportMgr().GetMember(i))
if (0 == name.Compare(member->GetPlayerName()))
return member->GetPlayerID();
return 0;
}
示例2: GetProperAgeName
// static
plString plNetLinkingMgr::GetProperAgeName( const plString & ageName )
{
plNetClientMgr * nc = plNetClientMgr::GetInstance();
std::vector<plFileName> files = plFileSystem::ListDir("dat", "*.age");
for (auto iter = files.begin(); iter != files.end(); ++iter)
{
plString work = iter->GetFileNameNoExt();
if (ageName.CompareI(work) == 0)
return work;
}
return ageName;
}
示例3: ICreateLocation
plLocation plPluginResManager::ICreateLocation(const plString& age, const plString& page, int32_t seqNum, bool itinerant)
{
bool willBeReserved = age.CompareI("global") == 0;
int32_t oldNum = seqNum;
seqNum = VerifySeqNumber(seqNum, age, page);
if (seqNum != oldNum)
{
hsAssert(false, "Conflicting page sequence number. Somebody called NameToLoc without verifying their seq# first!");
}
if (seqNum < 0)
{
willBeReserved = true;
seqNum = -seqNum;
}
plLocation newLoc;
if (willBeReserved)
newLoc = plLocation::MakeReserved(seqNum);
else
newLoc = plLocation::MakeNormal(seqNum);
// Flag common pages
for (int i = 0; i < plAgeDescription::kNumCommonPages; i++)
{
if (page.Compare(plAgeDescription::GetCommonPage(i)) == 0)
{
newLoc.SetFlags(plLocation::kBuiltIn);
break;
}
}
// If we have an age description file for the age we're creating a location
// for, grab some extra flags from it
plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age.c_str());
plAgePage* agePage = ageDesc ? ageDesc->FindPage(page.c_str()) : nil;
if (agePage)
{
if (agePage->GetFlags() & plAgePage::kIsLocalOnly)
newLoc.SetFlags(plLocation::kLocalOnly);
if (agePage->GetFlags() & plAgePage::kIsVolatile)
newLoc.SetFlags(plLocation::kVolatile);
}
if (itinerant)
newLoc.SetFlags(plLocation::kItinerant);
delete ageDesc;
return newLoc;
}
示例4: VerifySeqNumber
// Verifies that the given sequence number belongs to the given string combo and ONLY that combo. Returns a new, unique sequenceNumber if not
int32_t plPluginResManager::VerifySeqNumber(int32_t sequenceNumber, const plString& age, const plString& page)
{
bool negated = false, willBeReserved = age.CompareI("global") == 0;
if (sequenceNumber < 0)
{
sequenceNumber = -sequenceNumber;
willBeReserved = negated = true;
}
fLastVerifyError = kNoVerifyError;
fLastVerifyPage = nil;
plLocation toCompareTo;
if (willBeReserved)
plLocation::MakeReserved(sequenceNumber);
else
plLocation::MakeNormal(sequenceNumber);
// Does the page already exist?
plRegistryPageNode* pageNode = FindPage(age, page);
if (pageNode != nil)
{
if (pageNode->GetPageInfo().GetLocation() == toCompareTo)
// Right page, right sequence #. Assume we're smart enough to already have it right
return negated ? -sequenceNumber : sequenceNumber;
// Right page, wrong seq #...tag our last error field so we can know this later on
fLastVerifyError = kErrRightPageWrongSeq;
}
// Page doesn't yet exist, check to make sure the seq # isn't used yet
if (sequenceNumber > 0)
{
pageNode = FindPage(toCompareTo);
if (pageNode == nil)
// Safe to use
return negated ? -sequenceNumber : sequenceNumber;
else
{
// If there is no error yet, set the error to "already taken"
if (fLastVerifyError == kNoVerifyError)
fLastVerifyError = kErrSeqAlreadyTaken;
fLastVerifyPage = &pageNode->GetPageInfo();
}
}
// Gotta find a good sequence number to use, so keep searching until we find one
// (but start at a good high number so we won't hopefully ever run into anybody else)
const int kTemporarySequenceStartPrefix = 100; // can't be larger then 0xFE, so well start out at 100 for kicks
sequenceNumber = plPageInfoUtils::CombineSeqNum(kTemporarySequenceStartPrefix, 0);
int32_t upperLimit = 0xFEFFFF; // largest legal sequence number is a prefix of FE and a suffix of FFFF
for(; sequenceNumber < upperLimit; sequenceNumber++)
{
if (willBeReserved)
toCompareTo = plLocation::MakeReserved(sequenceNumber);
else
toCompareTo = plLocation::MakeNormal(sequenceNumber);
pageNode = FindPage(toCompareTo);
if (pageNode == nil)
return negated ? -sequenceNumber : sequenceNumber;
}
hsAssert(false, "Unable to find a valid sequence number to use");
fLastVerifyError = kErrCantFindValid;
return 0;
}