Page MenuHomeWildfire Games

NONCOPYABLE GUI classes and structs
ClosedPublic

Authored by elexis on Aug 10 2019, 1:13 AM.

Details

Summary

This patch makes the following classes NONCOPYABLE:

CChartData, CGUIList, CGUISeries, COListColumn, GUITooltip, SGUIMessage, SSpriteCall, STextCall, SFeedback, IGUISetting, CGUISetting, GUI, IGUIObject, IGUIScrollBar.

This is to have the compiler enforce that people don't write code copying these instances when const references should be sufficient for their purposes.
Adds comment for the classes which do copy for convenience and because they only contain primitives.
The list encompasses almost every GUI class, except few Text and Sprite structures which need further changes.

Drop the copying GetSetting and SetSetting template functions for CGUIList, CGUISeries, CClientArea, CGUIString so that the faster pointer variant is preferred.

Drops a copy when reading COList columns.
Drops one copying GUI<CClientArea>::GetSetting call in IGUIObject::UpdateCachedSize() and four copying GUI<CGUIString>::GetSetting calls in SetupText() functions in preference of GetSettingPointer.

Test Plan

Convince yourself that the compiler showing you where you copy when you don't have to is a win. Observe that GetSettingPointer always succeeds. Know that you can always remove the NONCOPYABLE if you really need it later.
Notice that a GetSettingReference sounds like a good next step, but also that there are 67 references to GetSettingPointer already.

Delete unused GUIRenderer IGLState class from rP1536 obsolete since rP11039.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8796
Build 14424: Vulcan BuildJenkins
Build 14423: arc lint + arc unit

Event Timeline

elexis created this revision.Aug 10 2019, 1:13 AM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/GUIManager.h
|  47| class·CGUIManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCGUIManager{' is invalid C code. Use --std or --language to configure the language.

source/gui/CGUISeries.h
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/gui/CGUISeries.h
| 176| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/CGUIList.h
|   1| /*·Copyright·(C)·2009·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2009"

source/gui/CGUIList.h
| 176| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIutil.h
|  44| template<typename·T>·class·GUI;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUIScrollBar.h
| 176| »   ·*·them·to·the·scroll-bar·and·it·will·see·if·the·message·regarded
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/CChart.h
|  36| »   std::vector<CVector2D>·m_Points;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'std::vector' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIRenderer.h
|  33| namespace·GUIRenderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceGUIRenderer{' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUIObject.h
| 176| »   ·*
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUITooltip.h
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/gui/GUITooltip.h
|  27| class·GUITooltip
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classGUITooltip{' is invalid C code. Use --std or --language to configure the language.

source/gui/COList.h
| 176| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIbase.h
| 176| class·CClientArea
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUItext.h
| 176| ·*/
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/348/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Aug 10 2019, 2:04 AM
This revision was automatically updated to reflect the committed changes.