Flatland

Documentation

SourceForge.net Logo

Flatland Documentation

Style Guidelines

Whitespace

Names

Class Layout

Example class:

class ExampleClass
{
  public:
    ExampleClass(int a);
    ExampleClass();
    ~ExampleClass();
    void OnMouseMotion(const Event& e);
    void OnKeyDown(const Event& e);
    void OnKeyUp(const Event& e);
    static const int Count = 5;
  private:
    int data[Count];
    bool ready;
};

Curly Braces

Headers

For header guards, use "#pragma once" rather than ifndef HEADER_H. The pragma is supported on most modern compilers.

Parameter Passing

For passing objects that can be modified by the routine, use a pointer. For passing objects that should not be modified by the routine, use a const reference. These rules also apply to structs. If the struct is 8 bytes or less, it may be passed by value for convenience. Note that modern C++ compilers will often optimize these cases by passing via registers instead of the stack.

Comments

// Summary: Test for circle-circle intersection and generate contacts.
// Copyright: 2007  Philip Rideout.  All rights reserved.
// License: see bsd-license.txt

Pointers

const char *s;
const TClass &instance;

Enumerations

Large enumerations should be generated by modifying enums.txt, which is used by enums.pl to generate Enums.h. The perl script generates an enum encapsulated within a struct which provides the following:

Misc


Generated on Sat Jan 13 17:20:21 2007 for Flatland by doxygen 1.5.1