1
###########################################################################/**
2
# @RdocClass RspVariableDirective
3
# @alias RspStringDirective
4
# @alias RspNumericDirective
5
# @alias RspIntegerDirective
6
# @alias RspLogicalDirective
7
#
8
# @title "The RspVariableDirective class"
9
#
10
# \description{
11
#  @classhierarchy
12
#
13
#  An RspVariableDirective is an @see "RspDirective" that causes the
14
#  RSP parser to assign the value of an attribute to an R object of
15
#  the same name as the attribute at the time of parsing.
16
# }
17
#
18
# @synopsis
19
#
20
# \arguments{
21
#   \item{value}{A @character string.}
22
#   \item{...}{Arguments passed to the constructor of @see "RspDirective".}
23
# }
24
#
25
# \section{Fields and Methods}{
26
#  @allmethods
27
# }
28
#
29
# @author
30
#
31
# @keyword internal
32
#*/###########################################################################
33
setConstructorS3("RspVariableDirective", function(value="variable", ...) {
34 1
  extend(RspDirective(value, ...), "RspVariableDirective")
35
})
36

37

38
setMethodS3("getInclude", "RspVariableDirective", function(object, ...) {
39 1
  attrs <- c("name", "content", "file", "default")
40 1
  has <- hasAttribute(object, attrs)
41 1
  names(has) <- attrs
42 1
  if (!has["name"]) {
43 1
    return(FALSE)
44
  }
45 1
  if (!any(has[c("content", "file", "default")])) {
46 1
    return(TRUE)
47
  }
48 1
  FALSE
49
})
50

51
setConstructorS3("RspStringDirective", function(value="string", ...) {
52 1
  extend(RspVariableDirective(value, ...), "RspStringDirective")
53
})
54

55
setConstructorS3("RspNumericDirective", function(value="numeric", ...) {
56 1
  extend(RspVariableDirective(value, ...), "RspNumericDirective")
57
})
58

59
setConstructorS3("RspIntegerDirective", function(value="integer", ...) {
60 1
  extend(RspNumericDirective(value, ...), "RspIntegerDirective")
61
})
62

63
setConstructorS3("RspLogicalDirective", function(value="logical", ...) {
64 1
  extend(RspVariableDirective(value, ...), "RspLogicalDirective")
65
})
66

67

68
###########################################################################/**
69
# @RdocClass RspMetaDirective
70
#
71
# @title "The RspMetaDirective class"
72
#
73
# \description{
74
#  @classhierarchy
75
#
76
#  An RspMetaDirective is an @see "RspDirective" representing RSP metadata.
77
# }
78
#
79
# @synopsis
80
#
81
# \arguments{
82
#   \item{value}{A @character string.}
83
#   \item{...}{Arguments passed to the constructor of @see "RspStringDirective".}
84
# }
85
#
86
# \section{Fields and Methods}{
87
#  @allmethods
88
# }
89
#
90
# @author
91
#
92
# @keyword internal
93
#*/###########################################################################
94
setConstructorS3("RspMetaDirective", function(value="meta", ...) {
95 1
  extend(RspStringDirective(value, ...), "RspMetaDirective")
96
})

Read our documentation on viewing source code .

Loading