diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-01 20:49:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-02 00:37:51 +0300 |
commit | 4df121e6dcdf53436f50ce81dd60096ce0138a2c (patch) | |
tree | 7cadc707bb49e4c148ba9c182075697a9643e20a /src/guichan | |
parent | ed3410d7eb61593a2235ddba97ce257c85e405a6 (diff) | |
download | manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.gz manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.bz2 manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.xz manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.zip |
Add const to more classes.
Diffstat (limited to 'src/guichan')
32 files changed, 123 insertions, 122 deletions
diff --git a/src/guichan/cliprectangle.cpp b/src/guichan/cliprectangle.cpp index e05736870..285cbbe81 100644 --- a/src/guichan/cliprectangle.cpp +++ b/src/guichan/cliprectangle.cpp @@ -62,8 +62,9 @@ namespace gcn height = 0; } - ClipRectangle::ClipRectangle(int x0, int y0, int width0, int height0, - int xOffset0, int yOffset0) : + ClipRectangle::ClipRectangle(const int x0, const int y0, + const int width0, const int height0, + const int xOffset0, const int yOffset0) : xOffset(xOffset0), yOffset(yOffset0) { diff --git a/src/guichan/color.cpp b/src/guichan/color.cpp index f58e7b58e..7cc3b887a 100644 --- a/src/guichan/color.cpp +++ b/src/guichan/color.cpp @@ -60,7 +60,7 @@ namespace gcn { } - Color::Color(int color) : + Color::Color(const int color) : r((color >> 16) & 0xFF), g((color >> 8) & 0xFF), b(color & 0xFF), @@ -68,7 +68,7 @@ namespace gcn { } - Color::Color(int ar, int ag, int ab, int aa) : + Color::Color(const int ar, const int ag, const int ab, const int aa) : r(ar), g(ag), b(ab), @@ -104,7 +104,7 @@ namespace gcn return result; } - Color Color::operator*(float value) const + Color Color::operator*(const float value) const { Color result(static_cast<int>(r * value), static_cast<int>(g * value), diff --git a/src/guichan/event.cpp b/src/guichan/event.cpp index 5983af7e7..24c913880 100644 --- a/src/guichan/event.cpp +++ b/src/guichan/event.cpp @@ -52,8 +52,8 @@ namespace gcn { - Event::Event(Widget* source) - :mSource(source) + Event::Event(Widget *const source) : + mSource(source) { } diff --git a/src/guichan/exception.cpp b/src/guichan/exception.cpp index 4ea86896e..75eaac2e9 100644 --- a/src/guichan/exception.cpp +++ b/src/guichan/exception.cpp @@ -73,7 +73,7 @@ namespace gcn Exception::Exception(const std::string& message, const std::string& function, const std::string& filename, - unsigned int line) + const unsigned int line) : mFunction(function), mMessage(message), mFilename(filename), diff --git a/src/guichan/include/guichan/cliprectangle.hpp b/src/guichan/include/guichan/cliprectangle.hpp index ea44ac680..886153549 100644 --- a/src/guichan/include/guichan/cliprectangle.hpp +++ b/src/guichan/include/guichan/cliprectangle.hpp @@ -79,12 +79,12 @@ namespace gcn * calculating the actual screen coordinate from * the relative screen coordinate. */ - ClipRectangle(int x0, - int y0, - int width0, - int height0, - int xOffset0, - int yOffset0); + ClipRectangle(const int x0, + const int y0, + const int width0, + const int height0, + const int xOffset0, + const int yOffset0); /** * Copy constructor. Copies x, y, width and height diff --git a/src/guichan/include/guichan/color.hpp b/src/guichan/include/guichan/color.hpp index 6f0cfc1ff..795cdc12d 100644 --- a/src/guichan/include/guichan/color.hpp +++ b/src/guichan/include/guichan/color.hpp @@ -75,7 +75,7 @@ namespace gcn * * @param color The color to initialise the object with. */ - Color(int color); + Color(const int color); /** * Constructor. The default alpha value is 255. @@ -86,7 +86,7 @@ namespace gcn * @param a Alpha, used for transparency. A value of 0 means * totaly transparent, 255 is totaly opaque. */ - Color(int r, int g, int b, int a = 255); + Color(const int r, const int g, const int b, const int a = 255); /** * Adds the RGB values of two colors together. The values will be @@ -121,7 +121,7 @@ namespace gcn * the add and subtract operations, be multiplied as * well. */ - Color operator*(float value) const; + Color operator*(const float value) const; /** * Compares two colors. diff --git a/src/guichan/include/guichan/event.hpp b/src/guichan/include/guichan/event.hpp index 3a4ad26e2..1b52df8ed 100644 --- a/src/guichan/include/guichan/event.hpp +++ b/src/guichan/include/guichan/event.hpp @@ -67,7 +67,7 @@ namespace gcn * * @param source The source widget of the event. */ - Event(Widget* source); + Event(Widget *const source); /** * Destructor. diff --git a/src/guichan/include/guichan/exception.hpp b/src/guichan/include/guichan/exception.hpp index 1b591f2d6..e2dd958be 100644 --- a/src/guichan/include/guichan/exception.hpp +++ b/src/guichan/include/guichan/exception.hpp @@ -115,7 +115,7 @@ namespace gcn Exception(const std::string& message, const std::string& function, const std::string& filename, - unsigned int line); + const unsigned int line); /** * Gets the function name where the exception occured. diff --git a/src/guichan/include/guichan/inputevent.hpp b/src/guichan/include/guichan/inputevent.hpp index 1de9d1832..296f14cd2 100644 --- a/src/guichan/include/guichan/inputevent.hpp +++ b/src/guichan/include/guichan/inputevent.hpp @@ -69,11 +69,11 @@ namespace gcn * @param isAltPressed True if alt is pressed, false otherwise. * @param isMetaPressed True if meta is pressed, false otherwise. */ - InputEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed); + InputEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed); /** * Checks if shift is pressed. diff --git a/src/guichan/include/guichan/key.hpp b/src/guichan/include/guichan/key.hpp index b852638b3..9b31d7c6b 100644 --- a/src/guichan/include/guichan/key.hpp +++ b/src/guichan/include/guichan/key.hpp @@ -68,7 +68,7 @@ namespace gcn * * @param value The ascii or enum value for the key. */ - Key(int value = 0); + Key(const int value = 0); /** * Checks if a key is a character. diff --git a/src/guichan/include/guichan/keyevent.hpp b/src/guichan/include/guichan/keyevent.hpp index e841f4a62..5cf1d26c7 100644 --- a/src/guichan/include/guichan/keyevent.hpp +++ b/src/guichan/include/guichan/keyevent.hpp @@ -81,13 +81,13 @@ namespace gcn * false otherwise. * @param key The key of the event. */ - KeyEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed, - unsigned int type, - bool numericPad, + KeyEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const bool numericPad, const Key& key); /** diff --git a/src/guichan/include/guichan/mouseevent.hpp b/src/guichan/include/guichan/mouseevent.hpp index 5b012dc20..ba2200d8d 100644 --- a/src/guichan/include/guichan/mouseevent.hpp +++ b/src/guichan/include/guichan/mouseevent.hpp @@ -78,16 +78,16 @@ namespace gcn * @param clickCount The number of clicks generated with the same button. * It's set to zero if another button is used. */ - MouseEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed, - unsigned int type, - unsigned int button, - int x, - int y, - int clickCount); + MouseEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const unsigned int button, + const int x, + const int y, + const int clickCount); /** * Gets the button of the mouse event. diff --git a/src/guichan/include/guichan/mouseinput.hpp b/src/guichan/include/guichan/mouseinput.hpp index 35952fde5..99ed1fad8 100644 --- a/src/guichan/include/guichan/mouseinput.hpp +++ b/src/guichan/include/guichan/mouseinput.hpp @@ -84,11 +84,11 @@ namespace gcn * @param timeStamp The timestamp of the mouse input. Used to * check for double clicks. */ - MouseInput(unsigned int button, - unsigned int type, - int x, - int y, - int timeStamp); + MouseInput(const unsigned int button, + const unsigned int type, + const int x, + const int y, + const int timeStamp); /** * Sets the type of the mouse input. diff --git a/src/guichan/include/guichan/rectangle.hpp b/src/guichan/include/guichan/rectangle.hpp index 013fe9b69..a4de652a4 100644 --- a/src/guichan/include/guichan/rectangle.hpp +++ b/src/guichan/include/guichan/rectangle.hpp @@ -75,7 +75,7 @@ namespace gcn * @param height The height of the rectangle. * @since 0.1.0 */ - Rectangle(int x, int y, int width, int height); + Rectangle(const int x, const int y, const int width, const int height); /** * Sets the dimension of a rectangle. diff --git a/src/guichan/include/guichan/sdl/sdlimage.hpp b/src/guichan/include/guichan/sdl/sdlimage.hpp index cd4285346..52fb9976b 100644 --- a/src/guichan/include/guichan/sdl/sdlimage.hpp +++ b/src/guichan/include/guichan/sdl/sdlimage.hpp @@ -70,7 +70,7 @@ namespace gcn * @param surface the surface from which to load. * @param autoFree true if the surface should automatically be deleted. */ - SDLImage(SDL_Surface* surface, bool autoFree); + SDLImage(SDL_Surface *const surface, const bool autoFree); /** * Destructor. diff --git a/src/guichan/include/guichan/selectionevent.hpp b/src/guichan/include/guichan/selectionevent.hpp index 331ebe92d..53efc93f5 100644 --- a/src/guichan/include/guichan/selectionevent.hpp +++ b/src/guichan/include/guichan/selectionevent.hpp @@ -67,7 +67,7 @@ namespace gcn * * @param source source The widget of the selection event. */ - SelectionEvent(Widget* source); + SelectionEvent(Widget *const source); /** * Destructor. diff --git a/src/guichan/include/guichan/widgets/dropdown.hpp b/src/guichan/include/guichan/widgets/dropdown.hpp index 7663a265f..6c6ffb4c5 100644 --- a/src/guichan/include/guichan/widgets/dropdown.hpp +++ b/src/guichan/include/guichan/widgets/dropdown.hpp @@ -95,9 +95,9 @@ namespace gcn * @param listBox the listBox to use. * @see ListModel, ScrollArea, ListBox. */ - DropDown(ListModel *listModel = nullptr, - ScrollArea *scrollArea = nullptr, - ListBox *listBox = nullptr); + DropDown(ListModel *const listModel = nullptr, + ScrollArea *const scrollArea = nullptr, + ListBox *const listBox = nullptr); /** * Destructor. diff --git a/src/guichan/include/guichan/widgets/icon.hpp b/src/guichan/include/guichan/widgets/icon.hpp index e25a7a770..ed010c31a 100644 --- a/src/guichan/include/guichan/widgets/icon.hpp +++ b/src/guichan/include/guichan/widgets/icon.hpp @@ -74,7 +74,7 @@ namespace gcn * * @param image The image to display. */ - Icon(const Image* image); + Icon(const Image *const image); /** * Descructor. diff --git a/src/guichan/include/guichan/widgets/scrollarea.hpp b/src/guichan/include/guichan/widgets/scrollarea.hpp index 4937bcbea..84649d530 100644 --- a/src/guichan/include/guichan/widgets/scrollarea.hpp +++ b/src/guichan/include/guichan/widgets/scrollarea.hpp @@ -90,7 +90,7 @@ namespace gcn * * @param content The content of the scroll area. */ - ScrollArea(Widget *content); + ScrollArea(Widget *const content); /** * Constructor. diff --git a/src/guichan/include/guichan/widgets/slider.hpp b/src/guichan/include/guichan/widgets/slider.hpp index a22c36844..bf2ce5937 100644 --- a/src/guichan/include/guichan/widgets/slider.hpp +++ b/src/guichan/include/guichan/widgets/slider.hpp @@ -81,7 +81,7 @@ namespace gcn * * @param scaleEnd The end value of the slider scale. */ - Slider(double scaleEnd = 1.0); + Slider(const double scaleEnd = 1.0); /** * Constructor. @@ -89,7 +89,7 @@ namespace gcn * @param scaleStart The start value of the slider scale. * @param scaleEnd The end value of the slider scale. */ - Slider(double scaleStart, double scaleEnd); + Slider(const double scaleStart, const double scaleEnd); /** * Destructor. diff --git a/src/guichan/inputevent.cpp b/src/guichan/inputevent.cpp index 53ae91442..4b0bec69d 100644 --- a/src/guichan/inputevent.cpp +++ b/src/guichan/inputevent.cpp @@ -52,11 +52,11 @@ namespace gcn { - InputEvent::InputEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed) + InputEvent::InputEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed) :Event(source), mShiftPressed(shiftPressed), mControlPressed(controlPressed), diff --git a/src/guichan/key.cpp b/src/guichan/key.cpp index d2913837e..4c6bfde80 100644 --- a/src/guichan/key.cpp +++ b/src/guichan/key.cpp @@ -52,7 +52,7 @@ namespace gcn { - Key::Key(int value) : + Key::Key(const int value) : mValue(value) { } diff --git a/src/guichan/keyevent.cpp b/src/guichan/keyevent.cpp index 2b7064dc7..003b288dc 100644 --- a/src/guichan/keyevent.cpp +++ b/src/guichan/keyevent.cpp @@ -52,22 +52,22 @@ namespace gcn { - KeyEvent::KeyEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed, - unsigned int type, - bool numericPad, - const Key& key) - :InputEvent(source, - shiftPressed, - controlPressed, - altPressed, - metaPressed), - mType(type), - mIsNumericPad(numericPad), - mKey(key) + KeyEvent::KeyEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const bool numericPad, + const Key& key) : + InputEvent(source, + shiftPressed, + controlPressed, + altPressed, + metaPressed), + mType(type), + mIsNumericPad(numericPad), + mKey(key) { } diff --git a/src/guichan/mouseevent.cpp b/src/guichan/mouseevent.cpp index 2e5c757c5..7f386b0a6 100644 --- a/src/guichan/mouseevent.cpp +++ b/src/guichan/mouseevent.cpp @@ -52,28 +52,27 @@ namespace gcn { - MouseEvent::MouseEvent(Widget* source, - bool shiftPressed, - bool controlPressed, - bool altPressed, - bool metaPressed, - unsigned int type, - unsigned int button, - int x, - int y, - int clickCount) - :InputEvent(source, - shiftPressed, - controlPressed, - altPressed, - metaPressed), - mType(type), - mButton(button), - mX(x), - mY(y), - mClickCount(clickCount) + MouseEvent::MouseEvent(Widget *const source, + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const unsigned int button, + const int x, + const int y, + const int clickCount) : + InputEvent(source, + shiftPressed, + controlPressed, + altPressed, + metaPressed), + mType(type), + mButton(button), + mX(x), + mY(y), + mClickCount(clickCount) { - } unsigned int MouseEvent::getButton() const diff --git a/src/guichan/mouseinput.cpp b/src/guichan/mouseinput.cpp index 791c8d7e9..f3b0fe511 100644 --- a/src/guichan/mouseinput.cpp +++ b/src/guichan/mouseinput.cpp @@ -52,16 +52,16 @@ namespace gcn { - MouseInput::MouseInput(unsigned int button, - unsigned int type, - int x, - int y, - int timeStamp) - : mType(type), - mButton(button), - mTimeStamp(timeStamp), - mX(x), - mY(y) + MouseInput::MouseInput(const unsigned int button, + const unsigned int type, + const int x, + const int y, + const int timeStamp) : + mType(type), + mButton(button), + mTimeStamp(timeStamp), + mX(x), + mY(y) { } diff --git a/src/guichan/rectangle.cpp b/src/guichan/rectangle.cpp index 0a6ed2908..eb87bff50 100644 --- a/src/guichan/rectangle.cpp +++ b/src/guichan/rectangle.cpp @@ -60,8 +60,9 @@ namespace gcn { } - Rectangle::Rectangle(int x_, int y_, int width_, int height_) - : x(x_), + Rectangle::Rectangle(const int x_, const int y_, + const int width_, const int height_) : + x(x_), y(y_), width(width_), height(height_) diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp index 5bb7041ff..3c0325280 100644 --- a/src/guichan/sdl/sdlimage.cpp +++ b/src/guichan/sdl/sdlimage.cpp @@ -55,7 +55,7 @@ namespace gcn { - SDLImage::SDLImage(SDL_Surface* surface, bool autoFree) : + SDLImage::SDLImage(SDL_Surface *const surface, const bool autoFree) : mSurface(surface), mAutoFree(autoFree) { diff --git a/src/guichan/selectionevent.cpp b/src/guichan/selectionevent.cpp index 8c8a3f28f..59ba9e641 100644 --- a/src/guichan/selectionevent.cpp +++ b/src/guichan/selectionevent.cpp @@ -52,8 +52,8 @@ namespace gcn { - SelectionEvent::SelectionEvent(Widget* source) - :Event(source) + SelectionEvent::SelectionEvent(Widget *const source) : + Event(source) { } diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp index 0cd979adc..c446b869d 100644 --- a/src/guichan/widgets/dropdown.cpp +++ b/src/guichan/widgets/dropdown.cpp @@ -57,9 +57,9 @@ namespace gcn { - DropDown::DropDown(ListModel *listModel, - ScrollArea *scrollArea, - ListBox *listBox) + DropDown::DropDown(ListModel *const listModel, + ScrollArea *const scrollArea, + ListBox *const listBox) { setWidth(100); setFocusable(true); diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp index 26139716d..b0d277fbd 100644 --- a/src/guichan/widgets/icon.cpp +++ b/src/guichan/widgets/icon.cpp @@ -71,7 +71,7 @@ namespace gcn mImage->getHeight()); } - Icon::Icon(const Image* image) : + Icon::Icon(const Image *const image) : mImage(image), mInternalImage(false) { diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp index 1251bc665..f8bd11334 100644 --- a/src/guichan/widgets/scrollarea.cpp +++ b/src/guichan/widgets/scrollarea.cpp @@ -80,7 +80,7 @@ namespace gcn addMouseListener(this); } - ScrollArea::ScrollArea(Widget *content) : + ScrollArea::ScrollArea(Widget *const content) : mVScroll(0), mHScroll(0), mScrollbarWidth(12), diff --git a/src/guichan/widgets/slider.cpp b/src/guichan/widgets/slider.cpp index ed14f525a..a9e9bed31 100644 --- a/src/guichan/widgets/slider.cpp +++ b/src/guichan/widgets/slider.cpp @@ -56,7 +56,7 @@ namespace gcn { - Slider::Slider(double scaleEnd) : + Slider::Slider(const double scaleEnd) : mDragged(false), mScaleStart(0), mScaleEnd(scaleEnd) @@ -72,7 +72,7 @@ namespace gcn addKeyListener(this); } - Slider::Slider(double scaleStart, double scaleEnd) : + Slider::Slider(const double scaleStart, const double scaleEnd) : mDragged(false), mScaleStart(scaleStart), mScaleEnd(scaleEnd) |