Skip to content

Commit

Permalink
🔖 λcommon v1.9.4: Added RISC-V archs, dropped useless const qualifier…
Browse files Browse the repository at this point in the history
…, and more...
  • Loading branch information
LambdAurora committed Dec 13, 2018
1 parent 3162ddf commit 2faf94d
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 50 deletions.
46 changes: 42 additions & 4 deletions include/lambdacommon/connection/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#include "../types.h"
#include <array>

#ifdef LAMBDA_WINDOWS
# pragma warning(push)
# pragma warning(disable:4251)
#endif

namespace lambdacommon
{
typedef std::string host;
Expand All @@ -27,10 +32,13 @@ namespace lambdacommon
INVALID
};

class LAMBDACOMMON_API Address : public Object
/*!
* Represents a network address.
*/
class LAMBDACOMMON_API Address : public Object, public Nullable
{
protected:
host *_host;
host _host;
port_t _port;

public:
Expand All @@ -42,32 +50,62 @@ namespace lambdacommon

~Address();

/*!
* Gets the host of the address.
* @return The host of the address.
*/
const host &get_host() const;

/*!
* Gets the port of the address.
* @return The port of the address.
*/
port_t get_port() const;

/*!
* Checks whether the address is an IPv4 address.
* @return True if the address is an IPv4 address, else false.
*/
bool is_ipv4() const;

/*!
* Checks whether the address is an IPv6 address.
* @return True if the address is an IPv6 address, else false.
*/
bool is_ipv6() const;

bool is_domain_valid() const;

/*!
* Checks whether the address is empty.
* @return True if the address is empty, else false.
*/
bool is_empty() const;

/*!
* Gets the type of address.
* @return The type of address.
*/
AddressType get_type() const;

bool is_null() const override;

std::string to_string() const override;

Address &operator=(const Address &other);

Address &operator=(Address &&other) noexcept;

bool operator==(const Address &other);
bool operator==(const Address &other) const;

bool operator!=(const Address &other);
bool operator<(const Address &other) const;

static Address EMPTY;
};
}

#ifdef LAMBDA_WINDOWS
# pragma warning(pop)
#endif

#endif //LAMBDACOMMON_ADDRESS_H
19 changes: 19 additions & 0 deletions include/lambdacommon/graphics/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,29 @@ namespace lambdacommon
*/
extern Color LAMBDACOMMON_API mix(const Color &a, const Color &b, float ratio);

/*!
* Makes a new Color instance from the given hexadecimal color value.
* @param hex_color The hexadecimal color value.
* @param has_alpha True if the hexadecimal color value includes the alpha channel, else false.
* @return A new Color instance.
*/
extern Color LAMBDACOMMON_API from_hex(uint64_t hex_color, bool has_alpha = true);

/*!
* Makes a new Color instance from the given hexadecimal color value string.
* @param hex_color The hexadecimal color value as a string.
* @return A new Color instance.
*/
extern Color LAMBDACOMMON_API from_hex(const std::string &hex_color);

/*!
* Makes a new Color instance from a RGB value.
* @param red Red channel.
* @param green Green channel.
* @param blue Blue channel.
* @param alpha Alpha channel.
* @return A new Color instance.
*/
extern Color LAMBDACOMMON_API from_int_rgba(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255);
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/lambdacommon/lambdacommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#define LAMBDACOMMON_VERSION_MAJOR 1
#define LAMBDACOMMON_VERSION_MINOR 9
#define LAMBDACOMMON_VERSION_PATCH 3
#define LAMBDACOMMON_VERSION_PATCH 4
#define LAMBDACOMMON_VERSION_TYPE "Release"

// Deletes the pointer and sets the variable to null. It's just simpler to write like this.
Expand Down
2 changes: 1 addition & 1 deletion include/lambdacommon/lstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef LAMBDACOMMON_STRING_H
#define LAMBDACOMMON_STRING_H

#include <vector>
#include "object.h"
#include <vector>

namespace lambdacommon
{
Expand Down
3 changes: 3 additions & 0 deletions include/lambdacommon/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

namespace lambdacommon
{
/*!
* Represents an object.
*/
class LAMBDACOMMON_API Object
{
public:
Expand Down
6 changes: 3 additions & 3 deletions include/lambdacommon/resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace lambdacommon
*
* Represents a resource identifier.
*/
class LAMBDACOMMON_API ResourceName
class LAMBDACOMMON_API ResourceName : public Object
{
private:
std::string _domain;
Expand Down Expand Up @@ -66,7 +66,7 @@ namespace lambdacommon
* Gets the resource name as a string.
* @return The resource name as a string.
*/
std::string to_string() const;
std::string to_string() const override;

/*!
* Creates a new {@code ResourceName} from this resource name.
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace lambdacommon
lambdacommon::fs::FilePath _working_directory;

public:
FileResourcesManager(const lambdacommon::fs::FilePath &working_directory = fs::get_current_working_directory());
explicit FileResourcesManager(const lambdacommon::fs::FilePath &working_directory = fs::get_current_working_directory());

FileResourcesManager(const FileResourcesManager &other);

Expand Down
6 changes: 3 additions & 3 deletions include/lambdacommon/sizes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace lambdacommon
Size2D() : Size2D<T>(0, 0)
{}

Size2D(const T width, const T height) : _width(width), _height(height)
Size2D(T width, T height) : _width(width), _height(height)
{}

/*!
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace lambdacommon
return _width == 0 && _height == 0;
}

std::string to_string() const override
virtual std::string to_string() const override
{
return R"({"width":)" + std::to_string(_width) + R"(,"height":)" + std::to_string(_height) + "}";
}
Expand Down Expand Up @@ -272,7 +272,7 @@ namespace lambdacommon
Size3D() : Size3D<T>(0, 0)
{}

Size3D(const T width, const T height, const T depth = 0) : Size2D<T>(width, height), _depth(depth)
Size3D(T width, T height, T depth = 0) : Size2D<T>(width, height), _depth(depth)
{}

/*!
Expand Down
8 changes: 6 additions & 2 deletions include/lambdacommon/system/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@

namespace lambdacommon
{
/*!
* Represents the current status of a device.
*/
enum DeviceStatus
{
CONNECTED = 1,
DISCONNECTED = 0
CONNECTED = true,
DISCONNECTED = false,
WAITING = 2
};
}

Expand Down
2 changes: 2 additions & 0 deletions include/lambdacommon/system/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace lambdacommon
ARM64,
ARMv8_64,
I386,
RISCV32,
RISCV64,
X86_64,
UNKNOWN
};
Expand Down
Loading

0 comments on commit 2faf94d

Please sign in to comment.