Use nullptr instead of NULL in the code and documentation

This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.

Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.

And also use null in the assert messages.

Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
This commit is contained in:
Vadim Zeitlin
2022-10-18 01:25:25 +02:00
parent 39ea524943
commit 4f4c5fcfdf
1844 changed files with 13721 additions and 13734 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ bool MyApp::OnInit()
// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
: wxFrame(nullptr, wxID_ANY, title)
{
// set the frame icon
+5 -5
View File
@@ -32,7 +32,7 @@ wxIMPLEMENT_APP(BombsApp);
// Called to initialize the program
bool BombsApp::OnInit()
{
srand((unsigned) time(NULL));
srand((unsigned) time(nullptr));
m_frame = new BombsFrame(&m_game);
@@ -52,7 +52,7 @@ wxBEGIN_EVENT_TABLE(BombsFrame, wxFrame)
wxEND_EVENT_TABLE()
BombsFrame::BombsFrame(BombsGame *game)
: wxFrame(NULL, wxID_ANY, wxT("wxBombs"), wxDefaultPosition,
: wxFrame(nullptr, wxID_ANY, wxT("wxBombs"), wxDefaultPosition,
wxSize(300, 300), wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX)
{
m_game = game;
@@ -248,7 +248,7 @@ BombsCanvas::BombsCanvas(wxFrame *parent, BombsGame *game)
m_cellWidth = (sx+3+X_UNIT)/X_UNIT;
m_cellHeight = (sy+3+Y_UNIT)/Y_UNIT;
dc.SetMapMode(wxMM_TEXT);
m_bmp = NULL;
m_bmp = nullptr;
}
BombsCanvas::~BombsCanvas()
@@ -256,7 +256,7 @@ BombsCanvas::~BombsCanvas()
if (m_bmp)
{
delete m_bmp;
m_bmp = NULL;
m_bmp = nullptr;
}
}
@@ -302,7 +302,7 @@ void BombsCanvas::UpdateGridSize()
if (m_bmp)
{
delete m_bmp;
m_bmp = NULL;
m_bmp = nullptr;
}
SetSize(GetGridSizeInPixels());
Refresh();
+1 -1
View File
@@ -26,7 +26,7 @@ public:
BombsGame()
{
m_width = m_height = 0;
m_field = NULL;
m_field = nullptr;
}
~BombsGame();
+1 -1
View File
@@ -179,7 +179,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
if (HaveYouWon())
{
wxWindow *frame = wxTheApp->GetTopWindow();
wxWindow *canvas = (wxWindow *) NULL;
wxWindow *canvas = nullptr;
if (frame)
{
+5 -5
View File
@@ -57,7 +57,7 @@ Pile::Pile(int x, int y, int dx, int dy)
//+-------------------------------------------------------------+
//| Description: |
//| Redraw the pile on the screen. If the pile is empty |
//| just draw a NULL card as a place holder for the pile. |
//| just draw a null card as a place holder for the pile. |
//| Otherwise draw the pile from the bottom up, starting |
//| at the origin of the pile, shifting each subsequent |
//| card by the pile's x and y offsets. |
@@ -65,7 +65,7 @@ Pile::Pile(int x, int y, int dx, int dy)
void Pile::Redraw(wxDC& dc )
{
FortyFrame *frame = (FortyFrame*) wxTheApp->GetTopWindow();
wxWindow *canvas = (wxWindow *) NULL;
wxWindow *canvas = nullptr;
if (frame)
{
canvas = frame->GetCanvas();
@@ -103,7 +103,7 @@ void Pile::Redraw(wxDC& dc )
//| Pile::GetTopCard() |
//+-------------------------------------------------------------+
//| Description: |
//| Return a pointer to the top card in the pile or NULL |
//| Return a pointer to the top card in the pile or nullptr |
//| if the pile is empty. |
//| NB: Gets a copy of the card without removing it from the |
//| pile. |
@@ -126,7 +126,7 @@ Card* Pile::GetTopCard()
//| Description: |
//| If the pile is not empty, remove the top card from the |
//| pile and return the pointer to the removed card. |
//| If the pile is empty return a NULL pointer. |
//| If the pile is empty return a null pointer. |
//+-------------------------------------------------------------+
Card* Pile::RemoveTopCard()
{
@@ -229,7 +229,7 @@ int Pile::CalcDistance(int x, int y)
// Return the card at x, y. Check the top card first, then
// work down the pile. If a card is found then return a pointer
// to the card, otherwise return NULL
// to the card, otherwise return nullptr
Card* Pile::GetCard(int x, int y)
{
int cardX;
+3 -3
View File
@@ -40,12 +40,12 @@ hack doesn't fix.
#include <time.h>
#define Random(x) (rand() % x)
#define Randomize() (srand((unsigned int)time(NULL)))
#define Randomize() (srand((unsigned int)time(nullptr)))
static int detail = 9; // CHANGE THIS... 7,8,9 etc
static bool running = false;
static wxMenuBar *menuBar = NULL;
static wxMenuBar *menuBar = nullptr;
// Define a new application type
class MyApp: public wxApp
@@ -89,7 +89,7 @@ private:
bool MyApp::OnInit()
{
// Create the main frame window
MyFrame *frame = new MyFrame(NULL, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
MyFrame *frame = new MyFrame(nullptr, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
// Make a menubar
wxMenu *file_menu = new wxMenu;
+1 -1
View File
@@ -89,7 +89,7 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
m_list = new wxListBox( this, ID_LISTBOX,
wxDefaultPosition,
listSize,
0, NULL,
0, nullptr,
wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
for (unsigned i = 0; i < (sizeof(g_patterns) / sizeof(LifePattern)); i++)
+14 -14
View File
@@ -112,10 +112,10 @@ Life::Life()
// pattern data
m_numcells = 0;
m_boxes = new LifeCellBox *[HASHSIZE];
m_head = NULL;
m_available = NULL;
m_head = nullptr;
m_available = nullptr;
for (int i = 0; i < HASHSIZE; i++)
m_boxes[i] = NULL;
m_boxes[i] = nullptr;
// state vars for BeginFind & FindMore
m_cells = new LifeCell[CELLSARRAYSIZE];
@@ -141,7 +141,7 @@ void Life::Clear()
// clear the hash table pointers
for (int i = 0; i < HASHSIZE; i++)
m_boxes[i] = NULL;
m_boxes[i] = nullptr;
// free used boxes
c = m_head;
@@ -151,7 +151,7 @@ void Life::Clear()
delete c;
c = nc;
}
m_head = NULL;
m_head = nullptr;
// free available boxes
c = m_available;
@@ -161,7 +161,7 @@ void Life::Clear()
delete c;
c = nc;
}
m_available = NULL;
m_available = nullptr;
// reset state
m_name = wxEmptyString;
@@ -295,7 +295,7 @@ LifeCellBox* Life::CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv)
// LinkBox:
// Returns a pointer to the box (x, y); if it didn't exist yet,
// it returns NULL or creates a new one, depending on the value
// it returns nullptr or creates a new one, depending on the value
// of the 'create' parameter.
//
LifeCellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create)
@@ -312,7 +312,7 @@ LifeCellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create)
if ((c->m_x == x) && (c->m_y == y)) return c;
// if not found, and (create == true), create a new one
return create? CreateBox(x, y, hv) : (LifeCellBox*) NULL;
return create? CreateBox(x, y, hv) : nullptr;
}
// KillBox:
@@ -338,10 +338,10 @@ void Life::KillBox(LifeCellBox *c)
// update neighbours
if (c->m_next) c->m_next->m_prev = c->m_prev;
if (c->m_hnext) c->m_hnext->m_hprev = c->m_hprev;
if (c->m_up) c->m_up->m_dn = NULL;
if (c->m_dn) c->m_dn->m_up = NULL;
if (c->m_lf) c->m_lf->m_rt = NULL;
if (c->m_rt) c->m_rt->m_lf = NULL;
if (c->m_up) c->m_up->m_dn = nullptr;
if (c->m_dn) c->m_dn->m_up = nullptr;
if (c->m_lf) c->m_lf->m_rt = nullptr;
if (c->m_rt) c->m_rt->m_lf = nullptr;
// append to the list of available boxes
c->m_next = m_available;
@@ -515,7 +515,7 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells)
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
for ( ; m_x <= m_x1; m_x += 8)
{
if ((c = LinkBox(m_x, m_y, false)) == NULL)
if ((c = LinkBox(m_x, m_y, false)) == nullptr)
continue;
// check whether there is enough space left in the array
@@ -540,7 +540,7 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells)
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
for ( ; m_x <= m_x1; m_x += 8)
{
if ((c = LinkBox(m_x, m_y, false)) == NULL)
if ((c = LinkBox(m_x, m_y, false)) == nullptr)
continue;
// check whether there is enough space left in the array
+4 -4
View File
@@ -173,8 +173,8 @@ bool LifeApp::OnInit()
// frame constructor
LifeFrame::LifeFrame() :
wxFrame( (wxFrame *) NULL, wxID_ANY, _("Life!"), wxDefaultPosition ),
m_navigator(NULL)
wxFrame( nullptr, wxID_ANY, _("Life!"), wxDefaultPosition ),
m_navigator(nullptr)
{
// frame icon
SetIcon(wxICON(mondrian));
@@ -1104,12 +1104,12 @@ void LifeCanvas::OnScroll(wxScrollWinEvent& event)
if (orient == wxHORIZONTAL)
{
m_viewportX += scrollinc;
ScrollWindow( -m_cellsize * scrollinc, 0, (const wxRect *) NULL);
ScrollWindow( -m_cellsize * scrollinc, 0, nullptr);
}
else
{
m_viewportY += scrollinc;
ScrollWindow( 0, -m_cellsize * scrollinc, (const wxRect *) NULL);
ScrollWindow( 0, -m_cellsize * scrollinc, nullptr);
}
}
+11 -11
View File
@@ -62,8 +62,8 @@ static int XPos; // Startup X position
static int YPos; // Startup Y position
static int pointSize = 12; // Font size
static const wxChar *index_filename = NULL; // Index filename
static const wxChar *data_filename = NULL; // Data filename
static const wxChar *index_filename = nullptr; // Index filename
static const wxChar *data_filename = nullptr; // Data filename
static wxChar error_buf[300]; // Error message buffer
static bool loaded_ok = false; // Poem loaded ok
static bool index_ok = false; // Index loaded ok
@@ -72,7 +72,7 @@ static bool paging = false; // Are we paging?
static int current_page = 0; // Currently viewed page
// Backing bitmap
wxBitmap *backingBitmap = NULL;
wxBitmap *backingBitmap = nullptr;
void PoetryError(const wxChar *, const wxChar *caption=wxT("wxPoem Error"));
void PoetryNotify(const wxChar *Msg, const wxChar *caption=wxT("wxPoem"));
@@ -90,7 +90,7 @@ void FindMax(int *max_thing, int thing);
wxIMPLEMENT_APP(MyApp);
MainWindow *TheMainWindow = NULL;
MainWindow *TheMainWindow = nullptr;
// Create the fonts
void MainWindow::CreateFonts()
@@ -110,7 +110,7 @@ MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style):
wxFrame(frame, id, title, pos, size, style)
{
m_corners[0] = m_corners[1] = m_corners[2] = m_corners[3] = NULL;
m_corners[0] = m_corners[1] = m_corners[2] = m_corners[3] = nullptr;
ReadPreferences();
CreateFonts();
@@ -510,7 +510,7 @@ bool MyApp::OnInit()
// randomize();
pages[0] = 0;
TheMainWindow = new MainWindow(NULL,
TheMainWindow = new MainWindow(nullptr,
wxID_ANY,
wxT("wxPoem"),
wxPoint(XPos, YPos),
@@ -592,7 +592,7 @@ MyCanvas::~MyCanvas()
// Note: this must be done before the main window/canvas are destroyed
// or we get an error (no parent window for menu item button)
delete m_popupMenu;
m_popupMenu = NULL;
m_popupMenu = nullptr;
}
// Define the repainting behaviour
@@ -693,13 +693,13 @@ int LoadIndex(const wxChar *file_name)
wxChar buf[100];
if (file_name == NULL)
if (file_name == nullptr)
return 0;
wxSprintf(buf, wxT("%s.idx"), file_name);
index_file = wxFopen(buf, wxT("r"));
if (index_file == NULL)
if (index_file == nullptr)
return 0;
wxFscanf(index_file, wxT("%ld"), &nitems);
@@ -769,7 +769,7 @@ bool LoadPoem(const wxChar *file_name, long position)
paging = false;
current_page = 0;
if (file_name == NULL)
if (file_name == nullptr)
{
wxSprintf(error_buf, wxT("Error in Poem loading."));
PoetryError(error_buf);
@@ -779,7 +779,7 @@ bool LoadPoem(const wxChar *file_name, long position)
wxSprintf(buf, wxT("%s.dat"), file_name);
data_file = wxFopen(buf, wxT("rb"));
if (data_file == NULL)
if (data_file == nullptr)
{
wxSprintf(error_buf, wxT("Data file %s not found."), buf);
PoetryError(error_buf);
+1 -1
View File
@@ -129,7 +129,7 @@ bool MyApp::OnInit()
// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
: wxFrame(nullptr, wxID_ANY, title)
{
// set the frame icon
@@ -73,7 +73,7 @@ DO:
It's also very important to make a consistent use of the ALIASES
defined by wxWidgets' Doxyfile. Open that file for more info.
- when you write true, false and NULL with their C++ semantic meaning,
- when you write true, false and nullptr with their C++ semantic meaning,
then use the @true, @false and @NULL commands.
- separate different paragraphs with an empty comment line.
+1 -1
View File
@@ -140,7 +140,7 @@ ALIASES += header{1}="Include file:^^ \verbatim #include <\1> \endverbatim"
# some formatting aliases
ALIASES += true="<span class='literal'>true</span>"
ALIASES += false="<span class='literal'>false</span>"
ALIASES += NULL="<span class='literal'>NULL</span>"
ALIASES += NULL="<span class='literal'>nullptr</span>"
ALIASES += NUL="<span class='literal'>NUL</span>"
# NOTE: these are important as you can't write in the docs
+1 -1
View File
@@ -189,7 +189,7 @@ See @ref overview_config for the descriptions of all features of this class.
This sample shows how to use wxDebugReport class to
generate a debug report in case of a program crash or otherwise. On start up,
it proposes to either crash itself (by dereferencing a NULL pointer) or
it proposes to either crash itself (by dereferencing a @NULL) or
generate debug report without doing it. Next it initializes the debug report
with standard information adding a custom file to it (just a timestamp) and
allows to view the information gathered using
+1 -1
View File
@@ -45,7 +45,7 @@ wxIMPLEMENT_APP(DerivedApp);
bool DerivedApp::OnInit()
{
wxFrame *the_frame = new wxFrame(NULL, ID_MYFRAME, argv[0]);
wxFrame *the_frame = new wxFrame(nullptr, ID_MYFRAME, argv[0]);
...
the_frame->Show(true);
+8 -8
View File
@@ -73,7 +73,7 @@ auto_ptr<wxZipEntry> entry;
wxFFileInputStream in(wxT("test.zip"));
wxZipInputStream zip(in);
while (entry.reset(zip.GetNextEntry()), entry.get() != NULL)
while (entry.reset(zip.GetNextEntry()), entry.get() != nullptr)
{
// access meta-data
wxString name = entry->GetName();
@@ -114,7 +114,7 @@ auto_ptr<wxZipEntry> entry;
outzip.CopyArchiveMetaData(inzip);
// call CopyEntry for each entry except those matching the pattern
while (entry.reset(inzip.GetNextEntry()), entry.get() != NULL)
while (entry.reset(inzip.GetNextEntry()), entry.get() != nullptr)
if (!entry->GetName().Matches(wxT("*.txt")))
if (!outzip.CopyEntry(entry.release(), inzip))
break;
@@ -165,9 +165,9 @@ do
{
entry.reset(zip.GetNextEntry());
}
while (entry.get() != NULL && entry->GetInternalName() != name);
while (entry.get() != nullptr && entry->GetInternalName() != name);
if (entry.get() != NULL)
if (entry.get() != nullptr)
{
// read the entry's data...
}
@@ -189,7 +189,7 @@ wxFFileInputStream in(wxT("test.zip"));
wxZipInputStream zip(in);
// load the zip catalog
while ((entry = zip.GetNextEntry()) != NULL)
while ((entry = zip.GetNextEntry()) != nullptr)
{
wxZipEntry*& current = cat[entry->GetInternalName()];
// some archive formats can have multiple entries with the same name
@@ -296,7 +296,7 @@ if (in->IsOk())
auto_ptr<wxArchiveEntry> entry;
// list the contents of the archive
while ((entry.reset(arc->GetNextEntry())), entry.get() != NULL)
while ((entry.reset(arc->GetNextEntry())), entry.get() != nullptr)
std::wcout << entry->GetName() << "\n";
}
else
@@ -381,7 +381,7 @@ auto_ptr<wxArchiveEntry> entry;
outarc->CopyArchiveMetaData(*arc);
while (entry.reset(arc->GetNextEntry()), entry.get() != NULL)
while (entry.reset(arc->GetNextEntry()), entry.get() != nullptr)
{
if (entry->GetName() == from)
entry->SetName(to);
@@ -418,7 +418,7 @@ MyNotifier notifier;
outarc->CopyArchiveMetaData(*arc);
while (entry.reset(arc->GetNextEntry()), entry.get() != NULL)
while (entry.reset(arc->GetNextEntry()), entry.get() != nullptr)
{
entry->SetNotifier(notifier);
if (!outarc->CopyEntry(entry.release(), *arc))
+2 -2
View File
@@ -81,7 +81,7 @@ Example of using an assertion macro:
@code
void GetTheAnswer(int *p)
{
wxCHECK_RET( p, "pointer can't be NULL in GetTheAnswer()" );
wxCHECK_RET( p, "pointer can't be null in GetTheAnswer()" );
*p = 42;
};
@@ -89,7 +89,7 @@ void GetTheAnswer(int *p)
If the condition is false, i.e. @c p is @NULL, the assertion handler is called
and, in any case (even when wxDEBUG_LEVEL is 0), the function returns without
dereferencing the NULL pointer on the next line thus avoiding a crash.
dereferencing the null pointer on the next line thus avoiding a crash.
The default assertion handler behaviour depends on whether the application
using wxWidgets was compiled in release build (with @c NDEBUG defined) or debug
+2 -2
View File
@@ -127,7 +127,7 @@ window. Both have to be bound to the frame with respective calls.
@code
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "Hello World")
: wxFrame(nullptr, wxID_ANY, "Hello World")
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
@@ -272,7 +272,7 @@ bool MyApp::OnInit()
}
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "Hello World")
: wxFrame(nullptr, wxID_ANY, "Hello World")
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
+1 -1
View File
@@ -200,7 +200,7 @@ connection = (MyConnection *)client->MakeConnection(hostName, server, "IPC TEST"
if (!connection)
{
wxMessageBox("Failed to make connection to server", "Client Demo Error");
return NULL;
return nullptr;
}
connection->StartAdvise("Item");
+2 -2
View File
@@ -270,7 +270,7 @@ A very simple example:
// Using wxChar* array
//
const wxChar* arrayDiet[] =
{ wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), NULL };
{ wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), nullptr };
pg->Append( new wxEnumProperty("Diet",
wxPG_LABEL,
@@ -348,7 +348,7 @@ wxFlagsProperty has similar construction:
@code
const wxChar* flags_prop_labels[] = { wxT("wxICONIZE"),
wxT("wxCAPTION"), wxT("wxMINIMIZE_BOX"), wxT("wxMAXIMIZE_BOX"), NULL };
wxT("wxCAPTION"), wxT("wxMINIMIZE_BOX"), wxT("wxMAXIMIZE_BOX"), nullptr };
// this value array would be optional if values matched string indexes
long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX,
+5 -5
View File
@@ -71,7 +71,7 @@ Example:
// it's a single Unicode code-point encoded as:
// - a UTF16 surrogate pair under Windows
// - a UTF8 multiple-bytes sequence under Linux
// (without considering the final NULL)
// (without considering the final NUL)
wxPrintf("wxString reports a length of %d character(s)", test.length());
// prints "wxString reports a length of 1 character(s)" on Linux
@@ -88,7 +88,7 @@ Example:
// they are 3 Unicode code-points encoded as:
// - 3 UTF16 code units under Windows
// - 6 UTF8 code units under Linux
// (without considering the final NULL)
// (without considering the final NUL)
wxPrintf("wxString reports a length of %d character(s)", test2.length());
// prints "wxString reports a length of 3 character(s)" on Linux
@@ -96,7 +96,7 @@ Example:
@endcode
To better explain what stated above, consider the second string of the example
above; it's composed by 3 characters and the final @c NULL:
above; it's composed by 3 characters and the final @NUL:
@image html overview_wxstring_encoding.png
@@ -303,12 +303,12 @@ for (i = s.begin(); i != s.end(); ++i)
As most programs use character strings, the standard C library provides quite
a few functions to work with them. Unfortunately, some of them have rather
counter-intuitive behaviour (like @c strncpy() which doesn't always terminate
the resulting string with a @NULL) and are in general not very safe (passing
the resulting string with a @NUL) and are in general not very safe (passing
@NULL to them will probably lead to program crash). Moreover, some very useful
functions are not standard at all. This is why in addition to all wxString
functions, there are also a few global string functions which try to correct
these problems: wxIsEmpty() verifies whether the string is empty (returning
@true for @NULL pointers), wxStrlen() also handles @NULL correctly and returns
@true for @NULL), wxStrlen() also handles @NULL correctly and returns
0 for them and wxStricmp() is just a platform-independent version of
case-insensitive string comparison function known either as @c stricmp() or
@c strcasecmp() on different platforms.
+4 -4
View File
@@ -142,7 +142,7 @@ This is how you would use the above simple dialog in your code.
void MyClass::ShowDialog()
{
wxDialog dlg;
if (wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog"))
if (wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog"))
dlg.ShowModal();
}
@endcode
@@ -165,7 +165,7 @@ the XRCCTRL macro to get a pointer to the child. To expand the previous code:
void MyClass::ShowDialog()
{
wxDialog dlg;
if (!wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog"))
if (!wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog"))
return;
wxTextCtrl* pText = XRCCTRL(dlg, "text", wxTextCtrl);
@@ -195,7 +195,7 @@ control to the XRCID macro:
void MyClass::ShowDialog()
{
wxDialog dlg;
if (!wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog"))
if (!wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog"))
return;
XRCCTRL(dlg, "text", wxTextCtrl)->Bind(wxEVT_TEXT,
@@ -367,7 +367,7 @@ protected:
private:
void InitWidgetsFromXRC()
{
wxXmlResource::Get()->LoadObject(this, NULL, "TestWnd", "wxFrame");
wxXmlResource::Get()->LoadObject(this, nullptr, "TestWnd", "wxFrame");
A = XRCCTRL(*this, "A", wxTextCtrl);
B = XRCCTRL(*this, "B", wxButton);
}
+1 -1
View File
@@ -59,7 +59,7 @@ The approach chosen was to use templates to help inherit QObject's (QWidget), pr
### Delete later
Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reset to NULL when the wx counterpart is marked to deletion).
Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reset to @NULL when the wx counterpart is marked to deletion).
This is due that in some situations, Qt object could still be referenced in the Qt event queue, so it cannot be removed immediately.
+1 -1
View File
@@ -161,7 +161,7 @@ private:
};
// functions to show the about dialog box
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr);
#endif // wxUSE_ABOUTDLG
+4 -4
View File
@@ -48,18 +48,18 @@ class WXDLLIMPEXP_CORE wxAcceleratorEntry
{
public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
wxMenuItem *item = NULL)
wxMenuItem *item = nullptr)
: m_flags(flags)
, m_keyCode(keyCode)
, m_command(cmd)
, m_item(item)
{ }
// create accelerator corresponding to the specified string, return NULL if
// create accelerator corresponding to the specified string, return nullptr if
// string couldn't be parsed or a pointer to be deleted by the caller
static wxAcceleratorEntry *Create(const wxString& str);
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL)
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = nullptr)
{
m_flags = flags;
m_keyCode = keyCode;
@@ -121,7 +121,7 @@ private:
int m_keyCode; // ASCII or virtual keycode
int m_command; // Command id to generate
// the menu item this entry corresponds to, may be NULL
// the menu item this entry corresponds to, may be null
wxMenuItem *m_item;
// for compatibility with old code, use accessors now!
+3 -3
View File
@@ -263,13 +263,13 @@ public:
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK,
// If *child is null and return value is wxACC_OK,
// this means that the child is a simple element and
// not an accessible object.
virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the parent, or NULL.
// Gets the parent, or nullptr.
virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent))
{ return wxACC_NOT_IMPLEMENTED; }
@@ -320,7 +320,7 @@ public:
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in
// If childId is 0 and child is null, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
+1 -1
View File
@@ -96,7 +96,7 @@ private:
// Common part of all ctors.
void Init()
{
m_impl = NULL;
m_impl = nullptr;
}
class wxAddRemoveImpl* m_impl;
+2 -2
View File
@@ -92,7 +92,7 @@ public:
void TransformPoint(wxDouble* x, wxDouble* y) const
{
wxCHECK_RET( x && y, "Can't be NULL" );
wxCHECK_RET( x && y, "Can't be null" );
const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y));
*x = dst.m_x;
@@ -107,7 +107,7 @@ public:
void TransformDistance(wxDouble* dx, wxDouble* dy) const
{
wxCHECK_RET( dx && dy, "Can't be NULL" );
wxCHECK_RET( dx && dy, "Can't be null" );
const wxPoint2DDouble
dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy));
+6 -6
View File
@@ -44,7 +44,7 @@ union wxAnyValueBuffer
wxAnyValueBuffer()
{
m_ptr = NULL;
m_ptr = nullptr;
}
};
@@ -324,7 +324,7 @@ public:
#if wxUSE_EXTENDED_RTTI
virtual const wxTypeInfo* GetTypeInfo() const
{
return wxGetTypeInfo((T*)NULL);
return wxGetTypeInfo((T*)nullptr);
}
#endif
};
@@ -389,7 +389,7 @@ public: \
_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\
virtual const wxTypeInfo* GetTypeInfo() const \
{ \
return wxGetTypeInfo((T*)NULL); \
return wxGetTypeInfo((T*)nullptr); \
} \
};
#else
@@ -673,7 +673,7 @@ public:
/*
Let's define a discrete Null value so we don't have to really
ever check if wxAny.m_type pointer is NULL or not. This is an
ever check if wxAny.m_type pointer is null or not. This is an
optimization, mostly. Implementation of this value type is
"hidden" in the source file.
*/
@@ -965,7 +965,7 @@ public:
const char* and const wchar_t*) has been assigned to wxAny.
*/
template <typename T>
T As(T* = NULL) const
T As(T* = nullptr) const
{
return wxPrivate::wxAnyAsImpl<T>::DoAs(*this);
}
@@ -1124,7 +1124,7 @@ struct wxAnyAsImpl<wxString>
// This macro shouldn't be used any longer for the same reasons as
// wxANY_VALUE_TYPE_CHECK_TYPE(), just call As() directly.
#define wxANY_AS(any, T) \
(any).As(static_cast<T*>(NULL))
(any).As(static_cast<T*>(nullptr))
template<typename T>
+9 -9
View File
@@ -22,7 +22,7 @@
// ----------------------------------------------------------------------------
// This is a helper class convertible to either narrow or wide string pointer.
// It is similar to wxCStrData but, unlike it, can be NULL which is required to
// It is similar to wxCStrData but, unlike it, can be null which is required to
// represent the return value of wxDateTime::ParseXXX() methods for example.
//
// NB: this class is fully inline and so doesn't need to be DLL-exported
@@ -30,12 +30,12 @@ class wxAnyStrPtr
{
public:
// ctors: this class must be created from the associated string or using
// its default ctor for an invalid NULL-like object; notice that it is
// its default ctor for an invalid nullptr-like object; notice that it is
// immutable after creation.
// ctor for invalid pointer
wxAnyStrPtr()
: m_str(NULL)
: m_str(nullptr)
{
}
@@ -58,7 +58,7 @@ public:
// e.g. "if ( FuncReturningAnyStrPtr() && ... )" (unfortunately using
// unspecified_bool_type here wouldn't help with ambiguity between all the
// different conversions to pointers)
operator bool() const { return m_str != NULL; }
operator bool() const { return m_str != nullptr; }
// at least VC7 also needs this one or it complains about ambiguity
// for !anystr expressions
@@ -71,7 +71,7 @@ public:
operator const char *() const
{
if ( !m_str )
return NULL;
return nullptr;
// check if the string is convertible to char at all
//
@@ -100,7 +100,7 @@ public:
operator const wchar_t *() const
{
if ( !m_str )
return NULL;
return nullptr;
// no complications with wide strings (as long as we discount
// surrogates as we do for now)
@@ -112,8 +112,8 @@ public:
}
// Because the objects of this class are only used as return type for
// functions which can return NULL we can skip providing dereferencing
// operators: the code using this class must test it for NULL first and if
// functions which can return nullptr we can skip providing dereferencing
// operators: the code using this class must test it for null first and if
// it does anything else with it has to assign it to either char* or
// wchar_t* itself, before dereferencing.
//
@@ -130,7 +130,7 @@ public:
private:
// the original string and the position in it we correspond to, if the
// string is NULL this object is NULL pointer-like
// string is null this object is null pointer-like
const wxString * const m_str;
const wxString::const_iterator m_iter;
+11 -11
View File
@@ -226,14 +226,14 @@ public:
// wxTheApp->GetTraits() during startup or termination when the global
// application object itself may be unavailable
//
// of course, it still returns NULL in this case and the caller must check
// of course, it still returns nullptr in this case and the caller must check
// for it
static wxAppTraits *GetTraitsIfExists();
// Return some valid traits object.
//
// This method checks if we have wxTheApp and returns its traits if it does
// exist and the traits are non-NULL, similarly to GetTraitsIfExists(), but
// exist and the traits are non-null, similarly to GetTraitsIfExists(), but
// falls back to wxConsoleAppTraits to ensure that it always returns
// something valid.
static wxAppTraits& GetValidTraits();
@@ -241,8 +241,8 @@ public:
// returns the main event loop instance, i.e. the event loop which is started
// by OnRun() and which dispatches all events sent from the native toolkit
// to the application (except when new event loops are temporarily set-up).
// The returned value maybe NULL. Put initialization code which needs a
// non-NULL main event loop into OnEventLoopEnter().
// The returned value maybe null. Put initialization code which needs a
// non-null main event loop into OnEventLoopEnter().
wxEventLoopBase* GetMainLoop() const
{ return m_mainLoop; }
@@ -495,7 +495,7 @@ protected:
// the one and only global application object
static wxAppConsole *ms_appInstance;
// create main loop from AppTraits or return NULL if
// create main loop from AppTraits or return nullptr if
// there is no main loop implementation
wxEventLoopBase *CreateMainLoop();
@@ -506,11 +506,11 @@ protected:
m_appDisplayName, // app display name ("My Application")
m_className; // class name
// the class defining the application behaviour, NULL initially and created
// the class defining the application behaviour, nullptr initially and created
// by GetTraits() when first needed
wxAppTraits *m_traits;
// the main event loop of the application (may be NULL if the loop hasn't
// the main event loop of the application (may be null if the loop hasn't
// been started yet or has already terminated)
wxEventLoopBase *m_mainLoop;
@@ -622,11 +622,11 @@ public:
// return the "main" top level window (if it hadn't been set previously
// with SetTopWindow(), will return just some top level window and, if
// there are none, will return NULL)
// there are none, will return nullptr)
virtual wxWindow *GetTopWindow() const;
// convenient helper which is safe to use even if there is no wxApp at
// all, it will just return NULL in this case
// all, it will just return nullptr in this case
static wxWindow *GetMainTopWindow();
// control the exit behaviour: by default, the program will exit the
@@ -697,7 +697,7 @@ public:
{
return ms_appInstance && ms_appInstance->IsGUI()
? static_cast<wxAppBase*>(ms_appInstance)
: NULL;
: nullptr;
}
protected:
@@ -709,7 +709,7 @@ protected:
void DeleteAllTLWs();
// the main top level window (may be NULL)
// the main top level window (may be null)
wxWindow *m_topWindow;
// if Yes, exit the main loop when the last top level window is deleted, if
+1 -1
View File
@@ -37,7 +37,7 @@ private:
class wxAppProgressIndicator : public wxAppProgressIndicatorBase
{
public:
wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL,
wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = nullptr,
int WXUNUSED(maxValue) = 100)
{
}
+9 -9
View File
@@ -66,8 +66,8 @@ public:
#endif // wxUSE_FONTMAP
// get the renderer to use for drawing the generic controls (return value
// may be NULL in which case the default renderer for the current platform
// is used); this is used in GUI only and always returns NULL in console
// may be null in which case the default renderer for the current platform
// is used); this is used in GUI only and always returns nullptr in console
//
// NB: returned pointer will be deleted by the caller
virtual wxRendererNative *CreateRenderer() = 0;
@@ -139,9 +139,9 @@ public:
// runtime (not compile-time) version.
// returns wxPORT_BASE for console applications and one of the remaining
// wxPORT_* values for GUI applications.
virtual wxPortId GetToolkitVersion(int *majVer = NULL,
int *minVer = NULL,
int *microVer = NULL) const = 0;
virtual wxPortId GetToolkitVersion(int *majVer = nullptr,
int *minVer = nullptr,
int *microVer = nullptr) const = 0;
// return true if the port is using wxUniversal for the GUI, false if not
virtual bool IsUsingUniversalWidgets() const = 0;
@@ -206,7 +206,7 @@ class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
{
public:
#if !wxUSE_CONSOLE_EVENTLOOP
virtual wxEventLoopBase *CreateEventLoop() override { return NULL; }
virtual wxEventLoopBase *CreateEventLoop() override { return nullptr; }
#endif // !wxUSE_CONSOLE_EVENTLOOP
#if wxUSE_LOG
@@ -224,9 +224,9 @@ public:
const wxString& title) override;
// the GetToolkitVersion for console application is always the same
wxPortId GetToolkitVersion(int *verMaj = NULL,
int *verMin = NULL,
int *verMicro = NULL) const override
wxPortId GetToolkitVersion(int *verMaj = nullptr,
int *verMin = nullptr,
int *verMicro = nullptr) const override
{
// no toolkits (wxBase is for console applications without GUI support)
// NB: zero means "no toolkit", -1 means "not initialized yet"
+9 -9
View File
@@ -58,11 +58,11 @@ public:
wxArchiveEntry *Clone() const { return DoClone(); }
void SetNotifier(wxArchiveNotifier& notifier);
virtual void UnsetNotifier() { m_notifier = NULL; }
virtual void UnsetNotifier() { m_notifier = nullptr; }
protected:
wxArchiveEntry() : m_notifier(NULL) { }
wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { }
wxArchiveEntry() : m_notifier(nullptr) { }
wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(nullptr) { }
virtual void SetOffset(wxFileOffset offset) = 0;
virtual wxArchiveEntry* DoClone() const = 0;
@@ -85,7 +85,7 @@ private:
// the wxArchiveInputStream then returns the entry's data. Eof() becomes true
// after an attempt has been made to read past the end of the entry's data.
//
// When there are no more entries, GetNextEntry() returns NULL and sets Eof().
// When there are no more entries, GetNextEntry() returns nullptr and sets Eof().
class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream
{
@@ -191,11 +191,11 @@ public:
typedef T* pointer;
typedef T& reference;
wxArchiveIterator() : m_rep(NULL) { }
wxArchiveIterator() : m_rep(nullptr) { }
wxArchiveIterator(Arc& arc) {
typename Arc::entry_type* entry = arc.GetNextEntry();
m_rep = entry ? new Rep(arc, entry) : NULL;
m_rep = entry ? new Rep(arc, entry) : nullptr;
}
wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) {
@@ -270,7 +270,7 @@ private:
typename Arc::entry_type* entry = m_arc.GetNextEntry();
if (!entry) {
UnRef();
return NULL;
return nullptr;
}
if (m_ref > 1) {
m_ref--;
@@ -285,7 +285,7 @@ private:
const T& GetValue() {
if (m_entry) {
_wxSetArchiveIteratorValue(m_value, m_entry, m_entry);
m_entry = NULL;
m_entry = nullptr;
}
return m_value;
}
@@ -361,7 +361,7 @@ protected:
virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0;
virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0;
wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { }
wxArchiveClassFactory() : m_pConv(nullptr), m_next(this) { }
wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f))
{ return *this; }
+6 -6
View File
@@ -287,7 +287,7 @@ public:
friend difference_type operator -(const itor& i1, const itor& i2);
public:
pointer m_ptr;
reverse_iterator() : m_ptr(NULL) { }
reverse_iterator() : m_ptr(nullptr) { }
explicit reverse_iterator(pointer ptr) : m_ptr(ptr) { }
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
reference operator*() const { return *m_ptr; }
@@ -313,7 +313,7 @@ public:
friend difference_type operator -(const itor& i1, const itor& i2);
public:
pointer m_ptr;
const_reverse_iterator() : m_ptr(NULL) { }
const_reverse_iterator() : m_ptr(nullptr) { }
explicit const_reverse_iterator(pointer ptr) : m_ptr(ptr) { }
const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
@@ -395,7 +395,7 @@ protected:
private:
// Allocate the new buffer big enough to hold m_nCount + nIncrement items and
// return the pointer to the old buffer, which must be deleted by the caller
// (if the old buffer is big enough, just return NULL).
// (if the old buffer is big enough, just return nullptr).
wxString *Grow(size_t nIncrement);
// Binary search in the sorted array: return the index of the string if it's
@@ -432,7 +432,7 @@ class WXDLLIMPEXP_BASE wxCArrayString
{
public:
wxCArrayString( const wxArrayString& array )
: m_array( array ), m_strings( NULL )
: m_array( array ), m_strings( nullptr )
{ }
~wxCArrayString() { delete[] m_strings; }
@@ -450,7 +450,7 @@ public:
wxString* Release()
{
wxString *r = GetStrings();
m_strings = NULL;
m_strings = nullptr;
return r;
}
@@ -513,7 +513,7 @@ public:
wxArrayStringsAdapter(const std::vector<wxString>& strings)
: m_type(wxSTRING_POINTER), m_size(strings.size())
{
m_data.ptr = m_size == 0 ? NULL : &strings[0];
m_data.ptr = m_size == 0 ? nullptr : &strings[0];
}
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
+2 -2
View File
@@ -195,12 +195,12 @@ public:
// Gets native size for given 'client' or wxDefaultSize if it doesn't
// have native equivalent. The first version returns the size in logical
// pixels while the second one returns it in DIPs.
static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = NULL);
static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = nullptr);
static wxSize GetNativeDIPSizeHint(const wxArtClient& client);
// Get the size hint of an icon from a specific wxArtClient from the
// topmost (i.e. first used) provider.
static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = NULL);
static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = nullptr);
static wxSize GetDIPSizeHint(const wxArtClient& client);
#if WXWIN_COMPATIBILITY_3_0
+3 -3
View File
@@ -110,8 +110,8 @@ public:
wxAuiToolBarItem()
{
m_window = NULL;
m_sizerItem = NULL;
m_window = nullptr;
m_sizerItem = nullptr;
m_spacerPixels = 0;
m_toolId = 0;
m_kind = wxITEM_NORMAL;
@@ -507,7 +507,7 @@ public:
const wxBitmapBundle& bitmap,
const wxBitmapBundle& disabledBitmap,
bool toggle = false,
wxObject* clientData = NULL,
wxObject* clientData = nullptr,
const wxString& shortHelpString = wxEmptyString,
const wxString& longHelpString = wxEmptyString)
{
+5 -5
View File
@@ -68,7 +68,7 @@ public:
int winId = 0)
: wxBookCtrlEvent(commandType, winId)
{
m_dragSource = NULL;
m_dragSource = nullptr;
}
wxEvent *Clone() const override { return new wxAuiNotebookEvent(*this); }
@@ -151,7 +151,7 @@ public:
void SetColour(const wxColour& colour);
void SetActiveColour(const wxColour& colour);
void DoShowHide();
void SetRect(const wxRect& rect, wxWindow* wnd = NULL);
void SetRect(const wxRect& rect, wxWindow* wnd = nullptr);
void RemoveButton(int id);
void AddButton(int id,
@@ -344,7 +344,7 @@ public:
//wxBookCtrlBase functions
virtual void SetPageSize (const wxSize &size) override;
virtual int HitTest (const wxPoint &pt, long *flags=NULL) const override;
virtual int HitTest (const wxPoint &pt, long *flags=nullptr) const override;
virtual int GetPageImage(size_t n) const override;
virtual bool SetPageImage(size_t n, int imageId) override;
@@ -383,7 +383,7 @@ protected:
virtual wxSize CalculateNewSplitSize();
// remove the page and return a pointer to it
virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) override { return NULL; }
virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) override { return nullptr; }
//A general selection function
virtual int DoModifySelection(size_t n, bool events);
@@ -415,7 +415,7 @@ protected:
void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
// set selection to the given window (which must be non-NULL and be one of
// set selection to the given window (which must be non-null and be one of
// our pages, otherwise an assert is raised)
void SetSelectionToWindow(wxWindow *win);
void SetSelectionToPage(const wxAuiNotebookPage& page)
+9 -9
View File
@@ -152,8 +152,8 @@ public:
, floating_pos(wxDefaultPosition)
, floating_size(wxDefaultSize)
{
window = NULL;
frame = NULL;
window = nullptr;
frame = nullptr;
state = 0;
dock_direction = wxAUI_DOCK_LEFT;
dock_layer = 0;
@@ -180,7 +180,7 @@ public:
*this = source;
}
bool IsOk() const { return window != NULL; }
bool IsOk() const { return window != nullptr; }
bool IsFixed() const { return !HasFlag(optionResizable); }
bool IsResizable() const { return HasFlag(optionResizable); }
bool IsShown() const { return !HasFlag(optionHidden); }
@@ -405,7 +405,7 @@ class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
public:
wxAuiManager(wxWindow* managedWnd = NULL,
wxAuiManager(wxWindow* managedWnd = nullptr,
unsigned int flags = wxAUI_MGR_DEFAULT);
virtual ~wxAuiManager();
void UnInit();
@@ -533,7 +533,7 @@ protected:
void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
void OnFloatingPaneResized(wxWindow* window, const wxRect& rect);
void Render(wxDC* dc);
void Repaint(wxDC* dc = NULL);
void Repaint(wxDC* dc = nullptr);
void ProcessMgrEvent(wxAuiManagerEvent& event);
void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart,
const wxMouseEvent& event);
@@ -596,7 +596,7 @@ protected:
wxPoint m_actionStart; // position where the action click started
wxPoint m_actionOffset; // offset from upper left of the item clicked
wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to
wxWindow* m_actionWindow; // action frame or window (NULL if none)
wxWindow* m_actionWindow; // action frame or window (nullptr if none)
wxRect m_actionHintRect; // hint rectangle for the action
wxRect m_lastRect;
wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over
@@ -630,12 +630,12 @@ class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
public:
wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
{
manager = NULL;
pane = NULL;
manager = nullptr;
pane = nullptr;
button = 0;
veto_flag = false;
canveto_flag = true;
dc = NULL;
dc = nullptr;
}
wxEvent *Clone() const override { return new wxAuiManagerEvent(*this); }
+3 -3
View File
@@ -48,7 +48,7 @@ public:
virtual void SetSizingInfo(const wxSize& tabCtrlSize,
size_t tabCount,
wxWindow* wnd = NULL) = 0;
wxWindow* wnd = nullptr) = 0;
virtual void SetNormalFont(const wxFont& font) = 0;
virtual void SetSelectedFont(const wxFont& font) = 0;
@@ -128,7 +128,7 @@ public:
void SetFlags(unsigned int flags) override;
void SetSizingInfo(const wxSize& tabCtrlSize,
size_t tabCount,
wxWindow* wnd = NULL) override;
wxWindow* wnd = nullptr) override;
void SetNormalFont(const wxFont& font) override;
void SetSelectedFont(const wxFont& font) override;
@@ -231,7 +231,7 @@ public:
void SetSizingInfo(const wxSize& tabCtrlSize,
size_t tabCount,
wxWindow* wnd = NULL) override;
wxWindow* wnd = nullptr) override;
void SetNormalFont(const wxFont& font) override;
void SetSelectedFont(const wxFont& font) override;
+6 -6
View File
@@ -29,7 +29,7 @@ inline size_t wxBase64EncodedSize(size_t len) { return 4*((len+2)/3); }
//
// returns the length of the encoded data or wxCONV_FAILED if the buffer is not
// large enough; to determine the needed size you can either allocate a buffer
// of wxBase64EncodedSize(srcLen) size or call the function with NULL buffer in
// of wxBase64EncodedSize(srcLen) size or call the function with null buffer in
// which case the required size will be returned
WXDLLIMPEXP_BASE size_t
wxBase64Encode(char *dst, size_t dstLen, const void *src, size_t srcLen);
@@ -83,18 +83,18 @@ inline size_t wxBase64DecodedSize(size_t srcLen) { return 3*srcLen/4; }
// returns the length of the decoded data or wxCONV_FAILED if an error occurs
// such as the buffer is too small or the encoded string is invalid; in the
// latter case the posErr is filled with the position where the decoding
// stopped if it is not NULL
// stopped if it is not null
WXDLLIMPEXP_BASE size_t
wxBase64Decode(void *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL);
size_t *posErr = nullptr);
inline size_t
wxBase64Decode(void *dst, size_t dstLen,
const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL)
size_t *posErr = nullptr)
{
// don't use str.length() here as the ASCII buffer is shorter than it for
// strings with embedded NULs
@@ -106,12 +106,12 @@ wxBase64Decode(void *dst, size_t dstLen,
WXDLLIMPEXP_BASE wxMemoryBuffer
wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL);
size_t *posErr = nullptr);
inline wxMemoryBuffer
wxBase64Decode(const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t *posErr = NULL)
size_t *posErr = nullptr)
{
// don't use str.length() here as the ASCII buffer is shorter than it for
// strings with embedded NULs
+2 -2
View File
@@ -135,7 +135,7 @@ public:
{ return false; }
virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const
wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = nullptr) const
{ return false; }
void SetName(const wxString& name) { m_name = name; }
@@ -233,7 +233,7 @@ public:
virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
virtual bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = NULL) const = 0;
const wxPalette *palette = nullptr) const = 0;
virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
/*
+1 -1
View File
@@ -112,7 +112,7 @@ public:
static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl);
// Check if bitmap bundle is non-empty.
bool IsOk() const { return m_impl.get() != NULL; }
bool IsOk() const { return m_impl.get() != nullptr; }
// Clear the bundle contents, IsOk() will return false after doing this.
void Clear();
+9 -9
View File
@@ -94,11 +94,11 @@ public:
// get the panel which represents the given page
virtual wxWindow *GetPage(size_t n) const { return m_pages.at(n); }
// get the current page or NULL if none
// get the current page or nullptr if none
wxWindow *GetCurrentPage() const
{
const int n = GetSelection();
return n == wxNOT_FOUND ? NULL : GetPage(n);
return n == wxNOT_FOUND ? nullptr : GetPage(n);
}
// get the currently selected page or wxNOT_FOUND if none
@@ -162,7 +162,7 @@ public:
virtual bool RemovePage(size_t n)
{
DoInvalidateBestSize();
return DoRemovePage(n) != NULL;
return DoRemovePage(n) != nullptr;
}
// remove all pages and delete them
@@ -217,7 +217,7 @@ public:
// hit test: returns which page is hit and, optionally, where (icon, label)
virtual int HitTest(const wxPoint& WXUNUSED(pt),
long * WXUNUSED(flags) = NULL) const
long * WXUNUSED(flags) = nullptr) const
{
return wxNOT_FOUND;
}
@@ -279,7 +279,7 @@ protected:
// create a new "page changing" event
virtual wxBookCtrlEvent* CreatePageChangingEvent() const
{ wxFAIL_MSG(wxT("Override this function!")); return NULL; }
{ wxFAIL_MSG(wxT("Override this function!")); return nullptr; }
// modify the event created by CreatePageChangingEvent() to "page changed"
// event, usually by just calling SetEventType() on it
@@ -292,15 +292,15 @@ protected:
virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); }
// Should we accept NULL page pointers in Add/InsertPage()?
// Should we accept null page pointers in Add/InsertPage()?
//
// Default is no but derived classes may override it if they can treat NULL
// Default is no but derived classes may override it if they can treat null
// pages in some sensible way (e.g. wxTreebook overrides this to allow
// having nodes without any associated page)
virtual bool AllowNullPage() const { return false; }
// For classes that allow null pages, we also need a way to find the
// closest non-NULL page corresponding to the given index, e.g. the first
// closest non-null page corresponding to the given index, e.g. the first
// leaf item in wxTreebook tree and this method must be overridden to
// return it if AllowNullPage() is overridden. Note that it can still
// return null if there are no valid pages after this one.
@@ -349,7 +349,7 @@ protected:
// event handlers
void OnSize(wxSizeEvent& event);
// controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
// controller buddy if available, nullptr otherwise (usually for native book controls like wxNotebook)
wxWindow *m_bookctrl;
// Whether to shrink to fit current page
+11 -11
View File
@@ -133,7 +133,7 @@ public:
CharType *release() const
{
if ( m_data == GetNullData() )
return NULL;
return nullptr;
wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") );
wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") );
@@ -141,7 +141,7 @@ public:
CharType * const p = m_data->Get();
wxScopedCharTypeBuffer *self = const_cast<wxScopedCharTypeBuffer*>(this);
self->m_data->Set(NULL, 0);
self->m_data->Set(nullptr, 0);
self->DecRef();
return p;
@@ -176,7 +176,7 @@ protected:
}
};
// placeholder for NULL string, to simplify this code
// placeholder for null string, to simplify this code
static Data *GetNullData()
{
return static_cast<Data *>(wxPrivate::GetUntypedNullData());
@@ -252,7 +252,7 @@ protected:
public:
typedef T CharType;
wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN)
wxCharTypeBuffer(const CharType *str = nullptr, size_t len = wxNO_LEN)
{
if ( str )
{
@@ -365,7 +365,7 @@ public:
wxCharBuffer(const wxScopedCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxCharBuffer(const CharType *str = nullptr) : wxCharTypeBufferBase(str) {}
wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxCharBuffer(const wxCStrData& cstr);
@@ -382,7 +382,7 @@ public:
wxWCharBuffer(const wxScopedCharTypeBufferBase& buf)
: wxCharTypeBufferBase(buf) {}
wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxWCharBuffer(const CharType *str = nullptr) : wxCharTypeBufferBase(str) {}
wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxWCharBuffer(const wxCStrData& cstr);
@@ -401,7 +401,7 @@ public:
// always return a buffer
// + we should derive this class from wxScopedCharTypeBuffer
// then
wxWritableCharTypeBuffer(const CharType *str = NULL)
wxWritableCharTypeBuffer(const CharType *str = nullptr)
: wxCharTypeBuffer<T>(str) {}
operator CharType*() { return this->data(); }
@@ -448,7 +448,7 @@ public:
// everything is private as it can only be used by wxMemoryBuffer
private:
wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize)
: m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0)
: m_data(size ? malloc(size) : nullptr), m_size(size), m_len(0), m_ref(0)
{
}
~wxMemoryBufferData() { free(m_data); }
@@ -483,13 +483,13 @@ private:
void *release()
{
if ( m_data == NULL )
return NULL;
if ( m_data == nullptr )
return nullptr;
wxASSERT_MSG( m_ref == 1, "can't release shared buffer" );
void *p = m_data;
m_data = NULL;
m_data = nullptr;
m_len =
m_size = 0;
+1 -1
View File
@@ -31,7 +31,7 @@ class wxBusyInfoFlags
public:
wxBusyInfoFlags()
{
m_parent = NULL;
m_parent = nullptr;
m_alpha = wxALPHA_OPAQUE;
}
+2 -2
View File
@@ -36,12 +36,12 @@ public:
// make this button the default button in its top level window
//
// returns the old default item (possibly NULL)
// returns the old default item (possibly null)
virtual wxWindow *SetDefault();
// returns the default button size for this platform, and optionally for a
// specific window when the platform supports per-monitor DPI
static wxSize GetDefaultSize(wxWindow* win = NULL);
static wxSize GetDefaultSize(wxWindow* win = nullptr);
protected:
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
+4 -4
View File
@@ -204,7 +204,7 @@ public:
}
// retrieves the limits currently in use (wxDefaultDateTime if none) in the
// provided pointers (which may be NULL) and returns true if there are any
// provided pointers (which may be null) and returns true if there are any
// limits or false if none
virtual bool
GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const
@@ -223,8 +223,8 @@ public:
// notice that this is not implemented in all versions
virtual wxCalendarHitTestResult
HitTest(const wxPoint& WXUNUSED(pos),
wxDateTime* WXUNUSED(date) = NULL,
wxDateTime::WeekDay* WXUNUSED(wd) = NULL)
wxDateTime* WXUNUSED(date) = nullptr,
wxDateTime::WeekDay* WXUNUSED(wd) = nullptr)
{
return wxCAL_HITTEST_NOWHERE;
}
@@ -253,7 +253,7 @@ public:
virtual void Mark(size_t day, bool mark) = 0;
virtual wxCalendarDateAttr *GetAttr(size_t WXUNUSED(day)) const
{ return NULL; }
{ return nullptr; }
virtual void SetAttr(size_t WXUNUSED(day), wxCalendarDateAttr *attr)
{ delete attr; }
virtual void ResetAttr(size_t WXUNUSED(day)) { }
+1 -1
View File
@@ -179,7 +179,7 @@ protected:
private:
void Init()
{
m_window = NULL;
m_window = nullptr;
m_x = m_y = 0;
m_width = m_height = 0;
m_countVisible = 0;
+1 -1
View File
@@ -168,7 +168,7 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&);
class WXDLLIMPEXP_CORE wxClipboardLocker
{
public:
wxClipboardLocker(wxClipboard *clipboard = NULL)
wxClipboardLocker(wxClipboard *clipboard = nullptr)
{
m_clipboard = clipboard ? clipboard : wxTheClipboard;
if ( m_clipboard )

Some files were not shown because too many files have changed in this diff Show More