You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.3 KiB
92 lines
2.3 KiB
9 years ago
|
NAMING CONVENTIONS
|
||
|
==================
|
||
|
|
||
|
CLASS NAMES
|
||
|
|
||
|
Class names follow Qt and KDE schema, with KXE or KXMLEditor prefix:
|
||
|
KXE....Dialog, KXE....View, KXE....Command for longer names.
|
||
|
examples: KXESpecProcInstrDialog
|
||
|
|
||
|
or
|
||
|
|
||
|
KXMLEditor.... for short names
|
||
|
examples: KXMLEditorShell, KXMLEditorShellIface, KXMLEditorAboutData,
|
||
|
KXMLEditorPart
|
||
|
|
||
|
|
||
|
VARIABLES
|
||
|
|
||
|
(1) prefixes for variable names
|
||
|
p - for pointer
|
||
|
psz - for "char *" and "const char *" (zero-terminated usally)
|
||
|
str - for QString objects
|
||
|
b - for booleans
|
||
|
i - for integers
|
||
|
dlg - for dialogs
|
||
|
pDlg - for pointers to dialogs
|
||
|
cmd - for commands
|
||
|
pCmd - for pointers to commands
|
||
|
|
||
|
(2) prefixes for member variables
|
||
|
Member variables should use the prefixes defined above but should additionally
|
||
|
be prefixed with "m_" or "s_", if they are static.
|
||
|
|
||
|
Example:
|
||
|
m_pDlgConfig - the member variable is a pointer to a dialog
|
||
|
|
||
|
(3) prefixes for member functions
|
||
|
sig - for signals
|
||
|
slot - for (normal) slots
|
||
|
slotAct - for slots connected to actions
|
||
|
|
||
|
COMMENTS
|
||
|
|
||
|
Comments in header files should stick to the rules for KDoc / Doxygen.
|
||
|
Comments in CPP-files should use only the new C++-style comments // to make
|
||
|
it possible to comment whole functions by using the C-style comments /* ... */.
|
||
|
|
||
|
SOURCE FORMAT
|
||
|
|
||
|
The source should be formatted in ANSI style and should be intended with tabs,
|
||
|
like in the following example (use the "Show tabs" option or something similar
|
||
|
in your editor to see the tabs):
|
||
|
|
||
|
namespace foospace
|
||
|
{
|
||
|
int Foo()
|
||
|
{
|
||
|
if (isBar)
|
||
|
{
|
||
|
bar(); // this is a
|
||
|
// very long comment
|
||
|
return 1;
|
||
|
}
|
||
|
else
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ADDING NEW FILES
|
||
|
================
|
||
|
|
||
|
Adding a new file to our project requires the following:
|
||
|
|
||
|
* creating it in our source tree
|
||
|
* adding it to the file Makefile.am in the subdirectory of the new file
|
||
|
- all files have to be added to the EXTRA_DIST variable
|
||
|
- all *.cpp and *.ui files have to be added to the *_SOURCES variable
|
||
|
- all *.h files have to be added to the noinst_HEADERS variable
|
||
|
* remove old dependencies
|
||
|
Normally removing the .deps and .libs subdirectories should do. If the application
|
||
|
crashs later due to missing symbols, you have to come back to this point and do
|
||
|
make clean
|
||
|
make distclean
|
||
|
* in the project's root dir call
|
||
|
make -f Makefile.dist
|
||
|
./configure
|
||
|
make
|
||
|
make install (as root)
|
||
|
* test the application
|
||
|
* add the new file to CVS
|
||
|
* commit the new file to CVS
|