-
Notifications
You must be signed in to change notification settings - Fork 189
Naming conventions and folder structure
Namespaces are CamelCase. Namespaces should represent logical parts of the code, for example all classes and functions that implement a specific method or functionality should go into one namespace. The name of that namespace should be related to the contained method or functionality.
User defined types, which includes class and struct names, should beginn
with a uppercase letter. For multi-word names, CamelCase naming is used.
Examples: class File;
, struct ParticleProperties;
.
Methods and free functions names should be lower case, and use underscore notation if they contain multiple words. They should include a verb if they do something. Example:
Data members should use underscores. E.g. struct Particle { int type_id; };
The name of private data members should start with m_
, e.g. class A { int m_private_member; };
Files that contain class declarations and definitions should be name
like the class. So for a class Foo
, the definition goes into Foo.hpp
,
the implementation into Foo.cpp
. Please use separate file per class.
The folder structure should follow the namespace structure. The names of the
folders are the lower case, underscore versions of the namespace name. So if there
is a class Espresso::Core::Foo::Bar
, its header file should be core/foo/Bar.hpp
.