summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/VbUtil.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-10-06 01:35:43 +0000
committerMichi Henning <michi@zeroc.com>2004-10-06 01:35:43 +0000
commit48522e29f4932093fc4fdc9c0d8c407b8bb48d55 (patch)
tree9bf8fb31d4e7a99ef4f5e5d581f7f63887118889 /cpp/src/Slice/VbUtil.cpp
parentWin32 fixes (diff)
downloadice-48522e29f4932093fc4fdc9c0d8c407b8bb48d55.tar.bz2
ice-48522e29f4932093fc4fdc9c0d8c407b8bb48d55.tar.xz
ice-48522e29f4932093fc4fdc9c0d8c407b8bb48d55.zip
Fixed problems around escaping of inherited method names.
Diffstat (limited to 'cpp/src/Slice/VbUtil.cpp')
-rwxr-xr-xcpp/src/Slice/VbUtil.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp
index c5f6e3c428d..76497a14d83 100755
--- a/cpp/src/Slice/VbUtil.cpp
+++ b/cpp/src/Slice/VbUtil.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Slice/VbUtil.h>
+#include <Slice/DotNetNames.h>
#include <IceUtil/Functional.h>
#include <sys/types.h>
@@ -26,7 +27,7 @@ using namespace Slice;
using namespace IceUtil;
static string
-lookupKwd(const string& name)
+lookupKwd(const string& name, int baseTypes, bool mangleCasts = false)
{
//
// Keyword list. *Must* be kept in alphabetical order.
@@ -57,21 +58,11 @@ lookupKwd(const string& name)
{
return "[" + name + "]";
}
-
- static const string memberList[] =
+ if(mangleCasts && (name == "checkedCast" || name == "uncheckedCast"))
{
- "Add", "Clear", "Clone", "Contains", "CopyTo", "Dictionary", "Equals", "Finalize",
- "GetBaseException", "GetEnumerator", "GetHashCode", "GetObjectData", "GetType",
- "IndexOf", "Insert", "IsFixedSize", "IsReadOnly", "IsSynchronized", "MemberWiseClone",
- "Microsoft", "OnClear", "OnClearComplete", "OnGet", "OnInsert", "OnInsertComplete",
- "OnRemove", "OnRemoveComplete", "OnSet", "OnSetComplete", "OnValidate", "ReferenceEquals",
- "Remove", "RemoveAt", "SyncRoot", "System", "ToString", "checkedCast", "uncheckedCast"
- };
- found = binary_search(&memberList[0],
- &memberList[sizeof(memberList) / sizeof(*memberList)],
- name,
- Slice::CICompare());
- return found ? "_Ice_" + name : name;
+ return string(DotNet::manglePrefix) + name;
+ }
+ return Slice::DotNet::mangleName(name, baseTypes);
}
//
@@ -114,10 +105,11 @@ splitScopedName(const string& scoped)
// but with all components that are VB keywords replaced by
// their "[]"-surrounded version; otherwise, if the passed name is
// not scoped, but a VB keyword, return the "[]"-surrounded name;
-// otherwise, return the name unchanged.
+// otherwise, check if the name is one of the method names of baseTypes;
+// if so, prefix it with _Ice_; otherwise, reutrn the name unchanged.
//
string
-Slice::VbGenerator::fixId(const string& name)
+Slice::VbGenerator::fixId(const string& name, int baseTypes, bool mangleCasts)
{
if(name.empty())
{
@@ -125,18 +117,22 @@ Slice::VbGenerator::fixId(const string& name)
}
if(name[0] != ':')
{
- return lookupKwd(name);
+ return lookupKwd(name, baseTypes, mangleCasts);
}
StringList ids = splitScopedName(name);
- transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
- stringstream result;
+ StringList newIds;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- if(i != ids.begin())
+ newIds.push_back(lookupKwd(*i, baseTypes));
+ }
+ stringstream result;
+ for(StringList::const_iterator j = ids.begin(); j != ids.end(); ++j)
+ {
+ if(j != ids.begin())
{
result << '.';
}
- result << *i;
+ result << *j;
}
return result.str();
}