Skip to content

Type Coding Standards

Liam Healey edited this page Feb 26, 2022 · 8 revisions

Commenting

Decription

A class comment should appear before the class definition. Descriptions should be complete sentences

/*
 * [Class description - Should explain what this class is used for/does]
 */

Class Marker

A class name comment should appear before and after the class definition (in the .h) and before and after the definitions of the class's functions (in the .cpp). The class should be used as the comment.

/* \/ ========= \/ *\
|  \/ UMyClass  \/  |
\* \/ ========= \/ */

class VOIDSINGER_API UMyClass : UObject
{
    GENERATED_BODY()

    [Code]
}

/* /\ ======== /\ *\
|  /\ UMyClass /\  |
\* /\ ======== /\ */

Functionality Category Markers

Category comments should appear before and after groups of functions and variables that all relate to a similar piece of functionality. These category markers should appear in both the .h and the .cpp. An example could be Voidsong Input Management. If in the .h, a new access specifier should always be placed after a new category starts, and members should be organized such that public comes first and then protected then private. Title case should always be used in category comments.

/* ------------------- *\     
\* \/ Category Name \/ */  

public:
[Code]
                
protected:
[Code]

private:
[Code]

/* /\ Category Name /\ *\     
\* ------------------- */

Delegate comments should appear above their definition.

//[Description - Explain what information is broadcasted]

Typedef comments should appear above their definition.

///[Description - Explain what kind of information is stored by this type]

Structures

Blueprint

C++

Commenting

A struct name comment should appear before and after the struct definition (including any hash functions).

/* \/ ============= \/ *\
|  \/ [Struct Name] \/  |
\* \/ ============= \/ */

[Code]

/* /\ ============= /\ *\
|  /\ [Struct Name] /\  |
\* /\ ============= /\ */

A struct comment should appear before the struct definition.

/**
 * [Description - Explain what information is stored and any special functionality]
 */

Enumerators

Blueprint

C++

[Mabel suggestions: mention uint8 and variable descriptions in the metadata]

Commenting

An enum name comment should appear before and after the enum definition.

/* \/ =========== \/ *\
|  \/ [Enum Name] \/  |
\* \/ =========== \/ */

[Code]

/* /\ =========== /\ *\
|  /\ [Enum Name] /\  |
\* /\ =========== /\ */

An enum comment should appear before the enum definition.

/**
 * [Description - Should explain what information the enum carries]
 */

Clone this wiki locally