Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] Replace NULL by nullptr #109

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/ff/src/ffdemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ void FFDemo::input()
{
Mix_PlayChannel(-1, mEscapeSound, 0);

action(gcn::ActionEvent(NULL, "escape"));
action(gcn::ActionEvent(nullptr, "escape"));
}
else if (mEvent.key.keysym.sym == SDLK_RETURN
|| mEvent.key.keysym.sym == SDLK_UP
Expand Down
2 changes: 1 addition & 1 deletion demo/ff/src/fflistbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ FFListBox::~FFListBox()

void FFListBox::draw(gcn::Graphics* graphics)
{
if (mListModel == NULL)
if (mListModel == nullptr)
{
return;
}
Expand Down
14 changes: 7 additions & 7 deletions include/guisan/focushandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,22 @@ namespace gcn
/**
* Gets the widget with focus.
*
* @return The widget with focus. NULL if no widget has focus.
* @return The widget with focus. nullptr if no widget has focus.
*/
virtual Widget* getFocused() const;

/**
* Gets the widget with modal focus.
*
* @return The widget with modal focus. NULL if no widget has
* @return The widget with modal focus. nullptr if no widget has
* modal focus.
*/
virtual Widget* getModalFocused() const;

/**
* Gets the widget with modal mouse input focus.
*
* @return The widget with modal mouse input focus. NULL if
* @return The widget with modal mouse input focus. nullptr if
* no widget has modal mouse input focus.
*/
virtual Widget* getModalMouseInputFocused() const;
Expand Down Expand Up @@ -356,24 +356,24 @@ namespace gcn
WidgetVector mWidgets;

/**
* Holds the focused widget. NULL if no widget has focus.
* Holds the focused widget. nullptr if no widget has focus.
*/
Widget* mFocusedWidget = nullptr;

/**
* Holds the modal focused widget. NULL if no widget has
* Holds the modal focused widget. nullptr if no widget has
* modal focused.
*/
Widget* mModalFocusedWidget = nullptr;

/**
* Holds the modal mouse input focused widget. NULL if no widget
* Holds the modal mouse input focused widget. nullptr if no widget
* is being dragged.
*/
Widget* mModalMouseInputFocusedWidget = nullptr;

/**
* Holds the dragged widget. NULL if no widget is
* Holds the dragged widget. nullptr if no widget is
* being dragged.
*/
Widget* mDraggedWidget = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions include/guisan/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace gcn
* Gets the top widget. The top widget is the root widget
* of the GUI.
*
* @return The top widget. NULL if no top widget has been set.
* @return The top widget. nullptr if no top widget has been set.
* @since 0.1.0
*/
virtual Widget* getTop() const;
Expand All @@ -153,7 +153,7 @@ namespace gcn
/**
* Gets the graphics object used for drawing.
*
* @return The graphics object used for drawing. NULL if no
* @return The graphics object used for drawing. nullptr if no
* graphics object has been set.
* @see setGraphics, OpenGLGraphics, SDLGraphics
* @since 0.1.0
Expand All @@ -172,7 +172,7 @@ namespace gcn
/**
* Gets the input object being used for input handling.
*
* @return The input object used for handling input. NULL if no
* @return The input object used for handling input. nullptr if no
* input object has been set.
* @see setInput, SDLInput
* @since 0.1.0
Expand Down
4 changes: 2 additions & 2 deletions include/guisan/opengl/openglsdlimageloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace gcn
{
SDL_Surface *loadedSurface = loadSDLSurface(filename);

if (loadedSurface == NULL)
if (loadedSurface == nullptr)
{
throw GCN_EXCEPTION(
std::string("Unable to load image file: ") + filename);
Expand All @@ -88,7 +88,7 @@ namespace gcn
SDL_Surface *surface = convertToStandardFormat(loadedSurface);
SDL_FreeSurface(loadedSurface);

if (surface == NULL)
if (surface == nullptr)
{
throw GCN_EXCEPTION(
std::string("Not enough memory to load: ") + filename);
Expand Down
4 changes: 0 additions & 4 deletions include/guisan/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,4 @@
#define GCN_EXTENSION_DECLSPEC
#endif

#ifndef NULL
#define NULL 0
#endif

#endif // end GCN_PLATFORM_HPP
2 changes: 1 addition & 1 deletion include/guisan/sdl/sdlimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace gcn
* @param autoFree true if the surface should automatically be deleted.
* @param renderer renderer object to create the texture (last parameter to avoid breaking stuff)
*/
SDLImage(SDL_Surface* surface, bool autoFree, SDL_Renderer* renderer = NULL);
SDLImage(SDL_Surface* surface, bool autoFree, SDL_Renderer* renderer = nullptr);

/**
* Destructor.
Expand Down
20 changes: 10 additions & 10 deletions include/guisan/widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace gcn
/**
* Gets the widget's parent container.
*
* @return The widget's parent container. NULL if the widget
* @return The widget's parent container. nullptr if the widget
* has no parent.
* @since 0.1.0
*/
Expand All @@ -199,7 +199,7 @@ namespace gcn
* Gets the top widget, or top parent, of this widget.
*
* @return The top widget, or top parent, for this widget.
* NULL if no top widget exists
* nullptr if no top widget exists
* (that is this widget doesn't have a parent).
* @since 1.1.0
*/
Expand Down Expand Up @@ -722,7 +722,7 @@ namespace gcn
static void setGlobalFont(Font* font);

/**
* Sets the font for the widget. If NULL is passed, the global font
* Sets the font for the widget. If nullptr is passed, the global font
* will be used.
*
* @param font The font to set for the widget.
Expand Down Expand Up @@ -861,12 +861,12 @@ namespace gcn
* This function is used to decide which gets mouse input,
* thus it can be overloaded to change that behaviour.
*
* NOTE: This always returns NULL if the widget is not
* NOTE: This always returns nullptr if the widget is not
* a container.
*
* @param x The x coordinate of the widget to get.
* @param y The y coordinate of the widget to get.
* @return The widget at the specified coodinate, NULL
* @return The widget at the specified coodinate, nullptr
* if no widget is found.
* @since 0.6.0
*/
Expand All @@ -883,7 +883,7 @@ namespace gcn
* @return A list of widgets. An empty list if no widgets was found.
* @since 1.1.0
*/
virtual std::list<Widget*> getWidgetsIn(const Rectangle& area, Widget* ignore = NULL);
virtual std::list<Widget*> getWidgetsIn(const Rectangle& area, Widget* ignore = nullptr);

/**
* Gets the mouse listeners of the widget.
Expand Down Expand Up @@ -937,7 +937,7 @@ namespace gcn
* Gets the internal focus handler used.
*
* @return the internalFocusHandler used. If no internal focus handler
* is used, NULL will be returned.
* is used, nullptr will be returned.
* @see setInternalFocusHandler
* @since 0.1.0
*/
Expand Down Expand Up @@ -1119,7 +1119,7 @@ namespace gcn
*
* @param id The id to find a widget by.
* @return The widget with the corrosponding id,
* NULL of no widget is found.
* nullptr of no widget is found.
*
* @since 1.1.0
*/
Expand Down Expand Up @@ -1196,13 +1196,13 @@ namespace gcn
FocusHandler* mFocusHandler = nullptr;

/**
* Holds the focus handler used by the widget. NULL
* Holds the focus handler used by the widget. nullptr
* if no internal focus handler is used.
*/
FocusHandler* mInternalFocusHandler = nullptr;

/**
* Holds the parent of the widget. NULL if the widget
* Holds the parent of the widget. nullptr if the widget
* has no parent.
*/
Widget* mParent = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion include/guisan/widgets/container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace gcn
* Finds a widget given an id.
*
* @param id The id to find a widget by.
* @return A widget with a corrosponding id, NULL if no widget
* @return A widget with a corrosponding id, nullptr if no widget
* is found.
* @see Widget::setId
*/
Expand Down
6 changes: 3 additions & 3 deletions include/guisan/widgets/dropdown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ namespace gcn
* @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox.
*/
DropDown(ListModel *listModel = NULL,
ScrollArea *scrollArea = NULL,
ListBox *listBox = NULL);
DropDown(ListModel *listModel = nullptr,
ScrollArea *scrollArea = nullptr,
ListBox *listBox = nullptr);

/**
* Destructor.
Expand Down
Loading