summaryrefslogtreecommitdiff
path: root/cpp/src/slice2vb/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-12-07 03:42:33 +0000
committerMichi Henning <michi@zeroc.com>2004-12-07 03:42:33 +0000
commitf2b17fda37ef30d1c79df2aeae9b1d02ffaa8f86 (patch)
tree9b4c8e9895b775d0b6add1c7b6b0766d53d228b1 /cpp/src/slice2vb/Gen.cpp
parentremoved bogus character in file (diff)
downloadice-f2b17fda37ef30d1c79df2aeae9b1d02ffaa8f86.tar.bz2
ice-f2b17fda37ef30d1c79df2aeae9b1d02ffaa8f86.tar.xz
ice-f2b17fda37ef30d1c79df2aeae9b1d02ffaa8f86.zip
Added context parameter to checkedCast() for Java, C#, and VB.
Diffstat (limited to 'cpp/src/slice2vb/Gen.cpp')
-rwxr-xr-xcpp/src/slice2vb/Gen.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp
index 80e12353be1..68acbab0fd0 100755
--- a/cpp/src/slice2vb/Gen.cpp
+++ b/cpp/src/slice2vb/Gen.cpp
@@ -3566,6 +3566,31 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.dec();
_out << nl << "End Function";
+ _out << sp << nl << "Public Shared Function checkedCast(ByVal b As Ice.ObjectPrx, ByVal ctx As Ice.Context) As "
+ << name << "Prx";
+ _out.inc();
+ _out << nl << "If b Is Nothing Then";
+ _out.inc();
+ _out << nl << "Return Nothing";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "If TypeOf b Is " << name << "Prx Then";
+ _out.inc();
+ _out << nl << "Return CType(b, " << name << "Prx)";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "If b.ice_isA(\"" << p->scoped() << "\", ctx) Then";
+ _out.inc();
+ _out << nl << "Dim h As " << name << "PrxHelper = New " << name << "PrxHelper";
+ _out << nl << "h.__copyFrom(b)";
+ _out << nl << "Return h";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "Return Nothing";
+ _out.dec();
+ _out << nl << "End Function";
+
+
_out << sp << nl << "Public Shared Function checkedCast(ByVal B As Ice.ObjectPrx, ByVal f As String) As "
<< name << "Prx";
_out.inc();
@@ -3591,6 +3616,31 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.dec();
_out << nl << "End Function";
+ _out << sp << nl << "Public Shared Function checkedCast(ByVal B As Ice.ObjectPrx, ByVal f As String, "
+ << "ByVal ctx As Ice.Context) As " << name << "Prx";
+ _out.inc();
+ _out << nl << "If b Is Nothing Then";
+ _out.inc();
+ _out << nl << "Return Nothing";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_newFacet(f)";
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "If bb.ice_isA(\"" << p->scoped() << "\", ctx) Then";
+ _out.inc();
+ _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()";
+ _out << nl << "h.__copyFrom(bb)";
+ _out << nl << "Return h";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "Catch __ex As Ice.FacetNotExistException";
+ _out << nl << "End Try";
+ _out << nl << "Return Nothing";
+ _out.dec();
+ _out << nl << "End Function";
+
_out << sp << nl << "Public Shared Function uncheckedCast(ByVal b As Ice.ObjectPrx) As " << name << "Prx";
_out.inc();
_out << nl << "If b Is Nothing Then";