void CHXString::SetAt(INT32 i, char ch) { HX_ASSERT(m_pRep && (i < m_pRep->GetBufferSize())); if (m_pRep) { EnsureUnique(); m_pRep->GetBuffer()[i] = ch; } }
const CHXString& CHXString::operator=(const unsigned char* pStr) { if (m_pRep) { EnsureUnique(); m_pRep->Copy((const char*)pStr, SafeStrlen((const char*)pStr)); } else if (pStr && *pStr) m_pRep = new CHXStringRep((const char*)pStr); return *this; }
char* CHXString::GetBufferSetLength(INT32 newSize) { // NOTE : newSize is a string length, not including ending zero byte... HX_ASSERT(newSize >= 0); if (m_pRep) { EnsureUnique(); m_pRep->ResizeAndCopy(newSize, true); } else if (newSize > 0) m_pRep = new CHXStringRep(newSize, true); return m_pRep->GetBuffer(); }
char* CHXString::GetBuffer(INT32 minSize) { // NOTE: minSize is string length, not including ending zero byte... HX_ASSERT(minSize >= 0); if (m_pRep) { if (m_pRep->GetBufferSize() < (minSize + 1)) { EnsureUnique(); m_pRep->ResizeAndCopy(minSize); } } else m_pRep = new CHXStringRep(minSize); return m_pRep->GetBuffer(); }
void CHXString::FreeExtra() { if (m_pRep) { INT32 newSize = GetLength(); if (newSize > 0) { EnsureUnique(); m_pRep->ResizeAndCopy(newSize); } else { if (m_pRep) { m_pRep->Release(); m_pRep = NULL; } } } }
const CHXString& CHXString::operator=(char ch) { if (m_pRep) { EnsureUnique(); if (m_pRep->GetBufferSize() < 2) m_pRep->Resize(1); m_pRep->GetBuffer()[0] = ch; m_pRep->GetBuffer()[1] = '\0'; if (ch) m_pRep->SetStringSize(1); else m_pRep->SetStringSize(0); } else m_pRep = new CHXStringRep(ch, 1); return *this; }
INT32 CHXString::SetMinBufSize(INT32 minSize) { // NOTE: minSize is a string length, not including ending zero byte... HX_ASSERT(minSize >= 0); INT32 ret = 0; if (m_pRep) { if (minSize >= m_pRep->GetStringSize()) { if (minSize) { EnsureUnique(); m_pRep->ResizeAndCopy(minSize); } else { if (m_pRep) { m_pRep->Release(); m_pRep = NULL; } } } if (m_pRep) ret = m_pRep->GetBufferSize() - 1; } else if (minSize > 0) { m_pRep = new CHXStringRep(minSize); ret = minSize; } return ret; }
void CHXString::Append(const char* pStr, INT32 size) { HX_ASSERT(size >= 0); if (size) { if (m_pRep) { EnsureUnique(); int newSize = m_pRep->GetStringSize() + size; Grow(newSize + 1); strncpy(m_pRep->GetBuffer() + m_pRep->GetStringSize(), pStr, size); /* Flawfinder: ignore */ m_pRep->GetBuffer()[newSize] = '\0'; m_pRep->SetStringSize(newSize); } else m_pRep = new CHXStringRep(pStr, size); } }
void Pen::SetWidth( float width ) { EnsureUnique(); (*API->Pen->SetPenWidth)( handle, width ); }
void Pen::SetBrush( const pcl::Brush& brush ) { EnsureUnique(); (*API->Pen->SetPenBrush)( handle, brush.handle ); }
void Pen::SetJoin( Pen::join join ) { EnsureUnique(); (*API->Pen->SetPenJoin)( handle, join ); }
void Pen::SetCap( Pen::cap cap ) { EnsureUnique(); (*API->Pen->SetPenCap)( handle, cap ); }
void Pen::SetStyle( Pen::style style ) { EnsureUnique(); (*API->Pen->SetPenStyle)( handle, style ); }
void Pen::SetColor( RGBA color ) { EnsureUnique(); (*API->Pen->SetPenColor)( handle, color ); }