Feature/shared exports msvc (#525)

This commit is contained in:
Philemon Benner
2025-10-19 16:32:15 +02:00
committed by GitHub
parent 06988aa0e1
commit 83951fd90b
42 changed files with 212 additions and 90 deletions
+2 -1
View File
@@ -11,10 +11,11 @@
#include "Object.hpp"
#include "Result.hpp"
#include "Variant.hpp"
#include "common.hpp"
namespace rfl {
class Generic {
class RFL_API Generic {
public:
constexpr static std::nullopt_t Null = std::nullopt;
+2 -1
View File
@@ -7,10 +7,11 @@
//#include "../Box.hpp"
//#include "../Result.hpp"
#include "../common.hpp"
namespace rfl::avro {
class SchemaImpl {
class RFL_API SchemaImpl {
public:
SchemaImpl(const std::string& _json_str);
+2 -1
View File
@@ -15,10 +15,11 @@
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../internal/is_literal.hpp"
#include "../common.hpp"
namespace rfl::avro {
class Writer {
class RFL_API Writer {
public:
struct AVROOutputArray {
avro_value_t val_;
+2 -1
View File
@@ -10,10 +10,11 @@
#include "../../Ref.hpp"
#include "../../Rename.hpp"
#include "../../Variant.hpp"
#include "../../common.hpp"
namespace rfl::avro::schema {
struct Type {
struct RFL_API Type {
struct Null {
Literal<"null"> type{};
};
+2 -1
View File
@@ -14,10 +14,11 @@
#include "Schema.hpp"
#include "Writer.hpp"
//#include "schema/Type.hpp"
#include "../common.hpp"
namespace rfl::avro {
std::string to_json_representation(
RFL_API std::string to_json_representation(
const parsing::schema::Definition& internal_schema);
/// Returns the Avro schema for a class.
+2 -1
View File
@@ -17,12 +17,13 @@
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../internal/ptr_cast.hpp"
#include "../common.hpp"
namespace rfl {
namespace bson {
/// Please refer to https://mongoc.org/libbson/current/api.html
class Writer {
class RFL_API Writer {
struct BSONType {
bson_t val_;
};
+2 -1
View File
@@ -13,10 +13,11 @@
#include "../always_false.hpp"
#include "../internal/is_literal.hpp"
#include "../internal/ptr_cast.hpp"
#include "../common.hpp"
namespace rfl::capnproto {
class Reader {
class RFL_API Reader {
public:
struct CapNProtoInputArray {
capnp::DynamicList::Reader val_;
+2 -1
View File
@@ -7,10 +7,11 @@
//#include "../Box.hpp"
//#include "../Result.hpp"
#include "../common.hpp"
namespace rfl::capnproto {
class SchemaImpl {
class RFL_API SchemaImpl {
public:
SchemaImpl(const std::string& _str);
+2 -1
View File
@@ -18,10 +18,11 @@
#include "../always_false.hpp"
#include "../internal/is_literal.hpp"
//#include "../internal/ptr_cast.hpp"
#include "../common.hpp"
namespace rfl::capnproto {
class Writer {
class RFL_API Writer {
public:
struct CapnProtoOutputArray {
capnp::DynamicList::Builder val_;
+2 -1
View File
@@ -9,10 +9,11 @@
#include "../../Ref.hpp"
//#include "../../Rename.hpp"
#include "../../Variant.hpp"
#include "../../common.hpp"
namespace rfl::capnproto::schema {
struct Type {
struct RFL_API Type {
struct Void {};
struct Bool {};
+2 -1
View File
@@ -16,10 +16,11 @@
#include "Writer.hpp"
#include "Reader.hpp"
//#include "schema/Type.hpp"
#include "../common.hpp"
namespace rfl::capnproto {
std::string to_string_representation(
RFL_API std::string to_string_representation(
const parsing::schema::Definition& internal_schema);
/// This ensures that the schema is only generated once.
+2 -1
View File
@@ -12,10 +12,11 @@
//#include "../Result.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl::cbor {
class Writer {
class RFL_API Writer {
using Encoder = jsoncons::cbor::cbor_bytes_encoder;
public:
+19
View File
@@ -0,0 +1,19 @@
#ifndef RFL_COMMON_HPP_
#define RFL_COMMON_HPP_
#ifdef RFL_BUILD_SHARED
#ifdef _WIN32
#ifdef reflectcpp_EXPORTS
#define RFL_API __declspec(dllexport)
#else
#define RFL_API __declspec(dllimport)
#endif
#else
#define RFL_API __attribute__((visibility("default")))
#endif
#else
#define RFL_API
#endif
#endif
+2 -1
View File
@@ -13,11 +13,12 @@
//#include "../Result.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl {
namespace flexbuf {
struct Writer {
struct RFL_API Writer {
struct OutputArray {
size_t start_;
};
+2 -1
View File
@@ -9,10 +9,11 @@
#include "../Generic.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl::generic {
struct Writer {
struct RFL_API Writer {
struct OutputArray {
Generic::Array* val_;
};
+7 -5
View File
@@ -4,25 +4,27 @@
#include <string>
#include <vector>
#include "../../common.hpp"
namespace rfl::internal::strings {
/// Joins a series of strings.
std::string join(const std::string& _delimiter,
RFL_API std::string join(const std::string& _delimiter,
const std::vector<std::string>& _strings);
/// Replace all occurences of _from with _to.
std::string replace_all(const std::string& _str, const std::string& _from,
RFL_API std::string replace_all(const std::string& _str, const std::string& _from,
const std::string& _to);
/// Splits _str along _delimiter.
std::vector<std::string> split(const std::string& _str,
RFL_API std::vector<std::string> split(const std::string& _str,
const std::string& _delimiter);
/// Transforms the string to camel case.
std::string to_camel_case(const std::string& _str);
RFL_API std::string to_camel_case(const std::string& _str);
/// Transforms the string to pascal case.
std::string to_pascal_case(const std::string& _str);
RFL_API std::string to_pascal_case(const std::string& _str);
} // namespace rfl::internal::strings
+2 -1
View File
@@ -13,11 +13,12 @@
//#include "../Result.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl {
namespace json {
class Writer {
class RFL_API Writer {
public:
struct YYJSONOutputArray {
YYJSONOutputArray(yyjson_mut_val* _val) : val_(_val) {}
+2 -1
View File
@@ -20,6 +20,7 @@
#include "schema/JSONSchema.hpp"
// #include "schema/Type.hpp"
// #include "write.hpp"
#include "../common.hpp"
namespace rfl::json {
@@ -31,7 +32,7 @@ struct TypeHelper<rfl::Variant<Ts...>> {
using JSONSchemaType = rfl::Variant<schema::JSONSchema<Ts>...>;
};
std::string to_schema_internal_schema(
RFL_API std::string to_schema_internal_schema(
const parsing::schema::Definition& internal_schema, const yyjson_write_flag,
const bool _no_required, const std::string& comment = "");
+2 -1
View File
@@ -13,10 +13,11 @@
//#include "../Result.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl::msgpack {
class Writer {
class RFL_API Writer {
public:
struct MsgpackOutputArray {};
+2 -1
View File
@@ -10,10 +10,11 @@
#include "../../Ref.hpp"
#include "../../Variant.hpp"
#include "ValidationType.hpp"
#include "../../common.hpp"
namespace rfl::parsing::schema {
struct Type {
struct RFL_API Type {
struct Boolean {};
struct Bytestring {};
@@ -2,12 +2,13 @@
#define RFL_PARSING_SCHEMAFUL_TUPLETOOBJECT_HPP_
#include "../schema/Type.hpp"
#include "../../common.hpp"
namespace rfl::parsing::schemaful {
/// Schemaful formats often don't have an explicit tuple representation.
/// This is the required workaround.
schema::Type::Object tuple_to_object(const schema::Type::Tuple& _tup);
RFL_API schema::Type::Object tuple_to_object(const schema::Type::Tuple& _tup);
} // namespace rfl::parsing::schemaful
+2 -1
View File
@@ -11,10 +11,11 @@
#include "../Ref.hpp"
#include "../Result.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl::toml {
class Writer {
class RFL_API Writer {
public:
struct TOMLArray {
::toml::array* val_;
+2 -1
View File
@@ -16,10 +16,11 @@
#include "../Result.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl::ubjson {
class Writer {
class RFL_API Writer {
using Encoder = jsoncons::ubjson::ubjson_bytes_encoder;
public:
+2 -1
View File
@@ -8,11 +8,12 @@
#include "../Ref.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl {
namespace xml {
struct Writer {
struct RFL_API Writer {
struct XMLOutputArray {
XMLOutputArray(const std::string_view& _name,
const Ref<pugi::xml_node>& _node)
+2 -1
View File
@@ -9,11 +9,12 @@
#include "../Ref.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
namespace rfl {
namespace yaml {
class Writer {
class RFL_API Writer {
public:
struct YAMLArray {};