Documentation ¶
Index ¶
- Variables
- func NameVariantsForPrimitive(val fidlgen.PrimitiveSubtype) nameVariants
- type Attributes
- type Bits
- type BitsMember
- type CmdlineFlags
- type Const
- type ConstantValue
- type Enum
- type EnumMember
- type Generator
- type HandleInformation
- type Kinded
- type Member
- type Method
- type Parameter
- type Protocol
- type Result
- type Root
- func (r *Root) Bits() []Kinded
- func (r *Root) Consts() []Kinded
- func (r *Root) Enums() []Kinded
- func (r *Root) LegacyIncludeDir() string
- func (r *Root) Namespace() namespace
- func (r *Root) Protocols() []Kinded
- func (r *Root) ProtocolsForTransport() func(string) []*Protocol
- func (r *Root) Services() []Kinded
- func (r *Root) SingleComponentLibraryName() bool
- func (r *Root) Structs() []Kinded
- func (r *Root) Tables() []Kinded
- func (r *Root) UnifiedIncludeDir() string
- func (r *Root) Unions() []Kinded
- type ScopedLayout
- type Service
- type ServiceMember
- type Struct
- type StructMember
- type Table
- type TableFrameItem
- type TableMember
- type Type
- func (t *Type) IsPrimitiveType() bool
- func (dn Type) Name() string
- func (dn Type) Namespace() namespace
- func (dn Type) NoLeading() string
- func (dn Type) Self() string
- func (dn Type) String() string
- func (t *Type) WireArgumentDeclaration(n string) string
- func (t *Type) WireInitMessage(n string) string
- type TypeShape
- type Union
- type UnionMember
Constants ¶
This section is empty.
Variables ¶
var ( // Protocol related WireSyncClient = fidlNs.member("WireSyncClient") WireClient = fidlNs.member("WireClient") WireEventHandlerInterface = internalNs.member("WireEventHandlerInterface") WireSyncEventHandler = fidlNs.member("WireSyncEventHandler") WireAsyncEventHandler = fidlNs.member("WireAsyncEventHandler") WireServer = fidlNs.member("WireServer") WireEventSender = fidlNs.member("WireEventSender") WireWeakEventSender = internalNs.member("WireWeakEventSender") WireClientImpl = internalNs.member("WireClientImpl") WireSyncClientImpl = internalNs.member("WireSyncClientImpl") WireSyncBufferClientImpl = internalNs.member("WireSyncBufferClientImpl") WireServerDispatcher = internalNs.member("WireServerDispatcher") // Method related WireRequest = fidlNs.member("WireRequest") WireResponse = fidlNs.member("WireResponse") WireResult = fidlNs.member("WireResult") WireUnownedResult = fidlNs.member("WireUnownedResult") WireResponseContext = fidlNs.member("WireResponseContext") WireCompleter = internalNs.member("WireCompleter") WireCompleterBase = internalNs.member("WireCompleterBase") WireMethodTypes = internalNs.member("WireMethodTypes") WireRequestView = internalNs.member("WireRequestView") )
These correspond to templated classes forward-declared in //zircon/system/ulib/fidl/include/lib/fidl/llcpp/wire_messaging.h
var ( DesignatedInitializationProxy = internalNs.member("DesignatedInitializationProxy") TypeTraits = internalNs.member("TypeTraits") )
These correspond to templated classes forward-declared in //src/lib/fidl/include/lib/fidl/cpp/internal/natural_types.h
var FamilyKinds = namespacedEnum(familyKinds{}).(familyKinds)
FamilyKinds are general categories identifying what operation we should use to pass a value without a move (LLCPP). It also defines the way we should initialize a field.
var Kinds = namespacedEnum(declKinds{}).(declKinds)
Kinds are the different kinds of FIDL declarations. They are used in header/impl templates to select the correct decl-specific template.
var TypeKinds = namespacedEnum(typeKinds{}).(typeKinds)
TypeKinds are the kinds of C++ types (arrays, primitives, structs, ...).
var (
WireTableFrame = fidlNs.member("WireTableFrame")
)
These correspond to templated classes forward-declared in //zircon/system/ulib/fidl/include/lib/fidl/llcpp/wire_types.h
Functions ¶
func NameVariantsForPrimitive ¶
func NameVariantsForPrimitive(val fidlgen.PrimitiveSubtype) nameVariants
NameVariantsForPrimitive returns the C++ name of a FIDL primitive type.
Types ¶
type Attributes ¶
type Attributes struct {
fidlgen.Attributes
}
type Bits ¶
type Bits struct { Attributes fidlgen.Strictness Type nameVariants Mask string MaskName nameVariants Members []BitsMember // contains filtered or unexported fields }
type BitsMember ¶
type BitsMember struct { Attributes Value ConstantValue // contains filtered or unexported fields }
type CmdlineFlags ¶
type CmdlineFlags struct {
// contains filtered or unexported fields
}
CmdlineFlags are the common command-line flags for all C++ backends.
func NewCmdlineFlags ¶
func NewCmdlineFlags(name string, validExperiments []string) *CmdlineFlags
NewCmdlineFlags returns a new instance of CmdlineFlags, which holds the values for flags passed on the command-line to a C++ generating fidlgen. |name| is the name of the binding used in @bindings_denylist and elsewhere. |validExperiments| is a list of experiment names that are supported.
func (*CmdlineFlags) ExperimentEnabled ¶
func (c *CmdlineFlags) ExperimentEnabled(experiment string) bool
func (*CmdlineFlags) ParseAndLoadIR ¶
func (c *CmdlineFlags) ParseAndLoadIR() *Root
type Const ¶
type Const struct { Attributes Extern bool Decorator string Type Type Value ConstantValue // contains filtered or unexported fields }
type ConstantValue ¶
func (ConstantValue) IsSet ¶
func (cv ConstantValue) IsSet() bool
func (ConstantValue) String ¶
func (cv ConstantValue) String() string
type Enum ¶
type Enum struct { Attributes fidlgen.Strictness Enum fidlgen.Enum Type nameVariants Members []EnumMember // contains filtered or unexported fields }
func (Enum) UnknownValueForTmpl ¶
func (e Enum) UnknownValueForTmpl() interface{}
type EnumMember ¶
type EnumMember struct { Attributes Value ConstantValue EnumMember fidlgen.EnumMember // contains filtered or unexported fields }
func (EnumMember) IsUnknown ¶
func (m EnumMember) IsUnknown() bool
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func (*Generator) ExperimentEnabled ¶
func (*Generator) GenerateFiles ¶
type HandleInformation ¶
type Kinded ¶
type Kinded interface {
Kind() declKind
}
A Kinded value is a declaration in FIDL, for which we would like to generate some corresponding C++ code.
type Method ¶
type Method struct { OrdinalName nameVariants Request message Response message CallbackType *nameVariants ResponseHandlerType string ResponderType string // Protocol is a reference to the containing protocol, for the // convenience of golang templates. Protocol *Protocol // contains filtered or unexported fields }
Method should be created using newMethod.
func (*Method) CallbackWrapper ¶
func (Method) CtsMethodAnnotation ¶
CtsMethodAnnotation generates a comment containing information about the FIDL method that is covered by the C++ generated method. It is primarily meant to be parsed by machines, but can serve as human readable documentation too. For more information see fxbug.dev/84332.
func (Method) WireCompleterArg ¶
func (Method) WireRequestViewArg ¶
type Parameter ¶
type Parameter struct { Type Type OffsetV1 int OffsetV2 int HandleInformation *HandleInformation // contains filtered or unexported fields }
func (Parameter) NameAndType ¶
type Protocol ¶
type Protocol struct { // OneWayMethods contains the list of one-way (i.e. fire-and-forget) methods // in the protocol. OneWayMethods []*Method // TwoWayMethods contains the list of two-way (i.e. has both request and // response) methods in the protocol. TwoWayMethods []*Method // ClientMethods contains the list of client-initiated methods (i.e. any // interaction that is not an event). It is the union of one-way and two-way // methods. ClientMethods []*Method // Events contains the list of events (i.e. initiated by servers) // in the protocol. Events []*Method // Generated struct holding variant-agnostic details about protocol. ProtocolDetails name // contains filtered or unexported fields }
Protocol should be created using newProtocol.
func (Protocol) WithHlMessaging ¶
func (p Protocol) WithHlMessaging() protocolWithHlMessaging
WithHlMessaging returns a new protocol IR where the HLCPP bindings details are promoted to the same naming scope as the protocol. This makes it easier to access the HLCPP details in golang templates.
type Result ¶
type Result struct { ValueMembers []Parameter ResultDecl nameVariants ErrorDecl nameVariants Error Type ValueDecl name ValueStructDecl nameVariants ValueTupleDecl name Value Type }
Result holds information about error results on methods.
func (Result) ValueArity ¶
type Root ¶
type Root struct { HandleTypes []string Library fidlgen.LibraryIdentifier Decls []Kinded Dependencies []fidlgen.LibraryIdentifier }
func (*Root) LegacyIncludeDir ¶
func (*Root) Namespace ¶
func (r *Root) Namespace() namespace
Namespace returns the C++ namespace for generated protocol types this FIDL library.
func (*Root) ProtocolsForTransport ¶
func (*Root) SingleComponentLibraryName ¶
SingleComponentLibraryName returns if the FIDL library name only consists of a single identifier (e.g. "library foo;"). This is significant because the unified namespace and the natural namespace are identical when the library only has one component.
func (*Root) UnifiedIncludeDir ¶
type ScopedLayout ¶
type ScopedLayout struct {
// contains filtered or unexported fields
}
ScopedLayout represents the definition of a scoped name for an anonymous layout. It consists of the scoped name (defined within the parent layout), and the flattened name (defined at the top level)
func (ScopedLayout) FlattenedName ¶
func (s ScopedLayout) FlattenedName() string
func (ScopedLayout) ScopedName ¶
func (s ScopedLayout) ScopedName() string
type Service ¶
type Service struct { Attributes ServiceName string Members []ServiceMember // contains filtered or unexported fields }
type ServiceMember ¶
type ServiceMember struct { Attributes ProtocolType nameVariants // contains filtered or unexported fields }
type Struct ¶
type Struct struct { Attributes fidlgen.Resourceness AnonymousChildren []ScopedLayout CodingTableType string Members []StructMember BackingBufferTypeV1 string BackingBufferTypeV2 string Result *Result // Full decls needed to check if a type is memcpy compatible. // Only set if it may be possible for a type to be memcpy compatible, // e.g. has no padding. // See the struct template for usage. FullDeclMemcpyCompatibleDeps []string TypeShapeV1 TypeShape TypeShapeV2 TypeShape // DesignatedInitializationProxy is the name of the internal aggregate // type associated with this struct in natural domain objects, // to support designated initialization. DesignatedInitializationProxy name // TypeTraits contains information about a natural domain object. TypeTraits name // contains filtered or unexported fields }
func (*Struct) IsRequestOrResponse ¶
IsRequestOrResponse indicates whether this struct is used as a method request/response.
type StructMember ¶
type StructMember struct { Attributes Type Type DefaultValue ConstantValue OffsetV1 int OffsetV2 int HandleInformation *HandleInformation // contains filtered or unexported fields }
func (StructMember) AsParameter ¶
func (m StructMember) AsParameter() Parameter
func (StructMember) NameAndType ¶
func (sm StructMember) NameAndType() (string, Type)
type Table ¶
type Table struct { Attributes fidlgen.Resourceness AnonymousChildren []ScopedLayout CodingTableType string Members []TableMember BiggestOrdinal int BackingBufferTypeV1 string BackingBufferTypeV2 string TypeShapeV1 TypeShape TypeShapeV2 TypeShape // WireTableFrame is the name of the table frame type associated with // this table in wire domain objects. WireTableFrame name // FrameItems stores the members in ordinal order; "null" for reserved. FrameItems []TableFrameItem // contains filtered or unexported fields }
type TableFrameItem ¶
type TableFrameItem *TableMember
type TableMember ¶
type TableMember struct { Attributes Type Type DefaultValue ConstantValue Ordinal int FieldPresenceIsSet string FieldPresenceSet string FieldPresenceClear string FieldDataName string MethodHasName string MethodClearName string ValueUnionName string HandleInformation *HandleInformation // contains filtered or unexported fields }
func (TableMember) NameAndType ¶
func (tm TableMember) NameAndType() (string, Type)
type Type ¶
type Type struct { WirePointer bool // Defines what operation we should use to pass a value without a move (LLCPP). It also // defines the way we should initialize a field. WireFamily familyKind // NeedsDtor indicates whether this type needs to be destructed explicitely // or not. NeedsDtor bool Kind typeKind IsResource bool Nullable bool DeclarationName fidlgen.EncodedCompoundIdentifier // Set iff IsArray || IsVector ElementType *Type // Valid iff IsArray ElementCount int InlineInEnvelope bool // contains filtered or unexported fields }
func (*Type) IsPrimitiveType ¶
IsPrimitiveType returns true if this type is primitive.
func (*Type) WireArgumentDeclaration ¶
WireArgumentDeclaration returns the argument declaration for this type for the wire variant.
func (*Type) WireInitMessage ¶
WireInitMessage returns message field initialization for the wire variant.
type Union ¶
type Union struct { Attributes fidlgen.Strictness fidlgen.Resourceness CodingTableType string AnonymousChildren []ScopedLayout TagEnum nameVariants TagUnknown nameVariants TagInvalid nameVariants WireOrdinalEnum name WireInvalidOrdinal name Members []UnionMember BackingBufferTypeV1 string BackingBufferTypeV2 string Result *Result TypeShapeV1 TypeShape TypeShapeV2 TypeShape // contains filtered or unexported fields }
type UnionMember ¶
type UnionMember struct { Attributes Ordinal uint64 Type Type StorageName name TagName nameVariants WireOrdinalName name Offset int HandleInformation *HandleInformation // contains filtered or unexported fields }
func (UnionMember) NameAndType ¶
func (um UnionMember) NameAndType() (string, Type)
func (UnionMember) UpperCamelCaseName ¶
func (um UnionMember) UpperCamelCaseName() string