Architecture overview
Draconis++ uses a layered architecture:include/Drac++/: Public API headers (stable interface)src/Lib/: Library implementationCore/: Cross-platform implementationsOS/: Platform-specific codeServices/: External service integrationsWrappers/: Third-party library wrappers
src/CLI/: Command-line interface application
Supported platforms
Draconis++ currently supports:| Platform | File | Description |
|---|---|---|
| Windows | src/Lib/OS/Windows.cpp | Windows 10/11 |
| Linux | src/Lib/OS/Linux.cpp | Linux (glibc/musl) |
| macOS | src/Lib/OS/macOS.cpp | macOS 12+ |
| BSD | src/Lib/OS/BSD.cpp | FreeBSD, OpenBSD, NetBSD |
| Haiku | src/Lib/OS/Haiku.cpp | Haiku OS |
| Serenity | src/Lib/OS/Serenity.cpp | SerenityOS |
Adding a new platform function
Declare the function in the public header
Add your function declaration to the appropriate header in
include/Drac++/Core/:System.hpp
Platform detection macros
Use preprocessor macros for conditional compilation:Standard macros
Custom Draconis++ macros
The build system defines additional macros:Using the type system
Always use Draconis++ type aliases in implementation files:Error handling conventions
Use the error macros defined inUtils/Error.hpp:
Windows-specific considerations
Using wide strings
Windows APIs often require wide strings:Required Windows libraries
Link against necessary libraries inmeson.build:
macOS-specific considerations
Using Objective-C++
For macOS APIs requiring Objective-C, use.mm files:
src/Lib/OS/macOS/Display.mm
Linking frameworks
Specify required frameworks:Linux-specific considerations
Optional dependencies
Handle optional dependencies gracefully:Reading from /proc and /sys
Code style guidelines
Follow these conventions when implementing platform code:Naming conventions
| Element | Style | Example |
|---|---|---|
| Types/Classes | PascalCase | SystemInfo |
| Functions | PascalCase | GetCpuInfo() |
| Variables | camelCase | cpuCount |
| Constants | SCREAMING_CASE | MAX_BUFFER_SIZE |
| Namespaces | lowercase | draconis::core |
Testing platform implementations
Create platform-specific tests:tests/test_platform.cpp
Submitting changes
When contributing platform implementations:Create a pull request
Follow Conventional Commits:Include:
- Descriptive title
- Implementation details
- Test results on your platform
- Documentation updates
Next steps
- Review the CONTRIBUTING.md guide
- Check the issue tracker for platform-specific tasks
- Join the community discussions