style: add clang-format config and reformat scaffolding files

This commit is contained in:
2026-09-07 10:07:26 +02:00
parent 975e3b2974
commit 50369995c7
12 changed files with 100 additions and 64 deletions
+12
View File
@@ -83,6 +83,18 @@ meson test -C build --print-errorlogs
meson configure build
```
## Formatting
Run `clang-format` on every C++ source or header file before considering a
change complete. The project config is `.clang-format` at the repository root.
```sh
find include src tests -type f \( -name '*.cpp' -o -name '*.h' \) -exec clang-format -i {} +
```
If `clang-format` is not available, match the existing style in the file being
edited.
## References
- `meson.build` (project root)
+22
View File
@@ -0,0 +1,22 @@
---
Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 120
BreakBeforeBraces: Attach
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
IndentCaseLabels: true
SpaceBeforeParens: ControlStatements
PointerAlignment: Left
SortIncludes: true
IncludeBlocks: Preserve
ReflowComments: true
AlignTrailingComments: true
BinPackArguments: false
BinPackParameters: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
+3
View File
@@ -253,6 +253,9 @@ reason in the plan.
- Keep headers minimal and free of unnecessary includes; forward-declare where
possible.
- Format code with the configured formatter (`clang-format` if available).
- Run `clang-format` on every C++ source or header file before considering a
change complete; do not commit unformatted code.
- The project formatter config is `.clang-format` at the repository root.
### Error handling
-2
View File
@@ -3,8 +3,6 @@
#include "screencast/capture/capture.h"
#include "screencast/codec/decoder.h"
#include "screencast/codec/encoder.h"
#include "screencast/network/discovery.h"
#include "screencast/network/signaling.h"
#include "screencast/network/transport.h"
#include "screencast/render/renderer.h"
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <optional>
#include <span>
#include <vector>
@@ -13,7 +14,7 @@ struct RtpHeader {
bool extension = false;
uint8_t csrc_count = 0;
bool marker = false;
uint7_t payload_type = 96; // dynamic
uint8_t payload_type = 96; // dynamic
uint16_t sequence_number = 0;
uint32_t timestamp = 0;
uint32_t ssrc = 0;
+2
View File
@@ -2,9 +2,11 @@
#include "screencast/network/transport.h"
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <variant>
namespace sc {
+1 -4
View File
@@ -7,10 +7,7 @@ project('screen_cast', 'cpp',
'buildtype=release',
])
# Public and private include directories
inc = include_directories('include')
# Core public headers / include dependency defined in src/meson.build.
# Public and private include directories are declared in `src/meson.build`.
subdir('src')
# Tests