Unverified Commit b88af74d authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #348 from knowledge4igor/code_style_improvements_1

Tiny codestyle improvements
parents 4b351fc9 fcbf4473
...@@ -238,9 +238,9 @@ namespace Async { ...@@ -238,9 +238,9 @@ namespace Async {
return *reinterpret_cast<T*>(&storage); return *reinterpret_cast<T*>(&storage);
} }
bool isVoid() const { return false; } bool isVoid() const override { return false; }
void *memory() { void *memory() override {
return &storage; return &storage;
} }
}; };
...@@ -251,9 +251,9 @@ namespace Async { ...@@ -251,9 +251,9 @@ namespace Async {
: Core(State::Pending, TypeId::of<void>()) : Core(State::Pending, TypeId::of<void>())
{ } { }
bool isVoid() const { return true; } bool isVoid() const override { return true; }
void *memory() { void *memory() override {
return nullptr; return nullptr;
} }
}; };
...@@ -266,7 +266,7 @@ namespace Async { ...@@ -266,7 +266,7 @@ namespace Async {
, chain_(chain) , chain_(chain)
{ } { }
void resolve(const std::shared_ptr<Core>& core) { void resolve(const std::shared_ptr<Core>& core) override {
if (resolveCount_ >= 1) if (resolveCount_ >= 1)
throw Error("Resolve must not be called more than once"); throw Error("Resolve must not be called more than once");
...@@ -274,7 +274,7 @@ namespace Async { ...@@ -274,7 +274,7 @@ namespace Async {
++resolveCount_; ++resolveCount_;
} }
void reject(const std::shared_ptr<Core>& core) { void reject(const std::shared_ptr<Core>& core) override {
if (rejectCount_ >= 1) if (rejectCount_ >= 1)
throw Error("Reject must not be called more than once"); throw Error("Reject must not be called more than once");
...@@ -1009,9 +1009,9 @@ namespace Async { ...@@ -1009,9 +1009,9 @@ namespace Async {
return Promise<T>(std::move(core)); return Promise<T>(std::move(core));
} }
bool isPending() const { return core_->state == State::Pending; } bool isPending() const override { return core_->state == State::Pending; }
bool isFulfilled() const { return core_->state == State::Fulfilled; } bool isFulfilled() const override { return core_->state == State::Fulfilled; }
bool isRejected() const { return core_->state == State::Rejected; } bool isRejected() const override { return core_->state == State::Rejected; }
template<typename ResolveFunc, typename RejectFunc> template<typename ResolveFunc, typename RejectFunc>
auto auto
......
...@@ -73,7 +73,7 @@ struct Connection : public std::enable_shared_from_this<Connection> { ...@@ -73,7 +73,7 @@ struct Connection : public std::enable_shared_from_this<Connection> {
Connected Connected
}; };
void connect(Address addr); void connect(const Address& addr);
void close(); void close();
bool isIdle() const; bool isIdle() const;
bool isConnected() const; bool isConnected() const;
......
...@@ -218,7 +218,7 @@ struct PathDecl { ...@@ -218,7 +218,7 @@ struct PathDecl {
}; };
struct Path { struct Path {
Path(std::string path, Http::Method method, std::string description); Path(std::string value, Http::Method method, std::string description);
std::string value; std::string value;
Http::Method method; Http::Method method;
...@@ -364,7 +364,7 @@ private: ...@@ -364,7 +364,7 @@ private:
struct SubPath { struct SubPath {
SubPath(std::string prefix, PathGroup* paths); SubPath(std::string prefix, PathGroup* paths);
PathBuilder route(std::string path, Http::Method method, std::string description = ""); PathBuilder route(std::string name, Http::Method method, std::string description = "");
PathBuilder route(PathDecl fragment, std::string description = ""); PathBuilder route(PathDecl fragment, std::string description = "");
SubPath path(std::string prefix); SubPath path(std::string prefix);
......
...@@ -358,7 +358,7 @@ Transport::handleTimeout(const std::shared_ptr<Connection>& connection) { ...@@ -358,7 +358,7 @@ Transport::handleTimeout(const std::shared_ptr<Connection>& connection) {
} }
void void
Connection::connect(Address addr) Connection::connect(const Address& addr)
{ {
struct addrinfo hints; struct addrinfo hints;
struct addrinfo *addrs; struct addrinfo *addrs;
......
...@@ -56,8 +56,7 @@ PathDecl::PathDecl( ...@@ -56,8 +56,7 @@ PathDecl::PathDecl(
, method(method) , method(method)
{ } { }
Path::Path( Path::Path(std::string value, Http::Method method, std::string description)
std::string value, Http::Method method, std::string description)
: value(std::move(value)) : value(std::move(value))
, method(method) , method(method)
, description(std::move(description)) , description(std::move(description))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment