Class "EnumDescriptor"

Description

R representation of an enum descriptor. This is a thin wrapper around the EnumDescriptor c++ class.

Objects from the Class

Objects of this class are typically retrieved as members of Descriptor objects

Slots

pointer:

external pointer to the EnumDescriptor instance

name:

simple name of the enum

full_name:

fully qualified name

type:

fully qualified name of the type that contains this enumeration

Methods

show

signature(object = "EnumDescriptor"): small information

as.character

signature(x = "EnumDescriptor"): returns the debug string of the enum descriptor. This is retrieved by a call to the DebugString method of the EnumDescriptor object.

toString

signature(x = "EnumDescriptor"): same as as.character

$

signature(x = "EnumDescriptor"): get the number associated with the name

has

signature(object = "EnumDescriptor"): indicate if the given name is a constant present in this enum.

containing_type

signature(object = "EnumDescriptor") : returns a Descriptor of the message type that contains this enum descriptor, or NULL if this is a top level enum descriptor.

length

signature(x = "EnumDescriptor") : number of constants in this enum.

value_count

signature(object = "EnumDescriptor") : number of constants in this enum.

value

signature(object = "EnumDescriptor") : extracts an EnumValueDescriptor. Exactly one argument of index, number or name has to be used. If index is used, the enum value descriptor is retrieved by position, using the value method of the C++ class. If number is used, the enum value descriptor is retrieved using the value of the constant, using the FindValueByNumber C++ method. If name is used, the enum value descriptor is retrieved using the name of the constant, using the FindValueByName C++ method.

[[

signature(x = "EnumDescriptor"): extracts field identified by its name or declared tag number

names

signature(x = "EnumDescriptor") : extracts names of this enum

Author(s)

Romain Francois <francoisromain@free.fr>

References

The EnumDescriptor C++ class

See Also

The Descriptor class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# example proto file supplied with this package
proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" ) 

# reading a proto file and creating the descriptor
Person <- P( "tutorial.Person", file = proto.file )

## End(Not run)

# enum type
Person$PhoneType

has(Person$PhoneType, "MOBILE")
has(Person$PhoneType, "HOME")
has(Person$PhoneType, "WORK")

has(Person$PhoneType, "FOOBAR")

length(Person$PhoneType)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.