本文整理汇总了C++中raiseError函数的典型用法代码示例。如果您正苦于以下问题:C++ raiseError函数的具体用法?C++ raiseError怎么用?C++ raiseError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了raiseError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadAnimation
/**
* アニメーションを読み込む
*/
void loadAnimation(ANIME_SET* graphic,ARCHIVE* archive,const char* file_name){
BUF* gfx_file = getFile(archive,file_name);
//ヘッダを飛ばす。
seekBuf(gfx_file,(long)strlen(ANIME_HEADER),SEEK_SET);
//ファイル名取得
int filename_size;
readBuf(gfx_file,&filename_size,sizeof(filename_size));
graphic->filename_size = filename_size;
graphic->filename = malloc(filename_size+1);
readBuf(gfx_file,graphic->filename,filename_size);
graphic->filename[filename_size] = '\0';
//スプライト取得
SDL_RWops* frame_ops = getGraphixFile(archive,graphic->filename);
getSpriteFromOPS(&graphic->sprite,frame_ops);
frame_ops->close(frame_ops); //メモリ開放は忘れずに
//スプライトエリア用スプライト
SPRITE* anime_sprite = &graphic->sprite;
//モード、フラグ、アニメ数。
readBuf(gfx_file,&graphic->mode,sizeof(graphic->mode));
readBuf(gfx_file,&graphic->flag,sizeof(graphic->flag));
readBuf(gfx_file,&graphic->anime_num,sizeof(graphic->anime_num));
int anime_num = graphic->anime_num;
graphic->anime = malloc( sizeof(ANIMATION*) * anime_num );
int i=0;
for(;i<anime_num;i++){
//アニメ番号
int num = 0;
readBuf(gfx_file,&num,sizeof(num));
if(anime_num < num) raiseError("invalid animation file:",file_name);
//メモリ確保。
graphic->anime[num] = malloc(sizeof(ANIMATION));
ANIMATION* anime = graphic->anime[num];
anime->num = num;
//フレーム番号取得
int frame_num;
readBuf(gfx_file,&frame_num,sizeof(frame_num));
anime->frame_num = frame_num;
anime->frame = malloc(sizeof(ANIMATION_FRAME)*frame_num);
int j;
for(j=0;i<frame_num;j++){
//フレームへのポインタの設定
ANIMATION_FRAME* frame = &anime->frame[j];
//持続時間
readBuf(gfx_file,&frame->frame_time,sizeof(frame->frame_time));
//スプライトの設定
frame->sprite_area.sprite = anime_sprite;
readBuf(gfx_file,&frame->sprite_area.x,sizeof(frame->sprite_area.x));
readBuf(gfx_file,&frame->sprite_area.y,sizeof(frame->sprite_area.y));
readBuf(gfx_file,&frame->sprite_area.width,sizeof(frame->sprite_area.width));
readBuf(gfx_file,&frame->sprite_area.height,sizeof(frame->sprite_area.height));
}
}
deleteBuf(gfx_file);
}
示例2: c_init_serial
void c_init_serial(
TermPair *termStorage, const char *devicePath,
const int speed, const Bool hw_flow_control
) {
if (termStorage == NULL) {
raiseError("The storage for the file descriptor must not be NULL");
}
termStorage->fd = open(devicePath, O_RDWR|O_NONBLOCK);
c_init_serialFD(termStorage, speed, hw_flow_control);
}
示例3: wasserted
/* "warning" assert -- safe to continue, so we don't throw exception. */
void wasserted(const char *msg, const char *file, unsigned line) {
problem() << "warning Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
sayDbContext();
raiseError(0,msg && *msg ? msg : "wassertion failure");
assertionCount.condrollover( ++assertionCount.warning );
#if defined(_DEBUG) || defined(_DURABLEDEFAULTON)
// this is so we notice in buildbot
log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl;
abort();
#endif
}
示例4: raiseError
static PyObject *isOptionSettable (PyObject * self, PyObject * args)
{
SANE_Int cap;
long lg;
if (!PyArg_ParseTuple (args, "l", &lg))
raiseError("Invalid arguments");
cap = lg;
return PyInt_FromLong (SANE_OPTION_IS_SETTABLE (cap));
}
示例5: if
void XSchemaSequence::scanForAttributes(QDomAttr &attribute, void * /*context*/)
{
QString name = attribute.nodeName();
if(name == IO_GENERIC_ID) {
_id = attribute.value() ;
} else if(name == IO_GENERIC_MINOCCURS) {
if(!_minOccurs.setValueFromAttribute(attribute.value())) {
raiseError(this, attribute, false);
}
} else if(name == IO_GENERIC_MAXOCCURS) {
if(!_maxOccurs.setValueFromAttribute(attribute.value())) {
raiseError(this, attribute, false);
}
} else {
if(!readOtherAttributes(attribute)) {
raiseError(this, attribute, false);
}
}
}
示例6: asserted
void asserted(const char *msg, const char *file, unsigned line) {
problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
sayDbContext();
raiseError(msg && *msg ? msg : "assertion failure");
lastAssert[0].set(msg, getDbContext().c_str(), file, line);
stringstream temp;
temp << "assertion " << file << ":" << line;
AssertionException e;
e.msg = temp.str();
throw e;
}
示例7: fitModel
PClassifier TLogRegLearner::operator()(PExampleGenerator gen, const int &weight)
{
int error;
PVariable var;
PClassifier cl = fitModel(gen, weight, error, var);
if (error >= TLogRegFitter::Constant)
raiseError("%s in %s", error==TLogRegFitter::Constant ? "constant" : "singularity", var->get_name().c_str());
return cl;
}
示例8: server
void QxThreadPool::runServer()
{
QxServer server(this);
server.setMaxPendingConnections(QxConnect::getSingleton()->getThreadCount());
quint16 serverPort = (quint16)(QxConnect::getSingleton()->getPort());
if (! server.listen(QHostAddress::Any, serverPort))
{ raiseError(QString("[QxOrm] cannot run server : '") + server.errorString() + QString("'"), QxTransaction_ptr()); return; }
Q_EMIT serverIsRunning(true, (& server));
exec();
Q_EMIT serverIsRunning(false, NULL);
}
示例9: loadAnimation
/**
* アニメーションを読み込む
*/
void loadAnimation(ANIME_SET* graphic,ARCHIVE* archive,const char* file_name){
SDL_RWops* gfx_file = getFile(archive,file_name);
//ヘッダを飛ばす。
SDL_RWseek(gfx_file,(long)strlen(ANIME_HEADER),SEEK_SET);
//ファイル名取得
int filename_size;
SDL_RWread(gfx_file,&filename_size,sizeof(filename_size),1);
graphic->filename_size = filename_size;
graphic->filename = malloc(filename_size+1);
SDL_RWread(gfx_file,graphic->filename,filename_size,1);
graphic->filename[filename_size] = '\0';
//モード、フラグ、アニメ数、アルファブレンディング
SDL_RWread(gfx_file,&graphic->mode,sizeof(graphic->mode),1);
SDL_RWread(gfx_file,&graphic->flag,sizeof(graphic->flag),1);
SDL_RWread(gfx_file,&graphic->anime_num,sizeof(graphic->anime_num),1);
SDL_RWread(gfx_file,&graphic->is_alpha_blending,sizeof(graphic->is_alpha_blending),1);
//スプライト取得
getSpriteFromArchive(&graphic->sprite,archive,graphic->filename,graphic->is_alpha_blending,TRUE);
//スプライトエリア用スプライト
SPRITE* anime_sprite = &graphic->sprite;
int anime_num = graphic->anime_num;
graphic->anime = malloc( sizeof(ANIMATION*) * anime_num );
int i=0;
for(;i<anime_num;i++){
//アニメ番号
int num = 0;
SDL_RWread(gfx_file,&num,sizeof(num),1);
if(anime_num < num) raiseError("invalid animation file:",file_name);
//メモリ確保。
graphic->anime[num] = malloc(sizeof(ANIMATION));
ANIMATION* anime = graphic->anime[num];
anime->num = num;
//フレーム番号取得
int frame_num;
SDL_RWread(gfx_file,&frame_num,sizeof(frame_num),1);
anime->frame_num = frame_num;
anime->frame = malloc(sizeof(ANIMATION_FRAME)*frame_num);
int j;
for(j=0;i<frame_num;j++){
//フレームへのポインタの設定
ANIMATION_FRAME* frame = &anime->frame[j];
//持続時間
SDL_RWread(gfx_file,&frame->frame_time,sizeof(frame->frame_time),1);
//スプライトの設定
int x,y,w,h;
SDL_RWread(gfx_file,&x,sizeof(x),1);
SDL_RWread(gfx_file,&y,sizeof(y),1);
SDL_RWread(gfx_file,&w,sizeof(w),1);
SDL_RWread(gfx_file,&h,sizeof(h),1);
makeSpriteArea(&frame->sprite_area,anime_sprite,x,y,w,h);
}
}
SDL_RWclose(gfx_file);
}
示例10: acmFormatTagDetails
CACMWaveFormat::CACMWaveFormat(WORD fmt, DWORD sz)
{
MMRESULT mmr;
m_fmt = NULL;
m_size = 0;
if (0 == sz)
{
CACMStruct<ACMFORMATTAGDETAILS> tagD;
// WIN95 bug keeps us from using the correct fmt here,
// because acmFormatEnum fails later if not
tagD->dwFormatTag = WAVE_FORMAT_UNKNOWN;
mmr = acmFormatTagDetails(NULL,
tagD,
ACM_FORMATTAGDETAILSF_LARGESTSIZE
);
if (0 != mmr)
raiseError(mmr,
"Error getting format descriptor size");
sz = tagD->cbFormatSize;
}
m_fmt = (LPWAVEFORMATEX)
GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT, sz);
if (m_fmt)
{
m_fmt->wFormatTag = fmt;
m_size = sz;
}
else
{
raiseError(MMSYSERR_NOMEM,
"No memory for wave format descriptor");
}
}
示例11: while
void QHelpProjectDataPrivate::readProject()
{
while (!atEnd()) {
readNext();
if (isStartElement()) {
if (name() == QLatin1String("virtualFolder")) {
virtualFolder = readElementText();
if (!hasValidSyntax(QLatin1String("test"), virtualFolder))
raiseError(QCoreApplication::translate("QHelpProject",
"Virtual folder has invalid syntax in file: \"%1\"").arg(fileName));
} else if (name() == QLatin1String("namespace")) {
namespaceName = readElementText();
if (!hasValidSyntax(namespaceName, QLatin1String("test")))
raiseError(QCoreApplication::translate("QHelpProject",
"Namespace \"%1\" has invalid syntax in file: \"%2\"").arg(namespaceName, fileName));
} else if (name() == QLatin1String("customFilter")) {
readCustomFilter();
} else if (name() == QLatin1String("filterSection")) {
readFilterSection();
} else if (name() == QLatin1String("metaData")) {
QString n = attributes().value(QLatin1String("name")).toString();
if (!metaData.contains(n))
metaData[n]
= attributes().value(QLatin1String("value")).toString();
else
metaData.insert(n, attributes().
value(QLatin1String("value")).toString());
} else {
raiseUnknownTokenError();
}
} else if (isEndElement() && name() == QLatin1String("QtHelpProject")) {
if (namespaceName.isEmpty())
raiseError(QCoreApplication::translate("QHelpProject",
"Missing namespace in QtHelpProject file: \"%1\"").arg(fileName));
else if (virtualFolder.isEmpty())
raiseError(QCoreApplication::translate("QHelpProject",
"Missing virtual folder in QtHelpProject file: \"%1\"").arg(fileName));
break;
}
}
}
示例12: openXmlFile
static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName)
{
QFile f(fileName.toString());
if (!f.open(QIODevice::ReadOnly))
return false;
if (!doc.setContent(f.readAll())) {
raiseError(AndroidManager::tr("Cannot parse \"%1\".").arg(fileName.toUserOutput()));
return false;
}
return true;
}
示例13: return
bool xbnode::getBool()
{
if( isBool() )
return (this->getText()=="true");
if( isNumeric() )
return getNumeric()!=0;
if( isText() )
return !getText().empty();
raiseError( "getBool() cant convert", __FILE__,__LINE__);
return false;
}
示例14: addData
void QHelpProjectDataPrivate::readData(const QByteArray &contents)
{
addData(contents);
while (!atEnd()) {
readNext();
if (isStartElement()) {
if (name() == QLatin1String("QtHelpProject")
&& attributes().value(QLatin1String("version")) == QLatin1String("1.0"))
readProject();
else
raiseError(QCoreApplication::translate("QHelpProject",
"Unknown token. Expected \"QtHelpProject\"."));
}
}
if (hasError()) {
raiseError(QCoreApplication::translate("QHelpProject",
"Error in line %1: %2").arg(lineNumber())
.arg(errorString()));
}
}
示例15: raiseError
bool Crypto::testSha256()
{
QByteArray sha256Test = CryptoHash::hash("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
CryptoHash::Sha256);
if (sha256Test != QByteArray::fromHex("248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1")) {
raiseError("SHA-256 mismatch.");
return false;
}
return true;
}