CodeStyle -- CTPP2 source file style guide. Based on FreeBSD style(9).

This file describes coding rules for CTPP2 header and source files.
This is also a preferred style for source code of all applications written in C++.

0. The copyright header should be a multi-line comment, with the first line
of the comment having a dash after the star like so:

   /*-
    * Copyright (c) 2004 - 2010 CTPP Team
    *
    * Long, boring license goes here, but redacted for brevity
    */


1. All classes, structures and data fields
   MUST have auto-documentation in doxygen style
   /**
     @doxytag
     @brief Auto-documentation for doxygen
   */
   class SomeClass
   {
   ....
   };

   /** @brief Some Variable */
   INT_32 iSomeVariable;


2. Important and BIG comments SHOULD be in C-style

   /*
    * VERY Important single-line comment.
    */

   /*
    * VERY BIG multi-line comment.
    *
    * blah-blah blah-blah blah-blah blah-blah blah-blah
    * blah-blah blah-blah blah-blah blah-blah blah-blah
    * blah-blah blah-blah blah-blah blah-blah blah-blah
    */


3. Single-line comments SHOULD be in C++ Style

   // Single-line comment

4. NEVER use "standard" types. Use instead platform-independent
   types, described in CTPP2Types.h

5. If it is possible, don't use boost and other foreign libraries.
   Boost, etc - good and powerful libraries, BUT non-compartible in most
   architectures and compilers.

6. All platform-dependent typedefs MUST be placed into file Types.h

7. All defines MUST be placed into file GlobalDefines.h

8. Enumeration values are all uppercase. Enumeration name SHOULD start from lowercase 'e'
   enum eMyEnum { ONE, TWO .... }

   In declarations, do not put any whitespace between asterisks and adjacent
   tokens, except for tokens that are identifiers related to types.

9. Names of structures and classes are in mixed case, instances delimited by changed case.
   struct FooBar
   {
       INT_32    some_field;
       INT_64    other_field;
   };

9. When declaring variables in structures, declare them sorted by use, then
   by size (largest to smallest), and then in alphabetical order.
   Variables in structures all lowercase, instances delimited by understrike '_'

10. When declaring variables in classes, declare them sorted by use, then
    by size (largest to smallest), and then in alphabetical order.
    Variables in classes are in mixed case. Instances delimited by changed case.

   class BarBaz
   {
   public:
           BarBaz();
           ~BarBaz() throw();
   private:
       INT_32    iSomeVariable;
       INT_64    iOtherVariable;
   };

11. All destructors SHOULD have empty list of exceptions.
   class BarBaz
   {
   public:
        ~BarBaz() throw();
   };

12. NEVER use public variables in classes.
    NEVER use private and protected variables in structures

13. NEVER use assert macros.
    Assert, in depends of compiler flags changes behavior of programm.
    Therefore, programm that compiled with debug option IS NOT the same
    as a programm without them.
    Use instead exceptions.

14. Do not use "!" for tests unless it is a boolean, e.g. use
    if (*p == '\0')
    not:
    if (!*p)

15. All branches and loops MUST use braces (`{' and `}'), e.g. use
    for (;;) { stmt; }
    not:
    for (;;) stmt;

16. For infinite loops use for (;;), not while(true)

17. Indentation is an tab (0x09) and space (0x20).
    Use tabs ONLY in string prefixies, use spaces ONLY in string suffixes, e.g. use
    class BarBaz
    {
    >>         INT_32........iVariable;
    public:
    >>         inline BarBaz()
    >>         {
    >>         >>         stmt;
    >>         }
    };

    struct FooBar
    {
    >>         INT_32........var_1;
    >>         INT_32........var_2;
    >>         CCHAR_P.......some_data;
    };

    where `.' - space and `>>' - tab


18. Sources MUST be compiled without warnings with "-Wall -pedantic -wno-long-long"
    GNU gcc code checker flags or its analogs in other compilers.

19. Examples: examples/code/Skel.*
