Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-fonseca committed Mar 9, 2020
1 parent dc9e105 commit 2260cc9
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 86 deletions.
3 changes: 2 additions & 1 deletion base/communication/IEEE1394Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

_COM_AZURE_DEV__BASE__ENTER_NAMESPACE

IEEE1394Impl* IEEE1394Impl::getDefault() noexcept {
IEEE1394Impl* IEEE1394Impl::getDefault() noexcept
{
return new _COM_AZURE_DEV__BASE__IEEE_1394_IMPL();
}

Expand Down
5 changes: 4 additions & 1 deletion base/io/FileInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class _COM_AZURE_DEV__BASE__API FileInputStream : public virtual Object, public
FileInputStream(
const String& name, bool exclusive = true);

inline bool atEnd() const {
/** Returns true if end has been reached. */
inline bool atEnd() const noexcept
{
return end;
}

Expand All @@ -58,6 +60,7 @@ class _COM_AZURE_DEV__BASE__API FileInputStream : public virtual Object, public
*/
unsigned int available() const;

/** Closes stream. */
void close();

unsigned int skip(unsigned int count);
Expand Down
1 change: 1 addition & 0 deletions base/io/FileOutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class _COM_AZURE_DEV__BASE__API FileOutputStream : public virtual Object, public
/** Returns true if open. */
bool isOpen() const noexcept;

/** Closes stream. */
void close();

/**
Expand Down
55 changes: 37 additions & 18 deletions base/math/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ template<class TYPE> class Vector : public Object {
/**
Returns the elements of the vector for modification.
*/
inline TYPE* getElements() {
inline TYPE* getElements()
{
if (elements.isMultiReferenced()) { // do we have the elements for our self
elements = new ReferenceCountedAllocator<TYPE>(*elements); // make copy of the elements
}
Expand All @@ -89,14 +90,16 @@ template<class TYPE> class Vector : public Object {
/**
Returns the elements of the vector for read-only.
*/
inline const TYPE* getElements() const noexcept {
inline const TYPE* getElements() const noexcept
{
return elements->getElements();
}

/**
Returns the elements of the vector for read-only.
*/
inline const TYPE* getReadOnlyElements() const noexcept {
inline const TYPE* getReadOnlyElements() const noexcept
{
return elements->getElements();
}

Expand All @@ -109,7 +112,8 @@ template<class TYPE> class Vector : public Object {
public:

/** Gets the size of the vector. */
inline unsigned int getSize() const noexcept {
inline unsigned int getSize() const noexcept
{
return elements->getSize();
}
public:
Expand Down Expand Up @@ -160,7 +164,9 @@ template<class TYPE> class Vector : public Object {
@param copy The vector to be copied.
*/
inline Vector(const Vector& copy) noexcept : elements(copy.elements) {
inline Vector(const Vector& copy) noexcept
: elements(copy.elements)
{
}

/**
Expand All @@ -175,42 +181,48 @@ template<class TYPE> class Vector : public Object {
/**
Returns the first element of the allocator as a modifying array.
*/
inline Iterator getBeginIterator() noexcept {
inline Iterator getBeginIterator() noexcept
{
return elements->getBeginIterator();
}

/**
Returns the end of the allocator as a modifying array.
*/
inline Iterator getEndIterator() noexcept {
inline Iterator getEndIterator() noexcept
{
return elements->getEndIterator();
}

/**
Returns the first element of the allocator as a non-modifying array.
*/
inline ReadIterator getBeginIterator() const noexcept {
inline ReadIterator getBeginIterator() const noexcept
{
return elements->getBeginIterator();
}

/**
Returns the end of the allocator as a non-modifying array.
*/
inline ReadIterator getEndIterator() const noexcept {
inline ReadIterator getEndIterator() const noexcept
{
return elements->getEndIterator();
}

/**
Returns a modifying enumerator of the array.
*/
inline Enumerator getEnumerator() noexcept {
inline Enumerator getEnumerator() noexcept
{
return elements->getEnumerator();
}

/**
Returns a non-modifying enumerator of the array.
*/
inline ReadEnumerator getReadEnumerator() const noexcept {
inline ReadEnumerator getReadEnumerator() const noexcept
{
return elements->getReadEnumerator();
}

Expand Down Expand Up @@ -240,7 +252,8 @@ template<class TYPE> class Vector : public Object {
@param index The index of the desired element.
*/
inline Element operator[](unsigned int index) {
inline Element operator[](unsigned int index)
{
return Element(*this, index);
}

Expand Down Expand Up @@ -327,7 +340,8 @@ template<class TYPE> class Vector : public Object {
@param value The value to be added.
*/
inline Vector& operator+=(const Vector& value) {
inline Vector& operator+=(const Vector& value)
{
return add(value);
}

Expand All @@ -336,7 +350,8 @@ template<class TYPE> class Vector : public Object {
@param value The value to be subtracted.
*/
inline Vector& operator-=(const Vector& value) {
inline Vector& operator-=(const Vector& value)
{
return subtract(value);
}

Expand All @@ -345,7 +360,8 @@ template<class TYPE> class Vector : public Object {
@param value The multiplicator.
*/
inline Vector& operator*=(const TYPE& value) noexcept {
inline Vector& operator*=(const TYPE& value) noexcept
{
return multiply(value);
}

Expand All @@ -354,21 +370,24 @@ template<class TYPE> class Vector : public Object {
@param value The divisor.
*/
inline Vector& operator/=(const TYPE& value) noexcept {
inline Vector& operator/=(const TYPE& value) noexcept
{
return divide(value);
}

/**
Unary plus.
*/
inline Vector operator+() const noexcept {
inline Vector operator+() const noexcept
{
return plus();
}

/**
Unary minus.
*/
inline Vector operator-() const noexcept {
inline Vector operator-() const noexcept
{
return minus();
}

Expand Down
2 changes: 1 addition & 1 deletion base/mem/Reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class GarbageCollect {
AnyReference object;
public:

GarbageCollect(AnyReference _object) noexcept
inline GarbageCollect(AnyReference _object) noexcept
: object(_object) {
}

Expand Down
3 changes: 2 additions & 1 deletion base/ui/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Label::Label(Window& owner)
setTextColor(Color(0, 0, 0));
}

void Label::onDisplay() noexcept {
void Label::onDisplay() noexcept
{
const Dimension dimension = getDimension();
if (dimension.isProper()) {
const Position lowerRight(dimension.getWidth() - 1, dimension.getHeight() - 1);
Expand Down
15 changes: 10 additions & 5 deletions base/ui/Label.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,34 @@ class _COM_AZURE_DEV__BASE__API Label : public Widget {
/**
Returns the text format.
*/
unsigned int getTextFormat() const noexcept {
unsigned int getTextFormat() const noexcept
{
return textFormat;
}

/**
Sets the text format.
*/
void setTextFormat(unsigned int textFormat) noexcept {
void setTextFormat(unsigned int textFormat) noexcept
{
this->textFormat = textFormat;
invalidate();
}

/**
Sets the background color.
*/
inline void setBackground(Color background) noexcept {
inline void setBackground(Color background) noexcept
{
this->background = background;
invalidate();
}

/**
Sets the text color.
*/
inline void setForeground(Color foreground) noexcept {
inline void setForeground(Color foreground) noexcept
{
this->foreground = foreground;
invalidate();
}
Expand All @@ -100,7 +104,8 @@ class _COM_AZURE_DEV__BASE__API Label : public Widget {
/**
Destroys the label.
*/
inline ~Label() noexcept {
inline ~Label() noexcept
{
}
};

Expand Down
15 changes: 10 additions & 5 deletions base/ui/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ class _COM_AZURE_DEV__BASE__API Menu : public Object {
/**
Returns the handle.
*/
inline OperatingSystem::Handle getHandle() const noexcept {
inline OperatingSystem::Handle getHandle() const noexcept
{
return handle;
}

/**
Returns true if the handle is valid.
*/
inline bool isValid() const noexcept {
inline bool isValid() const noexcept
{
return handle != OperatingSystem::INVALID_HANDLE;
}

Expand Down Expand Up @@ -145,22 +147,25 @@ class _COM_AZURE_DEV__BASE__API Menu : public Object {
/**
Assignment of menu from other menu.
*/
inline Menu& operator=(const Menu& assign) noexcept {
inline Menu& operator=(const Menu& assign) noexcept
{
handle = assign.handle;
return *this;
}

/**
Returns true if the menu is valid.
*/
inline bool isValid() const noexcept {
inline bool isValid() const noexcept
{
return handle.isValid();
}

/**
Returns the opaque menu handle.
*/
inline OperatingSystem::Handle getHandle() const noexcept {
inline OperatingSystem::Handle getHandle() const noexcept
{
// if (!handle.isValid()) {
// return OperatingSystem::INVALID_HANDLE;
// }
Expand Down
9 changes: 6 additions & 3 deletions base/ui/MessageDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
_COM_AZURE_DEV__BASE__ENTER_NAMESPACE

MessageDialog::MessageDialog() noexcept
: category(MessageDialog::INFORMATION), answer(MessageDialog::CANCEL) {
: category(MessageDialog::INFORMATION), answer(MessageDialog::CANCEL)
{
}

MessageDialog::MessageDialog(
const String& _title, const String& _message, Category _category) noexcept
: category(_category),
title(_title),
message(_message),
answer(MessageDialog::CANCEL) {
answer(MessageDialog::CANCEL)
{
}

bool MessageDialog::execute()
Expand Down Expand Up @@ -84,7 +86,8 @@ bool MessageDialog::execute()
#endif // flavor
}

MessageDialog::~MessageDialog() noexcept {
MessageDialog::~MessageDialog() noexcept
{
}

_COM_AZURE_DEV__BASE__LEAVE_NAMESPACE
9 changes: 6 additions & 3 deletions base/ui/Picture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
_COM_AZURE_DEV__BASE__ENTER_NAMESPACE

Picture::Picture(Window& owner)
: Widget(owner) {
: Widget(owner)
{
}

void Picture::setBitmap(const Bitmap& bitmap) {
void Picture::setBitmap(const Bitmap& bitmap)
{
this->bitmap = bitmap;
invalidate();
}

void Picture::onDisplay() noexcept {
void Picture::onDisplay() noexcept
{
// TAG: handle dimension != picture dimension
// TAG: binding point?

Expand Down
6 changes: 4 additions & 2 deletions testsuite/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class AsyncTransfer : public AsynchronousReadEventListener,
public:

void asynchronousCompletion(
const AsynchronousReadCompletion& completion) noexcept {
const AsynchronousReadCompletion& completion) noexcept
{
bytesRead = completion.getBytesRead();
if (completion.successful()) {
fout << "Read completed:" << EOL
Expand All @@ -52,7 +53,8 @@ class AsyncTransfer : public AsynchronousReadEventListener,
}

void asynchronousCompletion(
const AsynchronousWriteCompletion& completion) noexcept {
const AsynchronousWriteCompletion& completion) noexcept
{
if (completion.successful()) {
fout << "Write completed:" << EOL
<< " bytesWritten=" << completion.getBytesWritten() << EOL
Expand Down
Loading

0 comments on commit 2260cc9

Please sign in to comment.