Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Clang-Format configuration file
# Based on Google C++ style with moderate adjustments

Language: Cpp
BasedOnStyle: Google

# Indentation
IndentWidth: 4
TabWidth: 4
UseTab: Never
AccessModifierOffset: -4

# Line width
ColumnLimit: 100

# Braces
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Empty

# Pointer and reference alignment
PointerAlignment: Left
ReferenceAlignment: Left

# Include file sorting
SortIncludes: CaseSensitive
IncludeBlocks: Regroup
IncludeCategories:
# 1. Project headers
- Regex: '^"(client|server|common|protocol)/'
Priority: 1
# 2. Third-party libraries
- Regex: '^<.*\.h>'
Priority: 2
# 3. C++ standard library
- Regex: '^<.*>'
Priority: 3

# Namespace
NamespaceIndentation: None
CompactNamespaces: false
FixNamespaceComments: true

# Alignment
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: true

# Line breaking
AllowAllParametersOfDeclarationOnNextLine: true
BinPackArguments: true
BinPackParameters: true
BreakConstructorInitializers: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true

# Spacing
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

# C++11 features
Standard: c++17
Cpp11BracedListStyle: true

# Comments
ReflowComments: true
SpacesBeforeTrailingComments: 2
52 changes: 52 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# EditorConfig helps maintain consistent coding styles across different editors
# https://editorconfig.org

root = true

# Default settings (applies to all files)
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

# C/C++ files
[*.{c,cc,cpp,h,hpp}]
indent_size = 4

# CMake files
[CMakeLists.txt]
indent_size = 4

[*.cmake]
indent_size = 4

# Markdown files (preserve trailing spaces for line breaks)
[*.md]
trim_trailing_whitespace = false

# YAML files
[*.{yml,yaml}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Shell scripts
[*.sh]
indent_size = 2

# Batch scripts
[*.bat]
end_of_line = crlf

# Makefile (must use tabs)
[Makefile]
indent_style = tab

# Docker files
[Dockerfile*]
indent_size = 4
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug 报告
about: 报告一个 bug 帮助我们改进
title: '[BUG] '
labels: bug
assignees: ''
---

## 🐛 Bug 描述
简要描述这个 bug 是什么。

## 📝 复现步骤
1. 执行 '...'
2. 运行命令 '...'
3. 查看错误

## ✅ 期望行为
描述你期望发生什么。

## ❌ 实际行为
描述实际发生了什么。

## 🖥️ 环境信息
- 操作系统: [例如 Ubuntu 22.04 / Windows 11]
- 编译器: [例如 GCC 11.4 / MSVC 19.36]
- CMake 版本: [例如 3.22]

## 📋 日志输出
```
粘贴相关日志输出
```

## 📷 截图
如有必要,添加截图。

## 💡 其他信息
添加任何其他有关该问题的上下文。
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: 功能请求
about: 提出新功能或改进建议
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

## 🚀 功能描述
简要描述你想要的功能。

## 💡 动机
为什么需要这个功能?它解决什么问题?

## 📋 详细设计(可选)
如果你有实现思路,请描述:

### 方案
描述你提议的解决方案。

### 替代方案
你考虑过的其他方案。

## ✅ 验收标准
- [ ] 标准 1
- [ ] 标准 2

## 📚 参考资料
相关链接、文档或示例。
33 changes: 33 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## 📋 PR Description
Briefly describe what this PR does.

## 🔗 Related Issue
Closes #(issue number)

## 🔄 Change Type
Please check the applicable options:

- [ ] 🐛 Bug fix (fix)
- [ ] ✨ New feature (feat)
- [ ] 📝 Documentation update (docs)
- [ ] 🎨 Code format/style (style)
- [ ] ♻️ Code refactoring (refactor)
- [ ] ✅ Test related (test)
- [ ] 🔧 Build/configuration (chore)

## 📝 Change Details
- Change 1
- Change 2

## ✅ Self-Check List
- [ ] Code compiles successfully
- [ ] All tests pass
- [ ] Necessary tests added
- [ ] Related documentation updated
- [ ] Commit messages follow conventions

## 🧪 Testing Instructions
Describe how to test these changes.

## 📷 Screenshots (if applicable)
Screenshots of UI changes.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# IDE 个人化配置
# IDE personal configurations
.vscode/
*.code-workspace

# OS 文件
# OS files
.DS_Store
Thumbs.db
desktop.ini
*.swp
*.swo
*~

# 构建产物(如果根目录构建)
# Build artifacts (if built in root directory)
build/
out/
bin/
dist/

# 日志
# Logs
*.log

# 临时文件
# Temporary files
*.tmp
*.temp
75 changes: 75 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Contributor Covenant Code of Conduct

[![中文](https://img.shields.io/badge/lang-中文-red.svg)](CODE_OF_CONDUCT.zh-CN.md)

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by creating an issue in this repository. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

[homepage]: https://www.contributor-covenant.org
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 贡献者行为准则

[![English](https://img.shields.io/badge/lang-English-blue.svg)](CODE_OF_CONDUCT.md)

## 我们的承诺

为了营造一个开放和友好的环境,我们作为贡献者和维护者承诺:无论年龄、体型、残疾、种族、性别特征、性别认同和表达、经验水平、教育程度、社会经济地位、国籍、外貌、种族、宗教或性取向如何,参与我们项目和社区的每个人都不会受到骚扰。

## 我们的标准

有助于创造积极环境的行为包括:

* 使用友好和包容的语言
* 尊重不同的观点和经验
* 优雅地接受建设性批评
* 专注于对社区最有利的事情
* 对其他社区成员表示同理心

不可接受的参与者行为包括:

* 使用性暗示的语言或图像,以及不受欢迎的性关注或性挑逗
* 恶意挑衅、侮辱/贬损性评论以及个人或政治攻击
* 公开或私下骚扰
* 未经明确许可,发布他人的私人信息,如住址或电子邮件地址
* 其他可以合理地被认为在专业环境中不适当的行为

## 我们的责任

项目维护者有责任为可接受的行为标准做出诠释,并对任何不可接受的行为采取恰当且公平的纠正措施。

项目维护者有权且有责任删除、编辑或拒绝与本行为准则不符的评论、提交、代码、wiki 编辑、Issue 和其他贡献,并可以暂时或永久性地封禁任何他们认为行为不适当、威胁、冒犯或有害的贡献者。

## 适用范围

本行为准则适用于所有项目空间,当个人在公共空间代表项目或其社区时也适用。代表项目或社区的例子包括使用官方项目电子邮件地址、通过官方社交媒体账户发布消息,或在线上或线下活动中担任指定代表。

## 执行

如遇到辱骂、骚扰或其他不可接受的行为,可以通过创建 Issue 联系项目团队进行举报。所有投诉都将被审查和调查,并将做出被认为必要且适合具体情况的回应。项目团队有义务对事件举报者保密。

## 归属

本行为准则改编自 [Contributor Covenant][homepage] 2.0 版,
可在 https://www.contributor-covenant.org/version/2/0/code_of_conduct.html 获取。

[homepage]: https://www.contributor-covenant.org
Loading