本文整理汇总了C++中StringAttr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ StringAttr::get方法的具体用法?C++ StringAttr::get怎么用?C++ StringAttr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringAttr
的用法示例。
在下文中一共展示了StringAttr::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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("");
}
示例2: MakeStringException
CMailInfo(char const * _to, char const * _subject, char const * _mailServer, unsigned _port, char const * _sender, StringArray *_warnings)
: subject(_subject), mailServer(_mailServer), port(_port), sender(_sender), lastAction("process initialization"), inlen(0)
{
warnings = _warnings;
CSMTPValidator validator;
if(strlen(senderHeader) + sender.length() > 998)
throw MakeStringException(0, "email sender address too long: %" I64F "u characters", static_cast<__uint64>(sender.length()));
validator.validateAddress(sender.get(), "email sender address");
getRecipients(validator, _to);
if(strlen(toHeader) + to.length() > 998)
throw MakeStringException(0, "Email recipient address list too long: %u characters", to.length());
if(strlen(subjectHeader) + subject.length() > 998)
throw MakeStringException(0, "Email subject too long: %" I64F "u characters", static_cast<__uint64>(subject.length()));
validator.validateValue(subject.get(), "email subject");
}
示例3: querySDS
IPropertyTree *getSwapNodeInfo(bool create)
{
Owned<IRemoteConnection> conn = querySDS().connect("/SwapNode", myProcessSession(), RTM_LOCK_WRITE|(create?RTM_CREATE_QUERY:0), 1000*60*5);
if (!conn) {
ERRLOG("SWAPNODE: could not connect to /SwapNode branch");
return NULL;
}
StringBuffer xpath;
xpath.appendf("Thor[@group=\"%s\"]",groupName.get());
Owned<IPropertyTree> info = conn->queryRoot()->getPropTree(xpath.str());
if (!info) {
if (!create) {
PROGLOG("SWAPNODE: no information for group %s",groupName.get());
return NULL;
}
info.set(conn->queryRoot()->addPropTree("Thor",createPTree("Thor")));
info->setProp("@group",groupName.get());
}
return info.getClear();
}
示例4: validate
void CLibXmlValidator::validate()
{
if (!xmlFile.length() && !xml.length())
throw MakeStringException(XMLERR_MissingSource, "Source XML not provided");
if (!xsdFile.length() && !xsd.length())
throw MakeStringException(XMLERR_MissingSource, "XML Schema not provided");
xmlParserInputBufferPtr input;
if (xmlFile.length())
input = xmlParserInputBufferCreateFilename(xmlFile.get(), XML_CHAR_ENCODING_NONE);
else
input = xmlParserInputBufferCreateMem(xml.str(), xml.length()+1, XML_CHAR_ENCODING_NONE);
if (!input)
throw MakeStringException(XMLERR_InvalidXml, "Failed to create XML input stream");
xmlSchemaParserCtxtPtr xsdParser;
if (xsdFile.length())
xsdParser = xmlSchemaNewParserCtxt(xsdFile.get());
else
xsdParser = xmlSchemaNewMemParserCtxt(xsd.str(), xsd.length());
if (!xsdParser)
throw MakeStringException(XMLERR_InvalidXsd, "Failed to load XML Schema");
xmlSchemaSetParserErrors(xsdParser, libxmlXsdErrorMsgHandler, libxmlXsdErrorMsgHandler, this);
xmlSchemaPtr schema = xmlSchemaParse(xsdParser);
xmlSchemaFreeParserCtxt(xsdParser);
if (!schema)
throw MakeStringException(XMLERR_InvalidXsd, "XSD schema parsing failed");
xmlSchemaValidCtxtPtr validator = xmlSchemaNewValidCtxt(schema);
xmlSchemaSetValidErrors(validator, libxmlXsdErrorMsgHandler, libxmlXsdErrorMsgHandler, this);
int ret = xmlSchemaValidateStream(validator, input, XML_CHAR_ENCODING_NONE, emptySAXHandler, (void *)this);
if (ret != 0)
{
ensureExceptions()->append(*MakeStringException(XMLERR_XsdValidationFailed, "XML validation failed"));
throw exceptions.getClear();
}
xmlSchemaFreeValidCtxt(validator);
}
示例5: 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);
}
if (optWSProcAddress.isEmpty())
throw MakeStringException( 0, "Server address of ESDL process server must be provided" );
if (optWSProcPort.isEmpty())
throw MakeStringException( 0, "Port on which ESDL process is listening must be provided" );
return true;
}
示例6: 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());
}
示例7: parseCommandLineOption
bool parseCommandLineOption(ArgvIterator &iter)
{
StringAttr oneOption;
if (iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH) || iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH_S))
{
if(optIncludePath.length() > 0)
optIncludePath.append(ENVSEPSTR);
optIncludePath.append(oneOption.get());
return true;
}
if (EsdlPublishCmdCommon::parseCommandLineOption(iter))
return true;
return false;
}
示例8: 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));
}
示例9: open
void open()
{
SocketEndpoint address(mailServer.get());
if (address.isNull())
throw MakeStringException(MSGAUD_operator, 0, "Could not resolve mail server address %s in SendEmail*", mailServer.get());
address.port = port;
try
{
socket.setown(ISocket::connect(address));
}
catch(IException *E)
{
E->Release();
throw MakeStringException(MSGAUD_operator, 0, "Failed to connect to mail server at %s:%u in SendEmail*", mailServer.get(), port);
}
lastAction.clear().append("connection to server");
}
示例10: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
if (optTarget.isEmpty())
optTarget.set(arg);
else if (optFileName.isEmpty())
optFileName.set(arg);
else
{
fprintf(stderr, "\nunrecognized argument %s\n", arg);
return false;
}
continue;
}
if (iter.matchFlag(optValidateActive, ECLOPT_ACTIVE))
continue;
if (iter.matchFlag(optCheckDFS, ECLOPT_CHECK_DFS))
continue;
if (iter.matchOption(optPMID, ECLOPT_PMID) || iter.matchOption(optPMID, ECLOPT_PMID_S))
continue;
if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
continue;
StringAttr queryIds;
if (iter.matchOption(queryIds, ECLOPT_QUERYID))
{
optQueryIds.appendList(queryIds.get(), ",");
continue;
}
if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
return false;
}
return true;
}
示例11: sendRecv
bool SortSlaveMP::sendRecv(CMessageBuffer &mb, unsigned timeout)
{
if (!comm->sendRecv(mb,rank,tag,timeout))
return false;
byte ok = 255;
if (mb.length()) {
mb.read(ok);
if (ok==1)
return true;
if (ok==0) {
int err;
mb.read(err);
StringAttr errstr;
mb.read(errstr);
throw MakeStringException(err, "%s", errstr.get());
}
}
throw MakeStringException(-1,"SortSlaveMP::sendRecv() protocol error %d",(int)ok);
return false;
}
示例12: processCMD
int processCMD()
{
Owned<IClientWsESDLConfig> esdlConfigClient = EsdlCmdHelper::getWsESDLConfigSoapService(optWSProcAddress, optWSProcPort, optUser, optPass);
Owned<IClientDeleteESDLBindingRequest> request = esdlConfigClient->createDeleteESDLBindingRequest();
fprintf(stdout,"\nAttempting to un-bind ESDL Service: '%s.%s'\n", optTargetESPProcName.get(), optEspBinding.get());
StringBuffer id;
id.setf("%s.%s", optTargetESPProcName.get(), optEspBinding.get());
request->setId(id);
Owned<IClientDeleteESDLRegistryEntryResponse> resp = esdlConfigClient->DeleteESDLBinding(request);
if (resp->getExceptions().ordinality()>0)
{
EsdlCmdHelper::outputMultiExceptions(resp->getExceptions());
return 1;
}
fprintf(stdout, "\n %s.\n", resp->getStatus().getDescription());
return 0;
}
示例13: write
void write(char const * out, size32_t len, char const * action = NULL)
{
if(action)
lastAction.clear().append(action);
else
lastAction.clear().append(len, out).clip();
try
{
socket->write(out, len);
#ifdef SMTP_TRACE
DBGLOG("SMTP write: [%s]", out);
#endif
}
catch(IException * e)
{
int code = e->errorCode();
StringBuffer buff;
e->errorMessage(buff);
e->Release();
throw MakeStringException(MSGAUD_operator, 0, "Exception %d (%s) in SendEmail* while writing %s to mail server %s:%u", code, buff.str(), lastAction.str(), mailServer.get(), port);
}
}
示例14: queryName
const char * queryName() { return m_name.get(); }
示例15: queryOwner
const char * queryOwner() { return m_owner.get(); }