1.4 Style and Design Guidelines
For Amberite a2.0
C++ Code
To unify and to help others understand the plugin source files located under "/src", following style conventions should be followed.
Directory Structure
Header file directories for a certain use case should be prefixed with an underscore (./src/_main)
Directory names should be lowercase.
Info Boxes
Each file should contain a comment containing title, the copyright holder, the author and brief description.
/* =================================================
Example File
(C) Spliced Team, 2023-2024
Authored by click07
This is an example file containing example code.
================================================= */
Sub-Headers
If your file contains multiple important sections, they should be seperated by deviders like the one below.
// ----------------
// Example Section
// ----------------
Indent and Brackets
4 spaces are used for indentation. Brackets are put on a new line without indent.
If a block would only be 1 line long, brackets should not be used.
void ExampleMethod()
{
if(condition)
DoSomething();
}
Cases
Variable names should use camelCase.
int variableName;
Method and class names should use PascalCase.
void ExampleMethod()
Enums and Labels should use SCREAMING_CASE.
case INPUT_THREE:
Names
All names should be descriptive and directly indicate the purpose. Iterators however, can be single letters.
Additionally, names should not be abbreviated, except for when the non-abbreviated version is uncommon (e.g. tab instead of tabulation)
Booleans should be formed like questions (e.g. hasLoadedContent)
The variable/return type should not otherwise be indicated within the name.