Skip to content

Commit

Permalink
add a docstring for String()
Browse files Browse the repository at this point in the history
  • Loading branch information
evmar committed Feb 22, 2016
1 parent 7df4802 commit ddd30f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cairo/cairo.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ const (
ContentColorAlpha Content = C.CAIRO_CONTENT_COLOR_ALPHA ContentColorAlpha Content = C.CAIRO_CONTENT_COLOR_ALPHA
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Content) String() string { func (i Content) String() string {
switch i { switch i {
case ContentColor: case ContentColor:
Expand Down Expand Up @@ -357,6 +358,7 @@ const (
FormatRGB30 Format = C.CAIRO_FORMAT_RGB30 FormatRGB30 Format = C.CAIRO_FORMAT_RGB30
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Format) String() string { func (i Format) String() string {
switch i { switch i {
case FormatInvalid: case FormatInvalid:
Expand Down Expand Up @@ -487,6 +489,7 @@ const (
OperatorHslLuminosity Operator = C.CAIRO_OPERATOR_HSL_LUMINOSITY OperatorHslLuminosity Operator = C.CAIRO_OPERATOR_HSL_LUMINOSITY
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Operator) String() string { func (i Operator) String() string {
switch i { switch i {
case OperatorClear: case OperatorClear:
Expand Down Expand Up @@ -627,6 +630,7 @@ const (
AntialiasBest Antialias = C.CAIRO_ANTIALIAS_BEST AntialiasBest Antialias = C.CAIRO_ANTIALIAS_BEST
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Antialias) String() string { func (i Antialias) String() string {
switch i { switch i {
case AntialiasDefault: case AntialiasDefault:
Expand Down Expand Up @@ -668,6 +672,7 @@ const (
FillRuleEvenOdd FillRule = C.CAIRO_FILL_RULE_EVEN_ODD FillRuleEvenOdd FillRule = C.CAIRO_FILL_RULE_EVEN_ODD
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i FillRule) String() string { func (i FillRule) String() string {
switch i { switch i {
case FillRuleWinding: case FillRuleWinding:
Expand Down Expand Up @@ -710,6 +715,7 @@ const (
LineCapSquare LineCap = C.CAIRO_LINE_CAP_SQUARE LineCapSquare LineCap = C.CAIRO_LINE_CAP_SQUARE
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i LineCap) String() string { func (i LineCap) String() string {
switch i { switch i {
case LineCapButt: case LineCapButt:
Expand Down Expand Up @@ -744,6 +750,7 @@ const (
LineJoinBevel LineJoin = C.CAIRO_LINE_JOIN_BEVEL LineJoinBevel LineJoin = C.CAIRO_LINE_JOIN_BEVEL
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i LineJoin) String() string { func (i LineJoin) String() string {
switch i { switch i {
case LineJoinMiter: case LineJoinMiter:
Expand Down Expand Up @@ -1314,6 +1321,7 @@ const (
TextClusterFlagBackward TextClusterFlags = C.CAIRO_TEXT_CLUSTER_FLAG_BACKWARD TextClusterFlagBackward TextClusterFlags = C.CAIRO_TEXT_CLUSTER_FLAG_BACKWARD
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i TextClusterFlags) String() string { func (i TextClusterFlags) String() string {
switch i { switch i {
case TextClusterFlagBackward: case TextClusterFlagBackward:
Expand Down Expand Up @@ -1357,6 +1365,7 @@ const (
FontSlantOblique FontSlant = C.CAIRO_FONT_SLANT_OBLIQUE FontSlantOblique FontSlant = C.CAIRO_FONT_SLANT_OBLIQUE
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i FontSlant) String() string { func (i FontSlant) String() string {
switch i { switch i {
case FontSlantNormal: case FontSlantNormal:
Expand All @@ -1380,6 +1389,7 @@ const (
FontWeightBold FontWeight = C.CAIRO_FONT_WEIGHT_BOLD FontWeightBold FontWeight = C.CAIRO_FONT_WEIGHT_BOLD
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i FontWeight) String() string { func (i FontWeight) String() string {
switch i { switch i {
case FontWeightNormal: case FontWeightNormal:
Expand All @@ -1404,6 +1414,7 @@ const (
SubpixelOrderVBGR SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_VBGR SubpixelOrderVBGR SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_VBGR
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i SubpixelOrder) String() string { func (i SubpixelOrder) String() string {
switch i { switch i {
case SubpixelOrderDefault: case SubpixelOrderDefault:
Expand Down Expand Up @@ -1434,6 +1445,7 @@ const (
HintStyleFull HintStyle = C.CAIRO_HINT_STYLE_FULL HintStyleFull HintStyle = C.CAIRO_HINT_STYLE_FULL
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i HintStyle) String() string { func (i HintStyle) String() string {
switch i { switch i {
case HintStyleDefault: case HintStyleDefault:
Expand Down Expand Up @@ -1462,6 +1474,7 @@ const (
HintMetricsOn HintMetrics = C.CAIRO_HINT_METRICS_ON HintMetricsOn HintMetrics = C.CAIRO_HINT_METRICS_ON
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i HintMetrics) String() string { func (i HintMetrics) String() string {
switch i { switch i {
case HintMetricsDefault: case HintMetricsDefault:
Expand Down Expand Up @@ -1848,6 +1861,7 @@ const (
FontTypeUser FontType = C.CAIRO_FONT_TYPE_USER FontTypeUser FontType = C.CAIRO_FONT_TYPE_USER
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i FontType) String() string { func (i FontType) String() string {
switch i { switch i {
case FontTypeToy: case FontTypeToy:
Expand Down Expand Up @@ -2235,6 +2249,7 @@ const (
PathClosePath PathDataType = C.CAIRO_PATH_CLOSE_PATH PathClosePath PathDataType = C.CAIRO_PATH_CLOSE_PATH
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i PathDataType) String() string { func (i PathDataType) String() string {
switch i { switch i {
case PathMoveTo: case PathMoveTo:
Expand Down Expand Up @@ -2333,6 +2348,7 @@ const (
DeviceTypeInvalid DeviceType = C.CAIRO_DEVICE_TYPE_INVALID DeviceTypeInvalid DeviceType = C.CAIRO_DEVICE_TYPE_INVALID
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i DeviceType) String() string { func (i DeviceType) String() string {
switch i { switch i {
case DeviceTypeDRM: case DeviceTypeDRM:
Expand Down Expand Up @@ -2469,6 +2485,7 @@ const (
SurfaceObserverRecordOperations SurfaceObserverMode = C.CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS SurfaceObserverRecordOperations SurfaceObserverMode = C.CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i SurfaceObserverMode) String() string { func (i SurfaceObserverMode) String() string {
switch i { switch i {
case SurfaceObserverNormal: case SurfaceObserverNormal:
Expand Down Expand Up @@ -2626,6 +2643,7 @@ const (
SurfaceTypeCOGL SurfaceType = C.CAIRO_SURFACE_TYPE_COGL SurfaceTypeCOGL SurfaceType = C.CAIRO_SURFACE_TYPE_COGL
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i SurfaceType) String() string { func (i SurfaceType) String() string {
switch i { switch i {
case SurfaceTypeImage: case SurfaceTypeImage:
Expand Down Expand Up @@ -3058,6 +3076,7 @@ const (
PatternTypeRasterSource PatternType = C.CAIRO_PATTERN_TYPE_RASTER_SOURCE PatternTypeRasterSource PatternType = C.CAIRO_PATTERN_TYPE_RASTER_SOURCE
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i PatternType) String() string { func (i PatternType) String() string {
switch i { switch i {
case PatternTypeSolid: case PatternTypeSolid:
Expand Down Expand Up @@ -3220,6 +3239,7 @@ const (
ExtendPad Extend = C.CAIRO_EXTEND_PAD ExtendPad Extend = C.CAIRO_EXTEND_PAD
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Extend) String() string { func (i Extend) String() string {
switch i { switch i {
case ExtendNone: case ExtendNone:
Expand Down Expand Up @@ -3270,6 +3290,7 @@ const (
FilterGaussian Filter = C.CAIRO_FILTER_GAUSSIAN FilterGaussian Filter = C.CAIRO_FILTER_GAUSSIAN
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i Filter) String() string { func (i Filter) String() string {
switch i { switch i {
case FilterFast: case FilterFast:
Expand Down Expand Up @@ -3436,6 +3457,7 @@ const (
RegionOverlapPart RegionOverlap = C.CAIRO_REGION_OVERLAP_PART RegionOverlapPart RegionOverlap = C.CAIRO_REGION_OVERLAP_PART
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i RegionOverlap) String() string { func (i RegionOverlap) String() string {
switch i { switch i {
case RegionOverlapIn: case RegionOverlapIn:
Expand Down Expand Up @@ -3587,6 +3609,7 @@ const (
SVGVersion12 SVGVersion = C.CAIRO_SVG_VERSION_1_2 SVGVersion12 SVGVersion = C.CAIRO_SVG_VERSION_1_2
) )


// String implements the Stringer interface, which is used in places like fmt's %q. For all enums like this it returns the Go name of the constant.
func (i SVGVersion) String() string { func (i SVGVersion) String() string {
switch i { switch i {
case SVGVersion11: case SVGVersion11:
Expand Down
1 change: 1 addition & 0 deletions gen.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ Ptr *C.%s
w.Print(")") w.Print(")")


if goName != "Status" { if goName != "Status" {
w.Print("// String implements the Stringer interface, which is used in places like fmt's %%q. For all enums like this it returns the Go name of the constant.")
w.Print("func (i %s) String() string {", goName) w.Print("func (i %s) String() string {", goName)
w.Print("switch i {") w.Print("switch i {")
for _, c := range consts { for _, c := range consts {
Expand Down

0 comments on commit ddd30f8

Please sign in to comment.