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


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

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


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

示例1: 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);
    }
开发者ID:jamienoss,项目名称:HPCC-Platform,代码行数:33,代码来源:esdl-publish.cpp

示例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");
    }
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:17,代码来源:rmtsmtp.cpp

示例3: 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);
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:41,代码来源:libxml_validator.cpp

示例4: 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;
    }
开发者ID:SAB2012,项目名称:HPCC-Platform,代码行数:39,代码来源:esdl-publish.cpp

示例5: send

    bool send(INode *node,unsigned timeout)
    {
        unsigned retries = 3;
        loop {
            try {
                CMessageBuffer mb;
                serialize(mb);
                if (queryWorldCommunicator().sendRecv(mb,node,MPTAG_SASHA_REQUEST,timeout?timeout:12*60*60*1000)) { // could take a long time!
                    clearIds();
                    clearResults();
                    if (action==SCA_WORKUNIT_SERVICES_GET) {
                        mb.swapWith(wusbuf);
                    }
                    else {
                        unsigned n=0;
                        unsigned i;
                        if (mb.length()-mb.getPos()>=sizeof(unsigned)) {
                            mb.read(n);
                            for (i=0;i<n;i++) {
                                StringAttr s;
                                mb.read(s);
                                addId(s.get());
                            }
                            if (mb.length()-mb.getPos()>=sizeof(unsigned)+sizeof(bool)) {
                                mb.read(resultoverflow);
                                mb.read(n);
                                for (i=0;i<n;i++) {
                                    StringAttr res;
                                    mb.read(res);
                                    size32_t reslen = res.length();
                                    results.append(*new StringAttrItem(res,reslen));
                                    resultsize += reslen;
                                }
                                if (mb.length()-mb.getPos()>=sizeof(unsigned)) {
                                    mb.read(numdts);
                                    free(dts);
                                    dts = NULL;
                                    if (numdts) {
                                        dts = (CDateTime *)calloc(numdts,sizeof(CDateTime));
                                        for (i=0;i<numdts;i++)
                                            dts[i].deserialize(mb);
                                    }
                                }

                            }
                        }
                    }
                    return true;
                }   
                else
                    break;
            }
            catch (IException *e) {
                if ((--retries==0)||(action==SCA_STOP))
                    throw;
                EXCLOG(e,"CSashaCommand send");
                ::Release(e);
            }
            try { // shouldn't really be necessary but make sure socket really closed
                queryWorldCommunicator().disconnect(node);
            }
            catch (IException *e) {
                EXCLOG(e,"CSashaCommand disconnect");
                ::Release(e);
            }
        }; 
        return false;
    }
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:68,代码来源:sacmd.cpp

示例6: CThorNodeGroup

 CThorNodeGroup(const char* _groupName, unsigned _nodeCount, bool _replicateOutputs)
     : groupName(_groupName), nodeCount(_nodeCount), replicateOutputs(_replicateOutputs)
 {
     keyhash = hashnc((const byte *)groupName.get(),groupName.length(),0);
     timeCached = msTick();
 }
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:6,代码来源:ws_dfuService.hpp

示例7: doSendQuery

int doSendQuery(const char * ip, unsigned port, const char * base)
{
    Owned<ISocket> socket;
    Owned<ISecureSocketContext> secureContext;
    __int64 starttime, endtime;
    StringBuffer ipstr;
    try
    {
        if (strcmp(ip, ".")==0)
            ip = GetCachedHostName();
        else
        {
            const char *dash = strchr(ip, '-');
            if (dash && isdigit(dash[1]) && dash>ip && isdigit(dash[-1]))
            {
                if (persistConnections)
                    UNIMPLEMENTED;
                const char *startrange = dash-1;
                while (isdigit(startrange[-1]))
                    startrange--;
                char *endptr;
                unsigned firstnum = atoi(startrange);
                unsigned lastnum = strtol(dash+1, &endptr, 10);
                if (lastnum > firstnum)
                {
                    static unsigned counter;
                    static CriticalSection counterCrit;
                    CriticalBlock b(counterCrit);
                    ipstr.append(startrange - ip, ip).append((counter++ % (lastnum+1-firstnum)) + firstnum).append(endptr);
                    ip = ipstr.str();
                    printf("Sending to %s\n", ip);
                }
            }
        }
        starttime= get_cycles_now();
        if (persistConnections)
        {
            if (!persistSocket)
            {
                SocketEndpoint ep(ip,port);
                persistSocket.setown(ISocket::connect_timeout(ep, 1000));
                if (useSSL)
                {
#ifdef _USE_OPENSSL
                    if (!persistSecureContext)
                        persistSecureContext.setown(createSecureSocketContext(ClientSocket));
                    persistSSock.setown(persistSecureContext->createSecureSocket(persistSocket.getClear()));
                    persistSSock->secure_connect();
                    persistSocket.setown(persistSSock.getClear());
#else
                    throw MakeStringException(-1, "OpenSSL disabled in build");
#endif
                }
            }
            socket = persistSocket;
        }
        else
        {
            SocketEndpoint ep(ip,port);
            socket.setown(ISocket::connect_timeout(ep, 100000));
            if (useSSL)
            {
#ifdef _USE_OPENSSL
                secureContext.setown(createSecureSocketContext(ClientSocket));
                Owned<ISecureSocket> ssock = secureContext->createSecureSocket(socket.getClear());
                ssock->secure_connect();
                socket.setown(ssock.getClear());
#else
                throw MakeStringException(1, "OpenSSL disabled in build");
#endif
            }
        }
    }
    catch(IException * e)
    {
        pexception("failed to connect to server", e);
        return 1;
    }

    StringBuffer fullQuery;
    bool useHTTP = forceHTTP || strstr(base, "<soap:Envelope") != NULL;
    if (useHTTP)
    {
        StringBuffer newQuery;
        Owned<IPTree> p = createPTreeFromXMLString(base, ipt_none, ptr_none);
        const char *queryName = p->queryName();
        if ((stricmp(queryName, "envelope") != 0) && (stricmp(queryName, "envelope") != 0))
        {
            if (queryNameOverride.length())
                queryName = queryNameOverride;
            newQuery.appendf("<Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><Body><%sRequest>", queryName);
            Owned<IPTreeIterator> elements = p->getElements("./*");
            ForEach(*elements)
            {
                IPTree &elem = elements->query();
                toXML(&elem, newQuery, 0, XML_SingleQuoteAttributeValues);
            }
            newQuery.appendf("</%sRequest></Body></Envelope>", queryName);
            base = newQuery.str();
        }
//.........这里部分代码省略.........
开发者ID:miguelvazq,项目名称:HPCC-Platform,代码行数:101,代码来源:testsocket.cpp

示例8: xsdNsLength

 int xsdNsLength()   { return m_xsdNamespace.length(); }
开发者ID:afishbeck,项目名称:HPCC-Platform,代码行数:1,代码来源:msggenerator.hpp

示例9: appendVariableParmInfo

void appendVariableParmInfo(IArrayOf<IPropertyTree> &parts, IResultSetFactory *resultSetFactory, IConstWUResult &var, unsigned hashWebserviceSeq=0)
{
    Owned<IResultSetMetaData> meta = resultSetFactory->createResultSetMeta(&var);
    StringAttr noinput;
    if (var.getResultFieldOpt("noinput", StringAttrAdaptor(noinput)).length() && strToBool(noinput.length(), noinput.get()))  //developer specified not to show field on form
        return;

    SCMStringBuffer varname;
    var.getResultName(varname);
    int seq = var.getResultSequence();

    WUResultFormat fmt = var.getResultFormat();

    SCMStringBuffer eclschema;
    var.getResultEclSchema(eclschema);

    StringBuffer width, height, fieldSeq, isPassword, select;
    var.getResultFieldOpt("fieldwidth", StringBufferAdaptor(width));
    var.getResultFieldOpt("fieldheight", StringBufferAdaptor(height));
    var.getResultFieldOpt("password", StringBufferAdaptor(isPassword));
    var.getResultFieldOpt("select", StringBufferAdaptor(select));
    if (hashWebserviceSeq)
        fieldSeq.append(hashWebserviceSeq);
    else
        var.getResultFieldOpt("sequence", StringBufferAdaptor(fieldSeq));

    SCMStringBuffer s;
    Owned<IPropertyTree> part = createPTree("part");
    if (!var.isResultScalar())
    {
        meta->getXmlSchema(s, false);
        part->setProp("@name", varname.str());
        part->setProp("@type", "tns:XmlDataset");
        if (fieldSeq.length())
            part->setProp("@sequence", fieldSeq);
    }
    else
    {
        meta->getColumnEclType(s, 0);
        DisplayType dt = meta->getColumnDisplayType(0);
        StringAttr ptype;
        switch (dt)
        {
        case TypeBoolean:
            ptype.set("xsd:boolean");
            break;
        case TypeInteger:
            ptype.set("xsd:integer");
            break;
        case TypeUnsignedInteger:
            ptype.set("xsd:integer");
            break;
        case TypeReal:
            ptype.set("xsd:real");
            break;
        case TypeSet:
            ptype.set("tns:EspStringArray");
            break;
        case TypeDataset:
        case TypeData:
            ptype.set("tns:XmlDataSet");
            break;
        case TypeUnicode:
        case TypeString:
            ptype.set("xsd:string");
            break;
        case TypeUnknown:
        case TypeBeginIfBlock:
        case TypeEndIfBlock:
        case TypeBeginRecord:
        default:
            ptype.set("xsd:string");
            break;
        }
        part->setProp("@name", varname.str());
        part->setProp("@type", ptype.str());
        if (width.length())
            part->setProp("@width", width);
        if (height.length())
            part->setProp("@height", height);
        if (fieldSeq.length())
            part->setProp("@sequence", fieldSeq);
        if (isPassword.length())
            part->setProp("@password", isPassword);
        if (select.length())
        {
            StringArray optionList;
            optionList.appendList(select, ",");
            IPropertyTree *selectTree = ensurePTree(part, "select");
            ForEachItemIn(i, optionList)
            {
                const char *value = optionList.item(i);
                bool selected = '*'==*value;
                if (selected)
                    value++;
                StringAttr name;
                const char *eq = strchr(value, '=');
                if (!eq)
                    name.set(value);
                else
//.........这里部分代码省略.........
开发者ID:Josh-Googler,项目名称:HPCC-Platform,代码行数:101,代码来源:ws_ecl_wuinfo.cpp


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