diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-09-19 12:00:52 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-09-19 12:09:56 -0400 |
commit | 2068ac0ec6ce1f239abc73ff23407326ba33ffbf (patch) | |
tree | 110b52821232cdc5ffb1d6cd4f5f2110ed520f4d /cpp/src/Slice/CPlusPlusUtil.cpp | |
parent | Python support for optionals (diff) | |
download | ice-2068ac0ec6ce1f239abc73ff23407326ba33ffbf.tar.bz2 ice-2068ac0ec6ce1f239abc73ff23407326ba33ffbf.tar.xz ice-2068ac0ec6ce1f239abc73ff23407326ba33ffbf.zip |
Partial fix for ICE-3393:
- strealined StreamTraits.h
- added ability to define custom dictionaries in C++ (with cpp:type:...)
- added tests for custom dictionaries in test/Ice/custom
Fixed ICE-4867:
- clear parameter before unmarshaling into dictionary/map in C++
- added test
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 9eaed2ebcc5..992ba303cda 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -116,6 +116,21 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ } } +string +dictionaryTypeToString(const DictionaryPtr& dict, const StringList& metaData, int typeCtx) +{ + string dictType = findMetaData(metaData, typeCtx); + if(!dictType.empty()) + { + return dictType; + } + else + { + return fixKwd(dict->scoped()); + } +} + + void writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const string& fixedName, const StringList& metaData, int typeCtx) @@ -472,7 +487,13 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx { return sequenceTypeToString(seq, metaData, typeCtx); } - + + DictionaryPtr dict = DictionaryPtr::dynamicCast(type); + if(dict) + { + return dictionaryTypeToString(dict, metaData, typeCtx); + } + ContainedPtr contained = ContainedPtr::dynamicCast(type); if(contained) { @@ -596,6 +617,12 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m { return "const " + sequenceTypeToString(seq, metaData, typeCtx) + "&"; } + + DictionaryPtr dict = DictionaryPtr::dynamicCast(type); + if(dict) + { + return "const " + dictionaryTypeToString(dict, metaData, typeCtx) + "&"; + } ContainedPtr contained = ContainedPtr::dynamicCast(type); if(contained) @@ -678,6 +705,12 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList& return sequenceTypeToString(seq, metaData, typeCtx) + "&"; } + DictionaryPtr dict = DictionaryPtr::dynamicCast(type); + if(dict) + { + return dictionaryTypeToString(dict, metaData, typeCtx) + "&"; + } + ContainedPtr contained = ContainedPtr::dynamicCast(type); if(contained) { |