Commit 31e73412 authored by Dominik Charousset's avatar Dominik Charousset

Re-use the upstream enum string generator script

parent c18a1e1a
......@@ -12,7 +12,7 @@ caf_incubator_add_component(
$<$<CXX_COMPILER_ID:MSVC>:ws2_32>
PRIVATE
CAF::internal
ENUM_CONSISTENCY_CHECKS
ENUM_TYPES
net.basp.connection_state
net.basp.ec
net.basp.message_type
......@@ -30,10 +30,6 @@ caf_incubator_add_component(
src/multiplexer.cpp
src/net/abstract_actor_shell.cpp
src/net/actor_shell.cpp
src/net/basp/connection_state_strings.cpp
src/net/basp/ec_strings.cpp
src/net/basp/message_type_strings.cpp
src/net/basp/operation_strings.cpp
src/net/middleman.cpp
src/net/middleman_backend.cpp
src/net/packet_writer.cpp
......
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/net/basp/connection_state.hpp"
#include <string>
namespace caf {
namespace net {
namespace basp {
std::string to_string(connection_state x) {
switch(x) {
default:
return "???";
case connection_state::await_handshake_header:
return "await_handshake_header";
case connection_state::await_handshake_payload:
return "await_handshake_payload";
case connection_state::await_header:
return "await_header";
case connection_state::await_payload:
return "await_payload";
case connection_state::shutdown:
return "shutdown";
};
}
bool from_string(string_view in, connection_state& out) {
if (in == "await_handshake_header") {
out = connection_state::await_handshake_header;
return true;
} else if (in == "await_handshake_payload") {
out = connection_state::await_handshake_payload;
return true;
} else if (in == "await_header") {
out = connection_state::await_header;
return true;
} else if (in == "await_payload") {
out = connection_state::await_payload;
return true;
} else if (in == "shutdown") {
out = connection_state::shutdown;
return true;
} else {
return false;
}
}
bool from_integer(std::underlying_type_t<connection_state> in,
connection_state& out) {
auto result = static_cast<connection_state>(in);
switch(result) {
default:
return false;
case connection_state::await_handshake_header:
case connection_state::await_handshake_payload:
case connection_state::await_header:
case connection_state::await_payload:
case connection_state::shutdown:
out = result;
return true;
};
}
} // namespace basp
} // namespace net
} // namespace caf
CAF_POP_WARNINGS
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/net/basp/ec.hpp"
#include <string>
namespace caf {
namespace net {
namespace basp {
std::string to_string(ec x) {
switch(x) {
default:
return "???";
case ec::invalid_magic_number:
return "invalid_magic_number";
case ec::unexpected_number_of_bytes:
return "unexpected_number_of_bytes";
case ec::unexpected_payload:
return "unexpected_payload";
case ec::missing_payload:
return "missing_payload";
case ec::illegal_state:
return "illegal_state";
case ec::invalid_handshake:
return "invalid_handshake";
case ec::missing_handshake:
return "missing_handshake";
case ec::unexpected_handshake:
return "unexpected_handshake";
case ec::version_mismatch:
return "version_mismatch";
case ec::unimplemented:
return "unimplemented";
case ec::app_identifiers_mismatch:
return "app_identifiers_mismatch";
case ec::invalid_payload:
return "invalid_payload";
case ec::invalid_scheme:
return "invalid_scheme";
case ec::invalid_locator:
return "invalid_locator";
};
}
bool from_string(string_view in, ec& out) {
if (in == "invalid_magic_number") {
out = ec::invalid_magic_number;
return true;
} else if (in == "unexpected_number_of_bytes") {
out = ec::unexpected_number_of_bytes;
return true;
} else if (in == "unexpected_payload") {
out = ec::unexpected_payload;
return true;
} else if (in == "missing_payload") {
out = ec::missing_payload;
return true;
} else if (in == "illegal_state") {
out = ec::illegal_state;
return true;
} else if (in == "invalid_handshake") {
out = ec::invalid_handshake;
return true;
} else if (in == "missing_handshake") {
out = ec::missing_handshake;
return true;
} else if (in == "unexpected_handshake") {
out = ec::unexpected_handshake;
return true;
} else if (in == "version_mismatch") {
out = ec::version_mismatch;
return true;
} else if (in == "unimplemented") {
out = ec::unimplemented;
return true;
} else if (in == "app_identifiers_mismatch") {
out = ec::app_identifiers_mismatch;
return true;
} else if (in == "invalid_payload") {
out = ec::invalid_payload;
return true;
} else if (in == "invalid_scheme") {
out = ec::invalid_scheme;
return true;
} else if (in == "invalid_locator") {
out = ec::invalid_locator;
return true;
} else {
return false;
}
}
bool from_integer(std::underlying_type_t<ec> in,
ec& out) {
auto result = static_cast<ec>(in);
switch(result) {
default:
return false;
case ec::invalid_magic_number:
case ec::unexpected_number_of_bytes:
case ec::unexpected_payload:
case ec::missing_payload:
case ec::illegal_state:
case ec::invalid_handshake:
case ec::missing_handshake:
case ec::unexpected_handshake:
case ec::version_mismatch:
case ec::unimplemented:
case ec::app_identifiers_mismatch:
case ec::invalid_payload:
case ec::invalid_scheme:
case ec::invalid_locator:
out = result;
return true;
};
}
} // namespace basp
} // namespace net
} // namespace caf
CAF_POP_WARNINGS
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/net/basp/message_type.hpp"
#include <string>
namespace caf {
namespace net {
namespace basp {
std::string to_string(message_type x) {
switch(x) {
default:
return "???";
case message_type::handshake:
return "handshake";
case message_type::actor_message:
return "actor_message";
case message_type::resolve_request:
return "resolve_request";
case message_type::resolve_response:
return "resolve_response";
case message_type::monitor_message:
return "monitor_message";
case message_type::down_message:
return "down_message";
case message_type::heartbeat:
return "heartbeat";
};
}
bool from_string(string_view in, message_type& out) {
if (in == "handshake") {
out = message_type::handshake;
return true;
} else if (in == "actor_message") {
out = message_type::actor_message;
return true;
} else if (in == "resolve_request") {
out = message_type::resolve_request;
return true;
} else if (in == "resolve_response") {
out = message_type::resolve_response;
return true;
} else if (in == "monitor_message") {
out = message_type::monitor_message;
return true;
} else if (in == "down_message") {
out = message_type::down_message;
return true;
} else if (in == "heartbeat") {
out = message_type::heartbeat;
return true;
} else {
return false;
}
}
bool from_integer(std::underlying_type_t<message_type> in,
message_type& out) {
auto result = static_cast<message_type>(in);
switch(result) {
default:
return false;
case message_type::handshake:
case message_type::actor_message:
case message_type::resolve_request:
case message_type::resolve_response:
case message_type::monitor_message:
case message_type::down_message:
case message_type::heartbeat:
out = result;
return true;
};
}
} // namespace basp
} // namespace net
} // namespace caf
CAF_POP_WARNINGS
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/net/operation.hpp"
#include <string>
namespace caf {
namespace net {
std::string to_string(operation x) {
switch(x) {
default:
return "???";
case operation::none:
return "none";
case operation::read:
return "read";
case operation::write:
return "write";
case operation::read_write:
return "read_write";
case operation::shutdown:
return "shutdown";
};
}
} // namespace net
} // namespace caf
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/net/operation.hpp"
#include <string>
namespace caf {
namespace net {
std::string to_string(operation x) {
switch(x) {
default:
return "???";
case operation::none:
return "none";
case operation::read:
return "read";
case operation::write:
return "write";
case operation::read_write:
return "read_write";
case operation::shutdown:
return "shutdown";
};
}
bool from_string(string_view in, operation& out) {
if (in == "none") {
out = operation::none;
return true;
} else if (in == "read") {
out = operation::read;
return true;
} else if (in == "write") {
out = operation::write;
return true;
} else if (in == "read_write") {
out = operation::read_write;
return true;
} else if (in == "shutdown") {
out = operation::shutdown;
return true;
} else {
return false;
}
}
bool from_integer(std::underlying_type_t<operation> in,
operation& out) {
auto result = static_cast<operation>(in);
switch(result) {
default:
return false;
case operation::none:
case operation::read:
case operation::write:
case operation::read_write:
case operation::shutdown:
out = result;
return true;
};
}
} // namespace net
} // namespace caf
CAF_POP_WARNINGS
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