diff --git a/inst/include/jsonify/from_json/from_json.hpp b/inst/include/jsonify/from_json/from_json.hpp index 363fb99..e9cc6b9 100644 --- a/inst/include/jsonify/from_json/from_json.hpp +++ b/inst/include/jsonify/from_json/from_json.hpp @@ -1,8 +1,11 @@ #ifndef R_JSONIFY_FROM_JSON_H #define R_JSONIFY_FROM_JSON_H +#include "jsonify/jsonify_types.hpp" + #include + #include "from_json_utils.hpp" #include "simplify/simplify.hpp" diff --git a/inst/include/jsonify/jsonify.hpp b/inst/include/jsonify/jsonify.hpp index b5e9e3b..55b0b86 100644 --- a/inst/include/jsonify/jsonify.hpp +++ b/inst/include/jsonify/jsonify.hpp @@ -1,45 +1,7 @@ #ifndef R_JSONIFY_H #define R_JSONIFY_H -#include "rapidjson/document.h" - -#include - -namespace Rcpp { - - template< typename T > SEXP wrap( const rapidjson::Value::ValueType& obj ); - -namespace traits { - -} // traits -} // Rcpp - - - - -#include - - - -namespace Rcpp { - - template< typename T > - SEXP wrap( const rapidjson::Value::ValueType& obj) { - const int RTYPE = Rcpp::traits::r_sexptype_traits< T >::rtype; - - return Rcpp::wrap< RTYPE >( obj.Get< T >() ); - } - - -namespace traits { - - -} // traits -} // Rcpp - - - - +#include "jsonify_types.hpp" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" diff --git a/inst/include/jsonify/jsonify_types.hpp b/inst/include/jsonify/jsonify_types.hpp new file mode 100644 index 0000000..fb92577 --- /dev/null +++ b/inst/include/jsonify/jsonify_types.hpp @@ -0,0 +1,43 @@ +#ifndef R_JSONIFY_TYPES_H +#define R_JSONIFY_TYPES_H + +#include "rapidjson/document.h" + +#include + +namespace Rcpp { + +template< typename T > SEXP wrap( const rapidjson::Value& obj ); + +namespace traits { + +} // traits +} // Rcpp + + + + +#include + + + +namespace Rcpp { + +template< typename T > +SEXP wrap( const rapidjson::Value& obj) { + + const int RTYPE = Rcpp::traits::r_sexptype_traits< T >::rtype; + + return Rcpp::wrap< RTYPE >( obj.Get< T >() ); +} + + +namespace traits { + + +} // traits +} // Rcpp + + + +#endif \ No newline at end of file