1 Star 0 Fork 24

softworkhouse / seafile-client

forked from lins05 / seafile-client 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
coding-style.md 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
lins05 提交于 2013-11-06 14:30 . added c++ coding style

C++ Coding Style

Mainly borrowed from google c++ style coding style

Naming Conventions

Member Vairables

Lower case words seprated by underscores, and ends with an underscore, e.g. repos_list_, context_menu_

Variables in Qt Ui Files

Camel case starts with a "m", e.g. mUserNameText, mServerAddr

Functions

Camel case, e.g. showRepos

Setter and Getter

  • setter: setRepoName()
  • getter: repoName()

Constants

Camel case starts with "k", e.g. :

const int kRepoRefreshInterval = 1000;
const char *kDefaultName = "seafile";

Use constants variables instead of macros to define constants.

Invoking functions

  • constant function parameter must be passed by object reference
  • No this-> when invoking member functions.

Others

  • no source file scope static variable/function, use anonymous namespace
  • use forward declaration when possible, instead of including unnecessary header files
  • Never use exceptions
C++
1
https://gitee.com/hailiukeji/seafile-client.git
git@gitee.com:hailiukeji/seafile-client.git
hailiukeji
seafile-client
seafile-client
master

搜索帮助