void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); } \
void Remove(T Item) \
{ int iIndex = Index(Item); \
- wxCHECK( iIndex != NOT_FOUND ); \
+ wxCHECK2_MSG( iIndex != NOT_FOUND, return, \
+ "removing inexisting element in wxArray::Remove" ); \
wxBaseArray::Remove((uint)iIndex); } \
\
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
// add item at the given position
void wxBaseArray::Insert(long lItem, uint uiIndex)
{
- wxCHECK( uiIndex <= m_uiCount );
+ wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Insert" );
Grow();
// removes item from array (by index)
void wxBaseArray::Remove(uint uiIndex)
{
- wxCHECK( uiIndex <= m_uiCount );
+ wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Remove" );
memmove(&m_pItems[uiIndex], &m_pItems[uiIndex + 1],
(m_uiCount - uiIndex - 1)*sizeof(long));
{
int iIndex = Index(lItem);
- wxCHECK( iIndex != NOT_FOUND );
+ wxCHECK_RET( iIndex != NOT_FOUND,
+ "removing inexistent item in wxArray::Remove" );
Remove((uint)iIndex);
}
// read
off_t wxFile::Read(void *pBuf, off_t nCount)
{
- wxCHECK_RET( (pBuf != NULL) && IsOpened(), 0 );
+ wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
int iRc = ::read(m_fd, pBuf, nCount);
if ( iRc == -1 ) {
// write
bool wxFile::Write(const void *pBuf, uint nCount)
{
- wxCHECK_RET( (pBuf != NULL) && IsOpened(), 0 );
+ wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
int iRc = ::write(m_fd, pBuf, nCount);
if ( iRc == -1 ) {
static wxString wxFileSpec = "";
static int wxFindFileFlags;
-char *wxFindFirstFile(const wxString& spec, int flags)
+char *wxFindFirstFile(const char *spec, int flags)
{
wxFileSpec = spec;
wxFindFileFlags = flags; /* MATTHEW: [5] Remember flags */
bool wxFindFileInPath(wxString *pStr, const char *pszPath, const char *pszFile)
{
// we assume that it's not empty
- wxCHECK_RET( Strlen(pszFile) != 0, FALSE);
+ wxCHECK_MSG( !IsEmpty(pszFile), FALSE,
+ "empty file name in wxFindFileInPath");
// skip path separator in the beginning of the file name if present
if ( wxIsPathSeparator(*pszFile) )
bool wxFrame::CreateStatusBar(const int number)
{
// VZ: calling CreateStatusBar twice is an error - why anyone would do it?
- wxCHECK_RET( m_frameStatusBar == NULL, FALSE );
+ wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
+ "recreating status bar in wxFrame" );
m_frameStatusBar = OnCreateStatusBar(number);
if ( m_frameStatusBar )
void wxFrame::SetStatusText(const wxString& text, const int number)
{
- wxCHECK( m_frameStatusBar != NULL );
+ wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
m_frameStatusBar->SetStatusText(text, number);
}
void wxFrame::SetStatusWidths(const int n, const int *widths_field)
{
- wxCHECK( m_frameStatusBar != NULL );
+ wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
m_frameStatusBar->SetStatusWidths(n, widths_field);
PositionStatusBar();
// function appends a new item or submenu to the menu
void wxMenu::Append(wxMenuItem *pItem)
{
- wxCHECK( pItem != NULL );
+ wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
m_menuItems.Append(pItem);
void wxMenu::Enable(int Id, bool Flag)
{
wxMenuItem *item = FindItemForId(Id);
- wxCHECK( item != NULL );
+ wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
item->Enable(Flag);
}
bool wxMenu::Enabled(int Id) const
{
wxMenuItem *item = FindItemForId(Id);
- wxCHECK_RET( item != NULL, FALSE );
+ wxCHECK( item != NULL, FALSE );
return item->IsEnabled();
}
void wxMenu::Check(int Id, bool Flag)
{
wxMenuItem *item = FindItemForId(Id);
- wxCHECK( item != NULL );
+ wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
item->Check(Flag);
}
bool wxMenu::Checked(int Id) const
{
wxMenuItem *item = FindItemForId(Id);
- wxCHECK_RET( item != NULL, FALSE );
+ wxCHECK( item != NULL, FALSE );
return item->IsChecked();
}
void wxMenuItem::Check(bool bDoCheck)
{
- wxCHECK ( IsCheckable() );
+ wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
if ( m_bChecked != bDoCheck ) {
CheckMenuItem((HMENU)m_pParentMenu->GetHMenu(), m_idItem,
const char *wxRegKey::GetStdKeyName(uint key)
{
// return empty string if key is invalid
- wxCHECK_RET( key < nStdKeys, "" );
+ wxCHECK_MSG( key < nStdKeys, "", "invalid key in wxRegKey::GetStdKeyName" );
return aStdKeys[key].szName;
}
const char *wxRegKey::GetStdKeyShortName(uint key)
{
// return empty string if key is invalid
- wxCHECK_RET( key < nStdKeys, "" );
+ wxCHECK( key < nStdKeys, "" );
return aStdKeys[key].szShortName;
}