|
|
<ol><li><strong>Naming:</strong> Classes will be initialized with an upper case letter, example: ( ADIOS, NETCDF, PHDF5, Transform, Transport, etc. ). <ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code>class filedescriptor : public transport
|
|
|
{...</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code>class FileDescriptor : public Transport
|
|
|
{...</code></pre></li></ul></li></ul></li><li><strong>Members:</strong> Class member variables will use hungarian notation "m_" prefix followed an upper case letter: m_XMLConfig, m_Shape. This method enables easy autocomplete of members in many editors as it's encouraged by the clang-format. While member functions will have the same rules as regular functions (<em>e.g.</em> start with an upper case letter). <ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code>class Transport
|
|
|
<ol><li><strong>Naming:</strong> Classes will be initialized with an upper case letter, example: ( ADIOS, NETCDF, PHDF5, Transform, Transport, etc. ). <ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code>class filedescriptor : public transport
|
|
|
{...</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code>class FileDescriptor : public Transport
|
|
|
{...</code></pre></li></ul></li></ul></li><li><strong>Members:</strong> Class member variables will use hungarian notation "m_" prefix followed an upper case letter: m_XMLConfig, m_Shape. This method enables easy autocomplete of members in many editors as it's encouraged by the clang-format. While member functions will have the same rules as regular functions (<em>e.g.</em> start with an upper case letter). <ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code>class Transport
|
|
|
{
|
|
|
public:
|
|
|
std::string Name;
|
|
|
</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code> class Transport
|
|
|
public:
|
|
|
std::string Name;
|
|
|
</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code>class Transport
|
|
|
{
|
|
|
public:
|
|
|
std::string m_Name;
|
|
|
public:
|
|
|
std::string m_Name;
|
|
|
</code></pre></li></ul></li></ul></li><li><strong>Structs:</strong> reserve structs for public member variables only, Structs should not have member functions, inheritance or private members. Structs will be initialized with an upper case letter and member variables won't use hungarian notation as classes. <ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code>struct Attribute
|
|
|
{
|
|
|
public:
|
|
|
std::string m_Name;
|
|
|
std::string m_Type;
|
|
|
std::string m_Value;
|
|
|
void SetName( const std::string name ); // Use a class instead
|
|
|
public:
|
|
|
std::string m_Name;
|
|
|
std::string m_Type;
|
|
|
std::string m_Value;
|
|
|
void SetName( const std::string name ); // Use a class instead
|
|
|
}
|
|
|
</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code>struct Attribute
|
|
|
{
|
|
|
std::string Name;
|
|
|
std::string Type;
|
|
|
std::string Value;
|
|
|
std::string Name;
|
|
|
std::string Type;
|
|
|
std::string Value;
|
|
|
}
|
|
|
</code></pre></li></ul></li></ul></li><li><strong>Class Header and Source Files:</strong> Only allow one header and one source file per class ( <em>e.g.</em> class Transport in Transport.h and Transport.cpp), do not define several classes in the same file. Structs are always define in one header file, ( <em>e.g.</em> Attribute in Attribute.h )</li></ol> |
|
|
\ No newline at end of file |