Remove dynamic exceptions
[anna.git] / include / anna / dbos / Accesor.hpp
index a7bcd46..0533649 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 //
 
 
 #ifndef anna_dbos_Accesor_hpp
@@ -73,14 +45,14 @@ public:
      Devuelve el identificador de este accesor.
      \return El identificador de este accesor.
   */
-  Id getId() const throw() { return a_id; }
+  Id getId() const { return a_id; }
 
   /**
      Devuelve la instancia de la sentencia \em statement asociada a este cargador.
      \return La instancia de la sentencia \em statement asociada a este cargador. Puede ser NULL.
   */
   dbms::Statement* getStatement()
-  throw(RuntimeException) {
+  noexcept(false) {
     return (a_statement == NULL && a_database != NULL) ? (a_statement = initialize(*a_database)) : a_statement;
   }
 
@@ -88,7 +60,7 @@ public:
    * Devuelve \em true si el accesor fue inicializado con base de datos o \em false en otro caso.
    * \return \em true si el accesor fue inicializado con base de datos o \em false en otro caso.
    */
-  bool hasDataBase() const throw() { return a_database != NULL; }
+  bool hasDataBase() const { return a_database != NULL; }
 
   /**
      Devuelve la instancia de la base de datos asociada a este cargador.
@@ -96,13 +68,13 @@ public:
 
      \warning Si el accesor fue inicializado sin base de datos lo resultados no están definidos.
   */
-  dbms::Database& getDatabase() throw() { return *a_database; }
+  dbms::Database& getDatabase() { return *a_database; }
 
   /**
      Devuelve la conexion que esta usando actualmente este cargador.
      \return la conexion que esta usando actualmente este cargador.
   */
-  dbms::Connection& getConnection() throw(RuntimeException) {
+  dbms::Connection& getConnection() noexcept(false) {
     if(a_connection == NULL) {
       std::string msg(asString());
       msg += " | No available database connection";
@@ -116,7 +88,7 @@ public:
      Devuelve la representacion en forma de cadena de la clave primaria establecida.
      @return La representacion en forma de cadena de la clave primaria establecida.
   */
-  virtual std::string asString() const throw() = 0;
+  virtual std::string asString() const  = 0;
 
   /**
      Metodo de debemos re-escribir para devolver el nombre completo del selector de recursos.
@@ -124,7 +96,7 @@ public:
      a la que pertenece la clase.
      \return Una cadena con el nombre de este selector.
   */
-  virtual const char* getClassName() const throw() = 0;
+  virtual const char* getClassName() const  = 0;
 
 protected:
   /**
@@ -177,7 +149,7 @@ protected:
      definir este metodo.
      \param database Instancia de la base de datos indicada en el constructor.
   */
-  virtual dbms::Statement* initialize(dbms::Database& database) throw(RuntimeException) = 0;
+  virtual dbms::Statement* initialize(dbms::Database& database) noexcept(false) = 0;
 
 private:
   dbms::Database* a_database;
@@ -187,9 +159,9 @@ private:
   bool a_emodeIsNull;
   Exception::Mode::_v a_exceptionMode;
 
-  void setStatement(dbms::Statement* statement) throw() { a_statement = statement; }
+  void setStatement(dbms::Statement* statement) { a_statement = statement; }
 
-  virtual bool load(dbms::Connection*, const StorageArea*) throw(RuntimeException, dbms::DatabaseException);
+  virtual bool load(dbms::Connection*, const StorageArea*) noexcept(false);
 
   friend class StorageArea;
 };