本文整理汇总了C++中IsError函数的典型用法代码示例。如果您正苦于以下问题:C++ IsError函数的具体用法?C++ IsError怎么用?C++ IsError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Peek
bool Socket::Data::CloseRaw(int msecs_timeout)
{
if(socket == INVALID_SOCKET)
return false;
bool ok = !IsError() && Peek(msecs_timeout, true);
SOCKET old_socket = socket;
socket = INVALID_SOCKET;
if(old_socket != INVALID_SOCKET) {
SLOG("Socket::Data::CloseRaw(" << (int)old_socket << ")");
int res;
#if defined(PLATFORM_WIN32)
res = closesocket(old_socket);
#elif defined(PLATFORM_POSIX)
res = close(old_socket);
#else
#error Unsupported platform
#endif
if(res && !IsError()) {
SetSockError("close");
ok = false;
}
}
SLOG("//Socket::Data::CloseRaw, ok = " << ok);
return ok;
}
示例2: Error
void CGCode3DParser::M26Command()
{
// set sd pos
if (!GetExecutingFile() || CControl::GetInstance()->PrintFromSDRunnding())
{
Error(MESSAGE_PARSER3D_NO_FILE_SELECTED);
return;
}
if (_reader->SkipSpacesToUpper() == 'S')
{
_reader->GetNextChar();
_state._printFilePos = GetUInt32();
_state._printFileLine = 1; // TO DO => count line
if (IsError()) return;
GetExecutingFile().seek(_state._printFilePos);
}
else if (_reader->GetCharToUpper() == 'L')
{
_reader->GetNextChar();
unsigned long lineNr = GetUInt32();
if (IsError()) return;
if (lineNr < 1)
{
Error(MESSAGE_PARSER3D_LINE_SEEK_ERROR);
return;
}
GetExecutingFile().seek(0);
for (unsigned long line = 1; line < lineNr; line++)
{
// read line until \n
char ch;
do
{
if (GetExecutingFile().available() == 0)
{
Error(MESSAGE_PARSER3D_LINE_SEEK_ERROR);
return;
}
ch = GetExecutingFile().read();
}
while (ch != '\n');
}
_state._printFileLine = lineNr;
_state._printFilePos = GetExecutingFile().position();
}
}
示例3: while
void EzSockets::update()
{
if (IsError()) //If socket is in error, don't bother.
return;
while (CanRead() && !IsError()) //Check for Reading
if (pUpdateRead() < 1)
break;
if (CanWrite() && (outBuffer.length()>0))
pUpdateWrite();
}
示例4: Seek
void FNameTableArchiveReader::Seek( int64 InPos )
{
if (!IsError())
{
Reader.Seek( InPos );
}
}
示例5: Serialize
void FNameTableArchiveReader::Serialize( void* V, int64 Length )
{
if (!IsError())
{
Reader.Serialize( V, Length );
}
}
示例6: switch
bool CAddModuleSession::OnProcessMessage (const SArchonMessage &Msg)
// OnProcessMessage
//
// Process a response
{
switch (m_iState)
{
case stateWaitForMsg:
{
if (IsError(Msg))
{
SendMessageReplyError(Msg.sMsg, Msg.dPayload.GetElement(0));
return false;
}
SendMessageReply(MSG_OK);
return false;
}
default:
return false;
}
}
示例7: Print
CString CCInteger::Print (CCodeChain *pCC, DWORD dwFlags)
// Print
//
// Returns a text representation of this item
{
// If this is an error code, translate it
if (IsError())
{
switch (m_iValue)
{
case CCRESULT_NOTFOUND:
return strPatternSubst(LITERAL("[%d] Item not found."), m_iValue);
case CCRESULT_CANCEL:
return strPatternSubst(LITERAL("[%d] Operation canceled."), m_iValue);
case CCRESULT_DISKERROR:
return strPatternSubst(LITERAL("[%d] Disk error."), m_iValue);
default:
return strPatternSubst(LITERAL("[%d] Unknown error."), m_iValue);
}
}
// Otherwise, just print the integer value
else
return strFromInt(m_iValue, TRUE);
}
示例8: CPLError
bool OGRCouchDBDataSource::IsOK(json_object* poAnswerObj,
const char* pszErrorMsg)
{
if ( poAnswerObj == NULL ||
!json_object_is_type(poAnswerObj, json_type_object) )
{
CPLError(CE_Failure, CPLE_AppDefined, "%s",
pszErrorMsg);
return false;
}
json_object* poOK = CPL_json_object_object_get(poAnswerObj, "ok");
if ( !poOK )
{
IsError(poAnswerObj, pszErrorMsg);
return false;
}
const char* pszOK = json_object_get_string(poOK);
if ( !pszOK || !CPLTestBool(pszOK) )
{
CPLError(CE_Failure, CPLE_AppDefined, "%s", pszErrorMsg);
return false;
}
return true;
}
示例9: SyncPos
bool BlockStream::SyncPos()
{
if(IsError())
return false;
SetPos(GetPos());
return SyncPage();
}
示例10: Serialize
void FNameTableArchiveReader::Serialize( void* V, int64 Length )
{
if (FileAr && !IsError())
{
FileAr->Serialize( V, Length );
}
}
示例11: Seek
void FNameTableArchiveReader::Seek( int64 InPos )
{
if (FileAr && !IsError())
{
FileAr->Seek( InPos );
}
}
示例12:
ThemeManager::ThemeManager(FAContext *pContext)
{
char szThemePath[_MAX_PATH];
uint32 len = _MAX_PATH;
Error eRet;
m_pContext = pContext;
m_oCurrentTheme = "";
m_bDevelTheme = false;
szThemePath[0] = 0;
eRet = pContext->prefs->GetPrefString(kThemePathPref, szThemePath, &len);
if (IsError(eRet) || strlen(szThemePath) == 0) {
m_oCurrentTheme = BRANDING_DEFAULT_THEME;
}
else {
struct stat buf;
m_oCurrentTheme = szThemePath;
if (stat(szThemePath, &buf) == 0 && S_ISDIR(buf.st_mode)) {
m_bDevelTheme = true;
m_oDevelTheme = m_oCurrentTheme;
m_oCurrentTheme = THEME_IN_DEVEL;
}
}
}
示例13: Scan
Value ConvertDate::Scan(const Value& text) const {
Value v = UPP::Scan(DATE_V, text, defaultval);
if(IsError(v)) return v;
if(IsNull(v)) return notnull ? NotNullError() : v;
Date m = v;
if(m >= minval && m <= maxval) return v;
return ErrorValue(t_("Date must be between ") + UPP::Format(minval) + t_("range\v and ") + UPP::Format(maxval) + ".");
}
示例14: _Put
void BlockStream::_Put(int c) {
if(!IsOpen()) return;
if(IsError() || !SyncPos())
ptr = buffer;
wrlim = buffer + pagesize;
pagedirty = true;
*ptr++ = c;
}
示例15: ParseJson
static kbool_t ParseJson(KonohaContext *kctx, struct JsonBuf *jsonbuf, const char *text, size_t length, KTraceInfo *trace)
{
JSON json = parseJSON((JSONMemoryPool *)(JSONAPI JsonHandler), text, text + length);
if(IsError(json.val)) {
KLIB KRuntime_raise(kctx, KException_("InvalidJsonText"), SoftwareFault, NULL, trace->baseStack);
}
jsonbuf->json_i = json.bits;
return jsonbuf->json_i != 0;
}