Skip to content

Commit

Permalink
refactor ISOCodeListValue -> ISOCodeListItem to resolve Roxygen2 conf…
Browse files Browse the repository at this point in the history
…lict with new class ISOCodelistValue
  • Loading branch information
eblondel committed Dec 31, 2024
1 parent 2952623 commit b453715
Show file tree
Hide file tree
Showing 108 changed files with 249 additions and 342 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export(ISOCitationSeries)
export(ISOClassification)
export(ISOCodeDefinition)
export(ISOCodeListDictionary)
export(ISOCodeListValue)
export(ISOCodeListItem)
export(ISOCodelist)
export(ISOCodelistCatalogue)
export(ISOCodelistValue)
Expand Down
6 changes: 3 additions & 3 deletions R/ISOAbstractObject.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
})]

if(!inherits(self, "GMLElement") && !inherits(self, "SWEElement")) cat(crayon::white(paste0("<", crayon::underline(self$getClassName()), ">")))
if(is(self, "ISOCodeListValue")){
if(is(self, "ISOCodeListItem")){
clVal <- self$printAttrs$codeListValue
if("value" %in% names(clVal)) clVal = clVal$value
clDes <- self$codelistId$codeEntry[sapply(self$codelistId$codeEntry, function(ce){
Expand Down Expand Up @@ -361,7 +361,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
}
cat(paste0("\n", paste(rep(shift, depth), collapse=""),"|-- ", crayon::italic(field), " ", attrs_str))
item$print(depth = depth+1, add_codelist_description = add_codelist_description)
if(is(item, "ISOCodeListValue")){
if(is(item, "ISOCodeListItem")){
clVal <- item$printAttrs$codeListValue
clDes <- item$codelistId$entries[item$codelistId$entries$value == clVal,"description"]
cat(paste0(": ", clVal, if(add_codelist_description) crayon::cyan(paste0(" {",clDes,"}")) else ""))
Expand Down Expand Up @@ -1512,7 +1512,7 @@ ISOAbstractObject$getISOClasses = function(extended = FALSE, pretty = FALSE){
if(r6Predicate){
if(!is.null(clazz$classname)){
includePredicate <- !(clazz$classname %in% c("geometaLogger", "INSPIREMetadataValidator",
"ISOCodelist", "ISOCodeListValue", "ISOMetadataNamespace", "ISOTimePeriod","ISOAttributes",
"ISOCodelist", "ISOCodeListItem", "ISOMetadataNamespace", "ISOTimePeriod","ISOAttributes",
"pivot_format"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions R/ISOAssociationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOAssociationType <- R6Class("ISOAssociationType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "DS_AssociationTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOAssociationType <- R6Class("ISOAssociationType",
)

ISOAssociationType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOAssociationType, labels))
return(ISOCodeListItem$values(ISOAssociationType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCellGeometry.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCellGeometry <- R6Class("ISOCellGeometry",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_CellGeometryCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOCellGeometry <- R6Class("ISOCellGeometry",
)

ISOCellGeometry$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOCellGeometry, labels))
return(ISOCodeListItem$values(ISOCellGeometry, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCharacterSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCharacterSet <- R6Class("ISOCharacterSet",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_CharacterSetCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOCharacterSet <- R6Class("ISOCharacterSet",
)

ISOCharacterSet$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOCharacterSet, labels))
return(ISOCodeListItem$values(ISOCharacterSet, labels))
}
4 changes: 2 additions & 2 deletions R/ISOClassification.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOClassification <- R6Class("ISOClassification",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_ClassificationCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOClassification <- R6Class("ISOClassification",
)

ISOClassification$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOClassification, labels))
return(ISOCodeListItem$values(ISOClassification, labels))
}
14 changes: 7 additions & 7 deletions R/ISOCodeListValue.R → R/ISOCodeListItem.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' ISOCodeListValue
#' @name ISOCodeListItem
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO code element
#' @return Object of \code{\link[R6]{R6Class}} for modelling an ISO Metadata codelist element
#' @keywords ISO code list item
#' @return Object of \code{\link[R6]{R6Class}} for modelling an ISO Metadata codelist item
#' @format \code{\link[R6]{R6Class}} object.
#'
#' @note Abstract ISO codelist class used internally by geometa
Expand All @@ -14,11 +14,11 @@
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCodeListValue <- R6Class("ISOCodeListValue",
ISOCodeListItem <- R6Class("ISOCodeListItem",
inherit = ISOAbstractObject,
private = list(
printAttrs = list(),
xmlElement = "CodeListValue",
xmlElement = "CodeListItem",
xmlNamespacePrefix = "GCO"
),
public = list(
Expand All @@ -31,7 +31,7 @@ ISOCodeListValue <- R6Class("ISOCodeListValue",
#'@field valueDescription value description
valueDescription = NULL,

#'@description Method used to instantiate an \link{ISOCodeListValue}. By default,
#'@description Method used to instantiate an \link{ISOCodeListItem}. By default,
#' \code{addCodeListAttrs = TRUE}, to add codelist atributes to root XML. The
#' parameter \code{addCodeSpaceAttr = TRUE} by default, and ignored if the valueof
#' \code{addCodeLisAttrs} is set to \code{FALSE}. The argument \code{setValue}
Expand Down Expand Up @@ -154,7 +154,7 @@ ISOCodeListValue <- R6Class("ISOCodeListValue",
)
)

ISOCodeListValue$values = function(class, labels = FALSE){
ISOCodeListItem$values = function(class, labels = FALSE){
fields <- "value"
if(labels) fields <- c(fields, "name", "description")
element <- class$private_fields$xmlElement
Expand Down
18 changes: 16 additions & 2 deletions R/ISOCodelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,22 @@ ISOCodelist <- R6Class("ISOCodelist",
)
)

#' setISOCodelists
#' @name setISOCodelists
#' @aliases setISOCodelists
#' @title setISOCodelists
#' @export
#' @description \code{setISOCodelists} allows to set the list of ISO codelists
#' registered in \pkg{geometa}
#'
#' @usage setISOCodelists(version)
#'
#' @param version the version of the metadata standard
#'
#' @examples
#' setISOCodelists(version = "19139")
#'
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
#
setISOCodelists <- function(version = "19139"){
langCL <- system.file("extdata/codelists", "ISO-639-2_utf-8.txt", package = "geometa", mustWork = TRUE) #from http://www.loc.gov/standards/iso639-2/
ML_gmxCL <- system.file("extdata/codelists", "ML_gmxCodelists.xml", package = "geometa", mustWork = TRUE)
Expand Down Expand Up @@ -253,7 +267,7 @@ getISOCodelists <- function(){
clazz <- eval(parse(text=classname))
if(is(clazz, "R6ClassGenerator")){
if(!is.null(clazz$inherit)){
if(clazz$inherit == "ISOCodeListValue"){
if(clazz$inherit == "ISOCodeListItem"){
cl_classes <- c(cl_classes, clazz)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/ISOCodelistValueNew.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' ISOCodelistValue
#' @name ISOCodelistValue
#'
#' @docType class
#' @importFrom R6 R6Class
Expand Down
4 changes: 2 additions & 2 deletions R/ISOCountry.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCountry <- R6Class("ISOCountry",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = list(
"19139" = "Country",
Expand All @@ -47,5 +47,5 @@ ISOCountry <- R6Class("ISOCountry",
)

ISOCountry$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOCountry, labels))
return(ISOCodeListItem$values(ISOCountry, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCouplingType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCouplingType <- R6Class("ISOCouplingType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "SV_CouplingType",
xmlNamespacePrefix = "SRV"
Expand All @@ -41,5 +41,5 @@ ISOCouplingType <- R6Class("ISOCouplingType",
)

ISOCouplingType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOCouplingType, labels))
return(ISOCodeListItem$values(ISOCouplingType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCoverageContentType.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' - 19115-3 \url{https://schemas.isotc211.org/19115/-3/mrc/1.0/mrc/#element_MD_CoverageContentTypeCode}
#'
ISOCoverageContentType <- R6Class("ISOCoverageContentType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_CoverageContentTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -51,5 +51,5 @@ ISOCoverageContentType <- R6Class("ISOCoverageContentType",
)

ISOCoverageContentType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOCoverageContentType, labels))
return(ISOCodeListItem$values(ISOCoverageContentType, labels))
}
4 changes: 2 additions & 2 deletions R/ISODCPList.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODCPList <- R6Class("ISODCPList",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "DCPList",
xmlNamespacePrefix = "SRV"
Expand All @@ -41,5 +41,5 @@ ISODCPList <- R6Class("ISODCPList",
)

ISODCPList$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISODCPList, labels))
return(ISOCodeListItem$values(ISODCPList, labels))
}
4 changes: 2 additions & 2 deletions R/ISODatatype.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODatatype <- R6Class("ISODatatype",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_DatatypeCode",
xmlNamespacePrefix = "GMD"
Expand All @@ -39,5 +39,5 @@ ISODatatype <- R6Class("ISODatatype",
)

ISODatatype$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISODatatype, labels))
return(ISOCodeListItem$values(ISODatatype, labels))
}
4 changes: 2 additions & 2 deletions R/ISODateType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODateType <- R6Class("ISODateType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "CI_DateTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISODateType <- R6Class("ISODateType",
)

ISODateType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISODateType, labels))
return(ISOCodeListItem$values(ISODateType, labels))
}
4 changes: 2 additions & 2 deletions R/ISODimensionNameType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODimensionNameType <- R6Class("ISODimensionNameType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_DimensionNameTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISODimensionNameType <- R6Class("ISODimensionNameType",
)

ISODimensionNameType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISODimensionNameType, labels))
return(ISOCodeListItem$values(ISODimensionNameType, labels))
}
2 changes: 1 addition & 1 deletion R/ISODistributionUnits.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODistributionUnits <- R6Class("ISODistributionUnits",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_DistributionUnits",
xmlNamespacePrefix = "GMD"
Expand Down
4 changes: 2 additions & 2 deletions R/ISOEvaluationMethodType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "DQ_EvaluationMethodTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType",
)

ISOEvaluationMethodType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOEvaluationMethodType, labels))
return(ISOCodeListItem$values(ISOEvaluationMethodType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOGeometricObjectType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOGeometricObjectType <- R6Class("ISOGeometricObjectType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MD_GeometricObjectTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOGeometricObjectType <- R6Class("ISOGeometricObjectType",
)

ISOGeometricObjectType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOGeometricObjectType, labels))
return(ISOCodeListItem$values(ISOGeometricObjectType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOImageryBandDefinition.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryBandDefinition <- R6Class("ISOImageryBandDefinition",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MI_BandDefinition",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOImageryBandDefinition <- R6Class("ISOImageryBandDefinition",
)

ISOImageryBandDefinition$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOImageryBandDefinition, labels))
return(ISOCodeListItem$values(ISOImageryBandDefinition, labels))
}
4 changes: 2 additions & 2 deletions R/ISOImageryContext.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryContext <- R6Class("ISOImageryContext",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MI_ContextCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOImageryContext <- R6Class("ISOImageryContext",
)

ISOImageryContext$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOImageryContext, labels))
return(ISOCodeListItem$values(ISOImageryContext, labels))
}
4 changes: 2 additions & 2 deletions R/ISOImageryGeometryType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryGeometryType <- R6Class("ISOImageryGeometryType",
inherit = ISOCodeListValue,
inherit = ISOCodeListItem,
private = list(
xmlElement = "MI_GeometryTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOImageryGeometryType <- R6Class("ISOImageryGeometryType",
)

ISOImageryGeometryType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOImageryGeometryType, labels))
return(ISOCodeListItem$values(ISOImageryGeometryType, labels))
}
Loading

0 comments on commit b453715

Please sign in to comment.