Skip to content
Snippets Groups Projects
Verified Commit 53f53831 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

MAINT: clean up imports

parent b0047f3e
Branches
Tags
2 merge requests!42Release 0.2.0,!40F dot in username
Pipeline #24963 failed
...@@ -44,17 +44,17 @@ class RoleImpl; ...@@ -44,17 +44,17 @@ class RoleImpl;
class Role { class Role {
public: public:
explicit Role(std::string name); explicit Role(const std::string &name);
explicit Role(std::unique_ptr<RoleImpl> wrapped); explicit Role(std::unique_ptr<RoleImpl> wrapped);
Role(std::string name, std::string description); Role(const std::string &name, const std::string &description);
Role(const Role &role); Role(const Role &role);
auto operator=(const Role &role) -> Role &; auto operator=(const Role &role) -> Role &;
~Role(); ~Role();
auto ToString() const -> std::string; auto ToString() const -> std::string;
[[nodiscard]] auto GetName() const -> const std::string &; [[nodiscard]] auto GetName() const -> const std::string &;
auto SetName(std::string name) -> void; auto SetName(const std::string &name) -> void;
[[nodiscard]] auto GetDescription() const -> const std::string &; [[nodiscard]] auto GetDescription() const -> const std::string &;
auto SetDescription(std::string description) -> void; auto SetDescription(const std::string &description) -> void;
[[nodiscard]] auto GetPermissionRules() const -> const PermissionRules &; [[nodiscard]] auto GetPermissionRules() const -> const PermissionRules &;
// auto SetPermissionRules(PermissionRules rules) -> void; // auto SetPermissionRules(PermissionRules rules) -> void;
auto ClearPermissionRules() -> void; auto ClearPermissionRules() -> void;
......
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
#include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS... #include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse #include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse
#include "caosdb/handler_interface.h" // for HandlerTag, Handl... #include "caosdb/handler_interface.h" // for HandlerTag, Handl...
#include "caosdb/unary_rpc_handler.h" #include "caosdb/unary_rpc_handler.h" // for UnaryRpcHandler
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRespons... #include <grpcpp/completion_queue.h> // for CompletionQueue
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue #include <grpcpp/support/async_unary_call.h> // for ClientAsyncResponseReader
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
namespace caosdb::transaction { namespace caosdb::transaction {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse #include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse
#include "caosdb/handler_interface.h" // for HandlerTag #include "caosdb/handler_interface.h" // for HandlerTag
#include "caosdb/unary_rpc_handler.h" // for HandlerTag, Handl... #include "caosdb/unary_rpc_handler.h" // for HandlerTag, Handl...
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRespons... #include <grpcpp/completion_queue.h> // for CompletionQueue
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue #include <grpcpp/support/async_unary_call.h> // for ClientAsyncResponseReader
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
namespace caosdb::transaction { namespace caosdb::transaction {
......
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
#include "caosdb/handler_interface.h" // for HandlerTag, Handl... #include "caosdb/handler_interface.h" // for HandlerTag, Handl...
#include "caosdb/transaction_status.h" // for TransactionStatus #include "caosdb/transaction_status.h" // for TransactionStatus
#include <grpcpp/impl/codegen/client_context.h> // for ClientContext #include <grpcpp/client_context.h> // for ClientContext
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue #include <grpcpp/completion_queue.h> // for CompletionQueue
#include <grpcpp/impl/codegen/status.h> // for Status #include <grpcpp/support/status.h> // for Status
namespace caosdb::transaction { namespace caosdb::transaction {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "caosdb/acm/role_impl.h" // for RoleImpl #include "caosdb/acm/role_impl.h" // for RoleImpl
#include "caosdb/acm/v1alpha1/main.pb.h" // for ListRolesRequest #include "caosdb/acm/v1alpha1/main.pb.h" // for ListRolesRequest
#include "caosdb/protobuf_helper.h" // for ProtoMessageWrapper #include "caosdb/protobuf_helper.h" // for ProtoMessageWrapper
#include <type_traits> // for remove_reference<>::type
#include <unordered_set> // for _Node_iterator, operator!= #include <unordered_set> // for _Node_iterator, operator!=
#include <utility> // for move #include <utility> // for move
// IWYU pragma: no_include "net/proto2/public/repeated_field.h" // IWYU pragma: no_include "net/proto2/public/repeated_field.h"
...@@ -35,7 +34,7 @@ using ProtoRolePermissions = caosdb::acm::v1alpha1::RolePermissions; ...@@ -35,7 +34,7 @@ using ProtoRolePermissions = caosdb::acm::v1alpha1::RolePermissions;
using ProtoRoleCapabilities = caosdb::acm::v1alpha1::RoleCapabilities; using ProtoRoleCapabilities = caosdb::acm::v1alpha1::RoleCapabilities;
using ProtoListRoleItem = caosdb::acm::v1alpha1::ListRoleItem; using ProtoListRoleItem = caosdb::acm::v1alpha1::ListRoleItem;
RoleImpl::RoleImpl(std::string name, std::string description) { RoleImpl::RoleImpl(const std::string &name, const std::string &description) {
if (!name.empty()) { if (!name.empty()) {
this->wrapped->set_name(name); this->wrapped->set_name(name);
} }
...@@ -49,7 +48,7 @@ RoleImpl::RoleImpl(ProtoRole *role) : ScalarProtoMessageWrapper<ProtoRole>(role) ...@@ -49,7 +48,7 @@ RoleImpl::RoleImpl(ProtoRole *role) : ScalarProtoMessageWrapper<ProtoRole>(role)
RoleImpl::RoleImpl(ProtoListRoleItem &role_item) RoleImpl::RoleImpl(ProtoListRoleItem &role_item)
: ScalarProtoMessageWrapper<ProtoRole>(role_item.release_role()) {} : ScalarProtoMessageWrapper<ProtoRole>(role_item.release_role()) {}
RoleImpl::RoleImpl(std::string name) : RoleImpl(std::move(name), "") {} RoleImpl::RoleImpl(const std::string &name) : RoleImpl(name, "") {}
[[nodiscard]] auto RoleImpl::GeneratePermissionRulesSet() -> std::unique_ptr<PermissionRules> { [[nodiscard]] auto RoleImpl::GeneratePermissionRulesSet() -> std::unique_ptr<PermissionRules> {
auto result = std::make_unique<PermissionRules>(); auto result = std::make_unique<PermissionRules>();
...@@ -61,10 +60,10 @@ RoleImpl::RoleImpl(std::string name) : RoleImpl(std::move(name), "") {} ...@@ -61,10 +60,10 @@ RoleImpl::RoleImpl(std::string name) : RoleImpl(std::move(name), "") {}
Role::Role(std::unique_ptr<RoleImpl> wrapped) : wrapped(std::move(wrapped)) {} Role::Role(std::unique_ptr<RoleImpl> wrapped) : wrapped(std::move(wrapped)) {}
Role::Role(std::string name, std::string description) Role::Role(const std::string &name, const std::string &description)
: wrapped(std::make_unique<RoleImpl>(std::move(name), std::move(description))) {} : wrapped(std::make_unique<RoleImpl>(name, description)) {}
Role::Role(std::string name) : Role(std::move(name), {""}) {} Role::Role(const std::string &name) : Role(name, {""}) {}
Role::Role(const Role &role) : Role(role.GetName(), role.GetDescription()) {} Role::Role(const Role &role) : Role(role.GetName(), role.GetDescription()) {}
...@@ -78,11 +77,12 @@ auto Role::operator=(const Role &role) -> Role & { ...@@ -78,11 +77,12 @@ auto Role::operator=(const Role &role) -> Role & {
} }
Role::~Role() = default; Role::~Role() = default;
auto Role::GetName() const -> const std::string & { return this->wrapped->wrapped->name(); } auto Role::GetName() const -> const std::string & { return this->wrapped->wrapped->name(); }
auto Role::SetName(std::string name) -> void { auto Role::SetName(const std::string &name) -> void {
if (!name.empty()) { if (!name.empty()) {
this->wrapped->wrapped->set_name(std::move(name)); this->wrapped->wrapped->set_name(name);
} else { } else {
this->wrapped->wrapped->clear_name(); this->wrapped->wrapped->clear_name();
} }
...@@ -92,9 +92,9 @@ auto Role::GetDescription() const -> const std::string & { ...@@ -92,9 +92,9 @@ auto Role::GetDescription() const -> const std::string & {
return this->wrapped->wrapped->description(); return this->wrapped->wrapped->description();
} }
auto Role::SetDescription(std::string description) -> void { auto Role::SetDescription(const std::string &description) -> void {
if (!description.empty()) { if (!description.empty()) {
this->wrapped->wrapped->set_description(std::move(description)); this->wrapped->wrapped->set_description(description);
} else { } else {
this->wrapped->wrapped->clear_description(); this->wrapped->wrapped->clear_description();
} }
......
...@@ -40,11 +40,11 @@ public: ...@@ -40,11 +40,11 @@ public:
/** /**
* Constructor. Instanciate a role with the given name. * Constructor. Instanciate a role with the given name.
*/ */
explicit RoleImpl(std::string name); explicit RoleImpl(const std::string &name);
/** /**
* Constructor. Instanciate a role with the given name and description. * Constructor. Instanciate a role with the given name and description.
*/ */
RoleImpl(std::string name, std::string description); RoleImpl(const std::string &name, const std::string &description);
/** /**
* Constructor. Instanciate a role from the server's responces. * Constructor. Instanciate a role from the server's responces.
*/ */
......
...@@ -48,8 +48,6 @@ ...@@ -48,8 +48,6 @@
*/ */
#include "caosdb/file_transmission/register_file_upload_handler.h" #include "caosdb/file_transmission/register_file_upload_handler.h"
#include "caosdb/logging.h" // for CAOSDB_LOG_TRACE #include "caosdb/logging.h" // for CAOSDB_LOG_TRACE
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRes...
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
namespace caosdb::transaction { namespace caosdb::transaction {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
#include "caosdb/logging.h" // for CAOSDB_LOG_TRACE #include "caosdb/logging.h" // for CAOSDB_LOG_TRACE
#include <exception> // IWYU pragma: keep #include <exception> // IWYU pragma: keep
// IWYU pragma: no_include <bits/exception.h> // IWYU pragma: no_include <bits/exception.h>
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRes...
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
namespace caosdb::transaction { namespace caosdb::transaction {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment