File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class GeneratorCpp : public Generator
4949 void GenerateWarningsFooter ();
5050 void GenerateFooter ();
5151 void GenerateImports ();
52+ void GenerateImportsSource ();
5253 void GenerateImports (const std::string& source);
5354 void GenerateImports (const std::shared_ptr<Package>& p);
5455 void GenerateImportsModels (const std::shared_ptr<Package>& p, bool final );
Original file line number Diff line number Diff line change 77
88#include " fbe.h"
99
10+ #if defined(_WIN32) || defined(_WIN64)
11+ #include < windows.h>
12+ #undef DELETE
13+ #undef ERROR
14+ #undef HOST_NOT_FOUND
15+ #undef Yield
16+ #undef min
17+ #undef max
18+ #undef uuid_t
19+ #endif
20+
1021namespace FBE {
1122
1223std::string buffer_t::base64encode () const
Original file line number Diff line number Diff line change 4343#include < uuid/uuid.h>
4444#undef HOST_NOT_FOUND
4545#elif defined(_WIN32) || defined(_WIN64)
46- #include < windows.h>
4746#undef DELETE
4847#undef ERROR
4948#undef HOST_NOT_FOUND
Original file line number Diff line number Diff line change @@ -194,7 +194,6 @@ void GeneratorCpp::GenerateImports()
194194#include <uuid/uuid.h>
195195#undef HOST_NOT_FOUND
196196#elif defined(_WIN32) || defined(_WIN64)
197- #include <windows.h>
198197#undef DELETE
199198#undef ERROR
200199#undef HOST_NOT_FOUND
@@ -219,6 +218,27 @@ void GeneratorCpp::GenerateImports()
219218 }
220219}
221220
221+ void GeneratorCpp::GenerateImportsSource ()
222+ {
223+ std::string code = R"CODE(
224+ #if defined(_WIN32) || defined(_WIN64)
225+ #include <windows.h>
226+ #undef DELETE
227+ #undef ERROR
228+ #undef HOST_NOT_FOUND
229+ #undef Yield
230+ #undef min
231+ #undef max
232+ #undef uuid_t
233+ #endif
234+ )CODE" ;
235+
236+ // Prepare code template
237+ code = std::regex_replace (code, std::regex (" \n " ), EndLine ());
238+
239+ Write (code);
240+ }
241+
222242void GeneratorCpp::GenerateImports (const std::string& source)
223243{
224244 WriteLine ();
@@ -6332,6 +6352,9 @@ void GeneratorCpp::GenerateFBE_Source(const CppCommon::Path& path)
63326352 // Generate imports
63336353 GenerateImports (" fbe.h" );
63346354
6355+ // Generate imports source
6356+ GenerateImportsSource ();
6357+
63356358 // Generate namespace begin
63366359 WriteLine ();
63376360 WriteLineIndent (" namespace FBE {" );
You can’t perform that action at this time.
0 commit comments