messagePropertyNames(extensionField:)
Calculate the names to use for the Swift Extension on the extended message.
func messagePropertyNames(extensionField field: FieldDescriptor) -> MessageExtensionNames
Calculate the names to use for the Swift Extension on the extended message.
func messagePropertyNames(extensionField field: FieldDescriptor) -> MessageExtensionNames
s26SwiftProtobufPluginLibrary0aB5NamerC20messagePropertyNames14extensionFieldSS5value_SS3hasSS5cleartAA0J10DescriptorC_tF
What are these?SUCG
import SwiftProtobufPluginLibrary
A reusable framework for building protoc
plugins in Swift.
final class SwiftProtobufNamer
final class FieldDescriptor
Describes a single field of a message. To get the descriptor for a given field, first get the Descriptor
for the message in which it is defined, then find the field. To get a FieldDescriptor
for an extension, get the Descriptor
or FileDescriptor
for its containing scope, find the extension.
typealias MessageExtensionNames = (value: String, has: String, clear: String)
convenience init()
Initializes a a new namer, assuming everything will be in the same Swift module.
convenience init(currentFile file: FileDescriptor, protoFileToModuleMappings mappings: ProtoFileToModuleMappings)
Initializes a a new namer. All names will be generated as from the pov of the given file using the provided file to module mapper.
let mappings: ProtoFileToModuleMappings
var swiftProtobufModuleName: String { get }
var swiftProtobufModulePrefix: String { get }
let targetModule: String
func dottedRelativeName(enumValue: EnumValueDescriptor) -> String
The relative name with a leading dot so it can be used where the type is known.
func fullName(enum e: EnumDescriptor) -> String
Calculate the full name for the given enum.
func fullName(enumValue: EnumValueDescriptor) -> String
Calculate the full name for the given enum value.
func fullName(extensionField field: FieldDescriptor) -> String
Calculate the full name for the given extension.
func fullName(message: Descriptor) -> String
Calculate the full name for the given message.
func fullName(oneof: OneofDescriptor) -> String
Calculate the full name for the given oneof.
func messagePropertyName(oneof: OneofDescriptor, prefixed: String = "_") -> OneofFieldNames
Calculate the name to use for the Swift field on the message.
func messagePropertyNames(field: FieldDescriptor, prefixed: String, includeHasAndClear: Bool) -> MessageFieldNames
Calculate the names to use for the Swift fields on the message.
func relativeName(enum e: EnumDescriptor) -> String
Calculate the relative name for the given enum.
func relativeName(enumValue: EnumValueDescriptor) -> String
Calculate the relative name for the given enum value.
func relativeName(extensionField field: FieldDescriptor) -> String
Calculate the relative name for the given entension.
func relativeName(message: Descriptor) -> String
Calculate the relative name for the given message.
func relativeName(oneof: OneofDescriptor) -> String
Calculate the relative name for the given oneof.
func typePrefix(forFile file: FileDescriptor) -> String
Calculate the prefix to use for this file, it is derived from the proto package or swift_prefix file option.
typealias MessageFieldNames = (name: String, prefixed: String, has: String, clear: String)
typealias OneofFieldNames = (name: String, prefixed: String)
func uniquelyNamedValues(enum e: EnumDescriptor) -> [EnumValueDescriptor]
Filters the Enum’s values to those that will have unique Swift names. Only poorly named proto enum alias values get filtered away, so the assumption is they aren’t really needed from an api pov.