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. Unscoped enum values are post fixed with | 81 Enum values are prefixed with k and have post fix that consists of an underscore |
82 an underscore and singular name of the enum name. The enum itself should be | 82 and singular name of the enum name. The enum itself should be singular for |
83 singular for exclusive values or plural for a bitfield. If a count is needed it | 83 exclusive values or plural for a bitfield. If a count is needed it is |
84 is k<singular enum name>Count and not be a member of the enum (see exampl
e): | 84 k<singular enum name>Count and not be a member of the enum (see example): |
85 | 85 |
86 <!--?prettify?--> | 86 <!--?prettify?--> |
87 ~~~~ | 87 ~~~~ |
88 enum class SkPancakeType { | |
89 kBlueberry, | |
90 kPlain, | |
91 kChocolateChip, | |
92 }; | |
93 ~~~~ | |
94 | |
95 <!--?prettify?--> | |
96 ~~~~ | |
97 enum SkPancakeType { | 88 enum SkPancakeType { |
98 kBlueberry_PancakeType, | 89 kBlueberry_PancakeType, |
99 kPlain_PancakeType, | 90 kPlain_PancakeType, |
100 kChocolateChip_PancakeType, | 91 kChocolateChip_PancakeType, |
101 | 92 |
102 kLast_PancakeType = kChocolateChip_PancakeType | 93 kLast_PancakeType = kChocolateChip_PancakeType |
103 }; | 94 }; |
104 | 95 |
105 static const SkPancakeType kPancakeTypeCount = kLast_PancakeType + 1; | 96 static const SkPancakeType kPancakeTypeCount = kLast_PancakeType + 1; |
106 ~~~~ | 97 ~~~~ |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 this->drawBitmapRectToRect( | 551 this->drawBitmapRectToRect( |
561 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); | 552 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); |
562 } | 553 } |
563 ~~~~ | 554 ~~~~ |
564 | 555 |
565 Python | 556 Python |
566 ------ | 557 ------ |
567 | 558 |
568 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). | 559 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). |
569 | 560 |
OLD | NEW |