Skip to content

Commit 7e0df49

Browse files
committed
Export ValueSet base classes for use in DLL
Mark friend operator in Enum class as inline to prevent duplication
1 parent a778308 commit 7e0df49

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

include/ValueSet.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ namespace ePhotosynthesis {
714714
Untemplated base class to allow storage of mixed value sets in
715715
containers.
716716
*/
717-
class ValueSet_t {
717+
class EPHOTO_API ValueSet_t {
718718
public:
719719

720720
virtual ~ValueSet_t() {}
@@ -889,7 +889,7 @@ namespace ePhotosynthesis {
889889
will be used by.
890890
*/
891891
template<class T, class U, MODULE ID, PARAM_TYPE PT>
892-
class ValueSetBase : public ValueSetEnum<ID, PT> {
892+
class EPHOTO_API ValueSetBase : public ValueSetEnum<ID, PT> {
893893
public:
894894
typedef T ThisClass; /** Inheriting class */
895895
typedef U ThisParent; /** Parent class */

include/enums/enums.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// modified directly
33
#pragma once
44

5+
#include "ePhotosynthesis_export.h"
56
#include <string>
67
#include <map>
78
#include <vector>
@@ -243,7 +244,7 @@ namespace ePhotosynthesis {
243244
};
244245
#endif // EPHOTO_USE_SCOPED_ENUM
245246
template<MODULE M, PARAM_TYPE PT>
246-
class ValueSetEnum {
247+
class EPHOTO_API ValueSetEnum {
247248
public:
248249
#ifdef EPHOTO_USE_SCOPED_ENUM
249250
typedef typename enum_helper<M, PT>::type Type;
@@ -282,7 +283,7 @@ namespace ePhotosynthesis {
282283
\param[in] x Key to serialize
283284
\return Updated stream
284285
*/
285-
friend std::ostream& operator<<(std::ostream& out, const Type& x) {
286+
friend inline std::ostream& operator<<(std::ostream& out, const Type& x) {
286287
out << getName(x);
287288
return out;
288289
}
@@ -292,7 +293,7 @@ namespace ePhotosynthesis {
292293
\param[in] x Collection to serialize
293294
\return Updated stream
294295
*/
295-
friend std::ostream& operator<<(std::ostream& out, const std::map<Type, std::string>& x) {
296+
friend inline std::ostream& operator<<(std::ostream& out, const std::map<Type, std::string>& x) {
296297
print_map(x, out);
297298
return out;
298299
}
@@ -607,7 +608,7 @@ namespace ePhotosynthesis {
607608
\param[in] x Collection to serialize
608609
\return Updated stream
609610
*/
610-
friend std::ostream& operator<<(std::ostream& out, const std::vector<Type>& x) {
611+
friend inline std::ostream& operator<<(std::ostream& out, const std::vector<Type>& x) {
611612
print_vector(x, out);
612613
return out;
613614
}

utils/generate_enum.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ def generate_additional_method(self, function_type, enum_name='Type',
14771477
lines += ['*/']
14781478
static = 'static'
14791479
if function_type in ['operator<<']:
1480-
static = 'friend'
1480+
static = 'friend inline'
14811481
lines += [f"{static} {return_type} {function_name}"
14821482
f"({', '.join(args)}) {{"]
14831483
lines += [" " + x for x in body]
@@ -1779,6 +1779,7 @@ class CEnumGeneratorGlobalHeader(CEnumGeneratorBase):
17791779
name = 'global'
17801780
file_suffix = ''
17811781
prefix = CEnumGeneratorBase.prefix + [
1782+
'#include "ePhotosynthesis_export.h"',
17821783
'#include <string>',
17831784
'#include <map>',
17841785
'#include <vector>',
@@ -2424,7 +2425,7 @@ def generate_declaration(self, name, members, enum_name=None,
24242425
lines += ['#endif // EPHOTO_USE_SCOPED_ENUM']
24252426
lines += template_lines
24262427
lines += [
2427-
f'class {class_name}{specialization} {{',
2428+
f'class EPHOTO_API {class_name}{specialization} {{',
24282429
'public:',
24292430
]
24302431
lines += [

0 commit comments

Comments
 (0)