summaryrefslogtreecommitdiff
path: root/cpp/src/Slice
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp14
-rw-r--r--cpp/src/Slice/JavaUtil.cpp47
-rw-r--r--cpp/src/Slice/JavaUtil.h2
3 files changed, 53 insertions, 10 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index b65006e6c20..0a06db2ef8f 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -648,6 +648,20 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
"::std::shared_ptr<void>",
"::std::shared_ptr<::Ice::Value>"
};
+
+ if((typeCtx & TypeContextLocal) != 0)
+ {
+ for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ {
+ const string cppType = "cpp:type:";
+ const string meta = *i;
+
+ if(meta.find(cppType) == 0)
+ {
+ return meta.substr(cppType.size());
+ }
+ }
+ }
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index cb99ca5da46..947cdbe0602 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -1115,11 +1115,12 @@ Slice::JavaCompatGenerator::getOptionalFormat(const TypePtr& type)
string
Slice::JavaCompatGenerator::typeToString(const TypePtr& type,
- TypeMode mode,
- const string& package,
- const StringList& metaData,
- bool formal,
- bool optional) const
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal,
+ bool optional,
+ bool local) const
{
static const char* builtinTable[] =
{
@@ -1166,6 +1167,20 @@ Slice::JavaCompatGenerator::typeToString(const TypePtr& type,
"???",
"???"
};
+
+ if(local)
+ {
+ for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ {
+ const string javaType = "java:type:";
+ const string meta = *i;
+
+ if(meta.find(javaType) == 0)
+ {
+ return meta.substr(javaType.size());
+ }
+ }
+ }
if(!type)
{
@@ -1317,10 +1332,10 @@ Slice::JavaCompatGenerator::typeToString(const TypePtr& type,
string
Slice::JavaCompatGenerator::typeToObjectString(const TypePtr& type,
- TypeMode mode,
- const string& package,
- const StringList& metaData,
- bool formal) const
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal) const
{
static const char* builtinTable[] =
{
@@ -3599,6 +3614,20 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
"???",
"???"
};
+
+ if(local)
+ {
+ for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ {
+ const string javaType = "java:type:";
+ const string meta = *i;
+
+ if(meta.find(javaType) == 0)
+ {
+ return meta.substr(javaType.size());
+ }
+ }
+ }
if(!type)
{
diff --git a/cpp/src/Slice/JavaUtil.h b/cpp/src/Slice/JavaUtil.h
index dfabec06025..ce16795bdb2 100644
--- a/cpp/src/Slice/JavaUtil.h
+++ b/cpp/src/Slice/JavaUtil.h
@@ -145,7 +145,7 @@ protected:
TypeModeReturn
};
std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(),
- const StringList& = StringList(), bool = true, bool = false) const;
+ const StringList& = StringList(), bool = true, bool = false, bool = false) const;
//
// Get the Java object name for a type. For primitive types, this returns the