本文整理汇总了C++中StringAttr类的典型用法代码示例。如果您正苦于以下问题:C++ StringAttr类的具体用法?C++ StringAttr怎么用?C++ StringAttr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringAttr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getWorkunit
static IConstWorkUnit *getWorkunit(ICodeContext * ctx)
{
StringAttr wuid;
wuid.setown(ctx->getWuid());
// One assumes we have read access to our own wu
return getWorkunit(ctx, wuid);
}
示例2: getWorkunit
static IConstWorkUnit * getWorkunit(ICodeContext * ctx)
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
StringAttr wuid;
wuid.setown(ctx->getWuid());
return factory->openWorkUnit(wuid, false);
}
示例3: splitXmlTagNamesFromXPath
void splitXmlTagNamesFromXPath(const char *xpath, StringAttr &inner, StringAttr *outer=NULL)
{
if (!xpath || !xpath)
return;
StringBuffer s1;
StringBuffer s2;
appendNextXpathName(s1, xpath);
if (outer && xpath)
appendNextXpathName(s2, ++xpath);
if (xpath) //xpath too deep
return;
if (!s2.length())
inner.set(s1.str());
else
{
inner.set(s2.str());
outer->set(s1.str());
}
if (!inner.get())
inner.set("");
if (outer && !outer->get())
outer->set("");
}
示例4: 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());
}
示例5: 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();
}
示例6: fprintf
eclCmdOptionMatchIndicator EclCmdCommon::matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
{
bool boolValue;
if (iter.matchFlag(boolValue, ECLOPT_VERSION))
{
fprintf(stdout, "%s\n", BUILD_TAG);
return EclCmdOptionCompletion;
}
if (iter.matchOption(optServer, ECLOPT_SERVER)||iter.matchOption(optServer, ECLOPT_SERVER_S))
return EclCmdOptionMatch;
if (iter.matchOption(optPort, ECLOPT_PORT))
return EclCmdOptionMatch;
if (iter.matchOption(optUsername, ECLOPT_USERNAME)||iter.matchOption(optUsername, ECLOPT_USERNAME_S))
return EclCmdOptionMatch;
if (iter.matchOption(optPassword, ECLOPT_PASSWORD)||iter.matchOption(optPassword, ECLOPT_PASSWORD_S))
return EclCmdOptionMatch;
if (iter.matchFlag(optVerbose, ECLOPT_VERBOSE) || iter.matchFlag(optVerbose, ECLOPT_VERBOSE_S))
return EclCmdOptionMatch;
StringAttr tempArg;
if (iter.matchOption(tempArg, "-brk"))
{
#if defined(_WIN32) && defined(_DEBUG)
unsigned id = atoi(tempArg.sget());
if (id == 0)
DebugBreak();
else
_CrtSetBreakAlloc(id);
#endif
return EclCmdOptionMatch;
}
if (finalAttempt)
fprintf(stderr, "\n%s option not recognized\n", iter.query());
return EclCmdOptionNoMatch;
}
示例7: 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;
}
示例8: SplitIpPort
void SplitIpPort(StringAttr & ip, unsigned & port, const char * address)
{
const char * colon = strchr(address, ':');
if (colon)
{
ip.set(address,colon-address);
port = atoi(colon+1);
}
else
ip.set(address);
}
示例9: LINK
IHqlRemoteScope * XmlEclRepository::resolveScope(IProperties *props, const char * modname, bool deleteIfExists, bool createIfMissing)
{
Owned<IHqlRemoteScope> parentScope = LINK(rootScope);
const char * item = modname;
const char * dot;
do
{
dot = strchr(item, '.');
_ATOM moduleName;
StringAttr fullName;
if (dot)
{
moduleName = createIdentifierAtom(item, dot-item);
fullName.set(modname, dot - modname);
item = dot + 1;
}
else
{
moduleName = createIdentifierAtom(item);
fullName.set(modname);
}
//nested module already exist in parent scope?
Owned<IHqlRemoteScope> rScope = parentScope->lookupRemoteModule(moduleName);
if (!rScope && !createIfMissing)
return NULL;
if (rScope && deleteIfExists && !dot)
{
rScope->noteTextModified();
if (rScope->isEmpty())
parentScope->removeNestedScope(moduleName);
return NULL;
}
if (!rScope)
{
rScope.setown(createRemoteScope(moduleName, fullName, this, dot ? NULL : props, NULL, true));
int flags = props->getPropInt("@flags", 0);
parentScope->addNestedScope(rScope->queryScope(), flags);
}
else
rScope->invalidateParsed();
parentScope.set(rScope);
} while (dot);
if (parentScope)
parentScope->noteTextModified();
return parentScope.getLink();
}
示例10: SplitIpPort
void SplitIpPort(StringAttr & ip, unsigned & port, const char * address)
{
const char * colon = strchr(address, ':');
if (colon)
{
ip.set(address,colon-address);
if (strcmp(ip, ".")==0)
ip.set(GetCachedHostName());
port = atoi(colon+1);
}
else
ip.set(address);
}
示例11: run
virtual int run()
{
int access = 0;
int total = 0, mint = -1, maxt = 0;
for(int i = 0; i < m_rounds; i++)
{
time_t start, stop;
time(&start);
{
//synchronized block(m_mutex);
Owned<ISecUser> usr = m_secmgr->createUser(m_user.get());
usr->credentials().setPassword(m_passwd.get());
//access = m_secmgr->authorizeFileScope(*usr, m_resource.get());
access = m_secmgr->authorizeEx(m_rtype, *usr, m_resource.get());
}
time(&stop);
int span = (int)(stop - start);
total += span;
if(mint == -1 || mint > span)
mint = span;
if(maxt < span)
maxt = span;
if((i+1)%100 == 0)
DBGLOG("Finished %d times\n", i+1);
}
DBGLOG("Permission: %d, min: %d, max: %d, average:%f", access, mint, maxt, total*1.0/m_rounds);
return 0;
}
示例12: finalizeOptions
bool finalizeOptions(IProperties *globals)
{
if (optInput.length())
{
const char *in = optInput.get();
while (*in && isspace(*in)) in++;
if (*in!='<')
{
StringBuffer content;
content.loadFile(in);
optInput.set(content.str());
}
}
if (optESDLDefID.isEmpty())
throw MakeStringException( 0, "ESDL definition ID must be provided!" );
if (optESDLService.isEmpty())
throw MakeStringException( 0, "ESDL service definition name must be provided!" );
if(optTargetESPProcName.isEmpty())
throw MakeStringException( 0, "Name of Target ESP process must be provided!" );
if (optPortOrName.isEmpty())
throw MakeStringException( 0, "Either the target ESP service port of name must be provided!" );
else
{
const char * portorname = optPortOrName.get();
isdigit(*portorname) ? optTargetPort.set(portorname) : optService.set(portorname);
}
return EsdlPublishCmdCommon::finalizeOptions(globals);
}
示例13: getHeader
void getHeader(StringBuffer & header) const
{
header.append(senderHeader).append(sender.get()).append("\r\n");
header.append(toHeader).append(to.str()).append("\r\n");
header.append(subjectHeader).append(subject.get()).append("\r\n");
header.append("MIME-Version: 1.0\r\n");
}
示例14: parseCommandLineOptions
bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
//First 5 parameter order is fixed.
for (int cur = 0; cur < 5 && !iter.done(); cur++)
{
const char *arg = iter.query();
if (*arg != '-')
{
switch (cur)
{
case 0:
optTargetESPProcName.set(arg);
break;
case 1:
optBindingName.set(arg);
break;
case 2:
optService.set(arg);
break;
case 3:
optVersionStr.set(arg);
break;
case 4:
optMethod.set(arg);
break;
default:
fprintf(stderr, "\nUnrecognized positional argument detected : %s\n", arg);
usage();
return false;
}
}
else
{
fprintf(stderr, "\noption detected before required arguments: %s\n", arg);
usage();
return false;
}
iter.next();
}
for (; !iter.done(); iter.next())
{
if (parseCommandLineOption(iter))
continue;
if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
return false;
}
return true;
}
示例15: CPermissionCheckThread
CPermissionCheckThread(ISecManager* secmgr, const char* user, const char* passwd, const char* r, SecResourceType rtype, int rounds)
{
m_secmgr = secmgr;
m_user.set(user);
m_passwd.set(passwd);
m_resource.set(r);
m_rtype = rtype;
m_rounds = rounds;
}