Module gpb_names

Transformation of module names and names in parsed definitions, such as prefixing and lowercasing of message names etc.

Description

Transformation of module names and names in parsed definitions, such as prefixing and lowercasing of message names etc.

Data Types

dictionary()

dictionary() = term()

dict:dict().

item_type()

item_type() = 
    pkgs | msgs | groups | enums | services | rpcs | msg_types |
    enum_types | inverse_pkgs | inverse_msgs | inverse_groups |
    invert_enums

renamings()

renamings() = no_renamings | [{item_type(), dictionary()}]

Function Index

apply_enum_type_renaming/2Apply enum type renamings.
apply_msg_type_renaming/2Apply msg type renamings.
apply_renamings/2Apply any renamings.
compute_renamings/2Compute any renamings to be applied.
file_name_to_module_name/2Given a file name of a proto file, turn it into a module name, possibly with name transformations, such as prefix or suffix according to options.
format_error/1
is_not_renaming_opt/1The opposite of is_renaming_opt/1
is_renaming_opt/1Check whether an option is a renaming option or not.
rename_defs/2Rename definitions according to options, for example lowercasing message names.
rename_enum_macro/2Given an enum macro name, rename it according to opts, for example by prefixing it.
rename_module/2Given a module name, rename it according to opts, for example by prefixing it.

Function Details

apply_enum_type_renaming/2

apply_enum_type_renaming(EnumName, Renamings) -> any()

Apply enum type renamings

apply_msg_type_renaming/2

apply_msg_type_renaming(MsgName, Renamings) -> any()

Apply msg type renamings

apply_renamings/2

apply_renamings(Defs, Renamings :: renamings()) -> Defs

Apply any renamings.

compute_renamings/2

compute_renamings(Defs :: gpb_defs:defs(),
                  Opts :: gpb_compile:opts()) ->
                     {ok, renamings()} | {error, Reason :: term()}

Compute any renamings to be applied.

file_name_to_module_name/2

file_name_to_module_name(ProtoFileName :: string(),
                         Opts :: gpb_compile:opts()) ->
                            atom()

Given a file name of a proto file, turn it into a module name, possibly with name transformations, such as prefix or suffix according to options.

format_error/1

format_error(Reason) -> any()

is_not_renaming_opt/1

is_not_renaming_opt(Opt :: term()) -> boolean()

The opposite of is_renaming_opt/1

is_renaming_opt/1

is_renaming_opt(Opt :: term()) -> boolean()

Check whether an option is a renaming option or not.

rename_defs/2

rename_defs(Defs :: gpb_defs:defs(), Opts :: gpb_compile:opts()) ->
               {ok, gpb_defs:defs()} | {error, Reason :: term()}

Rename definitions according to options, for example lowercasing message names.

This effectively invokes apply_renamings/2 with the result from compute_renamings/2.

rename_enum_macro/2

rename_enum_macro(EnumMacro :: atom(), Opts :: gpb_compile:opts()) ->
                     atom()

Given an enum macro name, rename it according to opts, for example by prefixing it.

rename_module/2

rename_module(Mod :: atom() | string(),
              Opts :: gpb_compile:opts()) ->
                 atom()

Given a module name, rename it according to opts, for example by prefixing it.


Generated by EDoc