summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-12-05 08:28:43 +0000
committerMichi Henning <michi@zeroc.com>2003-12-05 08:28:43 +0000
commite8546c312a1ae7e9b67649dcc50dded80a7582c1 (patch)
tree499b4e8747ca04186c4e6b469e24d174eed267bd /cpp/src/Slice/CsUtil.cpp
parentAdded ifndef/endif guards (diff)
downloadice-e8546c312a1ae7e9b67649dcc50dded80a7582c1.tar.bz2
ice-e8546c312a1ae7e9b67649dcc50dded80a7582c1.tar.xz
ice-e8546c312a1ae7e9b67649dcc50dded80a7582c1.zip
*** empty log message ***
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp52
1 files changed, 41 insertions, 11 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 195fb5f43f2..ca76add0bff 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -104,7 +104,9 @@ splitScopedName(const string& scoped)
// but with all components that are C# keywords replaced by
// their "@"-prefixed version; otherwise, if the passed name is
// not scoped, but a C# keyword, return the "@"-prefixed name;
-// otherwise, return the name unchanged.
+// otherwise, return the name unchanged. For the first component
+// of a scoped name, also escape the reserved "Microsoft" and
+// "System" namespaces.
//
string
Slice::CsGenerator::fixKwd(const string& name)
@@ -122,21 +124,18 @@ Slice::CsGenerator::fixKwd(const string& name)
stringstream result;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- if(i != ids.begin())
- {
- result << '.';
- }
- else
+ if(i == ids.begin())
{
if(*i == "Microsoft" || *i == "System")
{
- result << "_cs_" + *i;
- }
- else
- {
- result << *i;
+ result << "_cs_";
}
}
+ else
+ {
+ result << '.';
+ }
+ result << *i;
}
return result.str();
}
@@ -144,6 +143,11 @@ Slice::CsGenerator::fixKwd(const string& name)
string
Slice::CsGenerator::typeToString(const TypePtr& type)
{
+ if(!type)
+ {
+ return "void";
+ }
+
static const char* builtinTable[] =
{
"byte",
@@ -180,6 +184,32 @@ Slice::CsGenerator::typeToString(const TypePtr& type)
return "???";
}
+bool
+Slice::CsGenerator::isValueType(const TypePtr& type)
+{
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin)
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ return false;
+ break;
+ }
+ }
+ return true;
+ }
+ if(EnumPtr::dynamicCast(type))
+ {
+ return true;
+ }
+ return false;
+}
+
#if 0
void