Remove dynamic exceptions
[anna.git] / source / time / Date.cpp
index e09a589..0745fdd 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 <anna/core/tracing/Logger.hpp>
@@ -65,7 +37,7 @@ using namespace anna::time;
 //------------------------------------------------------------------------------
 //----------------------------------------------------------- Date::initialize()
 //------------------------------------------------------------------------------
-void Date::initialize(const char * TZ) throw() {
+void Date::initialize(const char * TZ) {
   a_timestamp = ::time(NULL);
   setTz(TZ);
 }
@@ -74,7 +46,7 @@ void Date::initialize(const char * TZ) throw() {
 //------------------------------------------------------------------------------
 //-------------------------------------------------------------- Date::refresh()
 //------------------------------------------------------------------------------
-void Date::refresh(void) throw() {
+void Date::refresh(void) {
   anna::Guard guard(a_mutex);
 
   // Set current/programmed timezone
@@ -106,7 +78,7 @@ Date::Date(const char *TZ) {
 //------------------------------------------------------------------------------
 //---------------------------------------------------------------- Date::setTz()
 //------------------------------------------------------------------------------
-void Date::setTz(const char * TZ) throw() {
+void Date::setTz(const char * TZ) {
   if (TZ) a_tz.set(TZ);
   else a_tz = functions::getSystemTimezone(); 
 
@@ -117,7 +89,7 @@ void Date::setTz(const char * TZ) throw() {
 //------------------------------------------------------------------------------
 //---------------------------------------------------- Date::setSystemTimezone()
 //------------------------------------------------------------------------------
-void Date::setSystemTimezone() throw() {
+void Date::setSystemTimezone() {
   a_tz = functions::getSystemTimezone();
   // Refresh the other data:
   refresh();
@@ -127,7 +99,7 @@ void Date::setSystemTimezone() throw() {
 //------------------------------------------------------------------------------
 //---------------------------------------------------------------- Date::store()
 //------------------------------------------------------------------------------
-void Date::store(const time_t & unixTimestamp) throw() {
+void Date::store(const time_t & unixTimestamp) {
   a_timestamp = unixTimestamp;
   // Refresh the other data:
   refresh();
@@ -137,7 +109,7 @@ void Date::store(const time_t & unixTimestamp) throw() {
 //------------------------------------------------------------------------------
 //------------------------------------------------------------- Date::storeNtp()
 //------------------------------------------------------------------------------
-void Date::storeNtp(const unsigned int & ntpTimestamp) throw() {
+void Date::storeNtp(const unsigned int & ntpTimestamp) {
   a_timestamp = ntpTimestamp - TIMESTAMP_OFFSET_NTP1900_OVER_UNIX1970;
   // Refresh the other data:
   refresh();
@@ -149,7 +121,7 @@ void Date::storeNtp(const unsigned int & ntpTimestamp) throw() {
 //------------------------------------------------------------------------------
 void Date::store(const struct tm &date, const char *TZ)
 
-throw(anna::RuntimeException)
+noexcept(false)
 
 {
   if (TZ) {
@@ -181,7 +153,7 @@ throw(anna::RuntimeException)
 //---------------------------------------------------------------- Date::store()
 //------------------------------------------------------------------------------
 void Date::store(const std::string &stringDate, const char *TZ, const char *strptimeFormat)
-throw(anna::RuntimeException)
+noexcept(false)
 {
   if(strptimeFormat == NULL)
     throw anna::RuntimeException("Invalid NULL strptimeFormat !!", ANNA_FILE_LOCATION);
@@ -223,7 +195,7 @@ Date & Date::operator = (const Date & d) {
 //------------------------------------------------------------------------------
 //--------------------------------------------------------------- Date::getDay()
 //------------------------------------------------------------------------------
-const char *Date::getDay(void) const throw() {
+const char *Date::getDay(void) const {
 
   static const char *weekdayname[] = {"Sunday", "Monday", "Tuesday",
     "Wednesday", "Thursday", "Friday", "Saturday"};
@@ -235,7 +207,7 @@ const char *Date::getDay(void) const throw() {
 //------------------------------------------------------------------------------
 //------------------------------------------------------- Date::yyyymmddHHmmss()
 //------------------------------------------------------------------------------
-std::string Date::yyyymmddHHmmss(void) const throw() {
+std::string Date::yyyymmddHHmmss(void) const {
   return anna::functions::asString("%04d%02d%02d%02d%02d%02d",
      1900 + a_tm.tm_year, 1 + (a_tm.tm_mon), a_tm.tm_mday,
      a_tm.tm_hour, a_tm.tm_min, a_tm.tm_sec);
@@ -245,7 +217,7 @@ std::string Date::yyyymmddHHmmss(void) const throw() {
 //------------------------------------------------------------------------------
 //------------------------------------------------------------- Date::asString()
 //------------------------------------------------------------------------------
-std::string Date::asString(void) const throw() {
+std::string Date::asString(void) const {
 
   std::string result = anna::functions::asString("%s %02d/%02d/%04d %02d:%02d:%02d ", getDay(),
                           getTm().tm_mday, 1 + (getTm().tm_mon), 1900 + getTm().tm_year,
@@ -262,7 +234,7 @@ std::string Date::asString(void) const throw() {
 //------------------------------------------------------------------------------
 //---------------------------------------------------------------- Date::asXML()
 //------------------------------------------------------------------------------
-anna::xml::Node* Date::asXML(anna::xml::Node* parent) const throw() {
+anna::xml::Node* Date::asXML(anna::xml::Node* parent) const {
   //anna::xml::Node* result = parent->createChild("anna.time.Date");
   parent->createAttribute("Date", anna::functions::asString("%02d/%02d/%04d", getTm().tm_mday, 1 + (getTm().tm_mon), 1900 + getTm().tm_year));
   parent->createAttribute("Day", getDay());