本文整理汇总了C++中IsOk函数的典型用法代码示例。如果您正苦于以下问题:C++ IsOk函数的具体用法?C++ IsOk怎么用?C++ IsOk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsOk函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxCHECK_RET
void wxGCDCImpl::DoDrawSpline(const wxPointList *points)
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
wxGraphicsPath path = m_graphicContext->CreatePath();
wxPointList::compatibility_iterator node = points->GetFirst();
if ( !node )
// empty list
return;
const wxPoint *p = node->GetData();
wxCoord x1 = p->x;
wxCoord y1 = p->y;
node = node->GetNext();
p = node->GetData();
wxCoord x2 = p->x;
wxCoord y2 = p->y;
wxCoord cx1 = ( x1 + x2 ) / 2;
wxCoord cy1 = ( y1 + y2 ) / 2;
path.MoveToPoint( x1 , y1 );
path.AddLineToPoint( cx1 , cy1 );
#if !wxUSE_STD_CONTAINERS
while ((node = node->GetNext()) != NULL)
#else
while ((node = node->GetNext()))
#endif // !wxUSE_STD_CONTAINERS
{
p = node->GetData();
x1 = x2;
y1 = y2;
x2 = p->x;
y2 = p->y;
wxCoord cx4 = (x1 + x2) / 2;
wxCoord cy4 = (y1 + y2) / 2;
path.AddQuadCurveToPoint(x1 , y1 ,cx4 , cy4 );
cx1 = cx4;
cy1 = cy4;
}
path.AddLineToPoint( x2 , y2 );
m_graphicContext->StrokePath( path );
wxRect2DDouble box = path.GetBox();
CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y));
CalcBoundingBox(wxRound(box.m_x + box.m_width),
wxRound(box.m_y + box.m_height));
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:61,代码来源:dcgraph.cpp
示例2: wxCHECK_MSG
bool wxFont::GetStrikethrough() const
{
wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
return M_FONTDATA->m_nativeFontInfo.GetStrikethrough();
}
开发者ID:utelle,项目名称:wxWidgets,代码行数:6,代码来源:font.cpp
示例3: wxCHECK_MSG
int wxPen::GetDashCount() const
{
wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
return (M_PENDATA->m_countDashes);
}
开发者ID:beanhome,项目名称:dev,代码行数:6,代码来源:pen.cpp
示例4: wxCHECK_MSG
const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{
wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
return &(M_FONTDATA->m_nativeFontInfo);
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:6,代码来源:font.cpp
示例5: GTKSetPangoAttrs
bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const
{
if (!IsOk() || !(GetUnderlined() || GetStrikethrough()))
return false;
PangoAttrList* attrs = pango_attr_list_new();
PangoAttribute* a;
if (wx_pango_version_check(1,16,0))
{
// a PangoLayout which has leading/trailing spaces with underlined font
// is not correctly drawn by this pango version: Pango won't underline the spaces.
// This can be a problem; e.g. wxHTML rendering of underlined text relies on
// this behaviour. To workaround this problem, we use a special hack here
// suggested by pango maintainer Behdad Esfahbod: we prepend and append two
// empty space characters and give them a dummy colour attribute.
// This will force Pango to underline the leading/trailing spaces, too.
const char* text = pango_layout_get_text(layout);
const size_t n = strlen(text);
if ((n > 0 && text[0] == ' ') || (n > 1 && text[n - 1] == ' '))
{
wxCharBuffer buf(n + 6);
// copy the leading U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format
memcpy(buf.data(), "\342\200\214", 3);
// copy the user string
memcpy(buf.data() + 3, text, n);
// copy the trailing U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format
memcpy(buf.data() + 3 + n, "\342\200\214", 3);
pango_layout_set_text(layout, buf, n + 6);
// Add dummy attributes (use colour as it's invisible anyhow for 0
// width spaces) to ensure that the spaces in the beginning/end of the
// string are underlined too.
a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614);
a->start_index = 0;
a->end_index = 3;
pango_attr_list_insert(attrs, a);
a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614);
a->start_index = n + 3;
a->end_index = n + 6;
pango_attr_list_insert(attrs, a);
}
}
if (GetUnderlined())
{
a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
pango_attr_list_insert(attrs, a);
}
if (GetStrikethrough())
{
a = pango_attr_strikethrough_new(true);
pango_attr_list_insert(attrs, a);
}
pango_layout_set_attributes(layout, attrs);
pango_attr_list_unref(attrs);
return true;
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:62,代码来源:font.cpp
示例6: wxCHECK_MSG
bool wxGCDCImpl::DoStretchBlit(
wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight,
wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode logical_func , bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") );
wxCHECK_MSG( source->IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") );
if ( logical_func == wxNO_OP )
return true;
wxCompositionMode mode = TranslateRasterOp(logical_func);
if ( mode == wxCOMPOSITION_INVALID )
{
wxFAIL_MSG( wxT("Blitting is not supported with this logical operation.") );
return false;
}
wxRect subrect(source->LogicalToDeviceX(xsrc),
source->LogicalToDeviceY(ysrc),
source->LogicalToDeviceXRel(srcWidth),
source->LogicalToDeviceYRel(srcHeight));
const wxRect subrectOrig = subrect;
// clip the subrect down to the size of the source DC
wxRect clip;
source->GetSize(&clip.width, &clip.height);
subrect.Intersect(clip);
if (subrect.width == 0)
return true;
bool retval = true;
wxCompositionMode formerMode = m_graphicContext->GetCompositionMode();
if (m_graphicContext->SetCompositionMode(mode))
{
wxAntialiasMode formerAa = m_graphicContext->GetAntialiasMode();
if (mode == wxCOMPOSITION_XOR)
{
m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE);
}
if (xsrcMask == -1 && ysrcMask == -1)
{
xsrcMask = xsrc;
ysrcMask = ysrc;
}
wxBitmap blit = source->GetAsBitmap( &subrect );
if ( blit.IsOk() )
{
if ( !useMask && blit.GetMask() )
blit.SetMask(NULL);
double x = xdest;
double y = ydest;
double w = dstWidth;
double h = dstHeight;
// adjust dest rect if source rect is clipped
if (subrect.width != subrectOrig.width || subrect.height != subrectOrig.height)
{
x += (subrect.x - subrectOrig.x) / double(subrectOrig.width) * dstWidth;
y += (subrect.y - subrectOrig.y) / double(subrectOrig.height) * dstHeight;
w *= double(subrect.width) / subrectOrig.width;
h *= double(subrect.height) / subrectOrig.height;
}
m_graphicContext->DrawBitmap(blit, x, y, w, h);
}
else
{
wxFAIL_MSG( wxT("Cannot Blit. Unable to get contents of DC as bitmap.") );
retval = false;
}
if (mode == wxCOMPOSITION_XOR)
{
m_graphicContext->SetAntialiasMode(formerAa);
}
}
// reset composition
m_graphicContext->SetCompositionMode(formerMode);
return retval;
}
开发者ID:rsperberg,项目名称:wxWidgets,代码行数:85,代码来源:dcgraph.cpp
示例7: wxCHECK_RET
void wxGCDCImpl::SetTextBackground( const wxColour &col )
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") );
m_textBackgroundColour = col;
}
开发者ID:rsperberg,项目名称:wxWidgets,代码行数:6,代码来源:dcgraph.cpp
示例8: wxCHECK_MSG
wxBitmap *wxBrush::GetStipple() const
{
wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") );
return &M_BRUSHDATA->m_stipple;
}
开发者ID:beanhome,项目名称:dev,代码行数:6,代码来源:brush.cpp
示例9: wxCHECK_MSG
int wxPen::GetWidth() const
{
wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
return 1;
}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:6,代码来源:pen.cpp
示例10: ReadLine
int CSocket::ReadLine ( CString& szDest )
{
int iSize;
if ( !IsOk () )
return -1;
do
{
if ( m_bufferSize > 0 )
{
char* p = strchr ( m_buffer, '\n' );
if ( p && ( p <= ( m_buffer + m_bufferSize ) ) )
{
char* p2 = p;
while ( p2 > m_buffer && ( *p2 == '\n' || *p2 == '\r' ) )
*p2-- = '\0';
size_t len = static_cast < size_t > ( p2 - m_buffer + 1 );
if ( len > 1 || ( *p2 != '\n' && *p2 != '\r' ) )
{
szDest.assign ( m_buffer, len );
}
size_t len2 = static_cast < size_t > ( p - m_buffer );
assert ( m_bufferSize >= len2 );
memcpy ( m_buffer, p + 1, m_bufferSize - len2 );
m_bufferSize -= len2 + 1;
m_buffer [ m_bufferSize ] = '\0';
return len2;
}
}
// Llamamos a select para establecer un timeout
fd_set fds;
FD_ZERO ( &fds );
FD_SET ( m_socket, &fds );
struct timeval* tvTimeout = 0;
struct timeval __tvTimeout;
if ( m_uiTimeout > 0 )
{
__tvTimeout.tv_sec = m_uiTimeout / 1000;
__tvTimeout.tv_usec = (m_uiTimeout - ( __tvTimeout.tv_sec * 1000 )) * 1000;
tvTimeout = &__tvTimeout;
}
int nChanged = select ( m_socket + 1, &fds, NULL, NULL, tvTimeout );
// Comprobamos que todo ha ido bien en el select
if ( nChanged == -1 )
{
m_iErrno = errno;
m_szError = strerror ( errno );
InternalClose ( true );
return -1;
}
else if ( nChanged == 0 )
return 0;
else
{
// Leemos datos desde el socket
iSize = recv ( m_socket, m_buffer + m_bufferSize, BUFFER_SIZE - m_bufferSize, 0 );
if ( iSize > 0 )
{
m_bufferSize += iSize;
}
}
} while ( iSize > 0 );
m_iErrno = CPortability::SocketErrno ();
CPortability::SocketError ( m_iErrno, m_szError );
InternalClose ( true );
return -1;
}
开发者ID:CoMoDoRe,项目名称:servicesRH,代码行数:78,代码来源:CSocket.cpp
示例11: assert
void CComponentPlayerController::UpdatePostPhysX(float _fDeltaTime)
{
assert(IsOk());
CComponentVida* l_pComponentVida = GetEntity()->GetComponent<CComponentVida>();
CComponentEnergy* l_pComponentEnergy = GetEntity()->GetComponent<CComponentEnergy>();
const vector<CMaterial*>& l_vMaterials = m_pAnimatedModel->GetAnimatedInstanceModel()->GetAnimatedCoreModel()->GetMaterials();
CRenderer *l_pRenderer = CORE->GetRenderer();
CPostSceneRendererStep* l_pDamage = l_pRenderer->GetPostSceneRendererStep("damage_gui");
CPostSceneRendererStep* l_pBlood = l_pRenderer->GetPostSceneRendererStep("blood_gui");
float l_fHP = 100.f;
float l_fMaxHP = 100.f;
if(l_pComponentVida && !m_bGodMode)
{
l_fHP = l_pComponentVida->GetHP();
l_fMaxHP = l_pComponentVida->GetMaxHP();
}
float l_fEnergy = 100.f;
float l_fMaxEnergy = 100.f;
if(l_pComponentEnergy && !m_bGodMode)
{
l_fEnergy = l_pComponentEnergy->GetEnergy();
l_fMaxEnergy = l_pComponentEnergy->GetMaxEnergy();
}
float l_fMin = 0.0f;
float l_fMax = 1.0f;
float l_fGlowIntensity = l_fEnergy/l_fMaxEnergy * (l_fMax - l_fMin) + l_fMin;
vector<CMaterial*>::const_iterator l_itMaterial = l_vMaterials.begin();
while(l_itMaterial != l_vMaterials.end())
{
(*l_itMaterial)->SetGlowIntensity(l_fGlowIntensity);
++l_itMaterial;
}
if(l_pDamage)
{
if(l_fHP < l_fMaxHP)
{
float l_fDamageAlpha = 1.0f - (l_fHP/l_fMaxHP);
l_fDamageAlpha = l_fDamageAlpha + abs(l_fDamageAlpha*0.8f*sinf(5.0f*m_fBloodTime));
if(l_fDamageAlpha > 1.0f)
{
l_fDamageAlpha = 1.0f;
}
l_pRenderer->ActivateRenderPath("damage_gui");
l_pDamage->SetAlpha(l_fDamageAlpha);
}else{
l_pRenderer->DeactivateRenderPath("damage_gui");
}
}
if(m_fBloodFadeOutTime > 0.0f)
{
l_pBlood->SetAlpha(m_fBloodFadeOutTime/(float)BLOOD_FADEOUT_TIME);
l_pRenderer->ActivateRenderPath("blood_gui");
m_fBloodFadeOutTime -= _fDeltaTime;
}else{
l_pRenderer->DeactivateRenderPath("blood_gui");
m_fBloodFadeOutTime = 0.0f;
}
m_fBloodTime += _fDeltaTime;
CPostSceneRendererStep* l_pShockWave = l_pRenderer->GetPostSceneRendererStep("shock_wave");
if(m_fForceTime < 3.f)
{
m_fForceTime += _fDeltaTime;
l_pShockWave->SetTime(m_fForceTime*SHOCK_WAVE_VELOCITY);
if(m_fForceTime > 3.0f)
{
l_pRenderer->DeactivateRenderPath("shock_wave");
}
}
if(l_fHP > 0.0f && l_fHP < l_fMaxHP)
{
float l_fDamageVolume = 1.0f - (l_fHP/l_fMaxHP);
if(l_fDamageVolume > 1.0f)
{
l_fDamageVolume = 1.0f;
}
//.........这里部分代码省略.........
开发者ID:Atridas,项目名称:biogame,代码行数:101,代码来源:ComponentPlayerController.cpp
示例12: wxCHECK_MSG
wxFontEncoding wxFont::GetEncoding() const
{
wxCHECK_MSG( IsOk(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
return M_FONTDATA->GetEncoding();
}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:6,代码来源:font.cpp
示例13: wxASSERT_MSG
void wxOverlayImpl::Clear(wxWindowDC* dc)
{
wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") );
CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 );
CGContextClearRect( m_overlayContext, box );
}
开发者ID:EdgarTx,项目名称:wx,代码行数:6,代码来源:overlay.cpp
示例14: wxASSERT_MSG
size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
{
wxASSERT_MSG(m_inflate && m_z_buffer, wxT("Inflate stream not open"));
if (!m_inflate || !m_z_buffer)
m_lasterror = wxSTREAM_READ_ERROR;
if (!IsOk() || !size)
return 0;
int err = Z_OK;
m_inflate->next_out = (unsigned char *)buffer;
m_inflate->avail_out = size;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
while (err == Z_OK && m_inflate->avail_out > 0) {
if (m_inflate->avail_in == 0 && m_parent_i_stream->IsOk()) {
m_parent_i_stream->Read(m_z_buffer, m_z_size);
m_inflate->next_in = m_z_buffer;
m_inflate->avail_in = m_parent_i_stream->LastRead();
}
err = inflate(m_inflate, Z_SYNC_FLUSH);
}
switch (err) {
case Z_OK:
break;
case Z_STREAM_END:
if (m_inflate->avail_out) {
// Unread any data taken from past the end of the deflate stream, so that
// any additional data can be read from the underlying stream (the crc
// in a gzip for example)
if (m_inflate->avail_in) {
m_parent_i_stream->Reset();
m_parent_i_stream->Ungetch(m_inflate->next_in, m_inflate->avail_in);
m_inflate->avail_in = 0;
}
m_lasterror = wxSTREAM_EOF;
}
break;
case Z_BUF_ERROR:
// Indicates that zlib was expecting more data, but the parent stream
// has none. Other than Eof the error will have been already reported
// by the parent strean,
m_lasterror = wxSTREAM_READ_ERROR;
if (m_parent_i_stream->Eof())
{
wxLogError(_("Can't read inflate stream: unexpected EOF in underlying stream."));
}
break;
default:
wxString msg(m_inflate->msg, *wxConvCurrent);
if (!msg)
msg = wxString::Format(_("zlib error %d"), err);
wxLogError(_("Can't read from inflate stream: %s"), msg.c_str());
m_lasterror = wxSTREAM_READ_ERROR;
}
size -= m_inflate->avail_out;
m_pos += size;
return size;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:72,代码来源:zstream.cpp
注:本文中的IsOk函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论