Skip to content

Commit b4b0e34

Browse files
committed
docs(guideline): add TOC
Format table. Remove closing header guard in example.
1 parent b875476 commit b4b0e34

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

doc/CodingGuideline.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
# Coding Guideline
1+
# Coding Guideline <!-- omit in toc -->
22

33
Derived from existing source code in this repository.
44

5-
---
5+
## Table of Contents <!-- omit in toc -->
6+
7+
- [File Structure](#file-structure)
8+
- [Naming](#naming)
9+
- [Headers](#headers)
10+
- [Doxygen](#doxygen)
11+
- [Class Layout](#class-layout)
12+
- [Patterns](#patterns)
13+
- [Singleton](#singleton)
14+
- [State Machine](#state-machine)
15+
- [Formatting](#formatting)
16+
- [Conditionals](#conditionals)
17+
- [Switch](#switch)
18+
- [Parameters](#parameters)
19+
- [Logging](#logging)
20+
- [Tests](#tests)
621

722
## File Structure
823

@@ -48,25 +63,23 @@ Each section uses a 80-character comment banner:
4863
Close every header file with:
4964

5065
```cpp
51-
#endif /* FILENAME_H */
52-
5366
/** @} */
5467
```
5568

5669
---
5770

5871
## Naming
5972

60-
| Element | Convention | Example |
61-
|---|---|---|
62-
| Class | PascalCase | `StateMachine`, `StartupState` |
63-
| Interface / abstract base | Prefix `I` | `IState`, `IBoard` |
64-
| Method | camelCase | `setup()`, `getInstance()` |
65-
| Private member variable | `m_` prefix + camelCase | `m_isActive`, `m_duration` |
66-
| Constant / `static const` member | `UPPER_SNAKE_CASE` | `MIN_BATTERY_LEVEL`, `SEND_WAYPOINT_TIMER_INTERVAL` |
67-
| File-scope static variable | `g` prefix + camelCase | `gLogSinkSerial` |
68-
| Macro parameter | double-underscore prefix | `SIMPLE_TIMER_SECONDS(__timeInS)` |
69-
| Enum value | `UPPER_SNAKE_CASE` | `CMD_GET_MAX_SPEED`, `CMD_NONE` |
73+
| Element | Convention | Example |
74+
| -------------------------------- | ------------------------ | --------------------------------------------------- |
75+
| Class | PascalCase | `StateMachine`, `StartupState` |
76+
| Interface / abstract base | Prefix `I` | `IState`, `IBoard` |
77+
| Method | camelCase | `setup()`, `getInstance()` |
78+
| Private member variable | `m_` prefix + camelCase | `m_isActive`, `m_duration` |
79+
| Constant / `static const` member | `UPPER_SNAKE_CASE` | `MIN_BATTERY_LEVEL`, `SEND_WAYPOINT_TIMER_INTERVAL` |
80+
| File-scope static variable | `g` prefix + camelCase | `gLogSinkSerial` |
81+
| Macro parameter | double-underscore prefix | `SIMPLE_TIMER_SECONDS(__timeInS)` |
82+
| Enum value | `UPPER_SNAKE_CASE` | `CMD_GET_MAX_SPEED`, `CMD_NONE` |
7083

7184
Use `uint8_t`, `uint16_t`, `uint32_t` etc. for sized integer types. Append `U` to unsigned integer literals (`50U`, `1000U`).
7285

0 commit comments

Comments
 (0)