From 077b8b25ab7fac22daf8494feb125cd5c73b95ac Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 9 Jun 2010 11:59:38 +0000 Subject: QPID-2589 Cleanup pass to address function naming, capitalization rules, change Qpid messaging 'list' representation from List<> to Collection<>, some exception cleanup. Patch from Chuck Rolke git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@952968 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qpid/dotnet/src/Receiver.cpp | 99 ++++++++++++++----------------- 1 file changed, 45 insertions(+), 54 deletions(-) (limited to 'cpp/bindings/qpid/dotnet/src/Receiver.cpp') diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp index d647315620..15f8572a53 100644 --- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp +++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp @@ -34,10 +34,10 @@ #include "Duration.h" #include "QpidException.h" -namespace org { -namespace apache { -namespace qpid { -namespace messaging { +namespace Org { +namespace Apache { +namespace Qpid { +namespace Messaging { /// /// Receiver is a managed wrapper for a ::qpid::messaging::Receiver @@ -85,30 +85,30 @@ namespace messaging { } // - // get(message) + // Get(message) // - bool Receiver::get(Message ^ mmsgp) + bool Receiver::Get(Message ^ mmsgp) { - return get(mmsgp, DurationConstants::FORVER); + return Get(mmsgp, DurationConstants::FORVER); } - bool Receiver::get(Message ^ mmsgp, Duration ^ durationp) + bool Receiver::Get(Message ^ mmsgp, Duration ^ durationp) { ::qpid::messaging::Duration dur((*durationp).Milliseconds); - return receiverp->Receiver::get(*(mmsgp->messagep), dur); + return receiverp->Receiver::get(*(mmsgp->NativeMessage), dur); } // - // message = get() + // message = Get() // - Message ^ Receiver::get() + Message ^ Receiver::Get() { - return get(DurationConstants::FORVER); + return Get(DurationConstants::FORVER); } - Message ^ Receiver::get(Duration ^ durationp) + Message ^ Receiver::Get(Duration ^ durationp) { System::Exception ^ newException = nullptr; ::qpid::messaging::Message * msgp = NULL; @@ -133,58 +133,54 @@ namespace messaging { String ^ errmsg = gcnew String(error.what()); newException = gcnew QpidException(errmsg); } - catch (const std::exception & error) - { - String ^ errmsg = gcnew String(error.what()); - newException = gcnew QpidException(errmsg); - } - catch ( ... ) - { - newException = gcnew QpidException("Receiver:get unknown error"); - } finally { - // Clean up and throw on caught exceptions if (newException != nullptr) { if (msgp != NULL) { delete msgp; } - - throw newException; + if (newMessage != nullptr) + { + delete newMessage; + } } } + if (newException != nullptr) + { + throw newException; + } return newMessage; } // - // fetch(message) + // Fetch(message) // - bool Receiver::fetch(Message ^ mmsgp) + bool Receiver::Fetch(Message ^ mmsgp) { - return fetch(mmsgp, DurationConstants::FORVER); + return Fetch(mmsgp, DurationConstants::FORVER); } - bool Receiver::fetch(Message ^ mmsgp, Duration ^ durationp) + bool Receiver::Fetch(Message ^ mmsgp, Duration ^ durationp) { ::qpid::messaging::Duration dur((*durationp).Milliseconds); - return receiverp->::qpid::messaging::Receiver::fetch(*((*mmsgp).messagep), dur); + return receiverp->::qpid::messaging::Receiver::fetch(*((*mmsgp).NativeMessage), dur); } // - // message = fetch() + // message = Fetch() // - Message ^ Receiver::fetch() + Message ^ Receiver::Fetch() { - return fetch(DurationConstants::FORVER); + return Fetch(DurationConstants::FORVER); } - Message ^ Receiver::fetch(Duration ^ durationp) + Message ^ Receiver::Fetch(Duration ^ durationp) { System::Exception ^ newException = nullptr; ::qpid::messaging::Message * msgp = NULL; @@ -209,64 +205,59 @@ namespace messaging { String ^ errmsg = gcnew String(error.what()); newException = gcnew QpidException(errmsg); } - catch (const std::exception & error) - { - String ^ errmsg = gcnew String(error.what()); - newException = gcnew QpidException(errmsg); - } - catch ( ... ) - { - newException = gcnew QpidException("Receiver:fetch unknown error"); - - } finally { - // Clean up and throw on caught exceptions if (newException != nullptr) { if (msgp != NULL) { delete msgp; } - - throw newException; + if (newMessage != nullptr) + { + delete newMessage; + } } } + if (newException != nullptr) + { + throw newException; + } return newMessage; } - void Receiver::setCapacity(System::UInt32 capacity) + void Receiver::SetCapacity(System::UInt32 capacity) { receiverp->setCapacity(capacity); } - System::UInt32 Receiver::getCapacity() + System::UInt32 Receiver::GetCapacity() { return receiverp->getCapacity(); } - System::UInt32 Receiver::getAvailable() + System::UInt32 Receiver::GetAvailable() { return receiverp->getAvailable(); } - System::UInt32 Receiver::getUnsettled() + System::UInt32 Receiver::GetUnsettled() { return receiverp->getUnsettled(); } - void Receiver::close() + void Receiver::Close() { receiverp->close(); } - System::String ^ Receiver::getName() + System::String ^ Receiver::GetName() { return gcnew System::String(receiverp->getName().c_str()); } - Session ^ Receiver::getSession() + Session ^ Receiver::GetSession() { return parentSession; } -- cgit v1.2.1