Item | Format | Example |
---|---|---|
Class Names | Upper Camel Case | ExampleClass |
Static Function | Upper Camel Case | ExampleStaticFunction |
Member Function | Lower Camel Case | exampleMemberFunction |
Enum Names | Upper Camel Case | ExampleEnum |
Enum Item | Lower Snake Case with prefix e_ | e_example_a e_example_b |
Local Variable | Lower Snake Case |
example_local_var |
Public Member Variable | Lower Snake Case | example_public_var |
Protected/Private Member Variable | Lower Snake Case with prefix m_ | m_member_variable |
Static Private/Protected Member Variable | Lower Snake Case with prefix s_ | s_static_variable |
Templated Variable Type | Lower Snake Case with t_ | template<class t_type> |
Macros | All CAPS Snake Case | EXAMPLE_MACRO_DEFINE |
Enum Primitive Index | All CAPS | X, Y, LAT, LON |
set Functions are generally set[Var]. Get functions are generally just [var](). Both follow the function naming convention of lower camel case.
_t[X] are macros defined for translated strings. _t and _td being most notable. When using the function _td, the first argument should be lower snake case.
In general, we avoid using the built-in ambiguous types such as int, long, short, etc, opting instead to use the NDEVR explicit types
In order for our automated tools to work optimally, we recommend using the directory structure described in the diagram.
Each Module should have its own code folder, as well as a folder within VS and QtCreator for the IDE specific files.
The “Create Module” Function within NDEVR DevTools can be used to easily add modules to projects that follow this directory structure.
#include "../Headers/ThirdPartyLibsDialog.h"//Relative Path include (Only use for library)
#include //Use for "additional include directories"
#include //Use for other libraries
Strings in NDEVR should be created and used with the built-in String class which uses Unicode, UTF-8, as its storage protocol. For functions that use UTF16 (Windows, Freetype, etc) getAs<std::wstring>() can be used as a convenient means of conversion.
In order to prevent passwords from being included in memory dumps, logging, and to ensure they aren’t used directly in IO operations, NDEVR utilizes the PasswordString. Any passwords should be stored in this structure. User entry of passwords is done via QCustomLineEdit::setIsPassword(true), which will automatically return data as a PasswordString. The moment passwords are used they may decoded then and only then. In this way, we implicitly ensure protection of sensitive user data.
All textual information displayed to end users should be stored and created in the TranslatedString structure. This optimized structure hashes the string for use with a translation file, ensuring the user gets the message in the language of their choice while still allowing for readable English in-line comments. For simple strings, the macro _t(…) can be used. For more complicated strings or ones with replacement use the macro _td(…).
Virtual Functions have an impact on speed. Thus, their use should be limited when possible.
Exceptions provide for an alternative workflow, which, while can provide benefit, may also cause problems if not handled correctly.