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


C++ st::string类代码示例

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


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

示例1: parse

void usePathWrite::parse(const ST::string & usetext)
  {

  path = "";
  errormessages.clear();
  notext = true;

  if (usetext.length() > 0)
	 {
	 notext = false;
	 int k = usetext.isvalidfile();

	 if (k == 1)
		{
		errormessages.push_back("ERROR: file " + usetext +
		" could not be opened for writing\n");
		alreadyexisting = false;
		}
	 else if (k == 0)
		alreadyexisting = false;
	 else
		alreadyexisting = true;

	 if (errormessages.empty())
		path = usetext;
	 }

  }
开发者ID:cran,项目名称:BayesXsrc,代码行数:28,代码来源:use.cpp

示例2: GetPassword

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

    void* passwd = nullptr;
    uint32_t passwd_len = 0;

    if (SecKeychainFindGenericPassword(nullptr,
                                       service.size(),
                                       service.c_str(),
                                       username.size(),
                                       username.c_str(),
                                       &passwd_len,
                                       &passwd,
                                       nullptr) != errSecSuccess)
    {
        return ST::null;
    }

    ST::string ret(reinterpret_cast<const char*>(passwd), size_t(passwd_len));

    SecKeychainItemFreeContent(nullptr, passwd);

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

示例3: parser

TEST(plCmdParser, wchar_argv_parsing)
{
    const plCmdArgDef cmds[] = {
        { kCmdArgRequired | kCmdTypeString, "path", 0}
    };

    plCmdParser parser(cmds, arrsize(cmds));

    const wchar_t* args[] = {L"plCmdParser", L"~/.plasma/config.dat"};
    int argc = 2;

    std::vector<ST::string> tokens(argc);
    for (int i = 0; i < argc; i++) {
        tokens.push_back(ST::string::from_wchar(args[i]));
    }

    bool success = parser.Parse(tokens);

    ST::string prog = parser.GetProgramName();
    ST::string path = parser.GetString(0);

    EXPECT_EQ(success, true);
    EXPECT_STREQ(prog.c_str(), "plCmdParser");
    EXPECT_STREQ(path.c_str(), "~/.plasma/config.dat");
    EXPECT_EQ(parser.GetError(), kCmdErrorSuccess);
}
开发者ID:H-uru,项目名称:Plasma,代码行数:26,代码来源:test_plCmdParser.cpp

示例4: IPrcParse

void plAgeLinkStruct::IPrcParse(const pfPrcTag* tag, plResManager* mgr) {
    if (tag->getName() == "AgeInfo") {
        fFlags |= kHasAgeInfo;
        if (tag->hasChildren())
            fAgeInfo.prcParse(tag->getFirstChild(), mgr);
        else
            fAgeInfo.clear();
    } else if (tag->getName() == "LinkingRules") {
        fFlags |= kHasLinkingRules;
        ST::string lRule = tag->getParam("value", "kBasicLink");
        fLinkingRules = -1;
        for (size_t i=0; i<=kChildAgeBook; i++) {
            if (lRule == kLinkingRuleNames[i])
                fLinkingRules = i;
        }
        if (fLinkingRules == -1) {
            fLinkingRules = lRule.to_int();
        }
    } else if (tag->getName() == "SpawnPoint") {
        fFlags |= kHasSpawnPt;
        if (tag->hasChildren())
            fSpawnPoint.prcParse(tag->getFirstChild());
        else
            fSpawnPoint.clear();
    } else if (tag->getName() == "AmCCR") {
        fFlags |= kHasAmCCR;
        fAmCCR = tag->getParam("value", "0").to_uint();
    } else if (tag->getName() == "ParentAgeFilename") {
        fFlags |= kHasParentAgeFilename;
        fParentAgeFilename = tag->getParam("value", "");
    } else {
        plCreatable::IPrcParse(tag, mgr);
    }
}
开发者ID:Deledrius,项目名称:libhsplasma,代码行数:34,代码来源:plAgeLinkInfo.cpp

示例5: INewPage

void plAgeDescInterface::INewPage()
{
    ST::string name = ST_LITERAL("New Page Name");

    // Get the name of the new age from the user
    int ret = DialogBoxParam(hInstance,
                            MAKEINTRESOURCE(IDD_AGE_NAME),
                            GetCOREInterface()->GetMAXHWnd(),
                            NewAgeDlgProc,
                            (LPARAM)&name);
    if (ret != 1)
        return;

    HWND hPages = GetDlgItem(fhDlg, IDC_PAGE_LIST);

    // Make sure this page doesn't already exist
    int count = ListBox_GetCount(hPages);
    for (int i = 0; i < count; i++)
    {
        char pageName[256];
        ListBox_GetText(hPages, i, pageName);
        if (!name.compare_i(pageName))
            return;
    }

    // Add the new page and select it
    int idx = ListBox_AddString(hPages, name.c_str());

    // Choose a new sequence suffix for it
    plAgePage *newPage = new plAgePage( name, IGetFreePageSeqSuffix( hPages ), 0 );
    ListBox_SetItemData( hPages, idx, (LPARAM)newPage );
   
    fDirty = true;
}
开发者ID:Hoikas,项目名称:Plasma,代码行数:34,代码来源:plAgeDescInterface.cpp

示例6: memcpy

void DS::Stream::writeSafeString(const ST::string& value, DS::StringType format)
{
    if (format == e_StringUTF16) {
        ST::utf16_buffer buffer = value.to_utf16();
        uint16_t length = value.size() & 0x0FFF;
        ST::utf16_buffer work;
        char16_t* data = work.create_writable_buffer(length);
        memcpy(data, buffer.data(), length * sizeof(char16_t));
        for (uint16_t i=0; i<length; ++i)
            data[i] = ~data[i];
        write<uint16_t>(length | 0xF000);
        writeBytes(data, length * sizeof(char16_t));
        write<char16_t>(0);
    } else {
        ST::char_buffer buffer = (format == e_StringUTF8) ? value.to_utf8()
                               : value.to_latin_1(ST::substitute_invalid);
        uint16_t length = value.size() & 0x0FFF;
        ST::char_buffer work;
        char* data = work.create_writable_buffer(length);
        memcpy(data, buffer.data(), length * sizeof(char));
        for (uint16_t i=0; i<length; ++i)
            data[i] = ~data[i];
        write<uint16_t>(length | 0xF000);
        writeBytes(data, length * sizeof(char));
    }
}
开发者ID:zrax,项目名称:dirtsand,代码行数:26,代码来源:streams.cpp

示例7: GetIfaceSegmentName

ST::string plAnimComponentBase::GetIfaceSegmentName( bool allowNil )
{
    ST::string name = GetAnimName();
    if( allowNil || !name.is_empty() )
        return name;
    return ENTIRE_ANIMATION_NAME;
}
开发者ID:H-uru,项目名称:Plasma,代码行数:7,代码来源:plAnimComponent.cpp

示例8: 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;
    }
}
开发者ID:Lunanne,项目名称:libhsplasma,代码行数:26,代码来源:PlasmaSum.cpp

示例9: LoadPythonFiles

void plPythonMgr::LoadPythonFiles()
{
    plFileName clientPath = plMaxConfig::GetClientPath(false, true);
    if (clientPath.IsValid())
    {
        plFileName oldCwd = plFileSystem::GetCWD();
        plFileSystem::SetCWD(clientPath);

        // Get the path to the Python subdirectory of the client
        plFileName pythonPath = plFileName::Join(clientPath, "Python");

        PythonInterface::initPython();

        // Iterate through all the Python files in the folder
        std::vector<plFileName> pys = plFileSystem::ListDir(pythonPath, "*.py");
        for (auto iter = pys.begin(); iter != pys.end(); ++iter)
        {
            // Get the filename without the ".py" (module name)
            ST::string fileName = iter->GetFileNameNoExt();

            IQueryPythonFile(fileName.c_str());
        }

        PythonInterface::finiPython();

        plFileSystem::SetCWD(oldCwd);
    }
}
开发者ID:Hoikas,项目名称:Plasma,代码行数:28,代码来源:plPythonMgr.cpp

示例10: GetInternalName

ST::string GetInternalName(const ST::string& filename) {
    // Different files are stored in different locations; this function
    // will try to guess where to put things based on the file's extension.
    // This is all based on the contents of .sum files included with the
    // games that I examined for this.

    ST::string split = s_oldFormat ? "/" : "\\";
    ST::string name = FixSlashes(filename).after_last(PATHSEP);
    ST::string ext = name.after_last('.');
    if (s_oldFormat && ext == "prp")
        return name;
    if (ext == "ogg" || ext == "wav")
        return ST::string("sfx") + split + name;
    if (ext == "exe" || ext == "dll" || ext == "map" || ext == "pdb")
        return name;
    if (ext == "sdl")
        return ST::string("SDL") + split + name;
    if (ext == "pak")
        return ST::string("Python") + split + name;
    if (ext == "fx")
        return ST::string("fx") + split + name;

    // dat is the default, since so many file types go there...
    // To name a few,
    // prp, age, fni, csv, sub, node, pfp, dat, tron, hex, tga, loc
    return ST::string("dat") + split + name;
}
开发者ID:Lunanne,项目名称:libhsplasma,代码行数:27,代码来源:PlasmaSum.cpp

示例11: droprun

void droprun(dataobject & o)
  {
  list<ST::string> names = o.m.getModelVarnames();
  ST::string boolexp = o.methods[1].getexpression();

  if ( (names.size() > 0) && (boolexp.length() == 0) )
	 {
	 o.d.dropvariables(names);
	 o.errormessages = o.d.geterrormessages();
	if (o.errormessages.empty())
	  o.out("NOTE: " + ST::inttostring(names.size()) + " variables dropped\n");
	 }
  else if ( (names.size() == 0) && (boolexp.length() > 0) )
	 {
     unsigned nrelim;
	 nrelim = o.d.dropobservations(boolexp);
	 o.errormessages = o.d.geterrormessages();
	 if (o.errormessages.empty())
		o.out("NOTE: " + ST::inttostring(nrelim) + " observations dropped\n");
	 }
  else if ( (names.size() == 0) && (boolexp.length() == 0) )
	 {
	 o.outerror("ERROR: varlist or boolean expression expected\n");
	 }
  else
    o.outerror("ERROR: dropping variables and observations in one step not allowed\n");

  o.changedescription();
  }
开发者ID:jfahren,项目名称:BayesX,代码行数:29,代码来源:dataobj.cpp

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

示例13: FindSubDirs

void FindSubDirs(std::vector<plFileName> &dirnames, const plFileName &path)
{
    std::vector<plFileName> subdirs = plFileSystem::ListSubdirs(path);
    for (auto iter = subdirs.begin(); iter != subdirs.end(); ++iter) {
        ST::string name = iter->GetFileName();
        if (name.compare_i("system") != 0 && name.compare_i("plasma") != 0)
            dirnames.push_back(name);
    }
}
开发者ID:Deledrius,项目名称:Plasma,代码行数:9,代码来源:main.cpp

示例14: getOutputDir

ST::string getOutputDir(const ST::string& filename, plPageInfo* page) {
    ST::string odir = filename;
    ST_ssize_t sepLoc = odir.find_last(PATHSEP);
    if (sepLoc < 0)
        odir = ST::string();
    else
        odir = odir.left(sepLoc + 1);
    return odir + ST::format("{}_{}_PRP" PATHSEPSTR, page->getAge(), page->getPage());
}
开发者ID:Deledrius,项目名称:libhsplasma,代码行数:9,代码来源:PrpPack.cpp

示例15: writeBytes

void DS::Stream::writeString(const ST::string& value, DS::StringType format)
{
    if (format == e_StringUTF16) {
        ST::utf16_buffer buffer = value.to_utf16();
        writeBytes(buffer.data(), buffer.size() * sizeof(char16_t));
    } else {
        ST::char_buffer buffer = (format == e_StringUTF8) ? value.to_utf8()
                               : value.to_latin_1(ST::substitute_invalid);
        writeBytes(buffer.data(), buffer.size() * sizeof(char));
    }
}
开发者ID:zrax,项目名称:dirtsand,代码行数:11,代码来源:streams.cpp


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