1
###########################################################################/**
2
# @RdocClass RspText
3
#
4
# @title "The RspText class"
5
#
6
# \description{
7
#  @classhierarchy
8
#
9
#  An RspText is an @see "RspConstruct" that represents a plain text
10
#  section, i.e. everything that is inbetween any other types of
11
#  @see "RspConstruct":s.
12
#  Its content is independent of the underlying programming language.
13
# }
14
#
15
# @synopsis
16
#
17
# \arguments{
18
#   \item{text}{A @character string.}
19
#   \item{escape}{If @TRUE, character sequences \code{<\%} and \code{\%>}
20
#                 are escaped to \code{<\%\%} and \code{\%\%>}.}
21
#   \item{...}{Not used.}
22
# }
23
#
24
# \section{Fields and Methods}{
25
#  @allmethods
26
# }
27
#
28
# @author
29
#
30
# @keyword internal
31
#*/###########################################################################
32
setConstructorS3("RspText", function(text=character(), escape=FALSE, ...) {
33 1
  if (escape) {
34 0
    text <- escapeRspTags(text)
35
  }
36 1
  extend(RspConstruct(text), "RspText")
37
})
38

39

40
setMethodS3("getInclude", "RspText", function(object, ...) {
41 0
  TRUE
42
})
43

44

45
#########################################################################/**
46
# @RdocMethod getContent
47
#
48
# @title "Gets the contents of the RSP text"
49
#
50
# \description{
51
#  @get "title".
52
# }
53
#
54
# @synopsis
55
#
56
# \arguments{
57
#   \item{...}{Not used.}
58
#   \item{unescaped}{If @TRUE, character sequences \code{<\%\%} and
59
#                \code{\%\%>} are unescaped to \code{<\%} and \code{\%>}.}
60
# }
61
#
62
# \value{
63
#  Returns a @character string.
64
# }
65
#
66
# @author
67
#
68
# \seealso{
69
#   @seeclass
70
# }
71
#*/#########################################################################
72
setMethodS3("getContent", "RspText", function(text, unescape=FALSE, ...) {
73 1
  text <- as.character(text)
74 1
  if (unescape) {
75 1
    text <- unescapeRspTags(text)
76
  }
77 1
  text
78
})
79

80

81
setMethodS3("asRspString", "RspText", function(text, ...) {
82 1
  RspString(getContent(text))
83
})

Read our documentation on viewing source code .

Loading