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


C++ plString::c_str方法代码示例

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


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

示例1: SetPassword

bool pfMacPasswordStore::SetPassword(const plString& username, const plString& password)
{
    plString service = GetServerDisplayName();

    return SecKeychainAddGenericPassword(nullptr,
                                         service.GetSize(),
                                         service.c_str(),
                                         username.GetSize(),
                                         username.c_str(),
                                         password.GetSize(),
                                         password.c_str(),
                                         nullptr) == errSecSuccess;
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:13,代码来源:pfPasswordStore_Mac.cpp

示例2: 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

示例3: GetPassword

/*****************************************************************************
 ** 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

示例4: 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

示例5: SecureFiles

void SecureFiles(const plFileName& dir, const plString& ext, uint32_t* key)
{
    std::vector<plFileName> files = plFileSystem::ListDir(dir, ext.c_str());
    for (auto iter = files.begin(); iter != files.end(); ++iter)
    {
        printf("securing: %s\n", iter->GetFileName().c_str());
        plSecureStream::FileEncrypt(*iter, key);
    }
}
开发者ID:Asteral,项目名称:Plasma,代码行数:9,代码来源:main.cpp

示例6: NameToLoc

plKey plPluginResManager::NameToLoc(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant)
{
    // Get or create our page
    plRegistryPageNode* pageNode = INameToPage(age, page, sequenceNumber, itinerant);
    hsAssert(pageNode != nil, "No page returned from INameToPage(), shouldn't be possible");

    // Go find the sceneNode now, since we know the page exists (go through our normal channels, though)
    plString keyName = plString::Format("%s_%s", age.c_str(), page.c_str());

    plUoid nodeUoid(pageNode->GetPageInfo().GetLocation(), plSceneNode::Index(), keyName);

    plKey snKey = FindKey(nodeUoid);
    if (snKey == nil)
    {
        // Not found, create a new one
        plSceneNode *newSceneNode = new plSceneNode;
        snKey = NewKey(keyName, newSceneNode, pageNode->GetPageInfo().GetLocation());

        // Call init after it gets a key
        newSceneNode->Init();

        // Add to our list of exported nodes
        fExportedNodes.Append(newSceneNode);
        newSceneNode->GetKey()->RefObject();
    }
    else
    {
        hsAssert(snKey->ObjectIsLoaded() != nil, "Somehow we still have the key for a sceneNode that hasn't been loaded.");

        // Force load, or attempt to at least
        plSceneNode* node = plSceneNode::ConvertNoRef(snKey->VerifyLoaded());

        // Add to our list if necessary
        if (fExportedNodes.Find(node) == fExportedNodes.kMissingIndex)
        {
            fExportedNodes.Append(node);
            node->GetKey()->RefObject();
        }
    }

    // Return the key
    return snKey;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:43,代码来源:plPluginResManager.cpp

示例7: Write

bool pyStatusLog::Write(plString text)
{
    if (fLog)
    {
        fLog->AddLine(text.c_str());
        return true;
    }

    return false;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:10,代码来源:pyStatusLog.cpp

示例8: 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

示例9: EatKey

    virtual bool  EatKey( const plKey& key )
    {
        if( key->GetUoid().GetClassType() == fClassType &&
            NameMatches( fObjName.c_str(), key->GetUoid().GetObjectName().c_str(), fSubstr ) )
        {
            fFoundKey = key;
            return false;
        }

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

示例10: WriteSafeString

uint32_t hsStream::WriteSafeString(const plString &string)
{
    int len = string.GetSize();
    hsAssert(len<0xf000, plString::Format("string len of %d is too long for WriteSafeString %s, use WriteSafeStringLong",
        len, string.c_str()).c_str() );

    WriteLE16(len | 0xf000);
    if (len > 0)
    {
        uint32_t i;
        const char *buffp = string.c_str();
        for (i = 0; i < len; i++)
        {
            WriteByte(~buffp[i]);
        }
        return i;
    }
    else
        return 0;
}
开发者ID:branan,项目名称:Plasma,代码行数:20,代码来源:hsStream.cpp

示例11: 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

示例12: UpdateEditDlg

// updates the edit dialog based on the path specified
void UpdateEditDlg(plString locPath)
{
    if (locPath == gCurrentPath)
        return;

    gCurrentPath = locPath;

    plString itemText = plString::Format("Text (%s):", locPath.c_str());
    SetDlgItemTextW(gEditDlg, IDC_LOCPATH, itemText.ToWchar());

    plString ageName, setName, elementName, elementLanguage;
    SplitLocalizationPath(locPath, ageName, setName, elementName, elementLanguage);

    // now make sure they've drilled down deep enough to enable the dialog
    if (elementLanguage.IsEmpty()) // not deep enough
        EnableDlg(FALSE);
    else
    {
        EnableDlg(TRUE);
        plString key = plString::Format("%s.%s.%s", ageName.c_str(), setName.c_str(), elementName.c_str());
        plString elementText = pfLocalizationDataMgr::Instance().GetElementPlainTextData(key, elementLanguage);
        SetDlgItemTextW(gEditDlg, IDC_LOCALIZATIONTEXT, elementText.ToWchar());
    }

    // now to setup the add/delete buttons
    if (!elementLanguage.IsEmpty()) // they have selected a language
    {
        SetDlgItemText(gEditDlg, IDC_ADD, L"Add Localization");
        EnableWindow(GetDlgItem(gEditDlg, IDC_ADD), TRUE);
        SetDlgItemText(gEditDlg, IDC_DELETE, L"Delete Localization");
        if (elementLanguage != "English") // don't allow them to delete the default language
            EnableWindow(GetDlgItem(gEditDlg, IDC_DELETE), TRUE);
        else
            EnableWindow(GetDlgItem(gEditDlg, IDC_DELETE), FALSE);
    }
    else // they have selected something else
    {
        SetDlgItemText(gEditDlg, IDC_ADD, L"Add Element");
        EnableWindow(GetDlgItem(gEditDlg, IDC_ADD), TRUE);
        SetDlgItemText(gEditDlg, IDC_DELETE, L"Delete Element");
        if (!elementName.IsEmpty()) // they have selected an individual element
        {
            std::vector<plString> elementNames = pfLocalizationDataMgr::Instance().GetElementList(ageName, setName);
            if (elementNames.size() > 1) // they can't delete the only subtitle in a set
                EnableWindow(GetDlgItem(gEditDlg, IDC_DELETE), TRUE);
            else
                EnableWindow(GetDlgItem(gEditDlg, IDC_DELETE), FALSE);
        }
        else
            EnableWindow(GetDlgItem(gEditDlg, IDC_DELETE), FALSE);
    }
}
开发者ID:Filtik,项目名称:Plasma,代码行数:53,代码来源:plEditDlg.cpp

示例13: WriteColor

bool pyStatusLog::WriteColor(plString text, pyColor& color)
{
    if (fLog)
    {
        uint32_t st_color = ((uint32_t)(color.getAlpha()*255)<<24) +
                                ((uint32_t)(color.getRed()*255)<<16) +
                                ((uint32_t)(color.getGreen()*255)<<8) + 
                                ((uint32_t)(color.getBlue()*255));
        fLog->AddLine( text.c_str(), st_color );
        return true;
    }

    return false;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:14,代码来源:pyStatusLog.cpp

示例14: Open

bool pyStatusLog::Open(plString logName, uint32_t numLines, uint32_t flags)
{
    // make sure its closed first
    Close();

    // create a status log guy for this
    fICreatedLog = true;
    fLog = plStatusLogMgr::GetInstance().CreateStatusLog( (uint8_t)numLines, logName.c_str(), flags );
    if (fLog)
    {
        fLog->SetForceLog(true);
        return true;
    }
    return false;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:15,代码来源:pyStatusLog.cpp

示例15: WriteSafeStringLong

uint32_t hsStream::WriteSafeStringLong(const plString &string)
{
    uint32_t len = string.GetSize();
    WriteLE32(len);
    if (len > 0)
    {   
        const char *buffp = string.c_str();
        uint32_t i;
        for (i = 0; i < len; i++)
        {
            WriteByte(~buffp[i]);
        }
        return i;
    }
    else
        return 0;
}
开发者ID:branan,项目名称:Plasma,代码行数:17,代码来源:hsStream.cpp


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