update naming style guide

Change-Id: Icce1e029dd4d310b657cb66658ff5493beb90b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365522
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Mike Klein 2021-02-03 10:15:55 -06:00
parent 30b355a49e
commit 0b233d7498

View File

@ -48,15 +48,27 @@ public:
};
~~~~
Data fields in structs, classes, unions begin with lower-case f and are then
camel-capped.
Data fields in structs, classes, and unions that have methods begin with
lower-case f and are then camel-capped, to distinguish those fields from other
variables. Types that are predominantly meant for direct field access don't
need f-decoration.
<!--?prettify?-->
~~~~
struct GrCar {
...
float milesDriven;
Color color;
};
class GrMotorcyle {
public:
float getMilesDriven() const { return fMilesDriven; }
void setMilesDriven(float milesDriven) { fMilesDriven = milesDriven; }
Color getColor() const { return fColor; }
private:
float fMilesDriven;
...
Color fColor;
};
~~~~