File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed
include/Rcpp/date_datetime Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 22
33 * inst/include/Rcpp/date_datetime/Date.h (format, operator<<): Added
44 * inst/include/Rcpp/date_datetime/Datetime.h (format, operator<<): Ditto
5+ * inst/include/Rcpp/date_datetime/newDateVector.h (operator<<): Ditto
6+ * inst/include/Rcpp/date_datetime/newDatetimeVector.h (operator<<): Ditto
57
682016-11-23 Dirk Eddelbuettel <edd@debian.org>
79
Original file line number Diff line number Diff line change 88 \itemize {
99 \item The exception stack message is now correctly demangled on all
1010 compiler versions (Jim Hester in \ghpr {598 })
11- \item Date and Datetime object now have format methods
11+ \item Date and Datetime object and vector now have format methods and
12+ \code {operator << } support (PR \ghpr {599 })
1213 }
1314 \item Changes in Rcpp unit tests
1415 \itemize {
Original file line number Diff line number Diff line change @@ -52,13 +52,24 @@ namespace Rcpp {
5252 return *this ;
5353 }
5454
55+ friend inline std::ostream &operator <<(std::ostream & s, const newDateVector d);
56+
5557 private:
5658
5759 void setClass () {
5860 Shield<SEXP> dateclass (Rf_mkString (" Date" ));
5961 Rf_setAttrib (*this , R_ClassSymbol, dateclass);
6062 }
6163 };
64+
65+ inline std::ostream &operator <<(std::ostream & os, const newDateVector d) {
66+ int n = d.size ();
67+ for (int i=0 ; i<n; i++) {
68+ os << Date (d[i]).format () << " " ;
69+ if ((i+1 ) % 8 == 0 ) os << " \n " ;
70+ }
71+ return os;
72+ }
6273}
6374
6475#endif
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ namespace Rcpp {
6161 return *this ;
6262 }
6363
64+ friend inline std::ostream &operator <<(std::ostream & s, const newDatetimeVector d);
65+
6466 private:
6567
6668 void setClass (const char *tz) {
@@ -75,6 +77,16 @@ namespace Rcpp {
7577 }
7678 }
7779 };
80+
81+ inline std::ostream &operator <<(std::ostream & os, const newDatetimeVector d) {
82+ int n = d.size ();
83+ for (int i=0 ; i<n; i++) {
84+ os << Datetime (d[i]).format () << " " ;
85+ if ((i+1 ) % 4 == 0 ) os << " \n " ;
86+ }
87+ return os;
88+ }
89+
7890}
7991
8092#endif
You can’t perform that action at this time.
0 commit comments