diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-09-24 16:00:56 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-09-24 16:00:56 -0700 |
commit | 6bb0a7b82684d1ce59a996848773054ede1f442e (patch) | |
tree | 9a9cfbaa225afd5caca819eea9558908c9a64a40 /cpp/test/Ice/optional/TestI.cpp | |
parent | Replaced optionalType in StreamTrait<> by a bool fixedLength member (diff) | |
download | ice-6bb0a7b82684d1ce59a996848773054ede1f442e.tar.bz2 ice-6bb0a7b82684d1ce59a996848773054ede1f442e.tar.xz ice-6bb0a7b82684d1ce59a996848773054ede1f442e.zip |
Ruby port; Python & C++ fixes
Diffstat (limited to 'cpp/test/Ice/optional/TestI.cpp')
-rw-r--r-- | cpp/test/Ice/optional/TestI.cpp | 218 |
1 files changed, 205 insertions, 13 deletions
diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp index 22de9e2cb6e..826d0e9178c 100644 --- a/cpp/test/Ice/optional/TestI.cpp +++ b/cpp/test/Ice/optional/TestI.cpp @@ -44,6 +44,42 @@ InitialI::opOptionalException(const Optional<Int>& a, throw ex; } +void +InitialI::opDerivedException(const Optional<Int>& a, + const Optional<string>& b, + const Optional<OneOptionalPtr>& o, + const Ice::Current&) +{ + DerivedException ex; + ex.a = a; + ex.b = b; + ex.o = o; + ex.ss = b; + ex.o2 = o; + throw ex; +} + +void +InitialI::opRequiredException(const Optional<Int>& a, + const Optional<string>& b, + const Optional<OneOptionalPtr>& o, + const Ice::Current&) +{ + RequiredException ex; + ex.a = a; + ex.b = b; + ex.o = o; + if(b) + { + ex.ss = b.get(); + } + if(o) + { + ex.o2 = o.get(); + } + throw ex; +} + Optional<Ice::Byte> InitialI::opByte(const Optional<Ice::Byte>& p1, Optional<Ice::Byte>& p3, const Current&) { @@ -51,6 +87,27 @@ InitialI::opByte(const Optional<Ice::Byte>& p1, Optional<Ice::Byte>& p3, const C return p1; } +Optional<bool> +InitialI::opBool(const Optional<bool>& p1, Optional<bool>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<Short> +InitialI::opShort(const Optional<Short>& p1, Optional<Short>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<Int> +InitialI::opInt(const Optional<Int>& p1, Optional<Int>& p3, const Current&) +{ + p3 = p1; + return p1; +} + Optional<Long> InitialI::opLong(const Optional<Long>& p1, Optional<Long>& p3, const Current&) { @@ -58,6 +115,20 @@ InitialI::opLong(const Optional<Long>& p1, Optional<Long>& p3, const Current&) return p1; } +Optional<Float> +InitialI::opFloat(const Optional<Float>& p1, Optional<Float>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<Double> +InitialI::opDouble(const Optional<Double>& p1, Optional<Double>& p3, const Current&) +{ + p3 = p1; + return p1; +} + Optional<string> InitialI::opString(const Optional<string>& p1, Optional<string>& p3, const Current&) { @@ -65,6 +136,34 @@ InitialI::opString(const Optional<string>& p1, Optional<string>& p3, const Curre return p1; } +Optional<MyEnum> +InitialI::opMyEnum(const Optional<MyEnum>& p1, Optional<MyEnum>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<SmallStruct> +InitialI::opSmallStruct(const Optional<SmallStruct>& p1, Optional<SmallStruct>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<FixedStruct> +InitialI::opFixedStruct(const Optional<FixedStruct>& p1, Optional<FixedStruct>& p3, const Current&) +{ + p3 = p1; + return p1; +} + +Optional<VarStruct> +InitialI::opVarStruct(const Optional<VarStruct>& p1, Optional<VarStruct>& p3, const Current&) +{ + p3 = p1; + return p1; +} + Optional<OneOptionalPtr> InitialI::opOneOptional(const Optional<OneOptionalPtr>& p1, Optional<OneOptionalPtr>& p3, const Current&) { @@ -79,8 +178,8 @@ InitialI::opOneOptionalProxy(const Optional<OneOptionalPrx>& p1, Optional<OneOpt return p1; } -Optional<Ice::ByteSeq> -InitialI::opByteSeq(const Optional<pair<const Ice::Byte*, const Ice::Byte*> >& p1, Optional<Ice::ByteSeq>& p3, +Optional<Test::ByteSeq> +InitialI::opByteSeq(const Optional<pair<const Ice::Byte*, const Ice::Byte*> >& p1, Optional<Test::ByteSeq>& p3, const Current&) { if(p1) @@ -90,8 +189,19 @@ InitialI::opByteSeq(const Optional<pair<const Ice::Byte*, const Ice::Byte*> >& p return p3; } -Optional<Ice::ShortSeq> -InitialI::opShortSeq(const Optional<pair<const Short*, const Short*> >& p1, Optional<Ice::ShortSeq>& p3, const Current&) +Optional<Test::BoolSeq> +InitialI::opBoolSeq(const Optional<pair<const bool*, const bool*> >& p1, Optional<Test::BoolSeq>& p3, const Current&) +{ + if(p1) + { + p3 = Ice::BoolSeq(p1->first, p1->second); + } + return p3; +} + +Optional<Test::ShortSeq> +InitialI::opShortSeq(const Optional<pair<const Short*, const Short*> >& p1, Optional<Test::ShortSeq>& p3, + const Current&) { if(p1) { @@ -100,20 +210,51 @@ InitialI::opShortSeq(const Optional<pair<const Short*, const Short*> >& p1, Opti return p3; } -Optional<Ice::BoolSeq> -InitialI::opBoolSeq(const Optional<pair<const bool*, const bool*> >& p1, Optional<Ice::BoolSeq>& p3, const Current&) +Optional<Test::IntSeq> +InitialI::opIntSeq(const Optional<pair<const Int*, const Int*> >& p1, Optional<Test::IntSeq>& p3, const Current&) { if(p1) { - p3 = Ice::BoolSeq(p1->first, p1->second); + p3 = Test::IntSeq(p1->first, p1->second); + } + return p3; +} + +Optional<Test::LongSeq> +InitialI::opLongSeq(const Optional<pair<const Long*, const Long*> >& p1, Optional<Test::LongSeq>& p3, const Current&) +{ + if(p1) + { + p3 = Test::LongSeq(p1->first, p1->second); + } + return p3; +} + +Optional<Test::FloatSeq> +InitialI::opFloatSeq(const Optional<pair<const Float*, const Float*> >& p1, Optional<Test::FloatSeq>& p3, + const Current&) +{ + if(p1) + { + p3 = Test::FloatSeq(p1->first, p1->second); + } + return p3; +} + +Optional<Test::DoubleSeq> +InitialI::opDoubleSeq(const Optional<pair<const Double*, const Double*> >& p1, Optional<Test::DoubleSeq>& p3, + const Current&) +{ + if(p1) + { + p3 = Test::DoubleSeq(p1->first, p1->second); } return p3; } Optional<Ice::StringSeq> InitialI::opStringSeq(const Optional<pair<Ice::StringSeq::const_iterator, Ice::StringSeq::const_iterator> >& p1, - Optional<Ice::StringSeq>& p3, - const Current&) + Optional<Ice::StringSeq>& p3, const Current&) { if(p1) { @@ -122,10 +263,31 @@ InitialI::opStringSeq(const Optional<pair<Ice::StringSeq::const_iterator, Ice::S return p3; } +Optional<SmallStructSeq> +InitialI::opSmallStructSeq(const Optional<pair<const SmallStruct*, const SmallStruct*> >& p1, + Optional<SmallStructSeq>& p3, const Current&) +{ + if(p1) + { + p3 = SmallStructSeq(p1->first, p1->second); + } + return p3; +} + +Optional<SmallStructList> +InitialI::opSmallStructList(const Optional<pair<const SmallStruct*, const SmallStruct*> >& p1, + Optional<SmallStructList>& p3, const Current&) +{ + if(p1) + { + p3 = SmallStructList(p1->first, p1->second); + } + return p3; +} + Optional<FixedStructSeq> InitialI::opFixedStructSeq(const Optional<pair<const FixedStruct*, const FixedStruct*> >& p1, - Optional<FixedStructSeq>& p3, - const Current&) + Optional<FixedStructSeq>& p3, const Current&) { if(p1) { @@ -134,10 +296,20 @@ InitialI::opFixedStructSeq(const Optional<pair<const FixedStruct*, const FixedSt return p3; } +Optional<FixedStructList> +InitialI::opFixedStructList(const Optional<pair<const FixedStruct*, const FixedStruct*> >& p1, + Optional<FixedStructList>& p3, const Current&) +{ + if(p1) + { + p3 = FixedStructList(p1->first, p1->second); + } + return p3; +} + Optional<VarStructSeq> InitialI::opVarStructSeq(const Optional<pair<VarStructSeq::const_iterator, VarStructSeq::const_iterator> >& p1, - Optional<VarStructSeq>& p3, - const Current&) + Optional<VarStructSeq>& p3, const Current&) { if(p1) { @@ -146,6 +318,26 @@ InitialI::opVarStructSeq(const Optional<pair<VarStructSeq::const_iterator, VarSt return p3; } +Optional<IntIntDict> +InitialI::opIntIntDict(const Optional<IntIntDict>& p1, Optional<IntIntDict>& p3, const Current&) +{ + if(p1) + { + p3 = p1; + } + return p3; +} + +Optional<StringIntDict> +InitialI::opStringIntDict(const Optional<StringIntDict>& p1, Optional<StringIntDict>& p3, const Current&) +{ + if(p1) + { + p3 = p1; + } + return p3; +} + void InitialI::opClassAndUnknownOptional(const APtr& a, const Ice::Current&) { |