1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
###########################################################################/**
# @RdocClass RspVariableDirective
# @alias RspStringDirective
# @alias RspNumericDirective
# @alias RspIntegerDirective
# @alias RspLogicalDirective
#
# @title "The RspVariableDirective class"
#
# \description{
# @classhierarchy
#
# An RspVariableDirective is an @see "RspDirective" that causes the
# RSP parser to assign the value of an attribute to an R object of
# the same name as the attribute at the time of parsing.
# }
#
# @synopsis
#
# \arguments{
# \item{value}{A @character string.}
# \item{...}{Arguments passed to the constructor of @see "RspDirective".}
# }
#
# \section{Fields and Methods}{
# @allmethods
# }
#
# @author
#
# @keyword internal
#*/###########################################################################
setConstructorS3("RspVariableDirective", function(value="variable", ...) {
extend(RspDirective(value, ...), "RspVariableDirective")
})
setMethodS3("getInclude", "RspVariableDirective", function(object, ...) {
attrs <- c("name", "content", "file", "default")
has <- hasAttribute(object, attrs)
names(has) <- attrs
if (!has["name"]) {
return(FALSE)
}
if (!any(has[c("content", "file", "default")])) {
return(TRUE)
}
FALSE
})
setConstructorS3("RspStringDirective", function(value="string", ...) {
extend(RspVariableDirective(value, ...), "RspStringDirective")
})
setConstructorS3("RspNumericDirective", function(value="numeric", ...) {
extend(RspVariableDirective(value, ...), "RspNumericDirective")
})
setConstructorS3("RspIntegerDirective", function(value="integer", ...) {
extend(RspNumericDirective(value, ...), "RspIntegerDirective")
})
setConstructorS3("RspLogicalDirective", function(value="logical", ...) {
extend(RspVariableDirective(value, ...), "RspLogicalDirective")
})
###########################################################################/**
# @RdocClass RspMetaDirective
#
# @title "The RspMetaDirective class"
#
# \description{
# @classhierarchy
#
# An RspMetaDirective is an @see "RspDirective" representing RSP metadata.
# }
#
# @synopsis
#
# \arguments{
# \item{value}{A @character string.}
# \item{...}{Arguments passed to the constructor of @see "RspStringDirective".}
# }
#
# \section{Fields and Methods}{
# @allmethods
# }
#
# @author
#
# @keyword internal
#*/###########################################################################
setConstructorS3("RspMetaDirective", function(value="meta", ...) {
extend(RspStringDirective(value, ...), "RspMetaDirective")
})
|