OLD | NEW |
1 Coding Style Guidelines | 1 Coding Style Guidelines |
2 ======================= | 2 ======================= |
3 | 3 |
4 These conventions have evolved over time. Some of the earlier code in both | 4 These conventions have evolved over time. Some of the earlier code in both |
5 projects doesn’t strictly adhere to the guidelines. However, as the code evolves | 5 projects doesn’t strictly adhere to the guidelines. However, as the code evolves |
6 we hope to make the existing code conform to the guildelines. | 6 we hope to make the existing code conform to the guildelines. |
7 | 7 |
8 Files | 8 Files |
9 ----- | 9 ----- |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 <!--?prettify?--> | 71 <!--?prettify?--> |
72 ~~~~ | 72 ~~~~ |
73 bool gLoggingEnabled | 73 bool gLoggingEnabled |
74 Local variables begin lowercases and are camel-capped. | 74 Local variables begin lowercases and are camel-capped. |
75 | 75 |
76 int herdCats(const Array& cats) { | 76 int herdCats(const Array& cats) { |
77 int numCats = cats.count(); | 77 int numCats = cats.count(); |
78 } | 78 } |
79 ~~~~ | 79 ~~~~ |
80 | 80 |
81 Enum values are prefixed with k and have post fix that consists of an underscore | 81 Enum values are prefixed with k. Unscoped enum values are post fixed with |
82 and singular name of the enum name. The enum itself should be singular for | 82 an underscore and singular name of the enum name. The enum itself should be |
83 exclusive values or plural for a bitfield. If a count is needed it is | 83 singular for exclusive values or plural for a bitfield. If a count is needed it |
84 k<singular enum name>Count and not be a member of the enum (see example): | 84 is k<singular enum name>Count and not be a member of the enum (see exampl
e): |
85 | 85 |
86 <!--?prettify?--> | 86 <!--?prettify?--> |
87 ~~~~ | 87 ~~~~ |
| 88 enum class SkPancakeType { |
| 89 kBlueberry, |
| 90 kPlain, |
| 91 kChocolateChip, |
| 92 }; |
| 93 ~~~~ |
| 94 |
| 95 <!--?prettify?--> |
| 96 ~~~~ |
88 enum SkPancakeType { | 97 enum SkPancakeType { |
89 kBlueberry_PancakeType, | 98 kBlueberry_PancakeType, |
90 kPlain_PancakeType, | 99 kPlain_PancakeType, |
91 kChocolateChip_PancakeType, | 100 kChocolateChip_PancakeType, |
92 | 101 |
93 kLast_PancakeType = kChocolateChip_PancakeType | 102 kLast_PancakeType = kChocolateChip_PancakeType |
94 }; | 103 }; |
95 | 104 |
96 static const SkPancakeType kPancakeTypeCount = kLast_PancakeType + 1; | 105 static const SkPancakeType kPancakeTypeCount = kLast_PancakeType + 1; |
97 ~~~~ | 106 ~~~~ |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 this->drawBitmapRectToRect( | 560 this->drawBitmapRectToRect( |
552 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); | 561 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); |
553 } | 562 } |
554 ~~~~ | 563 ~~~~ |
555 | 564 |
556 Python | 565 Python |
557 ------ | 566 ------ |
558 | 567 |
559 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). | 568 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). |
560 | 569 |
OLD | NEW |