• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setLastError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: readNextChar

void XmlDocument::readQuotedString (String& result)
{
    const juce_wchar quote = readNextChar();

    while (! outOfData)
    {
        const juce_wchar c = readNextChar();

        if (c == quote)
            break;

        --input;

        if (c == '&')
        {
            readEntity (result);
        }
        else
        {
            const String::CharPointerType start (input);

            for (;;)
            {
                const juce_wchar character = *input;

                if (character == quote)
                {
                    result.appendCharPointer (start, input);
                    ++input;
                    return;
                }
                else if (character == '&')
                {
                    result.appendCharPointer (start, input);
                    break;
                }
                else if (character == 0)
                {
                    outOfData = true;
                    setLastError ("unmatched quotes", false);
                    break;
                }

                ++input;
            }
        }
    }
}
开发者ID:DinoPollano,项目名称:OwlSim,代码行数:48,代码来源:juce_XmlDocument.cpp


示例2: readValueFromFile

int readValueFromFile(char* fileName, char* buff, int len) 
{
    clearLastError();
    int ret = -1;
    FILE *fp = fopen(fileName,"r");
    if (fp == NULL) {
        setLastError("Unable to open file %s",fileName);
        return -1;
    } else {
        if (fread(buff, sizeof(char), len, fp)>0) {
            ret = 0;
        }
    }
    fclose(fp);
    return ret;
}
开发者ID:friendlyarm,项目名称:matrix,代码行数:16,代码来源:common.c


示例3: verifyFailed

    NOINLINE_DECL void verifyFailed(const char *msg, const char *file, unsigned line) {
        assertionCount.condrollover( ++assertionCount.regular );
        problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
        logContext();
        setLastError(0,msg && *msg ? msg : "assertion failure");
        stringstream temp;
        temp << "assertion " << file << ":" << line;
        AssertionException e(temp.str(),0);
        breakpoint();
#if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
        // this is so we notice in buildbot
        log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl;
        abort();
#endif
        throw e;
    }
开发者ID:89snake89,项目名称:mongo,代码行数:16,代码来源:assert_util.cpp


示例4: status

    Status WriteCmd::checkAuthForCommand( ClientBasic* client,
                                          const std::string& dbname,
                                          const BSONObj& cmdObj ) {

        Status status( auth::checkAuthForWriteCommand( client->getAuthorizationSession(),
                _writeType,
                NamespaceString( parseNs( dbname, cmdObj ) ),
                cmdObj ));

        // TODO: Remove this when we standardize GLE reporting from commands
        if ( !status.isOK() ) {
            setLastError( status.code(), status.reason().c_str() );
        }

        return status;
    }
开发者ID:GoldPi,项目名称:mongo,代码行数:16,代码来源:write_commands.cpp


示例5: sqlite_exec

bool QSQLite2Driver::rollbackTransaction()
{
    if (!isOpen() || isOpenError())
        return false;

    char* err;
    int res = sqlite_exec(d->access, "ROLLBACK", 0, this, &err);

    if (res == SQLITE_OK)
        return true;

    setLastError(QSqlError(tr("Unable to rollback transaction"),
                           QString::fromAscii(err), QSqlError::TransactionError, res));
    sqlite_freemem(err);
    return false;
}
开发者ID:RS102839,项目名称:qt,代码行数:16,代码来源:qsql_sqlite2.cpp


示例6: Hcsr04DeInit

EXPORT void Hcsr04DeInit()
{
    clearLastError();
    struct HCSR04_resource res;
    res.gpio = -1;

    char *hcsr04Path = (char *) malloc(FILE_PATH_LENGTH);
    memset(hcsr04Path, 0, FILE_PATH_LENGTH);
    strcpy(hcsr04Path, HCSR04_PATH);

    char *resStr = (char *)&res;
    if (Hcsr04Write(hcsr04Path, resStr) == -1) {
        setLastError("Fail to write resource to hcsr04");
    }
    free(hcsr04Path);
}
开发者ID:friendlyarm,项目名称:matrix,代码行数:16,代码来源:iio.c


示例7: setLastError

//Send a block of data to the FPGA, raise the execution signal, wait for the execution
// signal to be lowered, then read back up to values of results
// startAddress: local address on FPGA input buffer to begin writing at
// length: # of bytes to write
// inData: data to be sent to FPGA
// maxWaitTime: # of seconds to wait until execution timeout
// outData: readback data buffer (if function returns successfully)
// maxOutLength: maximum length of outData buffer provided
// outputLength: number of bytes actually returned (if function returns successfully)
// Returns true if entire process is successful.
// If function fails for any reason, returns false.
//  Check error code with getLastError().
//  error == FAILCAPACITY: The output was larger than provided buffer.  Rather than the number of
//			bytes actually returned, the outputLength variable will contain the TOTAL number bytes the
//			function wanted to return (the number of bytes actually returned will be maxOutLength).
//			If this occurs, user should read back bytes {maxOutLength, outputLength - 1} manually
//			with a subsequent sendRead command.
//  error == FAILREADACK: The write and execution phases completed correctly, but we retried
//			the readback phase too many times.  In this case, like the FAILCAPICITY error, outputLength
//			will contain the TOTAL number bytes the	function wanted to return.  The state of outData is unknown,
//			but some data has been partially written.  The user could try calling sendRead
//			from {0, outputLength-1} manually if re-calling sendWriteAndRun is not easy
//			(for example, if inData and outData overlapped).
//  error == anything else: see normal error list
BOOL PICO_SIRC::sendWriteAndRun(uint32_t startAddress, uint32_t inLength, uint8_t *inData, 
							  uint32_t maxWaitTimeInMsec, uint8_t *outData, uint32_t maxOutLength, 
							  uint32_t *outputLength)
{
	setLastError( 0);

	//Check the input parameters
	if(!inData){
		setLastError( INVALIDBUFFER);
		return false;
	}
	if(startAddress > OUTPUT_OFFSET){
		setLastError( INVALIDADDRESS);
		return false;
	}
	if(inLength == 0 || startAddress + inLength > OUTPUT_OFFSET){
		setLastError( INVALIDLENGTH);
		return false;
	}

	//Check the output parameters
	if(!outData){
		setLastError( INVALIDBUFFER);
		return false;
	}
	if(maxOutLength == 0 || maxOutLength > OUTPUT_OFFSET){
		setLastError( INVALIDLENGTH);
		return false;
	}

	//Send the data to the FPGA
    if (!sendWrite(startAddress,inLength,inData)){
        return false;
    }

    //Send the run cmd
    if (!sendRun()){
        return false;
    }

    //Wait till done
    if (!waitDone( maxWaitTimeInMsec)){
        return false;
    }

    //Read back data
    //BUGBUG what about partial results??
    if (!sendRead(0,maxOutLength,outData)){
        return false;
    }
    *outputLength = maxOutLength;

    //and done
    return true;
}
开发者ID:praveendath92,项目名称:SIRC_SW,代码行数:79,代码来源:pico_SIRC.cpp


示例8: posix_close

static int posix_close(SgObject self)
{
  if (SG_FD(self)->fd == 0 ||
      SG_FD(self)->fd == 1 ||
      SG_FD(self)->fd == 2) {
    /* we never close standard fd */
    return TRUE;
  }
  if (SG_FILE_VTABLE(self)->isOpen(self)) {
    const int isOK = close(SG_FD(self)->fd) != 0;
    setLastError(self);
    SG_FD(self)->fd = INVALID_HANDLE_VALUE;
    return isOK;
  }
  return FALSE;
}
开发者ID:spurious,项目名称:sagittarius-scheme-mirror,代码行数:16,代码来源:file.c


示例9: checkMeshExpType

bool CExporter::exportMesh(const std::wstring& strFilename)
{
	checkMeshExpType();

	if (!buildMesh())
	{
		return false;
	}
	for (DWORD i = 0; i < m_meshes.size(); ++i)
	{
		grp::MeshExporter* mesh = m_meshes[i];
		if (mesh == NULL)
		{
			continue;
		}
		std::wstring strFilePath = strFilename;
		if (m_meshes.size() > 1)
		{
			strFilePath += L"_";
			strFilePath += mesh->getName();
		}
		strFilePath += FILE_EXT_MESH_SKIN;

		std::fstream file;
		file.open(strFilePath.c_str(), std::ios_base::out | std::ios_base::binary);
		if (!file.is_open())
		{
			char szError[1024];
			::StringCchPrintf(szError, sizeof(szError), "Failed to open file [%s]", strFilePath.c_str());
			setLastError(szError);
			return false;
		}

		if (!mesh->exportTo(file,
							  (m_options.exportType & EXP_MESH_COMPRESS_POS) != 0,
							  (m_options.exportType & EXP_MESH_COMPRESS_NORMAL) != 0,
							  (m_options.exportType & EXP_MESH_COMPRESS_TEXCOORD) != 0,
							  (m_options.exportType & EXP_MESH_COMPRESS_WEIGHT) != 0))
		{
			file.close();
			return false;
		}
		file.close();
	}
	return true;
}
开发者ID:ColinGilbert,项目名称:grandpa-animation,代码行数:46,代码来源:Exporter_Mesh.cpp


示例10: waitForData

/*
 * Enter/exit with stream mutex held.
 * On error, does not hold the stream mutex.
 */
static jint
waitForData(SharedMemoryConnection *connection, Stream *stream)
{
    jint error = SYS_OK;

    /* Assumes mutex is held on call */
    while ((error == SYS_OK) && EMPTY(stream)) {
        CHECK_ERROR(leaveMutex(stream));
        error = sysEventWait(connection->otherProcess, stream->hasData, 0);
        if (error == SYS_OK) {
            CHECK_ERROR(enterMutex(stream, connection->shutdown));
        } else {
            setLastError(error);
        }
    }
    return error;
}
开发者ID:michalwarecki,项目名称:ManagedRuntimeInitiative,代码行数:21,代码来源:shmemBase.c


示例11: foreach

void SpadesLogParser::parseErrOutput(const QString &partOfLog){
    lastPartOfLog=partOfLog.split(QRegExp("(\n|\r)"));
    lastPartOfLog.first()=lastErrLine+lastPartOfLog.first();
    lastErrLine=lastPartOfLog.takeLast();
    foreach(QString buf, lastPartOfLog){
        if(buf.contains("== Error == ")
            || buf.contains(" ERROR ")){
                coreLog.error("Spades: " + buf);
                setLastError(buf);
        }else if (buf.contains("== Warning == ")
                  || buf.contains(" WARN ")){
            algoLog.info(buf);
        }else {
            algoLog.trace(buf);
        }
    }
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:17,代码来源:SpadesTask.cpp


示例12: setLastError

void Win32RedBookDevice::closeVolume()
{
   setLastError("");
   if(!mVolumeInitialized)
      return;

   if(mUsingMixer)
   {
      mMixerVolumeValue.dwValue = mOriginalVolume;
      mixerSetControlDetails(mVolumeDeviceId, &mMixerVolumeDetails, MIXER_SETCONTROLDETAILSF_VALUE);
      mixerClose((HMIXER)mVolumeDeviceId);
   }
   else
      auxSetVolume(mAuxVolumeDeviceId, mOriginalVolume);

   mVolumeInitialized = false;
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:17,代码来源:winRedbook.cpp


示例13: Q_D

bool QSQLite2Driver::commitTransaction()
{
    Q_D(QSQLite2Driver);
    if (!isOpen() || isOpenError())
        return false;

    char* err;
    int res = sqlite_exec(d->access, "COMMIT", 0, this, &err);

    if (res == SQLITE_OK)
        return true;

    setLastError(QSqlError(tr("Unable to commit transaction"),
                QString::fromLatin1(err), QSqlError::TransactionError, res));
    sqlite_freemem(err);
    return false;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:17,代码来源:qsql_sqlite2.cpp


示例14: qWarning

bool QMYSQLDriver::rollbackTransaction()
{
#ifndef CLIENT_TRANSACTIONS
    return FALSE;
#endif
    if ( !isOpen() ) {
#ifdef QT_CHECK_RANGE
	qWarning( "QMYSQLDriver::rollbackTransaction: Database not open" );
#endif
	return FALSE;
    }
    if ( mysql_query( d->mysql, "ROLLBACK" ) ) {
	setLastError( qMakeError("Unable to rollback transaction", QSqlError::Statement, d ) );
	return FALSE;
    }
    return TRUE;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:17,代码来源:qsql_mysql.cpp


示例15: isEncryptedZipFile

//某文件是否是加密后zip文件
bool isEncryptedZipFile(const char* szFileName)
{
	extern DWORD g_arrdwCrc32Table[256];

	//打开文件
	HANDLE hFile = ::CreateFile(szFileName, 
						GENERIC_READ,
						FILE_SHARE_READ|FILE_SHARE_WRITE,
						0,
						OPEN_EXISTING,
						FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_SEQUENTIAL_SCAN,
						0);

	if(hFile == INVALID_HANDLE_VALUE)
	{
		setLastError(AXP_ERR_FILE_ACCESS, "File=%s, WinErr=%d", szFileName, ::GetLastError());
		return false;
	}

	//Get File Size
	unsigned int nFileSize = ::GetFileSize(hFile, 0);
	//文件太小
	if(nFileSize <= 2 )
	{
		::CloseHandle(hFile);
		return false;
	}

	unsigned char temp[8];
	DWORD bytesReaded;
	::ReadFile(hFile, temp, 2, &bytesReaded, 0);
	::CloseHandle(hFile);

//	BYTE _1 = getZipEncryptXORKey(0);
//	BYTE _2 = getZipEncryptXORKey(1);

//	temp[0] ^ getZipEncryptXORKey(0)

	if(	'P' == (temp[0] ^ getZipEncryptXORKey(0))&&
		'K' == (temp[1] ^ getZipEncryptXORKey(1)) )
	{
		return true;
	}

	return false;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:47,代码来源:AXPUtil.cpp


示例16: Sg_LockFile

int Sg_LockFile(SgObject file, enum SgFileLockType mode)
{
  struct flock fl;
  int cmd = F_SETLKW;
  /* we lock the whole file */
  fl.l_whence = SEEK_SET;
  fl.l_start = 0;
  fl.l_len = 0;
  fl.l_type = F_RDLCK;		/* default */
  if (mode & SG_EXCLUSIVE) fl.l_type = F_WRLCK;
  if (mode & SG_DONT_WAIT) cmd = F_SETLK;
  if (fcntl(SG_FD(file)->fd, cmd, &fl)) {
    setLastError(file);
    return FALSE;
  }
  return TRUE;
}
开发者ID:spurious,项目名称:sagittarius-scheme-mirror,代码行数:17,代码来源:file.c


示例17: setLastError

void QTrackerDirectSyncResult::waitForFinished()
{
    if (queryRunner && isAsync) {
        driverPrivate->waitForConnectionOpen();
        if (!driverPrivate->driver->isOpen()) {
            setLastError(QSparqlError(driverPrivate->error,
                                      QSparqlError::ConnectionError));
            terminate();
            return;
        }
        //if we can acquire the semaphore then run fetcher directly
        //if we can't then fetcher is in the threadpool, so we wait
        //for it to complete
        queryRunner->runOrWait();
    }

}
开发者ID:matthewvogt,项目名称:libqtsparql,代码行数:17,代码来源:qsparql_tracker_direct_sync_result_p.cpp


示例18: clearLastError

CIMIPlugin*
CIMIPluginManager::createPlugin(std::string filename,
                                TPluginTypeEnum pluginType)
{
    std::stringstream error;
    clearLastError();

    switch (pluginType) {
    case CIMI_PLUGIN_PYTHON:
        return new CIMIPythonPlugin(filename);
    case CIMI_PLUGIN_UNKNOWN:
    default:
        error << "Cannot detect type for " << filename;
        setLastError(error.str());
        return NULL;
    }
}
开发者ID:wjcdx,项目名称:sunpinyin,代码行数:17,代码来源:imi_plugin.cpp


示例19: close

bool QPSQLDriver::open(const QString & db,
                        const QString & user,
                        const QString & password,
                        const QString & host,
                        int port,
                        const QString& connOpts)
{
    if (isOpen())
        close();
    QString connectString;
    if (!host.isEmpty())
        connectString.append(QLatin1String("host=")).append(qQuote(host));
    if (!db.isEmpty())
        connectString.append(QLatin1String(" dbname=")).append(qQuote(db));
    if (!user.isEmpty())
        connectString.append(QLatin1String(" user=")).append(qQuote(user));
    if (!password.isEmpty())
        connectString.append(QLatin1String(" password=")).append(qQuote(password));
    if (port != -1)
        connectString.append(QLatin1String(" port=")).append(qQuote(QString::number(port)));

    // add any connect options - the server will handle error detection
    if (!connOpts.isEmpty()) {
        QString opt = connOpts;
        opt.replace(QLatin1Char(';'), QLatin1Char(' '), Qt::CaseInsensitive);
        connectString.append(QLatin1Char(' ')).append(opt);
    }

    d->connection = PQconnectdb(connectString.toLocal8Bit().constData());
    if (PQstatus(d->connection) == CONNECTION_BAD) {
        setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d));
        setOpenError(true);
        PQfinish(d->connection);
        d->connection = 0;
        return false;
    }

    d->pro = getPSQLVersion(d->connection);
    d->isUtf8 = setEncodingUtf8(d->connection);
    setDatestyle(d->connection);

    setOpen(true);
    setOpenError(false);
    return true;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:45,代码来源:qsql_psql.cpp


示例20: setLastError

//------------------------------------------------------------------------------
bool UnixRedBookDevice::getTrackCount(U32 * numTracks)
{
#if !defined(__FreeBSD__)
   if(!mAcquired)
   {
      setLastError("Device has not been acquired");
      return(false);
   }

   if (!updateStatus())
      return false;

   AssertFatal(mCD, "mCD is NULL");
   *numTracks = mCD->numtracks;

   return(true);
#endif	// !defined(__FreeBSD__)
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:19,代码来源:x86UNIXRedbook.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setLed函数代码示例发布时间:2022-05-30
下一篇:
C++ setLanguage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap