summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/parser.cpp22
-rw-r--r--slicer/test/Jamfile.jam2
-rw-r--r--slicer/test/conversions.h17
-rw-r--r--slicer/test/preprocessor.cpp3
-rw-r--r--slicer/test/types.ice5
5 files changed, 38 insertions, 11 deletions
diff --git a/slicer/slicer/parser.cpp b/slicer/slicer/parser.cpp
index ab0bc88..5ea26b7 100644
--- a/slicer/slicer/parser.cpp
+++ b/slicer/slicer/parser.cpp
@@ -34,14 +34,20 @@ namespace Slicer {
auto c = Slice::ContainedPtr::dynamicCast(dm->container());
auto conversions = getAllConversions(dm);
for (const auto & conversion : conversions) {
- fprintbf(cpp, "%s %s(const %s &);\n",
- conversion.ExchangeType,
- conversion.ConvertToExchangeFunc,
- Slice::typeToString(type));
- fprintbf(cpp, "%s %s(const %s &);\n\n",
- Slice::typeToString(type),
- conversion.ConvertToModelFunc,
- conversion.ExchangeType);
+ if (!AdHoc::containerContains(conversion.Options, "nodeclare")) {
+ if (!AdHoc::containerContains(conversion.Options, "nodeclareto")) {
+ fprintbf(cpp, "%s %s(const %s &);\n",
+ conversion.ExchangeType,
+ conversion.ConvertToExchangeFunc,
+ Slice::typeToString(type));
+ }
+ if (!AdHoc::containerContains(conversion.Options, "nodeclarefrom")) {
+ fprintbf(cpp, "%s %s(const %s &);\n\n",
+ Slice::typeToString(type),
+ conversion.ConvertToModelFunc,
+ conversion.ExchangeType);
+ }
+ }
}
if (!conversions.empty()) {
fprintbf(cpp, "template<>\nvoid\n");
diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam
index 7776c5d..e679a76 100644
--- a/slicer/test/Jamfile.jam
+++ b/slicer/test/Jamfile.jam
@@ -13,6 +13,7 @@ lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib types :
types.ice
:
+ <include>.
<library>pthread
<library>Ice
<library>IceUtil
@@ -20,6 +21,7 @@ lib types :
<library>included//included
<implicit-dependency>included//included
: :
+ <include>.
<library>pthread
<library>Ice
<library>IceUtil
diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h
new file mode 100644
index 0000000..d462fb4
--- /dev/null
+++ b/slicer/test/conversions.h
@@ -0,0 +1,17 @@
+#ifndef SLICER_TEST_CONVERSIONS_H
+#define SLICER_TEST_CONVERSIONS_H
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+namespace TestModule {
+ class DateTime;
+}
+namespace Slicer {
+ ::TestModule::DateTime
+ stringToDateTime(const std::string & in);
+ std::string
+ dateTimeToString(const ::TestModule::DateTime & in);
+}
+
+#endif
+
diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp
index a55cdb2..435723f 100644
--- a/slicer/test/preprocessor.cpp
+++ b/slicer/test/preprocessor.cpp
@@ -61,8 +61,9 @@ BOOST_AUTO_TEST_CASE( slicer_test_ice )
const fs::path obj = fs::change_extension(tmp / base, ".o");
const std::string compile = stringbf(
- "g++ -Os -fPIC -c -std=c++0x -fvisibility=hidden -I tmp -I /usr/include/adhocutil -I /usr/include/Ice -I /usr/include/IceUtil -I %s -I %s -I %s %s -o %s",
+ "g++ -Os -fPIC -c -std=c++0x -fvisibility=hidden -I tmp -I /usr/include/adhocutil -I /usr/include/Ice -I /usr/include/IceUtil -I %s -I %s -I %s -I %s %s -o %s",
root / bjamout,
+ root,
included / bjamout,
root / "..",
cpp, obj);
diff --git a/slicer/test/types.ice b/slicer/test/types.ice
index 3766342..562099b 100644
--- a/slicer/test/types.ice
+++ b/slicer/test/types.ice
@@ -1,4 +1,5 @@
[["cpp:include:boost/date_time/posix_time/posix_time_types.hpp"]]
+[["cpp:include:conversions.h"]]
#include <included.ice>
@@ -22,7 +23,7 @@ module TestModule {
};
class DateTimeContainer {
[ "slicer:conversion:boost.posix_time.ptime:ptimeToDateTime:dateTimeToPTime",
- "slicer:conversion:std.string:stringToDateTime:dateTimeToString" ]
+ "slicer:conversion:std.string:stringToDateTime:dateTimeToString:nodeclare" ]
DateTime dt;
IsoDate date;
};
@@ -126,7 +127,7 @@ module TestModule2 {
class CrossModule extends TestModule::ClassType {
int anything;
[ "slicer:conversion:boost.posix_time.ptime:ptimeToDateTime:dateTimeToPTime",
- "slicer:conversion:std.string:stringToDateTime:dateTimeToString" ]
+ "slicer:conversion:std.string:stringToDateTime:dateTimeToString:nodeclare" ]
TestModule::DateTime dt;
TestModule::Base base;
};