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


C++ SetErrorMessage函数代码示例

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


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

示例1: sqlite3_step

bool SqliteResultSet::Next()
{
  if (m_pSqliteStatement == NULL)
    m_pSqliteStatement = m_pStatement->GetLastStatement();
  int nReturn = sqlite3_step(m_pSqliteStatement);
 
  if (nReturn != SQLITE_ROW)
    sqlite3_reset(m_pSqliteStatement);

  if ((nReturn != SQLITE_ROW) && (nReturn != SQLITE_DONE))
  {
    wxLogError(_("Error with RunQueryWithResults\n"));
    SetErrorCode(SqliteDatabaseLayer::TranslateErrorCode(nReturn));
#if SQLITE_VERSION_NUMBER>=3002002
    // sqlite3_db_handle wasn't added to the SQLite3 API until version 3.2.2
    SetErrorMessage(ConvertFromUnicodeStream(sqlite3_errmsg(sqlite3_db_handle(m_pSqliteStatement))));
#else
    SetErrorMessage(_("Unknown error advancing result set"));
#endif
    ThrowDatabaseException();
    return false;
  }
  
  return (nReturn == SQLITE_ROW);
}
开发者ID:05storm26,项目名称:codelite,代码行数:25,代码来源:SqliteResultSet.cpp

示例2: _decoder

void DecodeBufferWorker::Execute () {
    CImg<unsigned char> * img = NULL;
    string err;
    char * metadata = NULL;

    err = _decoder(_buffer, _buffsize, &img, &metadata);

    if (img == NULL) {
        SetErrorMessage(err.c_str());
        return;
    }
    _trans = img->spectrum() == 2 || img->spectrum() == 4;
    err = toRGBA(&img);
    if (err != "") {
        if (img) delete img;
        SetErrorMessage(err.c_str());
        return;
    }
    img->_is_shared = true; // don't free image data. need it for callback.
    _pixbuf = img->data();
    _width = img->width();
    _height = img->height();
    _channels = 4;
    _metadata = metadata;

    delete img;
    return;
}
开发者ID:neophob,项目名称:lwip,代码行数:28,代码来源:buffer_worker.cpp

示例3: SetErrorCode

wxDatabaseResultSet* wxMysqlPreparedStatementWrapper::RunQueryWithResults()
{
  wxMysqlPreparedStatementResultSet* pResultSet = NULL;
  MYSQL_BIND* pBoundParameters = m_Parameters.GetMysqlParameterBindings();

  if (m_pInterface->GetMysqlStmtBindParam()(m_pStatement, pBoundParameters))
  {
    SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement)));
    SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement)));
    wxDELETEA(pBoundParameters);
    ThrowDatabaseException();
    return NULL;
  }
  else
  {
    if (m_pInterface->GetMysqlStmtExecute()(m_pStatement) != 0)
    {
      SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement)));
      SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement)));
      wxDELETEA(pBoundParameters);
      ThrowDatabaseException();
      return NULL;
    }
    else
    {
      pResultSet = new wxMysqlPreparedStatementResultSet(m_pInterface, m_pStatement);
      if (pResultSet)
        pResultSet->SetEncoding(GetEncoding());
    }
  }
  wxDELETEA(pBoundParameters);;
  
  return pResultSet;
}
开发者ID:mtangoo,项目名称:wxDatabase,代码行数:34,代码来源:mysql_preparedstatement_wrapper.cpp

示例4: SetErrorCode

DatabaseResultSet* PostgresPreparedStatement::RunQueryWithResults()
{
  for (unsigned int i=0; i<(m_Statements.size()-1); i++)
  {
    m_Statements[i].RunQuery();
    if (m_Statements[i].GetErrorCode() != DATABASE_LAYER_OK)
    {
      SetErrorCode(m_Statements[i].GetErrorCode());
      SetErrorMessage(m_Statements[i].GetErrorMessage());
      ThrowDatabaseException();
      return NULL;
    }
  }
  PostgresPreparedStatementWrapper* pLastStatement = &(m_Statements[m_Statements.size()-1]);
  DatabaseResultSet* pResultSet = pLastStatement->RunQueryWithResults();
  if (pLastStatement->GetErrorCode() != DATABASE_LAYER_OK)
  {
    SetErrorCode(pLastStatement->GetErrorCode());
    SetErrorMessage(pLastStatement->GetErrorMessage());
    ThrowDatabaseException();
  }

  LogResultSetForCleanup(pResultSet);
  return pResultSet;
}
开发者ID:05storm26,项目名称:codelite,代码行数:25,代码来源:PostgresPreparedStatement.cpp

示例5: ASSERT_VALID

BOOL RMA::Parse( const SENTENCE& sentence )
{
   ASSERT_VALID( this );

   /*
   ** RMA - Recommended Minimum Navigation Information
   **                                                    12
   **        1 2       3 4        5 6   7   8   9   10  11|
   **        | |       | |        | |   |   |   |   |   | |
   ** $--RMA,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,x.x,a*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Blink Warning
   **  2) Latitude
   **  3) N or S
   **  4) Longitude
   **  5) E or W
   **  6) Time Difference A, uS
   **  7) Time Difference B, uS
   **  8) Speed Over Ground, Knots
   **  9) Track Made Good, degrees true
   ** 10) Magnetic Variation, degrees
   ** 11) E or W
   ** 12) Checksum
   */

   /*
   ** First we check the checksum...
   */

   NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 );

   if ( check == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( FALSE );
   }
   
   if ( check == Unknown )
   {
      SetErrorMessage( "Missing Checksum" );
      return( FALSE );
   } 

   IsDataValid                = sentence.Boolean( 1 );
   Position.Parse( 2, 3, 4, 5, sentence );
   TimeDifferenceA            = sentence.Double( 6 );
   TimeDifferenceB            = sentence.Double( 7 );
   SpeedOverGroundKnots       = sentence.Double( 8 );
   TrackMadeGoodDegreesTrue   = sentence.Double( 9 );
   MagneticVariation          = sentence.Double( 10 );
   MagneticVariationDirection = sentence.EastOrWest( 11 );

   return( TRUE );
}
开发者ID:mikejwatts,项目名称:epl_pi,代码行数:55,代码来源:rma.cpp

示例6: ZeroMemory

HRESULT CAviFile::AppendAudioData(WAVEFORMATEX *wfx, void *dat, unsigned long numbytes) {
	if (dat == NULL || numbytes == 0) {
		return AVIERR_BADPARAM;
	}
	
	if (wfx->nChannels == 0) {
		return AVIERR_BADFORMAT;
	}

	unsigned long numsamps = numbytes * 8 / wfx->wBitsPerSample;
	if ((numsamps * wfx->wBitsPerSample / 8) != numbytes) {
		return AVIERR_BADPARAM;
	}

	if (m_pAviAudioStream == NULL) // create the stream if necessary
	{
		if (m_pAviFile == NULL) {
			return S_OK;
		}

		AVISTREAMINFO ahdr;
		ZeroMemory(&ahdr, sizeof(ahdr));
		ahdr.fccType = streamtypeAUDIO;
		ahdr.dwScale = wfx->nBlockAlign;
		ahdr.dwRate = wfx->nSamplesPerSec * wfx->nBlockAlign;
		ahdr.dwSampleSize = wfx->nBlockAlign;
		ahdr.dwQuality = (DWORD)-1;
		HRESULT hr = AVIFileCreateStream(m_pAviFile, &m_pAviAudioStream, &ahdr);
		if (hr != AVIERR_OK) {
			SetErrorMessage(_T("Unable to create audio stream"));
			return E_FAIL;
		}

		hr = AVIStreamSetFormat(m_pAviAudioStream, m_lVSample, wfx, sizeof(WAVEFORMATEX) + wfx->cbSize);
		if (hr != AVIERR_OK) {
			SetErrorMessage(_T("Unable to set audio stream format"));
			return E_FAIL;
		}
	}

	HRESULT hr = AVIStreamWrite(m_pAviAudioStream, m_lASample, numsamps, dat, numbytes, 0, NULL, NULL);
	if (hr != AVIERR_OK) {
		SetErrorMessage(_T("Unable to Write Audio Stream to the output Movie File"));
		return E_FAIL;
	}

	m_lASample += numsamps;
	return S_OK;
}
开发者ID:BuckeyeDude,项目名称:Wabbitemu,代码行数:49,代码来源:avifile.cpp

示例7: create

static void create() {
    verb::create();
    SetVerb("ask");
    SetRules("LIV STR", "STR", "LIV to STR", "LIV for STR", "LIV about STR");
    if(GUEST_CHECK == "guest") SetErrorMessage("You can't do that."); 
    else SetErrorMessage("Ask what?  Or ask whom to do what?");
    SetHelp("Syntax: ask <LIVING> <SOMETHING>\n"
            "        ask <SOMETHING>\n"
            "        ask <LIVING> about <SOMETHING>\n"
            "        ask <LIVING> to <DO SOMETHING>\n"
            "        ask <LIVING> for <SOMETHING>\n\n"
            "Some npcs and perhaps some inanimate objects will respond "
            "when you query the target with a specific question.\n"
            "See also: reply, say, shout, speak, tell, whisper, yell");
}
开发者ID:UmbrellaWizard,项目名称:rose-mud,代码行数:15,代码来源:ask.c

示例8: ExecuteNativeCode

 void Job::Execute()
 {
     try
     {
         ExecuteNativeCode();
     }
     catch (cv::Exception& exc)
     {
         SetErrorMessage(exc.what());
     }
     catch (std::runtime_error& e)
     {
         SetErrorMessage(e.what());
     }
 }
开发者ID:AnveshJadon,项目名称:cloudcv-bootstrap,代码行数:15,代码来源:Job.cpp

示例9: ASSERT_VALID

BOOL STN::Parse( const SENTENCE& sentence )
{
   ASSERT_VALID( this );

   /*
   ** STN - Multiple Data ID
   **
   **        1   2
   **        |   |
   ** $--STN,x.x,*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Talker ID Number
   **  2) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 2 ) == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( FALSE );
   } 

   TalkerIDNumber   = sentence.Integer( 1 );

   return( TRUE );
}
开发者ID:mikejwatts,项目名称:epl_pi,代码行数:30,代码来源:stn.cpp

示例10: ResetErrorCodes

wxDatabaseResultSet* wxSqlitePreparedStatement::RunQueryWithResults()
{
  ResetErrorCodes();

  if (m_Statements.size() > 1)
  {
    for (unsigned int i=0; i<m_Statements.size()-1; i++)
    {
      int nReturn = sqlite3_step(m_Statements[i]);
 
      if (nReturn != SQLITE_ROW)
        sqlite3_reset(m_Statements[i]);

      if ((nReturn != SQLITE_ROW) && (nReturn != SQLITE_DONE))
      {
        wxLogError(_("Error with RunQueryWithResults\n"));
        SetErrorCode(wxSqliteDatabase::TranslateErrorCode(nReturn));
        SetErrorMessage(ConvertFromUnicodeStream(sqlite3_errmsg(m_pDatabase)));
        ThrowDatabaseException();
        return NULL;
      }
    }
  }
  // Work off the assumption that only the last statement will return result
  
  wxSqliteResultSet* pResultSet = new wxSqliteResultSet(this);
  if (pResultSet)
    pResultSet->SetEncoding(GetEncoding());

  LogResultSetForCleanup(pResultSet);
  return pResultSet;
}
开发者ID:mtangoo,项目名称:wxDatabase,代码行数:32,代码来源:sqlite_preparedstatement.cpp

示例11: GetDIBits

HRESULT CAviFile::AppendFrameUsual(HBITMAP hBitmap, int Count)
{
	BITMAPINFO	bmpInfo;

	bmpInfo.bmiHeader.biBitCount=0;
	bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);

	GetDIBits(m_hAviDC,hBitmap,0,0,NULL,&bmpInfo,DIB_RGB_COLORS);

	bmpInfo.bmiHeader.biCompression=BI_RGB;

	GetDIBits(m_hAviDC,hBitmap,0,bmpInfo.bmiHeader.biHeight,m_lpBits,&bmpInfo,DIB_RGB_COLORS);

	while( Count > 0 )
	{
		if(FAILED(AVIStreamWrite(m_pAviCompressedStream,m_lSample++,1,m_lpBits,bmpInfo.bmiHeader.biSizeImage,0,NULL,NULL)))
		{
			SetErrorMessage(_T("Unable to Write Video Stream to the output Movie File"));

			ReleaseMemory();

			m_LastError = E_FAIL;
			return E_FAIL;
		}
		--Count;
	}
    return S_OK;
}
开发者ID:stainlessio,项目名称:Linkage,代码行数:28,代码来源:AviFile.cpp

示例12: WXUNUSED

// query database
int wxPostgresDatabase::RunQuery(const wxString& strQuery, bool WXUNUSED(bParseQuery))
{
    // PostgreSQL takes care of parsing the queries itself so bParseQuery is ignored

    ResetErrorCodes();

    wxCharBuffer sqlBuffer = ConvertToUnicodeStream(strQuery);
    PGresult* pResultCode = m_pInterface->GetPQexec()((PGconn*)m_pDatabase, sqlBuffer);
    if ((pResultCode == NULL) || (m_pInterface->GetPQresultStatus()(pResultCode) != PGRES_COMMAND_OK))
    {
        SetErrorCode(wxPostgresDatabase::TranslateErrorCode(m_pInterface->GetPQresultStatus()(pResultCode)));
        SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetPQerrorMessage()((PGconn*)m_pDatabase)));
        m_pInterface->GetPQclear()(pResultCode);
        ThrowDatabaseException();
        return wxDATABASE_QUERY_RESULT_ERROR;
    }
    else
    {
        wxString rowsAffected = ConvertFromUnicodeStream(m_pInterface->GetPQcmdTuples()(pResultCode));
        long rows = -1;
        rowsAffected.ToLong(&rows);
        m_pInterface->GetPQclear()(pResultCode);
        return (int)rows;
    }
}
开发者ID:mtangoo,项目名称:wxDatabase,代码行数:26,代码来源:postgresql_database.cpp

示例13: ASSERT_VALID

BOOL HSC::Parse( const SENTENCE& sentence )
{
   ASSERT_VALID( this );

   /*
   ** HSC - Heading Steering Command
   **
   **        1   2 3   4  5
   **        |   | |   |  |
   ** $--HSC,x.x,T,x.x,M,*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Heading Degrees, True
   **  2) T = True
   **  3) Heading Degrees, Magnetic
   **  4) M = Magnetic
   **  5) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 5 ) == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( FALSE );
   } 

   DegreesTrue     = sentence.Double( 1 );
   DegreesMagnetic = sentence.Double( 3 );

   return( TRUE );
}
开发者ID:mikejwatts,项目名称:epl_pi,代码行数:34,代码来源:hsc.cpp

示例14: wxDatabaseErrorReporter

wxMysqlPreparedStatementParameter::wxMysqlPreparedStatementParameter(MYSQL_BIND* pBind, MYSQL_FIELD* pField)
 : wxDatabaseErrorReporter()
{
  m_pBind = pBind;
  m_pBind->is_null = &m_bIsNull;

  // Set the binding properties
  m_pBind->buffer_type = pField->type;
  m_pBind->buffer_length = pField->length + 1;
  //int nType = m_pBind->buffer_type;
  //if (nType == MYSQL_TYPE_STRING || nType == MYSQL_TYPE_VAR_STRING || nType == MYSQL_TYPE_BLOB
  //  || nType == MYSQL_TYPE_TINY_BLOB || nType == MYSQL_TYPE_MEDIUM_BLOB || nType == MYSQL_TYPE_LONG_BLOB)
  //{
    //wxLogDebug(_("Allocating %ld bytes in the MYSQL_BIND buffer\n"), pField->length);
    void* pBuffer = m_Data.bufferValue.GetWriteBuf(m_pBind->buffer_length);
    if (pBuffer == 0)
    {
      SetErrorCode(wxMysqlDatabase::TranslateErrorCode(0));
      SetErrorMessage(_("Error allocating buffer"));
      ThrowDatabaseException();
    }
    m_pBind->buffer = pBuffer;
    ClearBuffer();
  //  }
  //  else
  //  {
  //  pCurrentBinding->buffer = malloc(1);
  //  }

  int nType = m_pBind->buffer_type;
  if (nType == MYSQL_TYPE_BLOB || nType == MYSQL_TYPE_TINY_BLOB || nType == MYSQL_TYPE_MEDIUM_BLOB 
    || nType == MYSQL_TYPE_LONG_BLOB)
    m_pBind->length = &m_Data.nBufferLength;
}
开发者ID:mtangoo,项目名称:wxDatabase,代码行数:34,代码来源:mysql_preparedstatement_parameter.cpp

示例15: SetErrorMessage

bool HDM::Parse( const SENTENCE& sentence )
{

   /*
   ** HDM - Heading - Magnetic
   **
   **        1   2 3
   **        |   | |
   ** $--HDM,x.x,M*hh<CR><LF>
   **
   ** Field Number:
   **  1) Heading Degrees, Magnetic
   **  2) M = Magnetic
   **  3) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 3 ) == TRUE )
   {
      SetErrorMessage( _T("Invalid Checksum") );
      return( FALSE );
   }

   DegreesMagnetic = sentence.Double( 1 );

   return( TRUE );
}
开发者ID:JONA-GA,项目名称:connectorga_pi,代码行数:30,代码来源:hdm.cpp


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