1
###########################################################################/**
2
# @RdocClass RspLanguage
3
# @alias escape.HtmlRspLanguage
4
#
5
# @title "The RspLanguage class"
6
#
7
# \description{
8
#  @classhierarchy
9
#
10
#  An RspLanguage object specifies what the markup language of the
11
#  response/output document is, e.g. plain text and HTML.
12
#  The RspLanguage class provides methods to obtain language specific
13
#  strings/output such as how newlines and comments are written.
14
#  The RspLanguage class describes a plain text languages.  For HTML
15
#  see the @see "HtmlRspLanguage" subclass.
16
# }
17
#
18
# @synopsis
19
#
20
# \arguments{
21
#   \item{language}{A @character string.}
22
#   \item{...}{Not used.}
23
# }
24
#
25
# \section{Fields and Methods}{
26
#  @allmethods
27
# }
28
#
29
# @author
30
# @keyword internal
31
#*/###########################################################################
32
setConstructorS3("RspLanguage", function(language="plain", ...) {
33 1
  language <- Arguments$getCharacter(language, length=1, nchar=c(1,64))
34

35 1
  extend(Object(), "RspLanguage",
36 1
    language=language
37
  )
38
})
39

40

41

42
#########################################################################/**
43
# @RdocMethod getLanguage
44
#
45
# @title "Gets the language string"
46
#
47
# \description{
48
#  @get "title".
49
# }
50
#
51
# @synopsis
52
#
53
# \arguments{
54
#   \item{...}{Not used.}
55
# }
56
#
57
# \value{
58
#  Returns a @character string.
59
# }
60
#
61
# @author
62
#
63
# \seealso{
64
#   @seeclass
65
# }
66
#
67
# @keyword IO
68
#*/#########################################################################
69
setMethodS3("getLanguage", "RspLanguage", function(this, ...) {
70 0
  this$language
71
})
72

73

74
#########################################################################/**
75
# @RdocMethod getNewline
76
#
77
# @title "Gets the newline string specific for a given RSP response language"
78
#
79
# \description{
80
#  @get "title".
81
# }
82
#
83
# @synopsis
84
#
85
# \arguments{
86
#   \item{...}{Not used.}
87
# }
88
#
89
# \value{
90
#  Returns a @character string.
91
# }
92
#
93
# @author
94
#
95
# \seealso{
96
#   @seeclass
97
# }
98
#
99
# @keyword IO
100
#*/#########################################################################
101
setMethodS3("getNewline", "RspLanguage", function(this, ...) {
102 0
  "\n"
103
})
104

105

106

107
#########################################################################/**
108
# @RdocMethod getComment
109
# @alias getComment.HtmlRspLanguage
110
#
111
# @title "Gets a comment string specific for a given RSP response language"
112
#
113
# \description{
114
#  @get "title".
115
# }
116
#
117
# @synopsis
118
#
119
# \arguments{
120
#   \item{...}{R objects to be pasted together.}
121
# }
122
#
123
# \value{
124
#  Returns a @character string.
125
# }
126
#
127
# @author
128
#
129
# \seealso{
130
#   @seeclass
131
# }
132
#
133
# @keyword IO
134
#*/#########################################################################
135
setMethodS3("getComment", "RspLanguage", function(this, ...) {
136 0
  s <- paste(..., collapse="\n", sep="")
137
  # By default, no output!
138
  ""
139
})
140

141

142
#########################################################################/**
143
# @RdocMethod escape
144
#
145
# @title "Escapes a string specifically for a given RSP response language"
146
#
147
# \description{
148
#  @get "title".
149
# }
150
#
151
# @synopsis
152
#
153
# \arguments{
154
#   \item{...}{R objects to be pasted together.}
155
# }
156
#
157
# \value{
158
#  Returns a @character string.
159
# }
160
#
161
# @author
162
#
163
# \seealso{
164
#   @seeclass
165
# }
166
#
167
# @keyword IO
168
#*/#########################################################################
169
setMethodS3("escape", "RspLanguage", function(this, ...) {
170 0
  paste(..., collapse="\n", sep="")
171
})
172

173

174
#########################################################################/**
175
# @RdocMethod getVerbatim
176
# @alias getVerbatim.HtmlRspLanguage
177
#
178
# @title "Gets a verbatim string specific for a given RSP response language"
179
#
180
# \description{
181
#  @get "title".
182
# }
183
#
184
# @synopsis
185
#
186
# \arguments{
187
#   \item{...}{R objects to be pasted together.}
188
# }
189
#
190
# \value{
191
#  Returns a @character string.
192
# }
193
#
194
# @author
195
#
196
# \seealso{
197
#   @seeclass
198
# }
199
#
200
# @keyword IO
201
#*/#########################################################################
202
setMethodS3("getVerbatim", "RspLanguage", function(this, ...) {
203 0
  escape(this, ...)
204
})

Read our documentation on viewing source code .

Loading