lilypond-1.4.3
[lilypond.git] / Documentation / CodingStyle
blob0669c2094a60eefb89da375d30d3009667600931
1 -*-text-*-
3 CODING STANDARDS:
5 Functions and methods do not return errorcodes, but use assert for
6 checking status. 
8 INDENTATION, in emacs:
11 (add-hook 'c-mode-hook
12           '(lambda ()(setq c-basic-offset 4)))
15 (add-hook 'c++-mode-hook
16           '(lambda() (c-set-style "Stroustrup")
17              )
18           )
21 CLASSES and TYPES:
23         This_is_a_class
24         AClass_name     (for Abbreviation_class_name)
26 DATA MEMBERS
28         Class::member
30 if the member's name resembles its type, then I use
32         class Fubular { ..}
34         Class::fubular_
36 COMMENTS
38 /// short description
39 class Class {
40         ///
41         Data data_member_;
42         /**
43                 ..
44         */
46         /****************/
48         /// short memo
49         member();
50         /**
51                 long doco of member()
52         */
54 /**
55         Class documentation.
58 Unfortunately most of the code isn't really documented that good.
60 CLASSNAMES (2)
62 A lot of classes in LilyPond start with 'P', this is to distinguish
63 certain parts of LilyPond: the P stands for Printer, and the P-classes
64 are supposed to be more lowlevel than the others. Example:
66         Staff uses PStaff, PScore and PCol to do the typesetting of
67 symbols. Staff is  the "brains" for PStaff
69 NB: in PCursor (which is part of the library) P stands for PointerCursor
72 MEMBERS(2)
74 Standard methods:
76         ///check that *this satisfies its invariants, abort if not.
77         void OK() const
79         /// print *this (and substructures) to debugging log
80         void print() const
82         /// add some data to *this; 
83         add( .. )
84         /**
85         Presence of these methods usually imply that it is not feasible to this
86         via  a constructor
87         */
89         /// replace some data of *this
90         set( .. )