本文整理汇总了C++中StringAttr::set方法的典型用法代码示例。如果您正苦于以下问题:C++ StringAttr::set方法的具体用法?C++ StringAttr::set怎么用?C++ StringAttr::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringAttr
的用法示例。
在下文中一共展示了StringAttr::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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();
}
示例3: 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);
}
示例4: CMethodInfo
CMethodInfo(const char * label, const char * req, const char * resp) //, const char *sectag, const char *optag,const char* minver=NULL, const char* maxver=NULL)
{
m_label.set(label);
m_requestLabel.set(req);
m_responseLabel.set(resp);
/*
if (sectag)
m_securityTag.append(sectag);
if (optag)
m_optionalTag.append(optag);
m_minVer = (minver)?atof(minver):-1;
m_maxVer = (maxver)?atof(maxver):-1;
*/
};
示例5: addElementToPTree
static void addElementToPTree(IPropertyTree * root, IDefRecordElement * elem)
{
byte kind = elem ? elem->getKind() : DEKnone;
Owned<IPTree> branch = createPTree();
StringAttr branchName;
switch (kind)
{
case DEKnone:
branchName.set("None");
assertex(elem->numChildren() == 0);
break;
case DEKrecord:
{
branchName.set("Record");
branch->setPropInt("@maxSize", elem->getMaxSize());
unsigned numChildren = elem->numChildren();
for (unsigned i=0; i < numChildren; i++)
addElementToPTree(branch, elem->queryChild(i));
break;
}
case DEKifblock:
{
branchName.set("IfBlock");
StringBuffer value;
elem->queryCompareValue()->getStringValue(value);
branch->setProp("@compareValue", value.str());
assertex(elem->numChildren() == 2);
addElementToPTree(branch, elem->queryChild(0));
addElementToPTree(branch, elem->queryChild(0));
break;
}
case DEKfield:
{
branchName.set("Field");
branch->setProp("@name", elem->queryName()->str());
branch->setPropInt("@maxSize", elem->getMaxSize());
StringBuffer type;
elem->queryType()->getDescriptiveType(type);
branch->setProp("@type", type.str());
assertex(elem->numChildren() <= 1);
if(elem->numChildren())
addElementToPTree(branch, elem->queryChild(0));
break;
}
default:
throwUnexpected();
}
root->addPropTree(branchName.get(), branch.getClear());
}
示例6: 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);
}
示例7: getAccountInfo
//---------------------------------------------------------------------------
// getAccountInfo
//---------------------------------------------------------------------------
void getAccountInfo(const char* computer, StringAttr& user, StringAttr& pwd, IConstEnvironment* pConstEnv)
{
if (!pConstEnv)
throw MakeStringException(-1, "No environment is available!");
Owned<IConstMachineInfo> machine = pConstEnv->getMachine(computer);
if (!machine)
{
StringBuffer sComputer(computer);
StringBuffer sExtra;
if (sExtra.length() == 0)
machine.setown( pConstEnv->getMachineByAddress(computer) );
if (!machine)
throw MakeStringException(-1, "The computer '%s' is undefined!", computer);
}
Owned<IConstDomainInfo> domain = machine->getDomain();
if (!domain)
throw MakeStringException(-1, "The computer '%s' does not have any domain information!", computer);
StringBuffer x;
domain->getName(StringBufferAdaptor(x));
if (x.length())
x.append(PATHSEPCHAR);
domain->getAccountInfo(StringBufferAdaptor(x), StringAttrAdaptor(pwd));
user.set(x.str());
}
示例8: processOption
void processOption(const char *option, const char *value, StringBuffer &eclccCmd, StringBuffer &eclccProgName, IPipeProcess &pipe, bool isLocal)
{
if (memicmp(option, "eclcc-", 6) == 0 || *option=='-')
{
//Allow eclcc-xx-<n> so that multiple values can be passed through for the same named debug symbol
const char * start = option + (*option=='-' ? 1 : 6);
const char * dash = strchr(start, '-'); // position of second dash, if present
StringAttr optName;
if (dash)
optName.set(start, dash-start);
else
optName.set(start);
if (stricmp(optName, "hook") == 0)
{
if (isLocal)
throw MakeStringException(0, "eclcc-hook option can not be set per-workunit"); // for security reasons
eclccProgName.set(value);
}
else if (stricmp(optName, "compileOption") == 0)
eclccCmd.appendf(" -Wc,%s", value);
else if (stricmp(optName, "includeLibraryPath") == 0)
eclccCmd.appendf(" -I%s", value);
else if (stricmp(optName, "libraryPath") == 0)
eclccCmd.appendf(" -L%s", value);
else if (stricmp(start, "-allow")==0)
{
if (isLocal)
throw MakeStringException(0, "eclcc-allow option can not be set per-workunit"); // for security reasons
eclccCmd.appendf(" -%s=%s", start, value);
}
else
eclccCmd.appendf(" -%s=%s", start, value);
}
else if (strchr(option, '-'))
{
StringBuffer envVar;
if (isLocal)
envVar.append("WU_");
envVar.append(option);
envVar.toUpperCase();
envVar.replace('-','_');
pipe.setenv(envVar, value);
}
else
eclccCmd.appendf(" -f%s=%s", option, value);
}
示例9: parseCommandLineOptions
bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
//First 4 parameter's order is fixed.
//TargetESPProcessName
//TargetESPBindingPort | TargetESPServiceName
//ESDLDefinitionId
//ESDLServiceName
for (int cur = 0; cur < 4 && !iter.done(); cur++)
{
const char *arg = iter.query();
if (*arg != '-')
{
switch (cur)
{
case 0:
optTargetESPProcName.set(arg);
break;
case 1:
optPortOrName.set(arg);
break;
case 2:
optESDLDefID.set(arg);
break;
case 3:
optESDLService.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;
}
示例10: init
void init()
{
StringBuffer xpath("Software/ThorCluster[@name=\"");
xpath.append(clusterName).append("\"]");
Owned<IRemoteConnection> conn = querySDS().connect("/Environment", myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT);
environment.setown(createPTreeFromIPT(conn->queryRoot()));
options = environment->queryPropTree(xpath.str());
if (!options)
throwUnexpected();
groupName.set(options->queryProp("@nodeGroup"));
if (groupName.isEmpty())
groupName.set(options->queryProp("@name"));
VStringBuffer spareS("%s_spares", groupName.get());
spareGroupName.set(spareS);
group.setown(queryNamedGroupStore().lookup(groupName));
spareGroup.setown(queryNamedGroupStore().lookup(spareGroupName));
}
示例11: init
virtual void init()
{
CMasterActivity::init();
helper = (IHThorKeyPatchArg *)queryHelper();
OwnedRoxieString originalHelperName(helper->getOriginalName());
OwnedRoxieString patchHelperName(helper->getPatchName());
OwnedRoxieString outputHelperName(helper->getOutputName());
StringBuffer expandedFileName;
queryThorFileManager().addScope(container.queryJob(), originalHelperName, expandedFileName, false);
originalName.set(expandedFileName);
queryThorFileManager().addScope(container.queryJob(), patchHelperName, expandedFileName.clear(), false);
patchName.set(expandedFileName);
queryThorFileManager().addScope(container.queryJob(), outputHelperName, expandedFileName.clear(), false);
outputName.set(expandedFileName);
originalIndexFile.setown(queryThorFileManager().lookup(container.queryJob(), originalHelperName));
patchFile.setown(queryThorFileManager().lookup(container.queryJob(), patchHelperName));
if (originalIndexFile->numParts() != patchFile->numParts())
throw MakeActivityException(this, TE_KeyPatchIndexSizeMismatch, "Index %s and patch %s differ in width", originalName.get(), patchName.get());
if (originalIndexFile->querySuperFile() || patchFile->querySuperFile())
throw MakeActivityException(this, 0, "Patching super files not supported");
addReadFile(originalIndexFile);
addReadFile(patchFile);
width = originalIndexFile->numParts();
originalDesc.setown(originalIndexFile->getFileDescriptor());
patchDesc.setown(patchFile->getFileDescriptor());
Owned<IPartDescriptor> tlkDesc = originalDesc->getPart(originalDesc->numParts()-1);
const char *kind = tlkDesc->queryProperties().queryProp("@kind");
local = NULL == kind || 0 != stricmp("topLevelKey", kind);
if (!local && width > 1)
width--; // 1 part == No n distributed / Monolithic key
if (width > container.queryJob().querySlaves())
throw MakeActivityException(this, 0, "Unsupported: keypatch(%s, %s) - Cannot patch a key that's wider(%d) than the target cluster size(%d)", originalIndexFile->queryLogicalName(), patchFile->queryLogicalName(), width, container.queryJob().querySlaves());
IArrayOf<IGroup> groups;
fillClusterArray(container.queryJob(), outputName, clusters, groups);
newIndexDesc.setown(queryThorFileManager().create(container.queryJob(), outputName, clusters, groups, 0 != (KDPoverwrite & helper->getFlags()), 0, !local, width));
if (!local)
newIndexDesc->queryPart(newIndexDesc->numParts()-1)->queryProperties().setProp("@kind", "topLevelKey");
}
示例12: MakeStringException
CDaliServixFilter(IPropertyTree &filter)
{
const char *subnet = filter.queryProp("@subnet");
const char *mask = filter.queryProp("@mask");
if (!ipSubNet.set(subnet, mask))
throw MakeStringException(0, "Invalid sub net definition: %s, %s", subnet, mask);
dir.set(filter.queryProp("@directory"));
trace = filter.getPropBool("@trace");
}
示例13: extractEclCmdOption
bool extractEclCmdOption(StringAttr & option, IProperties * globals, const char * envName, const char * propertyName, const char * defaultPrefix, const char * defaultSuffix)
{
if (option)
return true;
StringBuffer temp;
bool ret = extractEclCmdOption(temp, globals, envName, propertyName, defaultPrefix, defaultSuffix);
option.set(temp.str());
return ret;
}
示例14: init
int init(const char *caller,const char *_path, bool allscopes,bool allfiles)
{
if (_path==NULL)
path.set("");
else
path.set(_path);
err = 0;
try {
if (!queryDistributedFileDirectory().loadScopeContents(_path,allscopes?&scopes:NULL,allfiles?&supers:NULL,allfiles?&files:NULL,true))
err = -ENOENT;
else
if (allfiles)
donefiles = true;
}
catch (IException *e) {
EXCLOG(e,caller);
err = -EFAULT;
}
return err;
}
示例15: setPMID
void setPMID(const char *_target, const char *name, bool globalScope)
{
if (!name || !*name)
throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "PackageMap name parameter required");
if (!globalScope)
{
target.set(_target);
if (target.isEmpty())
throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "Target cluster parameter required");
ensureClusterInfo();
pmid.append(target).append("::");
}
pmid.append(name);
pmid.toLowerCase();
}