Constructor and accessors for CURLOptions objects
These functions provide a constructor
and accessor methods
for the (currently S3) class
This class is a way to group and manage options settings
These functions manage a named list of options
where the names are elements of a fixed.
Not all elements need be set, but
these functions take care of expanding names
to match the fixed set, while allowing callers
to use abbreviated/partial names.
Names that do not match (via
will cause an error.
The set of possible names is given by
or more directly with
mapCurlOptNames handles the partial matching and
expansion of the names of the options for all the functions
that handle CURL options.
Currently this uses
perform the matching and so rejects words
that are ambiguous, i.e. have multiple matches
within the set of permissible option names.
As a result, "head" will match both
"header" and "headerfunction".
We may change this behavior in the future, but
we encourage using the full names for readability of code if nothing
curlOptions(..., .opts = list()) getCurlOptionsConstants() ## S3 method for class 'CURLOptions': [(x, i) <- value ## S3 method for class 'CURLOptions': [[(x, i) <- value listCurlOptions()
- name-value pairs identifying the settings for the options of interest.
- a named list of options, typically a previously created
CURLOptionsobject. These are merged with the options specified in
- the name(s) of the option elements being accessed. These can be partial names matching elements in the set of known options. Other names will cause an error.
- the values to assign to the options identified via
These functions use
to match and hence expand the names the callers
curlOptionsreturns an object of class
CURLOptionswhich is simply a named list.
getCurlConstantsreturns a named vector identifying the names of the possible options and their associated values. These values are used in the C code and also each integer encodes the type of the argument expected by the C code for that option.
tt = basicTextGatherer() myOpts = curlOptions(verbose = TRUE, header = TRUE, writefunc = tt[]) # note that the names are expanded, e.g. writefunc is now writefunction. names(myOpts) myOpts[["header"]] myOpts[["header"]] <- FALSE # Using the abbreviation "hea" is an error as it matches # both # myOpts[["hea"]] <- FALSE # Remove the option from the list myOpts[["header"]] <- NULL