当前位置: 首页>>代码示例>>C++>>正文


C++ plString类代码示例

本文整理汇总了C++中plString的典型用法代码示例。如果您正苦于以下问题:C++ plString类的具体用法?C++ plString怎么用?C++ plString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了plString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetClipboardText

void plClipboard::SetClipboardText(const plString& text)
{
    if (text.IsEmpty())
        return;
#ifdef HS_BUILD_FOR_WIN32
    plStringBuffer<wchar_t> buf = text.ToWchar();
    size_t len = buf.GetSize();

    if (len == 0) 
        return;

    std::unique_ptr<void, HGLOBAL(WINAPI*)(HGLOBAL)> copy(::GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t)), ::GlobalFree);
    if (!copy)
        return;

    if (!::OpenClipboard(NULL))
        return;

    ::EmptyClipboard();

    wchar_t* target = (wchar_t*)::GlobalLock(copy.get());
    memcpy(target, buf.GetData(), (len + 1) * sizeof(wchar_t));
    target[len] = '\0';
    ::GlobalUnlock(copy.get());

    ::SetClipboardData(CF_UNICODETEXT, copy.get());
    ::CloseClipboard();
#endif
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:29,代码来源:plClipboard.cpp

示例2: GetServerDisplayName

/*****************************************************************************
 ** pfMacPasswordStore                                                      **
 *****************************************************************************/
const plString pfMacPasswordStore::GetPassword(const plString& username)
{
    plString service = GetServerDisplayName();

    void* passwd = nullptr;
    uint32_t passwd_len = 0;

    if (SecKeychainFindGenericPassword(nullptr,
                                       service.GetSize(),
                                       service.c_str(),
                                       username.GetSize(),
                                       username.c_str(),
                                       &passwd_len,
                                       &passwd,
                                       nullptr) != errSecSuccess)
    {
        return plString::Null;
    }

    plString ret(reinterpret_cast<const char*>(passwd), size_t(passwd_len));

    SecKeychainItemFreeContent(nullptr, passwd);

    return ret;
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:28,代码来源:pfPasswordStore_Mac.cpp

示例3: AddNameToCursor

void plMouseDevice::AddNameToCursor(const plString& name)
{
    if (fInstance && !name.IsNull())
    {
        plDebugText     &txt = plDebugText::Instance();
        txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name.c_str());
    }
}
开发者ID:Asteral,项目名称:Plasma,代码行数:8,代码来源:plInputDevice.cpp

示例4: ProcessTab

//
// support for a single leading tab in statusLog strings
//
const char* ProcessTab(const char* fmt)
{
    static plString s;
    if (fmt && *fmt=='\t')
    {
        s = plFormat("  {}", fmt);
        return s.c_str();
    }
    return fmt;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:13,代码来源:plNetClientMgr.cpp

示例5: LoadAvatar

plKey plAvatarMgr::LoadAvatar(plString name, plString accountName, bool isPlayer, plKey spawnPoint, plAvTask *initialTask,
                              const plString &userStr, const plFileName &clothingFile)
{
    // *** account is currently unused. the idea is that eventually an NPC will
    // *** be able to use a customization account
    plKey result = nullptr;
    plKey requestor = GetKey(); // avatar manager is always the requestor for avatar loads
    plNetClientMgr *netMgr = plNetClientMgr::GetInstance();

    if(netMgr)      // can't clone without the net manager
    {
        hsAssert(!name.IsEmpty(), "name required by LoadPlayer fxn");
        netMgr->DebugMsg("Local: Loading player %s", name.c_str());

        // look up player by key name provided by user.
        // this string search should be replaced with some other method of 
        // avatar selection and key lookup.

        // Get the location for the player first
        plKey playerKey = nullptr;
        const plLocation& globalLoc = plKeyFinder::Instance().FindLocation("GlobalAvatars", name);
        const plLocation& maleLoc = plKeyFinder::Instance().FindLocation("GlobalAvatars", "Male");
        const plLocation& custLoc = plKeyFinder::Instance().FindLocation("CustomAvatars", name);

#ifdef PLASMA_EXTERNAL_RELEASE
        // Try global. If that doesn't work, players default to male.
        // If not a player, try custLoc. If that doesn't work, fall back to male
        const plLocation& loc = (globalLoc.IsValid() ? globalLoc : isPlayer ? maleLoc : custLoc.IsValid() ? custLoc : maleLoc);
#else
        // Try global. If that doesn't work try custom. Otherwise fall back to male
        const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc);
#endif

        if (loc == maleLoc)
            name = "Male";

        if (loc.IsValid())
        {
            plUoid uID(loc, plSceneObject::Index(), name);
            plLoadAvatarMsg *cloneMsg = new plLoadAvatarMsg(uID, requestor, 0, isPlayer, spawnPoint, initialTask, userStr);
            if (clothingFile.IsValid())
            {
                plLoadClothingMsg *clothingMsg = new plLoadClothingMsg(clothingFile);
                cloneMsg->SetTriggerMsg(clothingMsg);
            }
            result =  cloneMsg->GetCloneKey();
            
            // the clone message is automatically addressed to the net client manager
            // we'll receive the message back (or a similar message) when the clone is loaded
            cloneMsg->Send();
        }
    }
    return result;
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:54,代码来源:plAvatarMgr.cpp

示例6: 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;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:12,代码来源:plNetClientMgr.cpp

示例7: sendFileListRequest

uint32_t pnAuthClient::sendFileListRequest(const plString& directory, const plString& ext)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_FileListRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(directory.wstr());
    msg[2].fString = plwcsdup(ext.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
开发者ID:GPNMilano,项目名称:libhsplasma,代码行数:12,代码来源:pnAuthClient.cpp

示例8: StupidSearch

plKey plKeyFinder::StupidSearch(const plString & age, const plString & rm,
                                 uint16_t classType, const plString &obName, bool subString)
{
    if (obName.IsNull())
        return nil;

    plUoid newOid;

    fLastError = kOk;

    uint16_t maxClasses = plFactory::GetNumClasses();

    uint16_t ty = classType;
    if (ty == maxClasses)   // error
    {   fLastError = kInvalidClass;
        return nil;
    }

    if (!age.IsNull() && !rm.IsNull())
    {
        const plLocation &loc = IGetResMgr()->FindLocation( age, rm );
        if( !loc.IsValid() )
        {
            fLastError = kPageNotFound;
            return nil;
        }

        plKeyFinderIter keyFinder( classType, obName, subString );

        if( !IGetResMgr()->IterateKeys( &keyFinder, loc ) )
            // Return value of false means it stopped somewhere, i.e. found something
            return keyFinder.GetFoundKey();
    }
    else if (!age.IsNull())
    {
        plKeyFinderIter keyFinder(classType, obName, subString, age);

        if( !IGetResMgr()->IterateAllPages( &keyFinder ) )
            return keyFinder.GetFoundKey();
    }
    else
    {
        plKeyFinderIter keyFinder( classType, obName, subString );

        if( !IGetResMgr()->IterateKeys( &keyFinder ) )
            // Return value of false means it stopped somewhere, i.e. found something
            return keyFinder.GetFoundKey();
    }

    fLastError = kObjectNotFound;
    return nil;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:52,代码来源:plKeyFinder.cpp

示例9: 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;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:51,代码来源:plPluginResManager.cpp

示例10: sendFriendInviteRequest

uint32_t pnAuthClient::sendFriendInviteRequest(const plUuid& invite, const plString& email,
                const plString& sendTo)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_SendFriendInviteRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    invite.write(msg[1].fData);
    msg[2].fString = plwcsdup(email.wstr());
    msg[3].fString = plwcsdup(sendTo.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
开发者ID:GPNMilano,项目名称:libhsplasma,代码行数:14,代码来源:pnAuthClient.cpp

示例11: sendPlayerCreateRequest

uint32_t pnAuthClient::sendPlayerCreateRequest(const plString& playerName,
                const plString& playerShape, const plString& friendInvite)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_PlayerCreateRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(playerName.wstr());
    msg[2].fString = plwcsdup(playerShape.wstr());
    msg[3].fString = plwcsdup(friendInvite.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
开发者ID:GPNMilano,项目名称:libhsplasma,代码行数:14,代码来源:pnAuthClient.cpp

示例12: sendAcctLoginRequest

uint32_t pnAuthClient::sendAcctLoginRequest(uint32_t serverChallenge,
                uint32_t clientChallenge, const plString& acctName,
                const plString& password, const plString& authToken,
                const plString& os)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AcctLoginRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fUint = clientChallenge;
    msg[2].fString = plwcsdup(acctName.wstr());
    pnSha1Hash hash;
    if (acctName.find('@') != -1 && acctName.find("@gametap") == -1
        && acctName.find("@magiquest") == -1) {
        hash = NCHashLoginInfo(acctName, password, serverChallenge, clientChallenge);
    } else {
        hash = pnSha1Hash::Sha1(password.cstr(), password.len());
        hash.swapBytes();   // Cyan uses a different byte order for this case
    }
    memcpy(msg[3].fData, &hash, sizeof(hash));
    msg[4].fString = plwcsdup(authToken.wstr());
    msg[5].fString = plwcsdup(os.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
开发者ID:GPNMilano,项目名称:libhsplasma,代码行数:26,代码来源:pnAuthClient.cpp

示例13: GetAgeSDLObjectUoid

plUoid plNetClientMgr::GetAgeSDLObjectUoid(const plString& ageName) const
{
    hsAssert(!ageName.IsEmpty(), "nil ageName");

    // if age sdl hook is loaded
    if (fAgeSDLObjectKey)
        return fAgeSDLObjectKey->GetUoid();

    // if age is loaded
    plLocation loc = plKeyFinder::Instance().FindLocation(ageName,plAgeDescription::GetCommonPage(plAgeDescription::kGlobal));
    if (!loc.IsValid())
    {
        // check current age des
        if (plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName() == ageName)
            loc=plAgeLoader::GetInstance()->GetCurrAgeDesc().CalcPageLocation("BuiltIn");

        if (!loc.IsValid())
        {
            // try to load age desc
            hsStream* stream=plAgeLoader::GetAgeDescFileStream(ageName);
            if (stream)
            {
                plAgeDescription ad;
                ad.Read(stream);
                loc=ad.CalcPageLocation("BuiltIn");
                stream->Close();
            }           
            delete stream;
        }
    }

    return plUoid(loc, plSceneObject::Index(), plSDL::kAgeSDLObjectName);
}
开发者ID:MareinK,项目名称:Plasma,代码行数:33,代码来源:plNetClientMgr.cpp

示例14: EatPage

        virtual bool  EatPage( plRegistryPageNode *node )
        {
            const plPageInfo    &info = node->GetPageInfo();

            // Are we searching by age/page?
            if (!fAgeString.IsNull())
            {
                if (info.GetAge().CompareI(fAgeString) == 0 && info.GetPage().CompareI(fFindString) == 0)
                {
                    *fPagePtr = node;
                    return false;
                }
                return true;
            }

            // Try for page only
            if (info.GetPage().CompareI(fFindString) == 0)
            {
                *fPagePtr = node;
                return false;
            }

            // Try for full location
            if (plString::Format("%s_%s", info.GetAge().c_str(), info.GetPage().c_str()).CompareI(fFindString) == 0)
            {
                *fPagePtr = node;
                return false;
            }

            return true;    // Keep searching
        }
开发者ID:Asteral,项目名称:Plasma,代码行数:31,代码来源:plKeyFinder.cpp

示例15: hsAssert

std::vector<plFileName> plStreamSource::GetListOfNames(const plFileName& dir, const plString& ext)
{
    plFileName sDir = dir.Normalize('/');
    hsAssert(ext.CharAt(0) != '.', "Don't add a dot");
    std::lock_guard<std::mutex> lock(fMutex);

    // loop through all the file data records, and create the list
    std::vector<plFileName> retVal;
    for (auto curData = fFileData.begin(); curData != fFileData.end(); curData++)
    {
        if ((curData->second.fDir.AsString().CompareI(sDir.AsString()) == 0) &&
            (curData->second.fExt.CompareI(ext) == 0))
            retVal.push_back(curData->second.fFilename);
    }

#ifndef PLASMA_EXTERNAL_RELEASE
    // in internal releases, we can use on-disk files if they exist
    // Build the search string as "dir/*.ext"
    std::vector<plFileName> files = plFileSystem::ListDir(sDir, ("*." + ext).c_str());
    for (auto iter = files.begin(); iter != files.end(); ++iter)
    {
        plFileName norm = iter->Normalize('/');
        if (fFileData.find(norm) == fFileData.end()) // we haven't added it yet
            retVal.push_back(norm);
    }
#endif // PLASMA_EXTERNAL_RELEASE

    return retVal;
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:29,代码来源:plStreamSource.cpp


注:本文中的plString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。