Description Usage Arguments Details Value Note Author(s)
Convenience functions and operators for operating on bitflags and enums
1 2 3 4 5 6 7 8 9 10 11 | as.flag(x)
## S3 method for class 'flags'
x[value]
## S3 method for class 'flag'
x | y
## S3 method for class 'flag'
x & y
## S3 method for class 'flag'
!x
## S3 method for class 'enum'
x == y
|
x |
Numeric value to coerce to a |
y |
Right hand operand |
value |
The character id or index for a particular flag in a |
The libraries bound by RGtk2 often return numeric values that are either bitflags or enumerations. In order to facilitate operations on these types (especially bitflags), several methods have been defined corresponding to conventional operators for performing bitwise operations and comparisons.
RGtk2 defines all of the enum and flag types from the API's as vectors of class
flags
or enums
with their names corresponding to the
nicknames of the values. The [
operator on the
flags
or enums
class
retrieves a value as a flag
or enum
, respectively.
The ==.enum
method compares a enum
with either a
character or numeric representation of an enum value.
A flag
for as.flag
, [.flags
, and the bitwise operators.
A logical value for ==.enum
.
Sometimes the API does not return a value specifically as a flag
.
In this case, it is a generic numeric value and should be coerced with as.flag
.
Michael Lawrence
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.