diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/slice2matlab/Main.cpp | 8 | ||||
-rw-r--r-- | cpp/test/Ice/objects/AllTests.cpp | 29 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Test.ice | 15 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.cpp | 7 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.h | 2 |
5 files changed, 59 insertions, 2 deletions
diff --git a/cpp/src/slice2matlab/Main.cpp b/cpp/src/slice2matlab/Main.cpp index 051e37b76ac..c673feb482b 100644 --- a/cpp/src/slice2matlab/Main.cpp +++ b/cpp/src/slice2matlab/Main.cpp @@ -362,7 +362,11 @@ typeToString(const TypePtr& type) DictionaryPtr dict = DictionaryPtr::dynamicCast(type); if(dict) { - if(!StructPtr::dynamicCast(dict->keyType())) + if(StructPtr::dynamicCast(dict->keyType())) + { + return "struct"; + } + else { return "containers.Map"; } @@ -3599,7 +3603,7 @@ CodeVisitor::visitDictionary(const DictionaryPtr& p) if(cls || convert) { - out << nl << "function r = convert(d, obj)"; + out << nl << "function r = convert(d)"; out.inc(); if(st) { diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index a7ef9968ca8..7633f3732bb 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -536,5 +536,34 @@ allTests(Test::TestHelper* helper) { } + cout << "testing class containing complex dictionary... " << flush; + { + Test::MPtr m = ICE_MAKE_SHARED(Test::M); + + Test::StructKey k1; + k1.i = 1; + k1.s = "1"; + m->v[k1] = ICE_MAKE_SHARED(L, "one"); + + Test::StructKey k2; + k2.i = 2; + k2.s = "2"; + m->v[k2] = ICE_MAKE_SHARED(L, "two"); + + Test::MPtr m1; + Test::MPtr m2 = initial->opM(m, m1); + + test(m1->v.size() == 2); + test(m2->v.size() == 2); + + test(m1->v[k1]->data == "one"); + test(m2->v[k1]->data == "one"); + + test(m1->v[k2]->data == "two"); + test(m2->v[k2]->data == "two"); + + } + cout << "ok" << endl; + return initial; } diff --git a/cpp/test/Ice/objects/Test.ice b/cpp/test/Ice/objects/Test.ice index e3d8b9cca1e..e14044e7118 100644 --- a/cpp/test/Ice/objects/Test.ice +++ b/cpp/test/Ice/objects/Test.ice @@ -190,6 +190,19 @@ class L sequence<Value> ValueSeq; dictionary<string, Value> ValueMap; +struct StructKey +{ + int i; + string s; +} + +dictionary<StructKey, L> LMap; + +class M +{ + LMap v; +} + interface Initial { void shutdown(); @@ -232,6 +245,8 @@ interface Initial void throwInnerEx() throws Inner::Ex; void throwInnerSubEx() throws Inner::Sub::Ex; + + M opM(M v1, out M v2); } interface TestIntf diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp index d4d99f7b330..8bd3f8ef35f 100644 --- a/cpp/test/Ice/objects/TestI.cpp +++ b/cpp/test/Ice/objects/TestI.cpp @@ -371,6 +371,13 @@ InitialI::throwEDerived(const Ice::Current&) ICE_MAKE_SHARED(A1, "a4")); } +Test::MPtr +InitialI::opM(ICE_IN(Test::MPtr) v1, Test::MPtr& v2, const Ice::Current&) +{ + v2 = v1; + return v1; +} + bool UnexpectedObjectExceptionTestI::ice_invoke(ICE_IN(std::vector<Ice::Byte>), std::vector<Ice::Byte>& outParams, diff --git a/cpp/test/Ice/objects/TestI.h b/cpp/test/Ice/objects/TestI.h index 64397b0f1c4..f134202d575 100644 --- a/cpp/test/Ice/objects/TestI.h +++ b/cpp/test/Ice/objects/TestI.h @@ -145,6 +145,8 @@ public: virtual void throwInnerEx(const Ice::Current&); virtual void throwInnerSubEx(const Ice::Current&); + virtual Test::MPtr opM(ICE_IN(Test::MPtr), Test::MPtr&, const Ice::Current&); + private: Ice::ObjectAdapterPtr _adapter; |