Skip to content

Commit ae12cc2

Browse files
committed
white-space only: indentation, around operators/braces/function/function arguments
1 parent 19d8de2 commit ae12cc2

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

inst/include/Rcpp/Date.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ namespace Rcpp {
2626

2727
class Date {
2828
public:
29-
Date(){
29+
Date() {
3030
m_d = 0;
3131
update_tm();
3232
}
3333
Date(SEXP s);
3434

3535
// from integer (with negative dates before Jan 1, 1970)
36-
Date(const int &dt){
36+
Date(const int &dt) {
3737
m_d = dt;
3838
update_tm();
3939
}
4040

4141
// from fractional integer since epoch, just like R
42-
Date(const double &dt){
42+
Date(const double &dt) {
4343
m_d = dt;
4444
update_tm();
4545
}
@@ -65,9 +65,9 @@ namespace Rcpp {
6565

6666
~Date() {};
6767

68-
double getDate(void) const {
69-
return m_d;
70-
}
68+
double getDate(void) const {
69+
return m_d;
70+
}
7171

7272
// intra-day useless for date class
7373
//int getSeconds() const { return m_tm.tm_sec; }
@@ -85,25 +85,25 @@ namespace Rcpp {
8585
}
8686

8787
// Minimal set of date operations.
88-
friend Date operator+(const Date &date, int offset);
89-
friend double operator-(const Date& date1, const Date& date2);
90-
friend bool operator<(const Date &date1, const Date& date2);
91-
friend bool operator>(const Date &date1, const Date& date2);
88+
friend Date operator+( const Date &date, int offset);
89+
friend double operator-( const Date &date1, const Date& date2);
90+
friend bool operator<( const Date &date1, const Date& date2);
91+
friend bool operator>( const Date &date1, const Date& date2);
9292
friend bool operator==(const Date &date1, const Date& date2);
9393
friend bool operator>=(const Date &date1, const Date& date2);
9494
friend bool operator<=(const Date &date1, const Date& date2);
9595
friend bool operator!=(const Date &date1, const Date& date2);
9696

9797
inline int is_na() const {
98-
return traits::is_na<REALSXP>( m_d ) ;
98+
return traits::is_na<REALSXP>(m_d);
9999
}
100100

101101
private:
102102
double m_d; // (fractional) day number, relative to epoch of Jan 1, 1970
103103
struct tm m_tm; // standard time representation
104104

105105
// update m_tm based on m_d
106-
void update_tm(){
106+
void update_tm() {
107107
if (R_FINITE(m_d)) {
108108
time_t t = 24*60*60 * m_d; // (fractional) days since epoch to seconds since epoch
109109
m_tm = *gmtime_(&t);
@@ -120,16 +120,16 @@ namespace Rcpp {
120120

121121
// needed to wrap containers of Date such as vector<Date> or map<string,Date>
122122
namespace internal {
123-
template<> inline double caster<Rcpp::Date,double>( Rcpp::Date from){
123+
template<> inline double caster<Rcpp::Date,double>(Rcpp::Date from) {
124124
return static_cast<double>( from.getDate() ) ;
125125
}
126-
template<> inline Rcpp::Date caster<double,Rcpp::Date>( double from){
127-
return Rcpp::Date( static_cast<int>( from ) ) ;
126+
template<> inline Rcpp::Date caster<double,Rcpp::Date>(double from) {
127+
return Rcpp::Date(static_cast<int>(from));
128128
}
129129
}
130130

131-
template<> inline SEXP wrap_extra_steps<Rcpp::Date>( SEXP x ){
132-
Rf_setAttrib( x, R_ClassSymbol, Rf_mkString( "Date" ) ) ;
131+
template<> inline SEXP wrap_extra_steps<Rcpp::Date>(SEXP x) {
132+
Rf_setAttrib( x, R_ClassSymbol, Rf_mkString("Date"));
133133
return x ;
134134
}
135135

@@ -141,31 +141,31 @@ namespace Rcpp {
141141
return newdate;
142142
}
143143

144-
inline double operator-(const Date& d1, const Date& d2) { return d1.m_d - d2.m_d; }
145-
inline bool operator<(const Date &d1, const Date& d2) { return d1.m_d < d2.m_d; }
146-
inline bool operator>(const Date &d1, const Date& d2) { return d1.m_d > d2.m_d; }
147-
inline bool operator==(const Date &d1, const Date& d2) { return d1.m_d == d2.m_d; }
148-
inline bool operator>=(const Date &d1, const Date& d2) { return d1.m_d >= d2.m_d; }
149-
inline bool operator<=(const Date &d1, const Date& d2) { return d1.m_d <= d2.m_d; }
150-
inline bool operator!=(const Date &d1, const Date& d2) { return d1.m_d != d2.m_d; }
144+
inline double operator-( const Date& d1, const Date& d2) { return d1.m_d - d2.m_d; }
145+
inline bool operator<( const Date &d1, const Date& d2) { return d1.m_d < d2.m_d; }
146+
inline bool operator>( const Date &d1, const Date& d2) { return d1.m_d > d2.m_d; }
147+
inline bool operator==(const Date &d1, const Date& d2) { return d1.m_d == d2.m_d; }
148+
inline bool operator>=(const Date &d1, const Date& d2) { return d1.m_d >= d2.m_d; }
149+
inline bool operator<=(const Date &d1, const Date& d2) { return d1.m_d <= d2.m_d; }
150+
inline bool operator!=(const Date &d1, const Date& d2) { return d1.m_d != d2.m_d; }
151151

152-
namespace internal{
152+
namespace internal {
153153

154-
inline SEXP getPosixClasses(){
154+
inline SEXP getPosixClasses() {
155155
Shield<SEXP> datetimeclass(Rf_allocVector(STRSXP,2));
156156
SET_STRING_ELT(datetimeclass, 0, Rf_mkChar("POSIXct"));
157157
SET_STRING_ELT(datetimeclass, 1, Rf_mkChar("POSIXt"));
158158
return datetimeclass ;
159159
}
160160

161-
inline SEXP new_posixt_object( double d){
162-
Shield<SEXP> x( Rf_ScalarReal( d ) ) ;
163-
Rf_setAttrib(x, R_ClassSymbol, getPosixClasses() );
161+
inline SEXP new_posixt_object( double d) {
162+
Shield<SEXP> x(Rf_ScalarReal(d));
163+
Rf_setAttrib(x, R_ClassSymbol, getPosixClasses());
164164
return x ;
165165
}
166166

167-
inline SEXP new_date_object( double d){
168-
Shield<SEXP> x(Rf_ScalarReal( d ) ) ;
167+
inline SEXP new_date_object(double d) {
168+
Shield<SEXP> x(Rf_ScalarReal(d)) ;
169169
Rf_setAttrib(x, R_ClassSymbol, Rf_mkString("Date"));
170170
return x;
171171
}

0 commit comments

Comments
 (0)