Copyright | (c) Microsoft |
---|---|
License | MIT |
Maintainer | adamsap@microsoft.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
The module exports the built-in code generation templates.
- types_h :: [String] -> Bool -> Maybe String -> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- types_cpp :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- types_comm_cpp :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- reflection_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- enum_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- apply_h :: [Protocol] -> Maybe String -> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- apply_cpp :: [Protocol] -> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- data Protocol = Protocol {}
- comm_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- data FieldMapping
- data StructMapping = Class
- types_cs :: StructMapping -> FieldMapping -> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- comm_interface_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- comm_proxy_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
- comm_service_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
Templates
All codegen templates take at least the following arguments:
MappingContext
which determines mapping of Bond types to types in the target language- base file name, typically the name of the schema definition file without the extension
- list of
Import
s from the parsed schema definition - list of
Declaration
s from the parsed schema definition
Some templates are parameterized with additional options for customizing the generated code.
The templates return the name suffix for the target file and lazy
Text
with the generated code.
C++
:: [String] | list of optional header files to be |
-> Bool |
|
-> Maybe String | optional custom allocator to be used in the generated code |
-> MappingContext | |
-> String | |
-> [Import] | |
-> [Declaration] | |
-> (String, Text) |
Codegen template for generating base_name_type.h containing definitions of C++ types representing the schema.
types_cpp :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating base_name_types.cpp containing definitions of helper functions and schema metadata static variables.
types_comm_cpp :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating base_name_comm_types.cpp containing definitions of helper functions and schema metadata static variables.
reflection_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating base_name_reflection.h containing schema metadata definitions.
enum_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating base_name_enum.h containing definitions
of enums. Generated by gbc with --enum-header
flag.
:: [Protocol] | List of protocols for which |
-> Maybe String | Optional attribute to decorate the |
-> MappingContext | |
-> String | |
-> [Import] | |
-> [Declaration] | |
-> (String, Text) |
Codegen template for generating base_name_apply.h containing declarations of Apply function overloads for the specified protocols.
:: [Protocol] | List of protocols for which |
-> MappingContext | |
-> String | |
-> [Import] | |
-> [Declaration] | |
-> (String, Text) |
Codegen template for generating base_name_apply.cpp containing
definitions of the Apply
function overloads for the specified protocols.
Protocol data type is used to specify what protocols the Apply
function
overloads should be generated for.
Protocol | |
|
C++ Comm
comm_h :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating base_name_comm.h containing declarations of of service interface and proxy.
C#
data FieldMapping Source #
Representation of schema fields in the generated C# types
PublicFields | public fields |
Properties | auto-properties |
ReadOnlyProperties | auto-properties with private setter |
:: StructMapping | Specifies how to represent schema structs |
-> FieldMapping | Specifies how to represent schema fields |
-> MappingContext | |
-> String | |
-> [Import] | |
-> [Declaration] | |
-> (String, Text) |
Codegen template for generating definitions of C# types representing the schema.
comm_interface_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
Codegen template for generating code containing declarations of of services including interfaces, proxies and services files.
comm_proxy_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #
comm_service_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) Source #