|
rpm-build |
6f7582 |
libmwaw coding style
|
|
rpm-build |
6f7582 |
-------------------
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Indentation/spacing: We indent with tabs. Not spaces. This decision is, of
|
|
rpm-build |
6f7582 |
course, rather contentious, but it does have the force of inertia going for
|
|
rpm-build |
6f7582 |
it. Try to keep lines less than 120 columns wide. Please run
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
astyle -HU -A3 -k3 -y -n -s2 -r \*.cpp \*.h \*.?xx
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Naming: Version-specific classes, enumerations, and defines should be prefixed
|
|
rpm-build |
6f7582 |
with a clear abreviation of the format 'ClarisWks', 'MacWrt', ...
|
|
rpm-build |
6f7582 |
Generic classes (this includes utility abstractions like streams and strings)
|
|
rpm-build |
6f7582 |
should be prefixed with MWAW.
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
For better worse, we have decided on using the 'm_' prefix for naming class and struct
|
|
rpm-build |
6f7582 |
variables (i.e.: my_class->m_var). Short-hand for variable names is allowed,
|
|
rpm-build |
6f7582 |
but don't overdo it (m_var->len() instead of m_variable->length() is ok,
|
|
rpm-build |
6f7582 |
m_nam instead of m_name is stupid).
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Memory allocation: Use the C++ standard operations for this (new, delete) and shared_ptr (boost, c++11, ...).
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Data structures: Use the C++ standard library wherever appropriate and
|
|
rpm-build |
6f7582 |
convenient. It should almost never be necessary to roll your own data
|
|
rpm-build |
6f7582 |
structure.
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Strings: You may use either the C++ standard strings or our very own
|
|
rpm-build |
6f7582 |
UTF8-compliant RVNGString. Hand-allocated char *'s are discouraged.
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Further information: The OpenOffice.org (http://tools.openoffice.org/coding.html)
|
|
rpm-build |
6f7582 |
and AbiWord (cvs://cvs.abisource.com/abi/docs/AbiSourceCodeGuidelines.abw)
|
|
rpm-build |
6f7582 |
contain lots of useful information that will make you a better C++ coder.
|
|
rpm-build |
6f7582 |
Follow their advice religiously, except when they contradict something in this
|
|
rpm-build |
6f7582 |
document.
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
Fun: Remember, the important thing is to have fun. :-) These rules are a means,
|
|
rpm-build |
6f7582 |
not an end. Happy hacking!
|