Style Guide
来源:互联网 发布:网络对时软件 编辑:程序博客网 时间:2024/04/28 05:52
Style Guide
This document provides a style guide for .proto
files. By following these conventions, you'll make your protocol buffer message definitions and their corresponding classes consistent and easy to read.
Message And Field Names
Use CamelCase (with an initial capital) for message names – for example, SongServerRequest
. Use underscore_separated_names for field names – for example, song_name
.
message SongServerRequest { required string song_name = 1;}
Using this naming convention for field names gives you accessors like the following:
C++: const string& song_name() { ... } void set_song_name(const string& x) { ... }Java: public String getSongName() { ... } public Builder setSongName(String v) { ... }
Enums
Use CamelCase (with an initial capital) for enum type names and CAPITALS_WITH_UNDERSCORES for value names:
enum Foo { FIRST_VALUE = 1; SECOND_VALUE = 2;}
Each enum value should end with a semicolon, not a comma.
Services
If your .proto
defines an RPC service, you should use CamelCase (with an initial capital) for both the service name and any RPC method names:
service FooService { rpc GetSomething(FooRequest) returns (FooResponse);}
- Style Guide
- FW: C++ Style Guide : C++ Style Guide
- C# Coding Style Guide
- C# Coding Style Guide
- C# Coding Style Guide
- Mozilla Coding Style Guide
- C# Coding Style Guide
- X.509 Style Guide
- Dojo Style Guide(存照)
- C++ Style Guide
- Google C++ Style Guide
- Google C++ Style Guide
- Google C++ style guide
- Dojo Style Guide
- Google c++ style guide
- C++ Style Guide
- Google C++ Style Guide
- Google C++ Style Guide
- 云计算虚拟化技术总结
- Language Guide
- Encoding
- [X264] MinGW编译x264,VC中调用libx264.dll
- mfc中通过触发List Box 控件来显示图片
- Style Guide
- java 遍历map同时删除元素
- Python函数修饰符的初步理解
- Java中的计算器算法
- 虚函实现原理
- Protocol Buffer Basics: C++
- 番茄工作法总结
- android开发之数据共享(参数传递)
- win7 下ffmpeg release 版本崩溃问题