-
Notifications
You must be signed in to change notification settings - Fork 1.3k
F´ Style Guidelines
Note: this document is under review and is subject to change.
This document will capture the style guide for developing F´ projects. These recommendations apply to F´ framework code. Projects developing using F´ are recommended to use these standard but are not required to do so.
Note: not all framework code currently follows these guidelines. Newly submitted code shall follow these guidelines, and updating existing code is a work in progress.
This section will recommend naming style for various items withing F´.
Constants, enumeration values, compiler directives: constants, enumeration values, and compiler directives shall be defined in all-uppercase with tokens separated by '_'.
Example:
#define MY_DEFINITION 1234
const U32 MY_CONSTANT = 3;
enum EnumType {
VALUE_SUCCESS = ...,
VALUE_FAILURE = ...
}
Local Variables and Global Variables: variables shall be named in camel case, that is, starting with a lowercase letter with a capital letter starting each token.
Example:
U32 myVariable = 2;
Member Variables: member variables shall be named as local variables with a prefix of "m_".
Example:
U32 m_myMemberVariable;
Functions and Member Functions: functions and member functions shall be named in camel case just as local variables.
Types, Components, Ports, Classes, Packages, Namespaces, Modules: shall use Pascal case, that is, a leading capital letter with additional capitals at the start of each token.
Example
Svc.ComStub // FPP form
Svc::ComStub // C++ form
Notice that the FPP module, C++ namespace, and component name all are defined in pascal case.
F´ constructs are each defined in a module and breakdown into several categories: Types, Ports, Components, and Typologies. Modules are grouped into various packages including framework (Fw), drivers (Drv), service components (Svc), etc. Modules within packages shall be organized into the following structure.
Ports and Types: modules folders for Ports and Types shall respectively fall into named package sub-folders "Ports" and "Types".
Example: Fw.SuccessPort Port
Fw/Ports/SuccessPort/
Notice that the SuccessPort module folder is placed in the "Ports" sub-directory if the Fw Package. Type module folders would be placed in "Types".
Components: module directories are placed directly in the package directory.
Example: Svc.ComStub Component
Svc/ComStub/
Topologies: topologies are placed in the "Top" folder of a deployment's package.
Example: Ref Topology
Ref/Top
When referring to class members and functions, use of this->
shall be explicit.
Example:
this->m_myMemberVariable = 1;
this->myMemberFunction();