本文整理汇总了C++中MakeStringException函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeStringException函数的具体用法?C++ MakeStringException怎么用?C++ MakeStringException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeStringException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: esp_service_factory
//when we aren't loading dynamically
// Change the function names when we stick with dynamic loading.
ESP_FACTORY IEspService * esp_service_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
{
if (strcmp(type, "ws_ecl")==0)
{
CWsEclService* service = new CWsEclService;
service->init(name, type, cfg, process);
return service;
}
else
{
throw MakeStringException(-1, "Unknown service type %s", type);
}
return NULL;
}
示例2: LZMALZDecompressToBuffer
void LZMALZDecompressToBuffer(MemoryAttr & out, MemoryBuffer & in)
{
size32_t expsz;
size32_t cmpsz;
in.read(expsz).read(cmpsz);
void *o = out.allocate(expsz);
if (cmpsz!=expsz) {
CLZMA lzma;
size32_t written = lzma.expand(in.readDirect(cmpsz),cmpsz,o,expsz);
if (written!=expsz)
throw MakeStringException(0, "fastLZDecompressToBuffer - corrupt data(4) %d %d",written,expsz);
}
else
memcpy(o,in.readDirect(cmpsz),expsz);
}
示例3: MakeStringException
void CWsPackageProcessEx::getPkgInfoById(const char *packageMapId, IPropertyTree* tree)
{
if (!packageMapId || !*packageMapId)
return;
Owned<IPropertyTree> packageMaps = packageMapAndSet.getPackageMaps();
if (!packageMaps)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve information about package maps from dali server");
StringBuffer xpath;
xpath.append("PackageMap[@id='").append(packageMapId).append("']");
IPropertyTree *mapTree = packageMaps->queryPropTree(xpath);
if (mapTree)
mergePTree(tree, mapTree);
}
示例4: MakeStringException
IClientWsEclResp* CClientWsEclService::sendHttpRequest(IClientWsEclRequest* request, const char* method, const char* URL,
const char *user, const char *pw, const char *realm,
const char* httpPostVariableName, bool encodeHttpPostBody)
{
if(strlen(URL) == 0)
throw MakeStringException(-1, "url not set");
CClientWsEclRequest* eclrequest = dynamic_cast<CClientWsEclRequest*>(request);
Owned<CClientWsEclResponse> eclresponse = new CClientWsEclResponse;
eclresponse->setRequestId(m_reqId);
m_reqId++;
eclrequest->sendHttpRequest(*eclresponse, method, URL, user, pw, realm, httpPostVariableName, encodeHttpPostBody);
return eclresponse.getClear();
}
示例5: LZMADecompressToAttr
void LZMADecompressToAttr(MemoryAttr & out, const void * src)
{
size32_t *sz = (size32_t *)src;
size32_t expsz = *(sz++);
size32_t cmpsz = *(sz++);
void *o = out.allocate(expsz);
if (cmpsz!=expsz) {
CLZMA lzma;
size32_t written = lzma.expand(sz,cmpsz,o,expsz);
if (written!=expsz)
throw MakeStringException(0, "fastLZDecompressToBuffer - corrupt data(2) %d %d",written,expsz);
}
else
memcpy(o,sz,expsz);
}
示例6: getWorkunitFactory
static IWorkUnitFactory * getWorkunitFactory(ICodeContext * ctx)
{
IEngineContext *engineCtx = ctx->queryEngineContext();
if (engineCtx && !engineCtx->allowDaliAccess())
{
Owned<IException> e = MakeStringException(-1, "workunitservices cannot access Dali in this context - this normally means it is being called from a thor slave");
EXCLOG(e, NULL);
throw e.getClear();
}
//MORE: These should really be set up correctly - probably should be returned from IEngineContext
ISecManager *secmgr = NULL;
ISecUser *secuser = NULL;
return getWorkUnitFactory(secmgr, secuser);
}
示例7: xpath
bool CWsLoggingServiceEx::init(const char* service, const char* type, IPropertyTree* cfg, const char* process)
{
VStringBuffer xpath("Software/EspProcess[@name=\"%s\"]/EspService[@name=\"%s\"]", process, service);
Owned<IPropertyTree> pServiceNode = cfg->getPropTree(xpath.str());
if (!pServiceNode)
throw MakeStringException(-1, "No settings found for service %s", service);
Owned<IPropertyTreeIterator> logAgents = pServiceNode->getElements("LogAgent");
if (!logAgents)
throw MakeStringException(-1, "No logAgent is defined for service %s", service);
ForEach(*logAgents)
{
IPropertyTree& ptree = logAgents->query();
const char* agentName = ptree.queryProp("@name");
const char* agentType = ptree.queryProp("@type");
const char* agentPlugin = ptree.queryProp("@plugin");
if (!agentName || !*agentName || !agentPlugin || !*agentPlugin)
continue;
IEspLogAgent* logAgent = loadLoggingAgent(agentName, agentPlugin);
if (!logAgent)
{
ERRLOG(-1, "Failed to create logging agent for %s", agentName);
continue;
}
logAgent->init(agentName, agentType, &ptree, process);
IUpdateLogThread* logThread = createUpdateLogThread(&ptree, service, agentName, logAgent);
if(!logThread)
throw MakeStringException(-1, "Failed to create update log thread for %s", agentName);
loggingAgentThreads.push_back(logThread);
}
return true;
}
示例8: MakeStringException
/**************************************************************************
* CSecureHttpProtocol Implementation *
**************************************************************************/
CSecureHttpProtocol::CSecureHttpProtocol(IPropertyTree* cfg)
{
m_maxConcurrentThreads = 0;
if(cfg != NULL)
{
m_config.setown(cfg);
//ensure keys are specified. Passphrase is optional
StringBuffer sb;
cfg->getProp("certificate", sb);
if(sb.length() == 0)
{
throw MakeStringException(-1, "certificate file not specified in config file");
}
cfg->getProp("privatekey", sb.clear());
if(sb.length() == 0)
{
throw MakeStringException(-1, "private key file not specified in config file");
}
createSecureSocketContextEx2_t xproc = NULL;
IEspPlugin *pplg = loadPlugin(SSLIB);
if (pplg)
xproc = (createSecureSocketContextEx2_t) pplg->getProcAddress("createSecureSocketContextEx2");
else
throw MakeStringException(-1, "dll/shared-object %s can't be loaded", SSLIB);
if (xproc)
m_ssctx.setown(xproc(cfg, ServerSocket));
else
throw MakeStringException(-1, "procedure createSecureSocketContextEx2 can't be loaded");
}
}
示例9: createEclPlusHelper
IEclPlusHelper * createEclPlusHelper(IProperties * globals)
{
// Check to see what kind of helper to return !
IFormatType * format = createFormatter(globals);
IEclPlusHelper * helper = NULL;
if(globals->hasProp("action"))
{
const char * action = globals->queryProp("action");
if(!stricmp(action, "list"))
{
helper = new ListHelper(LINK(globals), format);
}
// Now re-enable delete
else if(!stricmp(action, "delete"))
{
helper = new DeleteHelper(LINK(globals), format);
}
else if(!stricmp(action, "dump"))
{
helper = new DumpHelper(LINK(globals), format);
}
else if(!stricmp(action, "graph"))
{
helper = new GraphHelper(LINK(globals), format);
}
else if(!stricmp(action, "view"))
{
helper = new ViewHelper(LINK(globals), format);
}
else if(!stricmp(action, "query"))
{
helper = new QueryHelper(LINK(globals), format);
}
else if(!stricmp(action, "abort"))
{
helper = new AbortHelper(LINK(globals), format);
}
else if(!stricmp(action, "rerun"))
{
helper = new RerunHelper(LINK(globals), format);
}
else
{
throw MakeStringException(-1, "unknown action");
}
}
return helper;
}
示例10: 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 (!optVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
{
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
}
}
else
throw MakeStringException( 0, "ESDL service definition version must be provided!" );
if(optTargetESPProcName.isEmpty())
throw MakeStringException( 0, "Name of Target ESP process must be provided" );
if (optService.isEmpty())
throw MakeStringException( 0, "Name of ESDL based service must be provided" );
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" );
if (optMethod.isEmpty())
throw MakeStringException( 0, "Name of ESDL based method must be provided" );
if (optBindingName.isEmpty())
throw MakeStringException( 0, "Name of ESP binding must be provided" );
return true;
}
示例11: b
NamedMutex::NamedMutex(const char *name)
{
{
CriticalBlock b(lockPrefixCS);
if (0 == lockPrefix.length())
{
if (!getConfigurationDirectory(NULL, "lock", NULL, NULL, lockPrefix))
throw MakeStringException(0, "Failed to get lock directory from environment");
}
addPathSepChar(lockPrefix);
lockPrefix.append("JLIBMUTEX_");
}
StringBuffer tmp(lockPrefix);
tmp.append("JLIBMUTEX_").append(name);
mutexfname = tmp.detach();
}
示例12: MakeStringException
IClientWsEclResp* CClientWsEclService::search(IClientWsEclRequest* request)
{
if(strlen(m_url) == 0)
{
throw MakeStringException(-1, "url not set");
}
CClientWsEclRequest* eclrequest = dynamic_cast<CClientWsEclRequest*>(request);
Owned<CClientWsEclResponse> eclresponse = new CClientWsEclResponse;
eclresponse->setRequestId(m_reqId);
m_reqId++;
eclrequest->post(m_url, *eclresponse);
return eclresponse.getClear();
}
示例13: appendException
void ParseErrorHandler::handleSAXParserException(const SAXParseException& e, const char* errorType)
{
char systemId[256], publicId[256];
XMLString::transcode(e.getSystemId(),systemId,255);
XMLString::transcode(e.getPublicId(),publicId,255);
char* message = XMLString::transcode(e.getMessage());
StringBuffer msg, line,col;
line.appendlong(e.getLineNumber());
col.appendlong(e.getColumnNumber());
msg.appendf("%s at \"%s\", line %s, char %s: %s", errorType,
(publicId&&publicId[0]) ? publicId : systemId, line.str(), col.str(), message);
appendException(MakeStringException(-1,"%s", msg.str()));
XMLString::release(&message);
}
示例14: MakeStringException
bool CLoggingManager::updateLog(IEspContext* espContext, const char* option, IPropertyTree* userContext, IPropertyTree* userRequest,
const char* backEndReq, const char* backEndResp, const char* userResp, const char* logDatasets, StringBuffer& status)
{
if (!initialized)
throw MakeStringException(-1,"LoggingManager not initialized");
bool bRet = false;
try
{
Owned<IPropertyTree> espContextTree;
if (espContext)
{
espContextTree.setown(createPTree("ESPContext"));
short port;
StringBuffer sourceIP, peerStr;
const char* esdlBindingID = espContext->queryESDLBindingID();
espContext->getServAddress(sourceIP, port);
espContextTree->addProp("SourceIP", sourceIP.str());
espContext->getPeer(peerStr);
espContextTree->addProp("Peer", peerStr.str());
if (!isEmptyString(esdlBindingID))
espContextTree->addProp("ESDLBindingID", esdlBindingID);
//More information in espContext may be added to the espContextTree later.
const char* userId = espContext->queryUserId();
if (userId && *userId)
espContextTree->addProp("UserName", userId);
espContextTree->addProp("ResponseTime", VStringBuffer("%.4f", (msTick()-espContext->queryCreationTime())/1000.0));
}
Owned<IEspUpdateLogRequestWrap> req = new CUpdateLogRequestWrap(nullptr, option, espContextTree.getClear(), LINK(userContext), LINK(userRequest),
backEndReq, backEndResp, userResp, logDatasets);
Owned<IEspUpdateLogResponse> resp = createUpdateLogResponse();
bRet = updateLog(espContext, *req, *resp, status);
}
catch (IException* e)
{
status.set("Failed to update log: ");
e->errorMessage(status);
ERRLOG("%s", status.str());
e->Release();
}
return bRet;
}
示例15: CassandraClusterSession
void CCassandraLogAgent::initKeySpace()
{
//Initialize Cassandra Cluster Session
cassSession.setown(new CassandraClusterSession(cass_cluster_new()));
if (!cassSession)
throw MakeStringException(-1,"Unable to create cassandra cassSession session");
setSessionOptions(NULL);
//ensure defaultDB
ensureDefaultKeySpace();
//ensure transSeed tables
ensureTransSeedTable();
//Read logging transaction seed
queryTransactionSeed(loggingTransactionApp.get(), loggingTransactionSeed);
}