libSBML C++ API  libSBML 5.8.0 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Date.cpp File Reference

Detailed Description

Date I/O.

Author
Sarah Keating

Copyright (C) 2009-2013 jointly by the following organizations: 1. California Institute of Technology, Pasadena, CA, USA 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK

Copyright (C) 2006-2008 by the California Institute of Technology, Pasadena, CA, USA

Copyright (C) 2002-2005 jointly by the following organizations: 1. California Institute of Technology, Pasadena, CA, USA 2. Japan Science and Technology Agency, Japan

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation. A copy of the license agreement is provided in the file named "LICENSE.txt" included with this software distribution. It is also available online at http://sbml.org/software/libsbml/license.html

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Include dependency graph for Date.cpp:

Functions

Date_tDate_clone (const Date_t *date)
 Creates a deep copy of the given Date_t structure. More...
 
Date_tDate_createFromString (const char *date)
 Creates a date from a string. More...
 
Date_tDate_createFromValues (unsigned int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int minute, unsigned int second, unsigned int sign, unsigned int hoursOffset, unsigned int minutesOffset)
 Creates a date optionally from the individual fields entered as numbers. More...
 
void Date_free (Date_t *date)
 Destroys this Date. More...
 
const char * Date_getDateAsString (Date_t *date)
 Returns the Date as a string. More...
 
unsigned int Date_getDay (Date_t *date)
 Returns the day from this Date. More...
 
unsigned int Date_getHour (Date_t *date)
 Returns the hour from this Date. More...
 
unsigned int Date_getHoursOffset (Date_t *date)
 Returns the hours of the offset from this Date. More...
 
unsigned int Date_getMinute (Date_t *date)
 Returns the minute from this Date. More...
 
unsigned int Date_getMinutesOffset (Date_t *date)
 Returns the minutes of the offset from this Date. More...
 
unsigned int Date_getMonth (Date_t *date)
 Returns the month from this Date. More...
 
unsigned int Date_getSecond (Date_t *date)
 Returns the seconds from this Date. More...
 
unsigned int Date_getSignOffset (Date_t *date)
 Returns the sign of the offset from this Date. More...
 
unsigned int Date_getYear (Date_t *date)
 Returns the year from this Date. More...
 
int Date_representsValidDate (Date_t *date)
 
int Date_setDateAsString (Date_t *date, const char *str)
 Sets the value of the date from a string. More...
 
int Date_setDay (Date_t *date, unsigned int value)
 Sets the value of the day checking appropriateness. More...
 
int Date_setHour (Date_t *date, unsigned int value)
 Sets the value of the hour checking appropriateness. More...
 
int Date_setHoursOffset (Date_t *date, unsigned int value)
 Sets the value of the offset hour checking appropriateness. More...
 
int Date_setMinute (Date_t *date, unsigned int value)
 Sets the value of the minute checking appropriateness. More...
 
int Date_setMinutesOffset (Date_t *date, unsigned int value)
 Sets the value of the offset minutes checking appropriateness. More...
 
int Date_setMonth (Date_t *date, unsigned int value)
 Sets the value of the month checking appropriateness. More...
 
int Date_setSecond (Date_t *date, unsigned int value)
 Sets the value of the second checking appropriateness. More...
 
int Date_setSignOffset (Date_t *date, unsigned int value)
 Sets the value of the offset sign checking appropriateness. More...
 
int Date_setYear (Date_t *date, unsigned int value)
 Sets the value of the year checking appropriateness. More...
 

Function Documentation

Date_t* Date_clone ( const Date_t date)

Creates a deep copy of the given Date_t structure.

Parameters
datethe Date_t structure to be copied
Returns
a (deep) copy of the given Date_t structure.
Date_t* Date_createFromString ( const char *  date)

Creates a date from a string.

Parameters
datea string representing the date.
Returns
pointer to the newly created Date_t structure.
Note
the string should be in W3CDTF format YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) where TZD is the time zone designator.
Date_t* Date_createFromValues ( unsigned int  year,
unsigned int  month,
unsigned int  day,
unsigned int  hour,
unsigned int  minute,
unsigned int  second,
unsigned int  sign,
unsigned int  hoursOffset,
unsigned int  minutesOffset 
)

Creates a date optionally from the individual fields entered as numbers.

Parameters
yearan unsigned int representing the year.
monthan unsigned int representing the month.
dayan unsigned int representing the day.
houran unsigned int representing the hour.
minutean unsigned int representing the minute.
secondan unsigned int representing the second.
signan unsigned int representing the sign of the offset (0/1 equivalent to +/-).
hoursOffsetan unsigned int representing the hoursOffset.
minutesOffsetan unsigned int representing the minutesOffset.
Returns
pointer to the newly created Date_t structure.
void Date_free ( Date_t date)

Destroys this Date.

Parameters
dateDate_t structure to be freed.
const char* Date_getDateAsString ( Date_t date)

Returns the Date as a string.

Parameters
datethe Date_t structure to be queried
Returns
the date as a string.
unsigned int Date_getDay ( Date_t date)

Returns the day from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the day from this Date.
unsigned int Date_getHour ( Date_t date)

Returns the hour from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the hour from this Date.
unsigned int Date_getHoursOffset ( Date_t date)

Returns the hours of the offset from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the hours of the offset from this Date.
unsigned int Date_getMinute ( Date_t date)

Returns the minute from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the minute from this Date.
unsigned int Date_getMinutesOffset ( Date_t date)

Returns the minutes of the offset from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the minutes of the offset from this Date.
unsigned int Date_getMonth ( Date_t date)

Returns the month from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the month from this Date.
unsigned int Date_getSecond ( Date_t date)

Returns the seconds from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the seconds from this Date.
unsigned int Date_getSignOffset ( Date_t date)

Returns the sign of the offset from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the sign of the offset from this Date.
unsigned int Date_getYear ( Date_t date)

Returns the year from this Date.

Parameters
datethe Date_t structure to be queried
Returns
the year from this Date.
int Date_representsValidDate ( Date_t date)
int Date_setDateAsString ( Date_t date,
const char *  str 
)

Sets the value of the date from a string.

Parameters
datethe Date_t structure to be set
strstring representing the date to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setDay ( Date_t date,
unsigned int  value 
)

Sets the value of the day checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the day to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setHour ( Date_t date,
unsigned int  value 
)

Sets the value of the hour checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the hour to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT;
int Date_setHoursOffset ( Date_t date,
unsigned int  value 
)

Sets the value of the offset hour checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the hours of the offset to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setMinute ( Date_t date,
unsigned int  value 
)

Sets the value of the minute checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the minute to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setMinutesOffset ( Date_t date,
unsigned int  value 
)

Sets the value of the offset minutes checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the minutes of the offset to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setMonth ( Date_t date,
unsigned int  value 
)

Sets the value of the month checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the month to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setSecond ( Date_t date,
unsigned int  value 
)

Sets the value of the second checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the second to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setSignOffset ( Date_t date,
unsigned int  value 
)

Sets the value of the offset sign checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the sign of the offset to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT
int Date_setYear ( Date_t date,
unsigned int  value 
)

Sets the value of the year checking appropriateness.

Parameters
datethe Date_t structure to be set
valuean unsigned int representing the year to set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_ATTRIBUTE_VALUE
  • LIBSBML_INVALID_OBJECT