[Qgis-developer] Typo in QgsRasterLayer enum

Manuel Massing m.massing at warped-space.de
Tue Aug 10 05:37:10 EDT 2010


Hi Pete,

> Last night  I was looking through the QgsRasterLayer code and noticed a
> typo in the DrawingStyle enum that made it in during the major renaming
> efforts  (r9564 & r9566) just before version 1.0 was released.
> 
> MultiBandSingleGandGray should be MultiBandsingleBandGray
> 
> Question is how do we go about fixing it and preserving compatibility?
> 
> I was thinking we would need to:
> 1) add the correctly spelled enum
> 2) use both enums where ever the incorrect one appears, example
> if( QgsRasterLayer::MultiBandSingleGandGray )
> becomes
> if( QgsRasterLayer::MultiBandSingleGandGray ||
> QgsRasterLayer::MultiBandsingleBandGray )
> 3) Wait until v2.0 to drop MultiBandSingleGandGray enum

It is possible to let multiple enumeration constants share the same value,
e.g.

  enum Test {
    Value1,
    Value1alias = Value1,
    Value2
  };


This retains binary and source compatibility, so one could introduce the
correctly written enum as an alias, rename all enums in the qgis codebase to 
the orthographically correct one (which has identical numerical value, so
won't affect binary API) and mark the old enum constant name as deprecated,
(keep it around for source compatibility until 2.0).

cheers,

	Manuel


More information about the Qgis-developer mailing list