This page describes, how charon code should look like. Especially if you write new plugins and want them to be integrated into the charon plugin collections, please read this document carefully.
Avoid using variables containing underscores (e.g. my_bad_variable) but use CamelCase versions (like myCoolVariable).
We use [http://www.doxygen.org/ Doxygen] for documentation creation.
For information how to document your classes, functions etc. see its [http://www.doxygen.org/manual.html Manual].
We want to separate interfaces from their implementation. Therefore, there is usually at least a *.h and a *.cpp file.
Templated functions cannot be implemented in the *.cpp file, therefore we additionally need a *.hxx or *.hpp file.
A class interface MyClass.h should look like this:
// Copyright header (LGPL) /** \file MyClass.h * Declaration of class MyClass * \author <a href="mailto:me@mail.org">me</a> * \date 2010-01-19 */ /// short class description /** optional * long class description */ class MyClass { private: /// some private function void _privateFunction(); public: /// public constructor /** \param[in] name object name */ MyClass(const std::string& name); /// some public function void publicFunction(int i /**[in] some integer input*/); };
The implementation in MyClass.cpp could look as follows:
// Copyright header (LGPL) /// \file MyClass.cpp /** Implementation of class MyClass * \author <a href="mailto:me@mail.org">me</a> * \date 2010-01-19 */ void MyClass::_privateFunction() { // some code } MyClass::MyClass(const std::string& /*name*/) { // please comment out unused parameters // to show, that you did not simply forget them // some more code } void MyClass::publicFunction(int i) { if (i == 0) { // do something } }
Using the following conventions makes option grouping in the grouped
view of cmake-gui easier and simplifies writing gentoo ebuilds a lot
(there are some automatic functions to enable or disable
options starting with the prefixes mentioned below).