# eric7.Utilities.ClassBrowsers.protoclbr

Parse a ProtoBuf protocol file and retrieve messages, enums, services and rpc methods.

It is based on the Python class browser found in this package.

### Global Attributes

SUPPORTED_TYPES
_commentsub
_getnext
_modules
_normalize

### Classes

Enum | Class to represent a ProtoBuf Enum.
Message | Class to represent a ProtoBuf Message.
Service | Class to represent a ProtoBuf Service.
ServiceMethod | Class to represent a ProtoBuf Service Method.
VisibilityMixin | Mixin class implementing the notion of visibility.

### Functions

calculateEndline | Function to calculate the end line.
readmodule_ex | Read a ProtoBuf protocol file and return a dictionary of messages, enums, services and rpc methods.
scan | Public method to scan the given source text.

## Enum

Class to represent a ProtoBuf Enum.

### Derived from

ClbrBaseClasses.Enum, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Enum | Constructor

### Static Methods

None

#### Enum (Constructor)

Enum(module, name, file, lineno)

Constructor

module (str)
  name of the module containing this enum
name (str)
  name of this enum
file (str)
  filename containing this enum
lineno (int)
  linenumber of the message enum

Up

## Message

Class to represent a ProtoBuf Message.

### Derived from

ClbrBaseClasses.Module, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Message | Constructor

### Static Methods

None

#### Message (Constructor)

Message(module, name, file, lineno)

Constructor

module (str)
  name of the module containing this message
name (str)
  name of this message
file (str)
  filename containing this message
lineno (int)
  linenumber of the message definition

Up

## Service

Class to represent a ProtoBuf Service.

### Derived from

ClbrBaseClasses.Class, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Service | Constructor

### Static Methods

None

#### Service (Constructor)

Service(module, name, file, lineno)

Constructor

module (str)
  name of the module containing this service
name (str)
  name of this service
file (str)
  filename containing this service
lineno (int)
  linenumber of the service definition

Up

## ServiceMethod

Class to represent a ProtoBuf Service Method.

### Derived from

ClbrBaseClasses.Function, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

ServiceMethod | Constructor

### Static Methods

None

#### ServiceMethod (Constructor)

ServiceMethod(name, file, lineno, signature, returns)

Constructor

name (str)
  name of this service method
file (str)
  filename containing this service method
lineno (int)
  linenumber of the service method definition
signature (str)
  parameter list of the service method
returns (str)
  return type of the service method

Up

## VisibilityMixin

Mixin class implementing the notion of visibility.

### Derived from

ClbrBaseClasses.ClbrVisibilityMixinBase

### Class Attributes

None

### Class Methods

None

### Methods

VisibilityMixin | Constructor

### Static Methods

None

#### VisibilityMixin (Constructor)

VisibilityMixin()

Constructor

Up

## calculateEndline

calculateEndline(lineno, lines)

Function to calculate the end line.

lineno (int)
  line number to start at (one based)
lines (list of str)
  list of source lines

Return:
  end line (one based)

Return Type:
  int

Up

## readmodule_ex

readmodule_ex(module, path=None)

Read a ProtoBuf protocol file and return a dictionary of messages, enums, services and rpc methods.

module (str)
  name of the ProtoBuf protocol file
path (list of str)
  path the file should be searched in

Return:
  the resulting dictionary

Return Type:
  dict

Up

## scan

scan(src, file, module)

Public method to scan the given source text.

src (str)
  source text to be scanned
file (str)
  file name associated with the source text
module (str)
  module name associated with the source text

Return:
  dictionary containing the extracted data

Return Type:
  dict

Up