[Rcpp-commits] r2952 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 5 12:52:02 CEST 2011


Author: romain
Date: 2011-04-05 12:52:01 +0200 (Tue, 05 Apr 2011)
New Revision: 2952

Modified:
   pkg/Rcpp/R/01_show.R
Log:
explicitely state that no field is exposed

Modified: pkg/Rcpp/R/01_show.R
===================================================================
--- pkg/Rcpp/R/01_show.R	2011-04-05 10:45:32 UTC (rev 2951)
+++ pkg/Rcpp/R/01_show.R	2011-04-05 10:52:01 UTC (rev 2952)
@@ -53,22 +53,26 @@
 	writeLines( "Constructors:" )
 	writeLines( paste( txt, collapse = "\n" ) )
 	
-	writeLines( "\nFields: " )
 	fields <- object at fields
 	nfields <- length(fields)
-	names <- names(fields)
-	txt <- character(nfields)
-	for( i in seq_len(nfields) ){
-	    f <- fields[[i]]
-	    doc <- f$docstring
-	    txt[i] <- sprintf( "    %s %s%s%s",
-	        f$cpp_class, 
-	        names[i], 
-	        if( f$read_only ) " [readonly]" else "", 
-	        if( nchar(doc) ) sprintf( "\n        docstring : %s", doc ) else ""
-	    )    
+	if( nfields ){
+	    names <- names(fields)
+	    txt <- character(nfields)
+	    writeLines( "\nFields: " )
+	    for( i in seq_len(nfields) ){
+	        f <- fields[[i]]
+	        doc <- f$docstring
+	        txt[i] <- sprintf( "    %s %s%s%s",
+	            f$cpp_class, 
+	            names[i], 
+	            if( f$read_only ) " [readonly]" else "", 
+	            if( nchar(doc) ) sprintf( "\n        docstring : %s", doc ) else ""
+	        )    
+	    }
+	    writeLines( paste( txt, collapse = "\n" ) )
+	} else {
+	    writeLines( "\nFields: No public fields exposed by this class" )
 	}
-	writeLines( paste( txt, collapse = "\n" ) )
 	
 	writeLines( "\nMethods: " )
 	mets <- object at methods



More information about the Rcpp-commits mailing list