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

renamings()

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

Function Index

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
rename_defs/2Rename definitions according to options, for example lowercasing message names.
rename_module/2Given a module name, rename it according to opts, for example by prefixing it.

Function Details

apply_renamings/2

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

Apply any renamings.

compute_renamings/2

compute_renamings(Defs :: gpb_parse: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()

rename_defs/2

rename_defs(Defs :: gpb_parse:defs(), Opts :: gpb_compile:opts()) ->
               {ok, gpb_parse: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_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