Skip to main content
Glama
naming_conventions.json3.9 kB
{ "variable": { "style": "snake_case", "description": "变量名使用小写字母和下划线", "examples": { "good": ["user_name", "total_count", "max_value"], "bad": ["userName", "TotalCount", "MAXVALUE"] }, "rules": [ "使用描述性名称,避免单字母变量(除了循环计数器)", "布尔变量使用 is_、has_、can_ 等前缀", "避免使用缩写,除非是广为人知的(如 id、url)" ] }, "constant": { "style": "UPPER_SNAKE_CASE 或 kCamelCase", "description": "常量使用全大写下划线或 k 前缀驼峰命名", "examples": { "good": ["MAX_BUFFER_SIZE", "kDefaultTimeout", "PI"], "bad": ["maxBufferSize", "max_buffer_size", "default_timeout"] }, "rules": [ "宏定义使用 UPPER_SNAKE_CASE", "constexpr 和 const 变量可使用 kCamelCase(Google Style)", "枚举值使用 kCamelCase 或 UPPER_SNAKE_CASE" ] }, "function": { "style": "snake_case 或 CamelCase", "description": "函数名使用小写下划线或大驼峰", "examples": { "good": ["calculate_total", "CalculateTotal", "get_user_name"], "bad": ["Calculate_Total", "calculatetotal", "CALCULATE_TOTAL"] }, "rules": [ "使用动词或动词短语", "getter 函数可以省略 get_ 前缀(如 name() 而非 get_name())", "setter 函数使用 set_ 前缀", "布尔返回值函数使用 is_、has_、can_ 等前缀" ] }, "class": { "style": "PascalCase", "description": "类名使用大驼峰命名", "examples": { "good": ["UserManager", "HttpClient", "DatabaseConnection"], "bad": ["userManager", "HTTPClient", "database_connection"] }, "rules": [ "使用名词或名词短语", "接口类可以使用 I 前缀(如 ILogger)或 Interface 后缀", "抽象类可以使用 Abstract 前缀或 Base 前缀", "避免使用 Manager、Handler 等模糊后缀,除非确实合适" ] }, "namespace": { "style": "snake_case 或 lowercase", "description": "命名空间使用小写或小写下划线", "examples": { "good": ["utils", "http_client", "database"], "bad": ["Utils", "HttpClient", "DATA_BASE"] }, "rules": [ "使用简短、描述性的名称", "避免嵌套过深(建议不超过 3 层)", "不要使用 using namespace 在头文件中" ] }, "member_variable": { "style": "suffix with _ 或 m_ prefix", "description": "成员变量使用下划线后缀或 m_ 前缀", "examples": { "good": ["name_", "m_name", "count_", "m_count"], "bad": ["name", "mName", "_name"] }, "rules": [ "私有成员变量使用下划线后缀(Google Style)", "或使用 m_ 前缀(Hungarian notation)", "公有成员变量不推荐,考虑使用 getter/setter", "静态成员变量可使用 s_ 前缀" ] }, "template_parameter": { "style": "PascalCase 或 single uppercase", "description": "模板参数使用大驼峰或单个大写字母", "examples": { "good": ["T", "TKey", "TValue", "Container"], "bad": ["t", "tKey", "container"] }, "rules": [ "单个类型参数使用 T", "多个参数使用描述性名称(TKey, TValue)", "概念(Concepts)使用大驼峰命名" ] }, "file_naming": { "style": "snake_case.cpp 或 PascalCase.cpp", "description": "文件名使用小写下划线或大驼峰", "examples": { "good": ["user_manager.cpp", "UserManager.cpp", "http_client.h"], "bad": ["UserManager.CPP", "user-manager.cpp", "HTTPLIENT.h"] }, "rules": [ "头文件使用 .h 或 .hpp", "实现文件使用 .cpp 或 .cc", "文件名应与主要类名匹配", "测试文件添加 _test 后缀" ] } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SongJiangzhou/cpp_guidelines_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server