本文整理汇总了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;
}
示例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();
}
示例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());
}