Remove dynamic exceptions
[anna.git] / include / anna / core / util / Millisecond.hpp
index 8a32ede..c9e60f0 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not 'N' 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_core_util_Millisecond_hpp
@@ -41,7 +13,7 @@
 
 #include <string>
 
-#include <anna/config/defines.hpp>
+#include <anna/core/util/defines.hpp>
 #include <anna/core/RuntimeException.hpp>
 
 namespace anna {
@@ -51,7 +23,7 @@ class Microsecond;
 
 class Millisecond {
 public:
-  typedef Integer64 type_t;
+  typedef S64 type_t;
 
   /**
    * Constructor
@@ -86,66 +58,66 @@ public:
    * Conversor a numérico.
    * \return El valor asociado a esta instancia.
    */
-  operator type_t () const throw() { return a_value; }
+  operator type_t () const { return a_value; }
 
   /**
    * \internal
    */
-  type_t& refValue() throw() { return a_value; }
+  type_t& refValue() { return a_value; }
 
-  Millisecond& operator= (const type_t other) throw() { a_value = other; return *this; }
+  Millisecond& operator= (const type_t other) { a_value = other; return *this; }
 
-  Millisecond& operator= (const Millisecond& other) throw() { a_value = other.a_value; return *this; }
+  Millisecond& operator= (const Millisecond& other) { a_value = other.a_value; return *this; }
 
-  Millisecond& operator= (const Second& other) throw();
+  Millisecond& operator= (const Second& other) ;
 
-  Millisecond& operator= (const Microsecond& other) throw();
+  Millisecond& operator= (const Microsecond& other) ;
 
-  bool operator== (const Millisecond& other) const throw() { return a_value == other.a_value; }
+  bool operator== (const Millisecond& other) const { return a_value == other.a_value; }
 
-  bool operator== (const Second& other) const throw();
+  bool operator== (const Second& other) const ;
 
-  bool operator== (const Microsecond& other) const throw();
+  bool operator== (const Microsecond& other) const ;
 
-  bool operator!= (const Millisecond& other) const throw() { return a_value != other.a_value; }
+  bool operator!= (const Millisecond& other) const { return a_value != other.a_value; }
 
-  bool operator!= (const Second& other) const throw();
+  bool operator!= (const Second& other) const ;
 
-  bool operator!= (const Microsecond& other) const throw();
+  bool operator!= (const Microsecond& other) const ;
 
-  bool operator> (const Millisecond& other) const throw() { return a_value > other.a_value; }
+  bool operator> (const Millisecond& other) const { return a_value > other.a_value; }
 
-  bool operator> (const Second& other) const throw();
+  bool operator> (const Second& other) const ;
 
-  bool operator> (const Microsecond& other) const throw();
+  bool operator> (const Microsecond& other) const ;
 
-  bool operator< (const Millisecond& other) const throw() { return a_value < other.a_value; }
+  bool operator< (const Millisecond& other) const { return a_value < other.a_value; }
 
-  bool operator< (const Second& other) const throw();
+  bool operator< (const Second& other) const ;
 
-  bool operator< (const Microsecond& other) const throw();
+  bool operator< (const Microsecond& other) const ;
 
-  bool operator>= (const Millisecond& other) const throw() { return a_value >= other.a_value; }
+  bool operator>= (const Millisecond& other) const { return a_value >= other.a_value; }
 
-  bool operator>= (const Second& other) const throw() { return (operator==(other) == true) ? true : operator>(other); }
+  bool operator>= (const Second& other) const { return (operator==(other) == true) ? true : operator>(other); }
 
-  bool operator>= (const Microsecond& other) const throw() { return (operator==(other) == true) ? true : operator>(other); }
+  bool operator>= (const Microsecond& other) const { return (operator==(other) == true) ? true : operator>(other); }
 
-  bool operator<= (const Millisecond& other) const throw() { return a_value <= other.a_value; }
+  bool operator<= (const Millisecond& other) const { return a_value <= other.a_value; }
 
-  bool operator<= (const Second& other) const throw() { return (operator==(other) == true) ? true : operator<(other); }
+  bool operator<= (const Second& other) const { return (operator==(other) == true) ? true : operator<(other); }
 
-  bool operator<= (const Microsecond& other) const throw() { return (operator==(other) == true) ? true : operator<(other); }
+  bool operator<= (const Microsecond& other) const { return (operator==(other) == true) ? true : operator<(other); }
 
-  Millisecond& operator+= (const Millisecond& other) throw() { a_value += other.a_value; return *this; }
+  Millisecond& operator+= (const Millisecond& other) { a_value += other.a_value; return *this; }
 
-  Millisecond& operator-= (const Millisecond& other) throw() {(a_value > other.a_value) ? (a_value -= other.a_value) : (a_value = 0); return *this; }
+  Millisecond& operator-= (const Millisecond& other) {(a_value > other.a_value) ? (a_value -= other.a_value) : (a_value = 0); return *this; }
 
   /**
    * Devuelve el valor asociado a esta instancia.
    * \return el valor asociado a esta instancia.
    */
-  type_t getValue() const throw() { return a_value; }
+  type_t getValue() const { return a_value; }
 
   /**
    * Si el valor de esta instancia es positivo devuelve el valor asociado a esta instancia en una estructura de
@@ -154,26 +126,26 @@ public:
    * \return Si el valor de esta instancia es positivo devuelve el valor asociado a esta instancia en una estructura de
    * time \em timeval usada habitualmente para temporizar operaciones a nivel de SO, en otro caso retorna NULL.
    */
-  timeval* getTimeVal(timeval& tv) const throw();
+  timeval* getTimeVal(timeval& tv) const ;
 
   /**
    * Devuelve la hora actual de sistema expresada en milisegundos transcurridos desde el 1 de Enero de 1970
    * \return la hora actual de sistema expresada en milisegundos transcurridos desde el 1 de Enero de 1970
    */
-  static Millisecond getTime() throw();
+  static Millisecond getTime() ;
 
   /**
    * Devuelve una cadena con el valor de esta instancia y las unidades "ms".
    * \return una cadena con el valor de esta instancia y las unidades "ms".
    */
-  std::string asString() const throw();
+  std::string asString() const ;
 
   /**
    * Obtiene los microsegundos del valor contenido en la cadena recibida como parámetro.
    * \param value Cadena que contiene los microsegundos habrá sido obtenida con #asString.
    * \return los microsegundos del valor contenido en la cadena recibida como parámetro.
    */
-  static Millisecond fromString(const std::string& value) throw(RuntimeException);
+  static Millisecond fromString(const std::string& value) noexcept(false);
 
 private:
   type_t a_value;
@@ -181,41 +153,41 @@ private:
   friend class Second;
   friend class Microsecond;
 
-  friend class Millisecond operator / (const Millisecond& left, const Millisecond& right) throw();
-  friend class Millisecond operator + (const Millisecond& left, const Millisecond& right) throw();
-  friend class Millisecond operator - (const Millisecond& left, const Millisecond& right) throw();
-  friend class Millisecond operator / (const Millisecond& left, const int right) throw();
-  friend class Millisecond operator / (const Millisecond& left, const unsigned int right) throw();
-  friend class Millisecond operator *(const Millisecond& left, const int right) throw();
+  friend class Millisecond operator / (const Millisecond& left, const Millisecond& right) ;
+  friend class Millisecond operator + (const Millisecond& left, const Millisecond& right) ;
+  friend class Millisecond operator - (const Millisecond& left, const Millisecond& right) ;
+  friend class Millisecond operator / (const Millisecond& left, const int right) ;
+  friend class Millisecond operator / (const Millisecond& left, const unsigned int right) ;
+  friend class Millisecond operator *(const Millisecond& left, const int right) ;
 };
 
 inline Millisecond operator / (const Millisecond& left, const Millisecond& right)
-throw() {
+{
   return Millisecond(left.a_value / right.a_value);
 }
 
 inline Millisecond operator + (const Millisecond& left, const Millisecond& right)
-throw() {
+{
   return Millisecond(left.a_value + right.a_value);
 }
 
 inline Millisecond operator - (const Millisecond& left, const Millisecond& right)
-throw() {
+{
   return Millisecond(left.a_value - right.a_value);
 }
 
 inline Millisecond operator / (const Millisecond& left, const int right)
-throw() {
+{
   return Millisecond(left.a_value / right);
 }
 
 inline Millisecond operator / (const Millisecond& left, const unsigned int right)
-throw() {
+{
   return Millisecond(left.a_value / right);
 }
 
 inline Millisecond operator *(const Millisecond& left, const int right)
-throw() {
+{
   return Millisecond(left.a_value * right);
 }