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


C++ girerr类代码示例

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


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

示例1: if

static value
i8ValFromParm(string  const& valueString) {

    value retval;

    if (valueString.length() < 1)
        throwf("Integer argument has nothing after the 'I/'");
    else {
        long long value;
        char * tailptr;
        
        errno = 0;

        value = strtoll(valueString.c_str(), &tailptr, 10);

        if (errno == ERANGE)
            throwf("'%s' is out of range for a 64 bit integer",
                   valueString.c_str());
        else if (errno != 0)
            throwf("Mysterious failure of strtoll(), errno=%d (%s)",
                   errno, strerror(errno));
        else {
            if (*tailptr != '\0')
                throwf("64 bit integer argument has non-digit crap "
                       "in it: '%s'",
                       tailptr);
            else
                retval = value_i8(value);
        }
    }
    return retval;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:32,代码来源:xmlrpc_pstream.cpp

示例2: hexByte

static value
bytestringValFromParm(string const& valueString) {

    value retval;

    if (valueString.length() / 2 * 2 != valueString.length())
        throwf("Hexadecimal text is not an even "
               "number of characters (it is %u characters)",
               valueString.length());
    else {
        vector<unsigned char> byteString(valueString.length() / 2);
        size_t strCursor;

        strCursor = 0;

        while (strCursor < valueString.length()) {
            string const hexByte(valueString.substr(strCursor, 2));

            unsigned char byte;
            int rc;

            rc = sscanf(hexByte.c_str(), "%2hhx", &byte);

            byteString.push_back(byte);

            if (rc != 1)
                throwf("Invalid hex data '%s'", hexByte.c_str());
            else
                strCursor += 2;
        }
        retval = value_bytestring(byteString);
    }
    return retval;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:34,代码来源:xmlrpc_pstream.cpp

示例3: catch

static void
parseCommandLine(cmdlineInfo * const cmdlineP,
                 int           const argc,
                 const char ** const argv) {

    CmdlineParser cp;

    cp.defineOption("serverfd",       CmdlineParser::UINT);

    try {
        cp.processOptions(argc, argv);
    } catch (exception const& e) {
        throwf("Command syntax error.  %s", e.what());
    }

    if (cp.optionIsPresent("serverfd")) {
        cmdlineP->serverfd = cp.getOptionValueUint("serverfd");
    } else
        cmdlineP->serverfd = 3;
    
    if (cp.argumentCount() < 1)
        cmdlineP->interactive = true;
    else {
        cmdlineP->interactive = false;
        cmdlineP->methodName = cp.getArgument(0);
        for (uint argI = 1; argI < cp.argumentCount(); ++argI)
            cmdlineP->params.push_back(cp.getArgument(argI));
    }            
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:29,代码来源:xmlrpc_pstream.cpp

示例4: cmdline

int 
main(int           const argc, 
     const char ** const argv) {

    try {
        cmdlineInfo cmdline(argc, argv);

        signal(SIGPIPE, SIG_IGN);

        clientXmlTransport_pstream myTransport(
            clientXmlTransport_pstream::constrOpt()
            .fd(cmdline.serverfd));

        client_xml myClient(&myTransport);

        if (cmdline.interactive) {
            if (cmdline.serverfd == STDIN_FILENO ||
                cmdline.serverfd == STDOUT_FILENO)
                throwf("Can't use Stdin or Stdout for the server fd when "
                       "running interactively.");
            doInteractive(&myClient);
        } else
            doCommand(&myClient, cmdline.methodName, cmdline.params);

    } catch (exception const& e) {
        cerr << "Failed.  " << e.what() << endl;
    } catch (...) {
        cerr << "Code threw unrecognized exception" << endl;
        abort();
    }
    return 0;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:32,代码来源:xmlrpc_pstream.cpp

示例5: paramList

static xmlrpc_value *
c_executeDefaultMethod(xmlrpc_env *   const envP,
                       const char *   const , // host
                       const char *   const methodName,
                       xmlrpc_value * const paramArrayP,
                       void *         const methodPtr) {
/*----------------------------------------------------------------------------
   This is a function designed to be called via a C registry to
   execute an XML-RPC method, but use a C++ method object to do the
   work.  You register this function as the default method function and a
   pointer to the C++ default method object as the method data in the C
   registry.

   If we had a pure C++ registry, this would be unnecessary.

   Since we can't throw an error back to the C code, we catch anything
   the XML-RPC method's execute() method throws, and any error we
   encounter in processing the result it returns, and turn it into an
   XML-RPC method failure.  This will cause a leak if the execute()
   method actually created a result, since it will not get destroyed.
-----------------------------------------------------------------------------*/
    defaultMethod * const methodP = 
        static_cast<defaultMethod *>(methodPtr);
    paramList const paramList(pListFromXmlrpcArray(paramArrayP));

    xmlrpc_value * retval;
    retval = NULL; // silence used-before-set warning

    try {
        xmlrpc_c::value result;
        
        try {
            methodP->execute(methodName, paramList, &result);
        } catch (xmlrpc_c::fault const& fault) {
            xmlrpc_env_set_fault(envP, fault.getCode(), 
                                 fault.getDescription().c_str()); 
        }
        if (!envP->fault_occurred) {
            if (result.isInstantiated())
                retval = result.cValue();
            else
                throwf("Xmlrpc-c user's xmlrpc_c::defaultMethod object's "
                       "'execute method' failed to set the RPC result "
                       "value.");
        }
    } catch (exception const& e) {
        xmlrpc_faultf(envP, "Unexpected error executing default "
                      "method code, detected by Xmlrpc-c "
                      "method registry code.  Method did not "
                      "fail; rather, it did not complete at all.  %s",
                      e.what());
    } catch (...) {
        xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR,
                             "Unexpected error executing default "
                             "method code, detected by Xmlrpc-c "
                             "method registry code.  Method did not "
                             "fail; rather, it did not complete at all.");
    }
    return retval;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:60,代码来源:registry.cpp

示例6: throwf

void
parseResponse(string       const& responseXml,
              rpcOutcome * const  outcomeP) {
/*----------------------------------------------------------------------------
   Parse the XML for an XML-RPC response into an XML-RPC result value.
-----------------------------------------------------------------------------*/
    env_wrap env;

    xmlrpc_value * c_resultP;
    int faultCode;
    const char * faultString;

    xmlrpc_parse_response2(&env.env_c, responseXml.c_str(), responseXml.size(),
                           &c_resultP, &faultCode, &faultString);

    if (env.env_c.fault_occurred)
        throwf("Unable to find XML-RPC response in what server sent back.  %s",
               env.env_c.fault_string);
    else {
        if (faultString) {
            *outcomeP =
                rpcOutcome(fault(faultString,
                                 static_cast<fault::code_t>(faultCode)));
            xmlrpc_strfree(faultString);
        } else {
            XMLRPC_ASSERT_VALUE_OK(c_resultP);
            *outcomeP = rpcOutcome(value(c_resultP));
            xmlrpc_DECREF(c_resultP);
        }
    }
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:31,代码来源:xml.cpp

示例7: e

 abyssGlobalState() {
     const char *error;
     AbyssInit(&error);
     if (error) {
         string const e(error);
         xmlrpc_strfree(error);
         throwf("AbyssInit() failed.  %s", e.c_str());
     }
 }
开发者ID:arssivka,项目名称:naomech,代码行数:9,代码来源:server_abyss.cpp

示例8: parseCommandLine

cmdlineInfo::
cmdlineInfo(int           const argc,
            const char ** const argv) {

    try {
        parseCommandLine(this, argc, argv);
    } catch (exception const& e) {
        throwf("Command syntax error.  %s", e.what());
    }
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:10,代码来源:xmlrpc_pstream.cpp

示例9: throwf

static value
nilValFromParm(string const& valueString) {

    value retval;

    if (valueString.length() > 0)
        throwf("Nil argument has something after the 'n/'");
    else
        retval = value_nil();

    return retval;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:12,代码来源:xmlrpc_pstream.cpp

示例10: call

    void
    call(xmlrpc_c::carriageParm * const  carriageParmP,
         string                   const& callXml,
         string *                 const  responseXmlP) {

        carriageParm_direct * const parmP =
            dynamic_cast<carriageParm_direct *>(carriageParmP);

        if (parmP == NULL)
            throw(error("Carriage parameter passed to the direct "
                        "transport is not type carriageParm_direct"));

        parmP->registryP->processCall(callXml, responseXmlP);
    }
开发者ID:RayPlante,项目名称:usvirtualobservatory,代码行数:14,代码来源:testclient.cpp

示例11: callWithClient

static void
doCommand(client_xml *   const  clientP,
          string         const& methodName,
          vector<string> const& paramArgs) {

    value result;

    callWithClient(clientP, methodName, paramListFromParamArgs(paramArgs),
                   &result);

    try {
        dumpResult(result);
    } catch(exception const& e) {
        throwf("Error showing result after RPC completed normally.  %s",
               e.what());
    }
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:17,代码来源:xmlrpc_pstream.cpp

示例12: parseResponse

void
parseSuccessfulResponse(string  const& responseXml,
                        value * const  resultP) {
/*----------------------------------------------------------------------------
   Same as parseResponse(), but expects the response to indicate success;
   throws an error if it doesn't.
-----------------------------------------------------------------------------*/
    rpcOutcome outcome;

    parseResponse(responseXml, &outcome);

    if (!outcome.succeeded())
        throwf("RPC response indicates it failed.  %s",
               outcome.getFault().getDescription().c_str());

    *resultP = outcome.getResult();
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:17,代码来源:xml.cpp

示例13: myRpcP

static void
callWithClient(client *  const  clientP,
               string    const& methodName,
               paramList const& paramList,
               value *   const  resultP) {
               
    rpcPtr myRpcP(methodName, paramList);

    carriageParm_pstream myCarriageParm;  // Empty - no parm needed

    try {
        myRpcP->call(clientP, &myCarriageParm);
    } catch (exception const& e) {
        throwf("RPC failed.  %s", e.what());
    }
    *resultP = myRpcP->getResult();
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:17,代码来源:xmlrpc_pstream.cpp

示例14: wordList

static void
parseCommand(string           const& cmd,
             string *         const  methodNameP,
             vector<string> * const  paramListP) {

    list<string> const wordList(parseWordList(cmd));

    list<string>::const_iterator cmdWordP;

    cmdWordP = wordList.begin();

    if (cmdWordP == wordList.end())
        throwf("Command '%s' does not have a method name", cmd.c_str());
    else {
        *methodNameP = *cmdWordP++;

        *paramListP = vector<string>();  // Start empty
        
        while (cmdWordP != wordList.end())
            paramListP->push_back(*cmdWordP++);
    }
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:22,代码来源:xmlrpc_pstream.cpp


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