[Rcpp-commits] r1364 - in pkg/Rcpp: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 29 13:55:38 CEST 2010


Author: romain
Date: 2010-05-29 13:55:38 +0200 (Sat, 29 May 2010)
New Revision: 1364

Added:
   pkg/Rcpp/man/completion.Rd
Modified:
   pkg/Rcpp/NAMESPACE
   pkg/Rcpp/R/Module.R
   pkg/Rcpp/R/zzz.R
   pkg/Rcpp/inst/ChangeLog
Log:
support for completion of C++ objects

Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE	2010-05-29 11:30:22 UTC (rev 1363)
+++ pkg/Rcpp/NAMESPACE	2010-05-29 11:55:38 UTC (rev 1364)
@@ -3,9 +3,12 @@
 import( methods )
 export(Rcpp.package.skeleton)
 
-importFrom( utils, capture.output )
+importFrom( utils, capture.output, assignInNamespace )
 
 exportClasses( Module, "C++Class", "C++Object" )
 export( Module )
 exportMethods( new )
 
+importFrom( utils, .DollarNames )
+exportMethods( .DollarNames )
+

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2010-05-29 11:30:22 UTC (rev 1363)
+++ pkg/Rcpp/R/Module.R	2010-05-29 11:55:38 UTC (rev 1364)
@@ -106,3 +106,8 @@
 	new( "Module", pointer = xp ) 
 }
 
+setGeneric( ".DollarNames" )
+setMethod( ".DollarNames", signature( x = "C++Object", pattern = "character" ), function(x, pattern ){
+	grep( pattern, .Call( "CppClass__methods" , x at cppclass, PACKAGE = "Rcpp" ), value = TRUE )
+} )
+

Modified: pkg/Rcpp/R/zzz.R
===================================================================
--- pkg/Rcpp/R/zzz.R	2010-05-29 11:30:22 UTC (rev 1363)
+++ pkg/Rcpp/R/zzz.R	2010-05-29 11:55:38 UTC (rev 1364)
@@ -15,5 +15,12 @@
 # You should have received a copy of the GNU General Public License
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-.onLoad <- function(libname, pkgname){}
+.onLoad <- function(libname, pkgname){
+	# FIXME: there ought to be a better way to do this without 
+	#        highjacking utils::.DollarNames
+	utils <- asNamespace( "utils" )
+	unlockBinding( ".DollarNames", utils )
+	assignInNamespace( ".DollarNames", .DollarNames, utils )
+	lockBinding( ".DollarNames", utils )
+}
 

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-05-29 11:30:22 UTC (rev 1363)
+++ pkg/Rcpp/inst/ChangeLog	2010-05-29 11:55:38 UTC (rev 1364)
@@ -2,6 +2,8 @@
 
 	* R/Module.R: when a Module is loaded, it creates extensions of the 
 	class C++Object for each internal class to enable S4 dispatch
+	
+	* R/Module.R: support for completion of methods of C++ objects
 
 2010-05-28  Romain Francois <romain at r-enthusiasts.com>
 

Added: pkg/Rcpp/man/completion.Rd
===================================================================
--- pkg/Rcpp/man/completion.Rd	                        (rev 0)
+++ pkg/Rcpp/man/completion.Rd	2010-05-29 11:55:38 UTC (rev 1364)
@@ -0,0 +1,22 @@
+\name{.DollarNames-methods}
+\docType{methods}
+\alias{.DollarNames-methods}
+\alias{.DollarNames,ANY,ANY-method}
+\alias{.DollarNames,C++Object,character-method}
+\title{Completion for C++ objects}
+\description{
+Completion for C++ objects
+}
+\section{Methods}{
+\describe{
+
+\item{\code{signature(x = "ANY", pattern = "ANY")}}{
+Standard method (from utils)
+}
+
+\item{\code{signature(x = "C++Object", pattern = "character")}}{
+	Method for \linkS4class{"C++Object"} objects.
+}
+}}
+\keyword{methods}
+



More information about the Rcpp-commits mailing list