Rcpp Version 1.1.2
Loading...
Searching...
No Matches
Rcpp::Date Class Reference

#include <Date.h>

Public Member Functions

 Date ()
 Date (SEXP s)
 Date (const int &dt)
 Date (const double &dt)
 Date (const std::string &s, const std::string &fmt="%Y-%m-%d")
 Date (const unsigned int &mon, const unsigned int &day, const unsigned int &year)
double getDate (void) const
int getDay () const
int getMonth () const
int getYear () const
int getWeekday () const
int getYearday () const
int is_na () const
 operator double () const
std::string format (const char *fmt="%Y-%m-%d") const

Static Public Member Functions

static unsigned int baseYear ()

Private Member Functions

void update_tm ()

Private Attributes

double m_d
struct tm m_tm

Friends

Date operator+ (const Date &date, int offset)
double operator- (const Date &date1, const Date &date2)
bool operator< (const Date &date1, const Date &date2)
bool operator> (const Date &date1, const Date &date2)
bool operator== (const Date &date1, const Date &date2)
bool operator>= (const Date &date1, const Date &date2)
bool operator<= (const Date &date1, const Date &date2)
bool operator!= (const Date &date1, const Date &date2)
std::ostream & operator<< (std::ostream &os, const Date d)

Detailed Description

Definition at line 31 of file Date.h.

Constructor & Destructor Documentation

◆ Date() [1/6]

Rcpp::Date::Date ( )
inline

Definition at line 33 of file Date.h.

References m_d, and update_tm().

Referenced by operator!=, operator+, operator-, operator<, operator<<, operator<=, operator==, operator>, and operator>=.

Here is the call graph for this function:

◆ Date() [2/6]

Rcpp::Date::Date ( SEXP s)
inline

Definition at line 25 of file Date.h.

References Rcpp::as(), m_d, and update_tm().

Here is the call graph for this function:

◆ Date() [3/6]

Rcpp::Date::Date ( const int & dt)
inline

Definition at line 40 of file Date.h.

References m_d, and update_tm().

Here is the call graph for this function:

◆ Date() [4/6]

Rcpp::Date::Date ( const double & dt)
inline

Definition at line 46 of file Date.h.

References m_d, and update_tm().

Here is the call graph for this function:

◆ Date() [5/6]

Rcpp::Date::Date ( const std::string & s,
const std::string & fmt = "%Y-%m-%d" )
inline

Definition at line 30 of file Date.h.

References Rcpp::as(), m_d, and update_tm().

Here is the call graph for this function:

◆ Date() [6/6]

Rcpp::Date::Date ( const unsigned int & mon,
const unsigned int & day,
const unsigned int & year )
inline

Definition at line 52 of file Date.h.

References baseYear(), m_d, m_tm, and Rcpp::mktime00().

Here is the call graph for this function:

Member Function Documentation

◆ baseYear()

unsigned int Rcpp::Date::baseYear ( )
inlinestatic

Definition at line 85 of file Date.h.

Referenced by Date(), and format().

◆ format()

std::string Rcpp::Date::format ( const char * fmt = "%Y-%m-%d") const
inline

Definition at line 107 of file Date.h.

References baseYear(), m_tm, and Rcpp::tm.

Referenced by operator<<, and Rcpp::newDateVector::operator<<.

Here is the call graph for this function:

◆ getDate()

double Rcpp::Date::getDate ( void ) const
inline

Definition at line 70 of file Date.h.

References m_d.

Referenced by Rcpp::internal::caster< Rcpp::Date, double >(), and Rcpp::wrap().

◆ getDay()

int Rcpp::Date::getDay ( ) const
inline

Definition at line 78 of file Date.h.

References m_tm.

◆ getMonth()

int Rcpp::Date::getMonth ( ) const
inline

Definition at line 79 of file Date.h.

References m_tm.

◆ getWeekday()

int Rcpp::Date::getWeekday ( ) const
inline

Definition at line 81 of file Date.h.

References m_tm.

◆ getYear()

int Rcpp::Date::getYear ( ) const
inline

Definition at line 80 of file Date.h.

References m_tm.

◆ getYearday()

int Rcpp::Date::getYearday ( ) const
inline

Definition at line 82 of file Date.h.

References m_tm.

◆ is_na()

int Rcpp::Date::is_na ( ) const
inline

Definition at line 99 of file Date.h.

References Rcpp::traits::is_na< REALSXP >(), and m_d.

Here is the call graph for this function:

◆ operator double()

Rcpp::Date::operator double ( ) const
inline

Definition at line 103 of file Date.h.

References m_d.

◆ update_tm()

void Rcpp::Date::update_tm ( )
inlineprivate

Definition at line 126 of file Date.h.

References Rcpp::gmtime_(), m_d, and m_tm.

Referenced by Date(), Date(), Date(), Date(), and Date().

Here is the call graph for this function:

◆ operator!=

bool operator!= ( const Date & date1,
const Date & date2 )
friend

Definition at line 170 of file Date.h.

References Date(), and m_d.

◆ operator+

Date operator+ ( const Date & date,
int offset )
friend

Definition at line 156 of file Date.h.

References Date(), Rcpp::gmtime_(), m_d, and m_tm.

◆ operator-

double operator- ( const Date & date1,
const Date & date2 )
friend

Definition at line 164 of file Date.h.

References Date(), and m_d.

◆ operator<

bool operator< ( const Date & date1,
const Date & date2 )
friend

Definition at line 165 of file Date.h.

References Date(), and m_d.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Date d )
friend

Definition at line 172 of file Date.h.

References Date(), and format().

◆ operator<=

bool operator<= ( const Date & date1,
const Date & date2 )
friend

Definition at line 169 of file Date.h.

References Date(), and m_d.

◆ operator==

bool operator== ( const Date & date1,
const Date & date2 )
friend

Definition at line 167 of file Date.h.

References Date(), and m_d.

◆ operator>

bool operator> ( const Date & date1,
const Date & date2 )
friend

Definition at line 166 of file Date.h.

References Date(), and m_d.

◆ operator>=

bool operator>= ( const Date & date1,
const Date & date2 )
friend

Definition at line 168 of file Date.h.

References Date(), and m_d.

Member Data Documentation

◆ m_d

double Rcpp::Date::m_d
private

◆ m_tm

struct tm Rcpp::Date::m_tm
private

Definition at line 123 of file Date.h.

Referenced by Date(), format(), getDay(), getMonth(), getWeekday(), getYear(), getYearday(), operator+, and update_tm().


The documentation for this class was generated from the following files:
  • inst/include/Rcpp/date_datetime/Date.h
  • inst/include/Rcpp/api/meat/Date.h