本文整理汇总了C++中RuntimeException函数的典型用法代码示例。如果您正苦于以下问题:C++ RuntimeException函数的具体用法?C++ RuntimeException怎么用?C++ RuntimeException使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RuntimeException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
void SthenoCore::changeIIDOfService(UUIDPtr& sid, UUIDPtr& iid, UUIDPtr& newIid) throw (RuntimeException&, ServiceException&) {
if (!isValid()) {
throw RuntimeException(RuntimeException::INVALID_RUNTIME);
}
LocalServicePtr servicePtr;
if (m_serviceMap.find(sid, servicePtr) == -1) {
throw ServiceException(ServiceException::SERVICE_NOT_KNOWN);
}
servicePtr->setIID(iid, newIid);
ServiceInstanceInfoPtr info;
servicePtr->getInstancesOfServiceInfo(newIid, info);
//info has the newIid
MeshPtr meshPtr;
try {
getOverlay()->getMesh(meshPtr);
} catch (OverlayException& ex) {
throw RuntimeException(RuntimeException::INVALID_OVERLAY);
}
meshPtr->onServiceUpdateIID(sid, iid, newIid);
}
示例2: IMG_Load
SDL_Surface* Art::LoadTex(const char *fileName)
{
SDL_Surface *s = IMG_Load(fileName);
if (!s)
{
char message[0xff];
sprintf(message, "Can not load resource file %s", fileName);
throw RuntimeException(message);
}
return s;
}
示例3: return
/*!
Returns the MongoDB driver associated with the TMongoQuery object.
*/
const TMongoDriver *TMongoQuery::driver() const
{
#ifdef TF_NO_DEBUG
return (const TMongoDriver *)database.driver();
#else
const TMongoDriver *driver = dynamic_cast<const TMongoDriver *>(database.driver());
if (!driver) {
throw RuntimeException("cast error", __FILE__, __LINE__);
}
return driver;
#endif
}
示例4: RuntimeException
void LayeredConfiguration::setRaw(const std::string& key, const std::string& value)
{
for (ConfigList::iterator it = _configs.begin(); it != _configs.end(); ++it)
{
if (it->writeable)
{
it->pConfig->setRaw(key, value);
return;
}
}
throw RuntimeException("No writeable configuration object to store the property", key);
}
示例5: RuntimeException
void executive::ReconvergenceTFSoftware::eval_Exit(
executive::CTAContext &context,
const ir::PTXInstruction &instr) {
if (stack.size() == 1 &&
context.active.count() == context.active.size()) {
context.executionState = CTAContext::Exit;
}
else {
throw RuntimeException("not all threads hit the exit: ",
context.PC, instr);
}
}
示例6: anyUnhandledExceptions
bool ConcurrentMergeScheduler::anyUnhandledExceptions() {
if (!allInstances) {
boost::throw_exception(RuntimeException(L"setTestMode() was not called"));
}
SyncLock instancesLock(&allInstances);
for (Collection<ConcurrentMergeSchedulerPtr>::iterator instance = allInstances.begin(); instance != allInstances.end(); ++instance) {
(*instance)->sync();
}
bool v = anyExceptions;
anyExceptions = false;
return v;
}
示例7: AtomSpace_getAtomByHandle
int AtomSpace_getAtomByHandle( AtomSpace* this_ptr
, UUID handle
, char** type
, char** name
, UUID** out
, int* out_len)
{
Handle h(handle);
if(!h)
throw InvalidParamException(TRACE_INFO,
"Invalid Handler parameter.");
const std::string &str = classserver().getTypeName(h->getType());
(*type) = (char*) malloc(sizeof(char) * (str.length()+1));
if(!(*type))
throw RuntimeException(TRACE_INFO,"Failed malloc.");
std::strcpy(*type, str.c_str());
NodePtr ptr = NodeCast(h);
if(ptr){//It is a node.
const std::string &str = ptr->getName();
(*name) = (char*) malloc(sizeof(char) * (str.length()+1));
if(!(*name))
throw RuntimeException(TRACE_INFO,"Failed malloc.");
std::strcpy(*name, str.c_str());
return 1;
}else{//It is a link.
LinkPtr lnk = LinkCast(h);
if(!lnk)
throw RuntimeException(TRACE_INFO,"Error in cast Link.");
*out_len=lnk->getArity();
(*out) = (UUID*) malloc(sizeof(UUID) * (*out_len));
if(!(*out))
throw RuntimeException(TRACE_INFO,"Failed malloc.");
int i;
for(i=0;i<(*out_len);i++)
(*out)[i]=lnk->getOutgoingAtom(i).value();
return 0;
}
}
示例8: RuntimeException
void Image::loadData(std::unique_ptr<util::UseQueryResults> &rs) {
if (!rs)
throw RuntimeException("(ImageData:LoadData) UseQueryResult was NULL");
_image.release();
rs->getString("Name", _name);
rs->getString("Path", _img_path);
_location = rs->getInt("Location");
_docID = rs->getInt("docID");
_imgID = rs->getInt("idImages");
if (rs->hasField("Category"))
_category = rs->getInt("Category");
}
示例9: RuntimeException
JClass::JClass(QString clsName)
{
JNIEnv* env = *JVM::instance();
clsName.replace('.', '/');
QByteArray name = clsName.toUtf8();
jclass obj = env->FindClass(name.constData());
if (!obj)
throw RuntimeException(QObject::tr("Java class %1 not found or failed to load").arg(clsName));
m_class = (jclass) env->NewGlobalRef(obj);
env->DeleteLocalRef(obj);
}
示例10: FreeLibrary
void Win32::unload()
{
if(m_handle != 0)
{
BOOL result;
result = FreeLibrary(m_handle);
if(!result)
{
throw RuntimeException("Module unload failed.");
}
m_handle = 0;
}
}
示例11: GetCurrentInstructionPos
void VM::ForInit(Value *var, Value *limit, Value *step)
{
if (var->type_ != ValueT_Number)
{
auto pos = GetCurrentInstructionPos();
throw RuntimeException(pos.first, pos.second,
var, "'for' init", "number");
}
if (limit->type_ != ValueT_Number)
{
auto pos = GetCurrentInstructionPos();
throw RuntimeException(pos.first, pos.second,
limit, "'for' limit", "number");
}
if (step->type_ != ValueT_Number)
{
auto pos = GetCurrentInstructionPos();
throw RuntimeException(pos.first, pos.second,
step, "'for' step", "number");
}
}
示例12: session
/*!
\~english
Returns the authenticity token.
\~japanese
HTTPリクエストの正当性を検証するためのトークンを返す
*/
QByteArray TActionController::authenticityToken() const
{
if (Tf::app()->appSettings().value(STORE_TYPE).toString().toLower() == QLatin1String("cookie")) {
QString key = Tf::app()->appSettings().value(CSRF_PROTECTION_KEY).toString();
QByteArray csrfId = session().value(key).toByteArray();
if (csrfId.isEmpty()) {
throw RuntimeException("CSRF protectionsession value is empty", __FILE__, __LINE__);
}
return csrfId;
} else {
return QCryptographicHash::hash(session().id() + Tf::app()->appSettings().value("Session.Secret").toByteArray(), QCryptographicHash::Sha1).toHex();
}
}
示例13: sb_stemmer_stem
bool SnowballFilter::incrementToken() {
if (input->incrementToken()) {
StringUtils::toUTF8(termAtt->termBuffer().get(), termAtt->termLength(), utf8Result);
const sb_symbol* stemmed = sb_stemmer_stem(stemmer, utf8Result->result.get(), utf8Result->length);
if (stemmed == NULL) {
boost::throw_exception(RuntimeException(L"exception stemming word:" + termAtt->term()));
}
int32_t newlen = StringUtils::toUnicode(stemmed, sb_stemmer_length(stemmer), termAtt->termBuffer());
termAtt->setTermLength(newlen);
return true;
} else {
return false;
}
}
示例14: switch
TActionContext *TActionContext::current()
{
TActionContext *context = 0;
switch ( Tf::app()->multiProcessingModule() ) {
case TWebApplication::Thread:
context = qobject_cast<TActionThread *>(QThread::currentThread());
if (!context) {
throw RuntimeException("The current thread is not TActionThread", __FILE__, __LINE__);
}
break;
case TWebApplication::Prefork:
context = TActionForkProcess::currentContext();
if (!context) {
throw RuntimeException("The current process is not TActionProcess", __FILE__, __LINE__);
}
default:
break;
}
return context;
}
示例15: syncLock
void MockRAMDirectory::close()
{
SyncLock syncLock(this);
if (!openFiles)
{
openFiles = MapStringInt::newInstance();
openFilesDeleted = HashSet<String>::newInstance();
}
if (noDeleteOpenFile && !openFiles.empty())
{
// RuntimeException instead of IOException because RAMDirectory does not throw IOException currently
boost::throw_exception(RuntimeException(L"MockRAMDirectory: cannot close: there are still open files"));
}
}