summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-12-16 01:12:38 +0000
committerMichi Henning <michi@zeroc.com>2003-12-16 01:12:38 +0000
commitd20b8f5a3db4b0f0f12577318cb54b67616ded56 (patch)
treed9feafb7d1a3890bd1bd5cc0f0564a9f6c76de04 /cpp/src
parentmore tracing (diff)
downloadice-d20b8f5a3db4b0f0f12577318cb54b67616ded56.tar.bz2
ice-d20b8f5a3db4b0f0f12577318cb54b67616ded56.tar.xz
ice-d20b8f5a3db4b0f0f12577318cb54b67616ded56.zip
Changed Ice::Exception::ice_name() to return const string&.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceUtil/CtrlCHandler.cpp6
-rw-r--r--cpp/src/IceUtil/Exception.cpp12
-rw-r--r--cpp/src/IceUtil/ThreadException.cpp24
-rw-r--r--cpp/src/IceUtil/UUID.cpp6
-rw-r--r--cpp/src/IceXML/Parser.cpp6
-rw-r--r--cpp/src/Transform/Exception.cpp6
-rw-r--r--cpp/src/Transform/Node.cpp6
-rw-r--r--cpp/src/Transform/Node.h3
-rw-r--r--cpp/src/slice2cpp/Gen.cpp25
9 files changed, 62 insertions, 32 deletions
diff --git a/cpp/src/IceUtil/CtrlCHandler.cpp b/cpp/src/IceUtil/CtrlCHandler.cpp
index d77dd20744d..c54efff40b1 100644
--- a/cpp/src/IceUtil/CtrlCHandler.cpp
+++ b/cpp/src/IceUtil/CtrlCHandler.cpp
@@ -33,10 +33,12 @@ CtrlCHandlerException::CtrlCHandlerException(const char* file, int line) :
{
}
-string
+static string ctrlCHandlerName = "IceUtil::CtrlCHandlerException";
+
+const string&
CtrlCHandlerException::ice_name() const
{
- return "IceUtil::CtrlCHandlerException";
+ return ctrlCHandlerName;
}
Exception*
diff --git a/cpp/src/IceUtil/Exception.cpp b/cpp/src/IceUtil/Exception.cpp
index c3cf3424053..795b9217b12 100644
--- a/cpp/src/IceUtil/Exception.cpp
+++ b/cpp/src/IceUtil/Exception.cpp
@@ -39,10 +39,12 @@ IceUtil::Exception::~Exception()
{
}
-string
+string IceUtil::Exception::_name = "IceUtil::Exception";
+
+const string&
IceUtil::Exception::ice_name() const
{
- return "IceUtil::Exception";
+ return _name;
}
void
@@ -95,10 +97,12 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
}
}
-string
+string IceUtil::NullHandleException::_name = "IceUtil::NullHandleException";
+
+const string&
IceUtil::NullHandleException::ice_name() const
{
- return "IceUtil::NullHandleException";
+ return _name;
}
IceUtil::Exception*
diff --git a/cpp/src/IceUtil/ThreadException.cpp b/cpp/src/IceUtil/ThreadException.cpp
index 857fc962987..0cafa6612bd 100644
--- a/cpp/src/IceUtil/ThreadException.cpp
+++ b/cpp/src/IceUtil/ThreadException.cpp
@@ -22,10 +22,12 @@ IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int li
{
}
-string
+string IceUtil::ThreadSyscallException::_name = "IceUtil::ThreadSyscallException";
+
+const string&
IceUtil::ThreadSyscallException::ice_name() const
{
- return "IceUtil::ThreadSyscallException";
+ return _name;
}
void
@@ -88,10 +90,12 @@ IceUtil::ThreadLockedException::ThreadLockedException(const char* file, int line
{
}
-string
+string IceUtil::ThreadLockedException::_name = "IceUtil::ThreadLockedException";
+
+const string&
IceUtil::ThreadLockedException::ice_name() const
{
- return "IceUtil::ThreadLockedException";
+ return _name;
}
IceUtil::Exception*
@@ -111,10 +115,12 @@ IceUtil::ThreadStartedException::ThreadStartedException(const char* file, int li
{
}
-string
+string IceUtil::ThreadStartedException::_name = "IceUtil::ThreadStartedException";
+
+const string&
IceUtil::ThreadStartedException::ice_name() const
{
- return "IceUtil::ThreadStartedException";
+ return _name;
}
IceUtil::Exception*
@@ -134,10 +140,12 @@ IceUtil::ThreadNotStartedException::ThreadNotStartedException(const char* file,
{
}
-string
+string IceUtil::ThreadNotStartedException::_name = "IceUtil::ThreadNotStartedException";
+
+const string&
IceUtil::ThreadNotStartedException::ice_name() const
{
- return "IceUtil::ThreadNotStartedException";
+ return _name;
}
IceUtil::Exception*
diff --git a/cpp/src/IceUtil/UUID.cpp b/cpp/src/IceUtil/UUID.cpp
index bcefe9fe008..acdd3af223f 100644
--- a/cpp/src/IceUtil/UUID.cpp
+++ b/cpp/src/IceUtil/UUID.cpp
@@ -59,10 +59,12 @@ IceUtil::UUIDGenerationException::UUIDGenerationException(const char* file, int
{
}
-string
+string IceUtil::UUIDGenerationException::_name = "IceUtil::UUIDGenerationException";
+
+const string&
IceUtil::UUIDGenerationException::ice_name() const
{
- return "IceUtil::UUIDGenerationException";
+ return _name;
}
IceUtil::Exception*
diff --git a/cpp/src/IceXML/Parser.cpp b/cpp/src/IceXML/Parser.cpp
index f973ef03f27..7231005b74f 100644
--- a/cpp/src/IceXML/Parser.cpp
+++ b/cpp/src/IceXML/Parser.cpp
@@ -33,10 +33,12 @@ IceXML::ParserException::ParserException(const char* file, int line, const strin
{
}
-string
+string IceXML::ParserException::_name = "IceXML::ParserException";
+
+const string&
IceXML::ParserException::ice_name() const
{
- return "IceXML::ParserException";
+ return _name;
}
void
diff --git a/cpp/src/Transform/Exception.cpp b/cpp/src/Transform/Exception.cpp
index 4240f450fb7..e6b030bf178 100644
--- a/cpp/src/Transform/Exception.cpp
+++ b/cpp/src/Transform/Exception.cpp
@@ -24,10 +24,12 @@ Transform::TransformException::TransformException(const char* file, int line, co
{
}
-string
+string Transform::TransformException::_name = "Transform:TransformException";
+
+const string&
Transform::TransformException::ice_name() const
{
- return "Transform::TransformException";
+ return _name;
}
void
diff --git a/cpp/src/Transform/Node.cpp b/cpp/src/Transform/Node.cpp
index 9b37554f172..754d18b29aa 100644
--- a/cpp/src/Transform/Node.cpp
+++ b/cpp/src/Transform/Node.cpp
@@ -75,10 +75,12 @@ Transform::EvaluateException::EvaluateException(const char* file, int line, cons
{
}
-string
+string Transform::EvaluateException::_name = "Transform::EvaluateException";
+
+const string&
Transform::EvaluateException::ice_name() const
{
- return "Transform::EvaluateException";
+ return _name;
}
void
diff --git a/cpp/src/Transform/Node.h b/cpp/src/Transform/Node.h
index dcebd33cdaa..908152f4be4 100644
--- a/cpp/src/Transform/Node.h
+++ b/cpp/src/Transform/Node.h
@@ -31,7 +31,7 @@ class EvaluateException : public IceUtil::Exception
public:
EvaluateException(const char*, int, const std::string&);
- virtual std::string ice_name() const;
+ virtual const std::string& ice_name() const;
virtual void ice_print(std::ostream&) const;
virtual IceUtil::Exception* ice_clone() const;
virtual void ice_throw() const;
@@ -41,6 +41,7 @@ public:
private:
std::string _reason;
+ static std::string _name;
};
class SymbolTable
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 04fc5a890fb..b2b7074b082 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -375,10 +375,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
C << eb;
}
- H << nl << "virtual ::std::string ice_name() const;";
- C << sp << nl << "::std::string" << nl << scoped.substr(2) << "::ice_name() const";
+ H << nl << "virtual const ::std::string& ice_name() const;";
+ C << sp << nl << "::std::string " << scoped.substr(2) << "::_name = \"" << p->scoped().substr(2) << "\";";
+ C << sp << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_name() const";
C << sb;
- C << nl << "return \"" << p->scoped().substr(2) << "\";";
+ C << nl << "return " << scoped.substr(2) << "::_name;";
C << eb;
if(p->isLocal())
@@ -509,6 +510,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << eb << ";";
C << sp << nl << "static __F__" << name << "__Init __F__" << name << "__i;";
}
+
+ H.dec();
+ H << sp << nl << "private:";
+ H.inc();
+ H << sp << nl << "static ::std::string _name;";
+
H << eb << ';';
}
@@ -1985,19 +1992,19 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sp;
C << nl << "void ";
- C << nl << scoped.substr(2) << "::__copyMembers(" << scoped << "Ptr to) const";
+ C << nl << scoped.substr(2) << "::__copyMembers(" << scoped << "Ptr __to) const";
C << sb;
string winUpcall;
string unixUpcall;
if(!bases.empty() && !bases.front()->isInterface())
{
- winUpcall = fixKwd(bases.front()->name()) + "::__copyMembers(to);";
- unixUpcall = fixKwd(bases.front()->scoped()) + "::__copyMembers(to);";
+ winUpcall = fixKwd(bases.front()->name()) + "::__copyMembers(__to);";
+ unixUpcall = fixKwd(bases.front()->scoped()) + "::__copyMembers(__to);";
}
else
{
- winUpcall = "Object::__copyMembers(to);";
- unixUpcall = "::Ice::Object::__copyMembers(to);";
+ winUpcall = "Object::__copyMembers(__to);";
+ unixUpcall = "::Ice::Object::__copyMembers(__to);";
}
C.zeroIndent();
C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG
@@ -2013,7 +2020,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p->dataMembers();
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- C << nl << "to->" << (*q)->name() << " = " << (*q)->name() << ";";
+ C << nl << "__to->" << (*q)->name() << " = " << (*q)->name() << ";";
}
C << eb;