[webkit-dev] Enum naming style?
Eric Seidel
eric at webkit.org
Wed Oct 1 16:01:30 PDT 2008
According to the WebKit style http://webkit.org/coding/coding-style.html
Names: 10. Enum members should user InterCaps with an initial capital letter.
Our enums seem to use every style imaginable:
enum EditorDeleteAction {
deleteSelectionAction,
deleteKeyAction,
forwardDeleteKeyAction
};
enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic,
MinIntrinsic };
enum CSSPropertyID {
CSSPropertyInvalid = 0,
CSSPropertyBackground = 1001,
CSSPropertyBackgroundAttachment = 1002,
....
enum SVGStitchOptions {
SVG_STITCHTYPE_UNKNOWN = 0,
SVG_STITCHTYPE_STITCH = 1,
SVG_STITCHTYPE_NOSTITCH = 2
};
Most of these seem "wrong" according to the official style. But one
point which is missing in the styleguide is what the names of the
individual values should be?
For example:
enum Color {
BrownColor,
RedColor,
BlueColor
};
Or should it be:
enum Color {
Brown,
Red,
Blue
}
Or even:
enum Color {
ColorBrown,
ColorRed,
ColorBlue
}
I would argue for enum Color { BrownColor };
Thoughts?
-eric
More information about the webkit-dev
mailing list