[Rcpp-commits] r3572 - in pkg/RcppBDT: . inst/include src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 12 05:52:02 CEST 2012


Author: edd
Date: 2012-04-12 05:52:01 +0200 (Thu, 12 Apr 2012)
New Revision: 3572

Modified:
   pkg/RcppBDT/ChangeLog
   pkg/RcppBDT/inst/include/RcppBDT.h
   pkg/RcppBDT/src/RcppBDT.cpp
Log:
remove exception specifications
expand name of a local #define to be more explicit


Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog	2012-04-11 20:31:04 UTC (rev 3571)
+++ pkg/RcppBDT/ChangeLog	2012-04-12 03:52:01 UTC (rev 3572)
@@ -1,3 +1,11 @@
+2012-04-11  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/RcppBDT.h, src/RcppBDT.cpp: Prefix local #define
+	variable with RcppBDT_ to avoid any possivke clashes
+
+	* inst/include/RcppBDT.h, src/RcppBDT.cpp: Remove exception
+	specifications in partial specializations for as and wrap
+
 2011-01-17  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION (Version): bumped to 0.1.0 for first CRAN upload

Modified: pkg/RcppBDT/inst/include/RcppBDT.h
===================================================================
--- pkg/RcppBDT/inst/include/RcppBDT.h	2012-04-11 20:31:04 UTC (rev 3571)
+++ pkg/RcppBDT/inst/include/RcppBDT.h	2012-04-12 03:52:01 UTC (rev 3572)
@@ -1,8 +1,8 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
 //
 // RcppBDT.h: Rcpp and Boost Date_Time glue
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012  Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of RcppBDT.
 //
@@ -31,9 +31,9 @@
 // compile-time only which make things a little easier.
 // On Windows, set the BOOSTLIB variable to point to a suitable directory.
 // On other systems, just have Boost in the include path 
-#define UseWithStrings 0
+#define RcppBDT_UseWithStrings 0
 
-#if UseWithString
+#if RcppBDT_UseWithString
   #include <boost/date_time/gregorian/gregorian.hpp> 	// Gregorian calendar types, including I/O
 #else
   #include <boost/date_time/gregorian/gregorian_types.hpp> 	// Gregorian calendar types, no I/O
@@ -41,10 +41,10 @@
 
 namespace Rcpp {
     // non-intrusive extension via template specialisation
-    template <> boost::gregorian::date as( SEXP dt ) throw(not_compatible);
+    template <> boost::gregorian::date as( SEXP dt );
 
     // non-intrusive extension via template specialisation
-    template <> SEXP wrap(const boost::gregorian::date &d) throw(not_compatible);
+    template <> SEXP wrap(const boost::gregorian::date &d);
 }
 
 #include <Rcpp.h>

Modified: pkg/RcppBDT/src/RcppBDT.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDT.cpp	2012-04-11 20:31:04 UTC (rev 3571)
+++ pkg/RcppBDT/src/RcppBDT.cpp	2012-04-12 03:52:01 UTC (rev 3572)
@@ -1,4 +1,4 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
 //
 // RcppBDT.cpp: Rcpp and Boost Date_Time glue
 //
@@ -23,18 +23,18 @@
 
 // define template specialisations for as and wrap
 namespace Rcpp {
-    template <> boost::gregorian::date as( SEXP dtsexp ) throw(not_compatible) {
+    template <> boost::gregorian::date as( SEXP dtsexp ) {
         Rcpp::Date dt(dtsexp);
         return boost::gregorian::date(dt.getYear(), dt.getMonth(), dt.getDay());
     }
 
-    template <> SEXP wrap(const boost::gregorian::date &d) throw(not_compatible) {
+    template <> SEXP wrap(const boost::gregorian::date &d) {
         boost::gregorian::date::ymd_type ymd = d.year_month_day();     // convert to y/m/d struct
         return Rcpp::wrap(Rcpp::Date( ymd.year, ymd.month, ymd.day ));
     }
 }
 
-#if UseWithStrings
+#if RcppBDT_UseWithStrings
     void date_print(boost::gregorian::date *d) {
 	std::cout << *d << std::endl;
     }
@@ -68,7 +68,7 @@
 int date_dayofweek(boost::gregorian::date *d) { return static_cast<int>( d->day_of_week() ); }
 int date_dayofyear(boost::gregorian::date *d) { return static_cast<int>( d->day_of_year() ); }
 
-#if UseWithStrings
+#if RcppBDT_UseWithStrings
     // these extract the requested date portion or representation as an integer
     std::string date_toString(boost::gregorian::date *d) { return boost::gregorian::to_simple_string(*d); }
     std::string date_toIsoString(boost::gregorian::date *d) { return boost::gregorian::to_iso_string(*d); }
@@ -153,7 +153,7 @@
     .constructor("default constructor")
     .constructor<int, int, int>("constructor from year, month, day")
 
-    #if UseWithStrings
+    #if RcppBDT_UseWithStrings
         // free functions defined above with date* as first argument
         .method("fromString", &date_fromString, "create a date from a delimited string")
         .method("fromUndelString", &date_fromUndelString, "create a date from an un delimited string")
@@ -174,7 +174,7 @@
     .method("getDayOfWeek", &date_dayofweek, "returns the day of the week")
     .method("getDayOfYear", &date_dayofyear, "returns the day of the year")
 
-    #if UseWithStrings
+    #if RcppBDT_UseWithStrings
         .method("getString", &date_toString, "returns a string representation")
         .method("getIsoString", &date_toIsoString, "returns an ISO string representation")
         .method("getExtIsoString", &date_toExtIsoString, "returns an extended ISO string representation")



More information about the Rcpp-commits mailing list