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


C++ StringAttr::clear方法代码示例

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


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

示例1: connectionRemoteMachine

bool connectionRemoteMachine(const StringBuffer& sPath, IConstEnvironment* pConstEnv)
{
  bool rc = true;
  if (sPath.length() > 2 && sPath[0] == '\\' && sPath[1] == '\\')
  {
    const char* spath = sPath.str();
    const char* cpos = strchr(spath + 2, '\\');
    int pos = cpos? cpos - spath : -1;

    if (pos != -1)
    {
      char szComp[128];
      strncpy(szComp, spath + 2, pos);
      StringBuffer computer(szComp);
      StringAttr userid;
      StringAttr pswd;

      try {
        //if computer is defined in hardware section then use its associated
        //login information, if any
        getAccountInfo(computer, userid, pswd, pConstEnv);
      } catch (...)
      {
        userid.clear();
        pswd.clear();
      }
    }
  }
  return rc;
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:30,代码来源:buildset.cpp

示例2: splitArchivedFileName

static void splitArchivedFileName(const char *fullName, StringAttr &container, StringAttr &option, StringAttr &relPath)
{
    const char *tail = splitName(fullName);
    assertex(tail);
    size_t containerLen = tail-fullName;
    if (fullName[containerLen-1]==PATHSEPCHAR)
        containerLen--;
    container.set(fullName, containerLen);
    if (*tail=='{')
    {
        tail++;
        const char *end = strchr(tail, '}');
        if (!end)
            throw MakeStringException(0, "Invalid archive-embedded filename - no matching } found");
        option.set(tail, end - tail);
        tail = end+1;
        if (*tail==PATHSEPCHAR)
            tail++;
        else if (*tail != 0)
            throw MakeStringException(0, "Invalid archive-embedded filename - " PATHSEPSTR " expected after }");
    }
    else
        option.clear();
    if (tail && *tail)
    {
        StringBuffer s(tail);
        s.replace(PATHSEPCHAR, '/');
        relPath.set(s);
    }
    else
        relPath.clear();
}
开发者ID:BenMJones,项目名称:HPCC-Platform,代码行数:32,代码来源:archive.cpp

示例3: splitGitFileName

static void splitGitFileName(const char *fullName, StringAttr &gitDir, StringAttr &revision, StringAttr &relPath)
{
    assertex(fullName);
    const char *git = strstr(fullName, ".git" PATHSEPSTR "{" );
    assertex(git);
    const char *tail = git+5;
    gitDir.set(fullName, tail-fullName);
    assertex (*tail=='{');
    tail++;
    const char *end = strchr(tail, '}');
    if (!end)
        throw MakeStringException(0, "Invalid git repository filename - no matching } found");
    revision.set(tail, end - tail);
    tail = end+1;
    if (*tail==PATHSEPCHAR)
        tail++;
    else if (*tail != 0)
        throw MakeStringException(0, "Invalid git repository filename - " PATHSEPSTR " expected after }");
    if (tail && *tail)
    {
        StringBuffer s(tail);
        s.replace(PATHSEPCHAR, '/');
        relPath.set(s);
    }
    else
        relPath.clear();
    // Check it's a valid git repository
    StringBuffer configName(gitDir);
    configName.append("config");
    if (!checkFileExists(configName.str()))
        throw MakeStringException(0, "Invalid git repository - config file %s not found", configName.str());
}
开发者ID:garonsky,项目名称:HPCC-Platform,代码行数:32,代码来源:gitfile.cpp


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