Blame HACKING

Packit Service 9d1170
libwpd coding style
Packit Service 9d1170
-------------------
Packit Service 9d1170
Packit Service 9d1170
Indentation/spacing: We indent with tabs. Not spaces. This decision is, of
Packit Service 9d1170
course, rather contentious, but it does have the force of inertia going for
Packit Service 9d1170
it. Try to keep lines less than 120 columns wide. Please run
Packit Service 9d1170
Packit Service 9d1170
    make astyle
Packit Service 9d1170
Packit Service 9d1170
before committing.
Packit Service 9d1170
Packit Service 9d1170
Naming: Version-specific classes, enumerations, and defines should be prefixed 
Packit Service 9d1170
with 'WP', followed by the version number (e.g.: WP6, WP5, WP51, etc.). 
Packit Service 9d1170
Generic classes should be prefixed with WPX.
Packit Service 9d1170
Packit Service 9d1170
For better worse, we have decided on using the camel caps convention for naming 
Packit Service 9d1170
variables (i.e.: tempJustification). Use of hungarian notation (i.e.: iNum) is
Packit Service 9d1170
forbidden, with one exception: use the 'm_' prefix for naming class and struct
Packit Service 9d1170
variables (i.e.: my_class->m_var). Short-hand for variable names is allowed,
Packit Service 9d1170
but don't overdo it (m_var->len() instead of m_variable->length() is ok,
Packit Service 9d1170
m_nam instead of m_name is stupid). For WordPerfect-specific state, err on the 
Packit Service 9d1170
side of verbosity (e.g.: names like 
Packit Service 9d1170
WP6ParagraphGroup_RightMarginAdjustmentSubGroup are _good_), as the extra 
Packit Service 9d1170
contextual information is useful when trying to decipher a convoluted piece of 
Packit Service 9d1170
code in the libwpd parser.
Packit Service 9d1170
Packit Service 9d1170
Memory allocation: Use the C++ standard operations for this (new, delete). 
Packit Service 9d1170
The rare use of realloc (and consequent use of malloc and free) in special 
Packit Service 9d1170
cases is allowed (although using a data structure from the C++ standard library
Packit Service 9d1170
is almost always preferable): take care not to mix and match C and C++ memory 
Packit Service 9d1170
allocation functions in this case.
Packit Service 9d1170
Packit Service 9d1170
Data structures: Use the C++ standard library wherever appropriate and 
Packit Service 9d1170
convenient. It should almost never be necessary to roll your own data 
Packit Service 9d1170
structure.
Packit Service 9d1170
Packit Service 9d1170
Strings: You may use either the C++ standard strings or our very own 
Packit Service 9d1170
UTF8-compliant librevenge::RVNGString. Hand-allocated char *'s are
Packit Service 9d1170
strongly discouraged.
Packit Service 9d1170
Packit Service 9d1170
Further information: The OpenOffice.org (http://tools.openoffice.org/coding.html)
Packit Service 9d1170
and AbiWord (cvs://cvs.abisource.com/abi/docs/AbiSourceCodeGuidelines.abw) 
Packit Service 9d1170
contain lots of useful information that will make you a better C++ coder. 
Packit Service 9d1170
Follow their advice religiously, except when they contradict something in this 
Packit Service 9d1170
document.
Packit Service 9d1170
Packit Service 9d1170
Fun: Remember, the important thing is to have fun. :-) These rules are a means,
Packit Service 9d1170
not an end. Happy hacking!