X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdbms%2FDate.hpp;h=c5c6f2fae03c84a583a48aefa7e1390852efd33e;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=f7865364e7f9c993b990022aac77cfd3ccebff24;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/dbms/Date.hpp b/include/anna/dbms/Date.hpp index f786536..c5c6f2f 100644 --- a/include/anna/dbms/Date.hpp +++ b/include/anna/dbms/Date.hpp @@ -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_dbms_Date_hpp @@ -195,21 +167,21 @@ public: \return El contenido de esta fecha. \warning Si el metodo Data::isNull devolvio \em true el contenido de la estructura no esta definido. */ - const tm& getValue() const throw() { return a_value; } + const tm& getValue() const { return a_value; } /** Devuelve el contenido de esta fecha. \return El contenido de esta fecha. \warning Si el metodo Data::isNull devolvio \em true el contenido de la estructura no esta definido. */ - tm& getValue() throw() { return a_value; } + tm& getValue() { return a_value; } /** * Interpreta el contenido de la fecha y lo transfiere al buffer. * \return El buffer que contiene esta fecha interpretada con el formato indicado en el contructor. * \warning El resultado sera NULL en caso de no poder interpretar correctamente la fecha. */ - virtual const char* getCStringValue() const throw(); + virtual const char* getCStringValue() const ; /** * Interpreta el contenido de esta fecha como el numero de segundos transcurridos desde el 1 de Enero de 1970. @@ -219,112 +191,112 @@ public: * Si el contenido de la columna sociada es nulo este metodo devolvera 0. Si la conversion a * segundos no puede ser realizada devolvera -1. */ - Second getSecondValue() const throw() { return Second((Data::isNull() == true) ? 0 : mktime(&const_cast (this)->a_value)); } + Second getSecondValue() const { return Second((Data::isNull() == true) ? 0 : mktime(&const_cast (this)->a_value)); } /** * Devuelve el formato indicado en el constructor de la clase. * \return El formato indicado en el constructor de la clase. */ - const char* getFormat() const throw() { return a_format; } + const char* getFormat() const { return a_format; } /** * Devuelve el año contenido por esta fecha. * \return El año contenido por esta fecha. */ - int getYear() const throw() { return a_value.tm_year + 1900; } + int getYear() const { return a_value.tm_year + 1900; } /** * Devuelve el mes contenido por esta fecha. * \return El mes contenido por esta fecha. */ - int getMonth() const throw() { return a_value.tm_mon + 1; } + int getMonth() const { return a_value.tm_mon + 1; } /** * Devuelve el dia del mes contenido por esta fecha. * \return El dia del mes contenido por esta fecha. */ - int getDay() const throw() { return a_value.tm_mday; } + int getDay() const { return a_value.tm_mday; } /** * Devuelve la hora del dia contenida en la fecha. * \return La hora del dia contenida en la fecha. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - int getHour() const throw() { return a_value.tm_hour; } + int getHour() const { return a_value.tm_hour; } /** * Devuelve el minuto de la hora contenida en la fecha. * \return El minuto de la hora contenida en la fecha. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - int getMinute() const throw() { return a_value.tm_min; } + int getMinute() const { return a_value.tm_min; } /** * Devuelve el segundo de la hora contenida en la fecha. * \return El segundo de la hora contenida en la fecha. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - int getSecond() const throw() { return a_value.tm_sec; } + int getSecond() const { return a_value.tm_sec; } /** * Establece el año de esta fecha * \param year Año de la fecha. Debe ser mayor de 1900. */ - void setYear(const int year) throw(RuntimeException) { set("Year", a_value.tm_year, year - 1900, 0, -1); } + void setYear(const int year) noexcept(false) { set("Year", a_value.tm_year, year - 1900, 0, -1); } /** * Establece mes de esta fecha. * \param month Mes de la fecha. Debe estar comprendido entre 1 y 12. */ - void setMonth(const int month) throw(RuntimeException) { set("Month", a_value.tm_mon, month - 1, 0, 11); } + void setMonth(const int month) noexcept(false) { set("Month", a_value.tm_mon, month - 1, 0, 11); } /** * Establece el dia del mes de esta fecha. * \param day Dia del mes. Debe estar comprendido entre 1 y 31. */ - void setDay(const int day) throw(RuntimeException) { set("Day", a_value.tm_mday, day, 1, 31); } + void setDay(const int day) noexcept(false) { set("Day", a_value.tm_mday, day, 1, 31); } /** * Establece la hora de esta fecha. * \param hour Hora del dia. Debe estar comprendida entre 0 y 23. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - void setHour(const int hour) throw(RuntimeException) { set("Hour", a_value.tm_hour, hour, 0, 23); } + void setHour(const int hour) noexcept(false) { set("Hour", a_value.tm_hour, hour, 0, 23); } /** * Establece el minuto de esta fecha. * \param minute Minuto de la hora del dia. Debe estar comprendida entre 0 y 59. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - void setMinute(const int minute) throw(RuntimeException) { set("Minute", a_value.tm_min, minute, 0, 59); } + void setMinute(const int minute) noexcept(false) { set("Minute", a_value.tm_min, minute, 0, 59); } /** * Establece el segundo de esta fecha. * \param second Segungo de la hora del dia. Debe estar comprendida entre 0 y 60. * \warning Verifique que el tipo 'Date' de su RDBMS es capaz de contener horas, minutos y segundos. */ - void setSecond(const int second) throw(RuntimeException) { set("Second", a_value.tm_sec, second, 0, 60); } + void setSecond(const int second) noexcept(false) { set("Second", a_value.tm_sec, second, 0, 60); } /** Interpreta la cadena recibida segun el formato indicado en el constructor y la asigna a esta instancia, pero requiere que al invocar al constructor de esta fecha se indique el formato usado para traducir. \param str Cadena de la que copiar. */ - void setValue(const char* str) throw(RuntimeException); + void setValue(const char* str) noexcept(false); /** Interpreta la cadena recibida segun el formato indicado en el constructor y la asigna a esta instancia, pero requiere que al invocar al constructor de esta fecha se indique el formato usado para traducir. \param str Cadena de la que copiar. */ - void setValue(const std::string& str) throw(RuntimeException) { setValue(str.c_str()); } + void setValue(const std::string& str) noexcept(false) { setValue(str.c_str()); } /** * Establece esta fecha con los segundos transcurridos desde el 1/1/1970. * \param second Numeros de segundos transcurridos desde el 1 de Enero de 1970. * \see anna::functions::second */ - void setValue(const Second &second) throw(RuntimeException); + void setValue(const Second &second) noexcept(false); /** Operador de copia. @@ -332,13 +304,13 @@ public: \return La instancia de esta fecha. \warning Solo copia el contenido de la fecha recibida, no cambia el formato de interpretacion de la fecha origen. */ - Date& operator = (const Date& date) throw(RuntimeException); + Date& operator = (const Date& date) noexcept(false); /** Devuelve una cadena con la informacion referente a esta instancia. \return Una cadena con la informacion referente a esta instancia. */ - virtual std::string asString() const throw(); + virtual std::string asString() const ; protected: char* a_format; @@ -354,8 +326,8 @@ protected: explicit Date(const Type::_v type, const bool isNulleable, const char* format); private: - void set(const char* what, int& variable, const int value, const int min, const int max) throw(RuntimeException); - void do_clear() throw() { anna_memset(&a_value, 0, sizeof(a_value)); } + void set(const char* what, int& variable, const int value, const int min, const int max) noexcept(false); + void do_clear() { anna_memset(&a_value, 0, sizeof(a_value)); } }; }