RProtoBuf (version 0.4.13)

EnumDescriptor-class: Class "EnumDescriptor"

Description

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

Arguments

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

References

The EnumDescriptor C++ class

See Also

The '>Descriptor class

Examples

Run this code
# 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 )
# }
# 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)
# }

Run the code above in your browser using DataCamp Workspace