Remove dynamic exceptions
[anna.git] / example / ldap / tSearch / main.cpp
index 335a829..00ed541 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// https://bitbucket.org/testillano/anna
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
 
 
 #include <iostream>
@@ -52,7 +24,7 @@
 #include <anna/ldap/Attribute.hpp>
 
 class MySession : public ldap::Session {
-   void eventResponse (const ldap::Response&) throw (RuntimeException);
+   void eventResponse (const ldap::Response&) noexcept(false);
 };
 
 class MyEngine : public ldap::Engine {
@@ -62,9 +34,9 @@ public:
 private:
    Recycler<MySession> a_sessions;
 
-   ldap::Session* allocateSession (const int category) throw () { return a_sessions.create (); }
+   ldap::Session* allocateSession (const int category) { return a_sessions.create (); }
 
-   void releaseSession (ldap::Session* session) throw () 
+   void releaseSession (ldap::Session* session) { 
       MySession* aux = static_cast <MySession*> (session);
       a_sessions.release (aux);
    }
@@ -85,26 +57,26 @@ public:
    MyCommunicator () : comm::Communicator () { ;}
 
 private:
-   void eventReceiveMessage (comm::ClientSocket &, const comm::Message&) throw (RuntimeException) {;}
+   void eventReceiveMessage (comm::ClientSocket &, const comm::Message&) noexcept(false) {;}
 };
 
 class Buddy : public Clock {
 public:
    Buddy () :  Clock ("buddy", (Millisecond)2000) {;}
    
-   void setLDAPEngine (ldap::Engine& ldapEngine) throw () { a_ldapEngine = &ldapEngine;  }
+   void setLDAPEngine (ldap::Engine& ldapEngine) { a_ldapEngine = &ldapEngine;  }
    
 private:
    ldap::Engine* a_ldapEngine;   
    ldap::Search a_ldapSearch;
    
-   bool tick () throw (RuntimeException);
+   bool tick () noexcept(false);
 };
 
 class Stopper : public Timer {
 public:
    Stopper () :  Timer ("stopper", (Millisecond)0) {;}
-   void expire (Engine*) throw (RuntimeException);      
+   void expire (Engine*) noexcept(false);      
 };
 
 class LDAPClient : public anna::comm::Application {
@@ -113,12 +85,12 @@ public:
    
 private:
    MyCommunicator a_communicator;
-   timex::Engine a_timeController;
+   anna::timex::Engine a_timeController;
    MyEngine a_ldapEngine;
    Buddy a_buddy;
    Stopper a_stopper;  
 
-   void run () throw (RuntimeException);    
+   void run () noexcept(false);    
 };
 
 using namespace std;
@@ -159,7 +131,7 @@ LDAPClient::LDAPClient () :
    cl.add ("scope", CommandLine::Argument::Optional, "Ambito");
    cl.add ("user", CommandLine::Argument::Optional, "Usuario");
    cl.add ("password", CommandLine::Argument::Optional, "Password");
-   cl.add ("d", CommandLine::Argument::Optional, "Nivel de depuraciรณn (all = activa todo)");
+   cl.add ("d", CommandLine::Argument::Optional, "Nivel de depuracion (all = activa todo)");
 }
 
 //-----------------------------------------------------------------------------------------
@@ -169,7 +141,7 @@ LDAPClient::LDAPClient () :
 // (1) Para evitar la ejecucion de la aplicacion en caso de indicar un valor no valido.
 //-----------------------------------------------------------------------------------------
 void LDAPClient::run ()
-   throw (RuntimeException)
+   noexcept(false)
 {
    LOGMETHOD (TraceMethod tm ("LDAPClient", "run", ANNA_FILE_LOCATION));
 
@@ -196,7 +168,7 @@ void LDAPClient::run ()
 }
 
 void MySession::eventResponse (const ldap::Response& response) 
-   throw (RuntimeException)
+   noexcept(false)
 {
    cout << "LDAP Response: " << response.asString () << endl;
    cout << "   Name: " << response.getName () << endl;   
@@ -222,7 +194,7 @@ void MySession::eventResponse (const ldap::Response& response)
 }
 
 bool Buddy::tick () 
-   throw (RuntimeException
+   noexcept(false
 {
    CommandLine& cl = CommandLine::instantiate ();
 
@@ -250,7 +222,7 @@ bool Buddy::tick ()
 }
 
 void Stopper::expire (Engine*) 
-   throw (RuntimeException)
+   noexcept(false)
 {
    LOGMETHOD (TraceMethod tm ("Stopper", "expire", ANNA_FILE_LOCATION));