mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 07:28:01 -05:00
* fix: `@docType "package"` is deprecated * fix: S3 methods need `@export` or `@exportS3method` tag. * chore: devtools::document()
60 lines
981 B
R
60 lines
981 B
R
Map <- R6Class(
|
|
'Map',
|
|
portable = FALSE,
|
|
public = list(
|
|
initialize = function() {
|
|
private$map <<- fastmap()
|
|
},
|
|
get = function(key) {
|
|
map$get(key)
|
|
},
|
|
set = function(key, value) {
|
|
map$set(key, value)
|
|
value
|
|
},
|
|
mget = function(keys) {
|
|
map$mget(keys)
|
|
},
|
|
mset = function(...) {
|
|
map$mset(...)
|
|
},
|
|
remove = function(key) {
|
|
if (!map$has(key))
|
|
return(NULL)
|
|
|
|
result <- map$get(key)
|
|
map$remove(key)
|
|
result
|
|
},
|
|
containsKey = function(key) {
|
|
map$has(key)
|
|
},
|
|
keys = function(sort = FALSE) {
|
|
map$keys(sort = sort)
|
|
},
|
|
values = function(sort = FALSE) {
|
|
map$as_list(sort = sort)
|
|
},
|
|
clear = function() {
|
|
map$reset()
|
|
},
|
|
size = function() {
|
|
map$size()
|
|
}
|
|
),
|
|
|
|
private = list(
|
|
map = NULL
|
|
)
|
|
)
|
|
|
|
#' @export
|
|
as.list.Map <- function(x, ...) {
|
|
x$values()
|
|
}
|
|
|
|
#' @export
|
|
length.Map <- function(x) {
|
|
x$size()
|
|
}
|