typePrefix(forFile:)
Calculate the prefix to use for this file, it is derived from the proto package or swift_prefix file option.
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.
func typePrefix(forFile file: FileDescriptor) -> String
s26SwiftProtobufPluginLibrary0aB5NamerC10typePrefix7forFileSSAA0I10DescriptorC_tF
What are these?8KAMF
import SwiftProtobufPluginLibrary
A reusable framework for building protoc
plugins in Swift.
final class SwiftProtobufNamer
final class FileDescriptor
Models a .proto file. FileDescriptor
s are not directly created, instead they are constructed/fetched via the DescriptorSet
or they are directly accessed via a file
property on all the other types of descriptors.
@frozen struct String
A Unicode string value that is a collection of characters.
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(extensionField field: FieldDescriptor) -> MessageExtensionNames
Calculate the names to use for the Swift Extension on the extended 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.
typealias MessageExtensionNames = (value: String, has: String, clear: String)
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.