Fix some std::move() of a reference parameter issues.

Also some coding standard fixes for member variable
names.
This commit is contained in:
Jeff Young 2025-07-27 11:23:52 +01:00
parent 4a07154ba3
commit 755537ad8c
5 changed files with 471 additions and 544 deletions

View File

@ -44,13 +44,16 @@
// sch_label.cpp // sch_label.cpp
extern wxString getElectricalTypeLabel( LABEL_FLAG_SHAPE aType ); extern wxString getElectricalTypeLabel( LABEL_FLAG_SHAPE aType );
PANEL_SYNC_SHEET_PINS::PANEL_SYNC_SHEET_PINS( wxWindow* aParent, SCH_SHEET* aSheet, PANEL_SYNC_SHEET_PINS::PANEL_SYNC_SHEET_PINS( wxWindow* aParent, SCH_SHEET* aSheet, wxNotebook* aNoteBook,
wxNotebook* aNoteBook, int aIndex, int aIndex, SHEET_SYNCHRONIZATION_AGENT& aAgent,
SHEET_SYNCHRONIZATION_AGENT& aAgent, const SCH_SHEET_PATH& aPath ) :
const SCH_SHEET_PATH& aPath ) : PANEL_SYNC_SHEET_PINS_BASE( aParent ),
PANEL_SYNC_SHEET_PINS_BASE( aParent ), m_sheet( aSheet ), m_noteBook( aNoteBook ), m_sheet( aSheet ),
m_index( aIndex ), m_sheetFileName( aSheet->GetFileName() ), m_agent( aAgent ), m_noteBook( aNoteBook ),
m_path( std::move( aPath ) ), m_index( aIndex ),
m_sheetFileName( aSheet->GetFileName() ),
m_agent( aAgent ),
m_path( aPath ),
m_views( { m_views( {
{ SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL, m_viewSheetLabels }, { SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL, m_viewSheetLabels },
{ SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN, m_viewSheetPins }, { SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN, m_viewSheetPins },

View File

@ -145,13 +145,13 @@ public:
void SetValue( const wxString& aValue ) { m_value = aValue; } void SetValue( const wxString& aValue ) { m_value = aValue; }
const wxString& GetValue() const { return m_value; } const wxString& GetValue() const { return m_value; }
void SetFields( nlohmann::ordered_map<wxString, wxString>& aFields ) void SetFields( nlohmann::ordered_map<wxString, wxString> aFields )
{ {
m_fields = std::move( aFields ); m_fields = std::move( aFields );
} }
const nlohmann::ordered_map<wxString, wxString>& GetFields() const { return m_fields; } const nlohmann::ordered_map<wxString, wxString>& GetFields() const { return m_fields; }
void SetProperties( std::map<wxString, wxString>& aProps ) void SetProperties( std::map<wxString, wxString> aProps )
{ {
m_properties = std::move( aProps ); m_properties = std::move( aProps );
} }

View File

@ -125,9 +125,9 @@ std::optional<int64_t> FindSquareDistanceToItem( const BOARD_ITEM& item, const V
{ {
// Exploit the intersectable as a nearable // Exploit the intersectable as a nearable
std::visit( std::visit(
[&]( auto& geom ) [&]( const auto& geom )
{ {
nearable = NEARABLE_GEOM( std::move( geom ) ); nearable = NEARABLE_GEOM( geom );
}, },
*intersectable ); *intersectable );
} }

File diff suppressed because it is too large Load Diff

View File

@ -424,19 +424,19 @@ public:
IDF3_BOARD( IDF3::CAD_TYPE aCadType ); IDF3_BOARD( IDF3::CAD_TYPE aCadType );
virtual ~IDF3_BOARD(); virtual ~IDF3_BOARD();
IDF3::CAD_TYPE GetCadType( void ); IDF3::CAD_TYPE GetCadType( void ) { return m_cadType; }
// retrieve the nominal unit used in reading/writing // retrieve the nominal unit used in reading/writing
// data. This is primarily for use by owned objects // data. This is primarily for use by owned objects
// and is only of informational use for the end user. // and is only of informational use for the end user.
// Internally all data is represented in mm and the // Internally all data is represented in mm and the
// end user must use only mm in the API. // end user must use only mm in the API.
IDF3::IDF_UNIT GetUnit( void ); IDF3::IDF_UNIT GetUnit( void ) const { return m_unit; }
const std::string& GetNewRefDes( void ); const std::string& GetNewRefDes( void );
void SetBoardName( const std::string& aBoardName ); void SetBoardName( const std::string& aBoardName ) { m_boardName = aBoardName; }
const std::string& GetBoardName( void ); const std::string& GetBoardName( void ) const { return m_boardName; }
bool SetBoardThickness( double aBoardThickness ); bool SetBoardThickness( double aBoardThickness );
double GetBoardThickness( void ); double GetBoardThickness( void );
@ -445,21 +445,23 @@ public:
bool WriteFile( const wxString& aFullFileName, bool aUnitMM = true, bool WriteFile( const wxString& aFullFileName, bool aUnitMM = true,
bool aForceUnitFlag = false ); bool aForceUnitFlag = false );
const std::string& GetIDFSource( void ); const std::string& GetIDFSource( void ) const { return m_idfSource; }
void SetIDFSource( const std::string& aIDFSource); void SetIDFSource( const std::string& aIDFSource) { m_idfSource = aIDFSource; }
const std::string& GetBoardSource( void );
const std::string& GetLibrarySource( void ); const std::string& GetBoardSource( void ) const { return m_brdSource; }
const std::string& GetBoardDate( void ); const std::string& GetLibrarySource( void ) const { return m_libSource; }
const std::string& GetLibraryDate( void ); const std::string& GetBoardDate( void ) const { return m_brdDate; }
int GetBoardVersion( void ); const std::string& GetLibraryDate( void ) const { return m_libDate; }
int GetBoardVersion( void ) const { return m_brdFileVersion; }
bool SetBoardVersion( int aVersion ); bool SetBoardVersion( int aVersion );
int GetLibraryVersion( void ); int GetLibraryVersion( void ) const { return m_libFileVersion; }
bool SetLibraryVersion( int aVersion ); bool SetLibraryVersion( int aVersion );
double GetUserScale( void ); double GetUserScale( void ) const { return m_userScale; }
bool SetUserScale( double aScaleFactor ); bool SetUserScale( double aScaleFactor );
int GetUserPrecision( void ); int GetUserPrecision( void ) const { return m_userPrec; }
bool SetUserPrecision( int aPrecision ); bool SetUserPrecision( int aPrecision );
void GetUserOffset( double& aXoff, double& aYoff ); void GetUserOffset( double& aXoff, double& aYoff );
@ -469,11 +471,10 @@ public:
bool DelBoardOutline( IDF_OUTLINE* aOutline ); bool DelBoardOutline( IDF_OUTLINE* aOutline );
bool DelBoardOutline( size_t aIndex ); bool DelBoardOutline( size_t aIndex );
size_t GetBoardOutlinesSize( void ); size_t GetBoardOutlinesSize( void );
BOARD_OUTLINE* GetBoardOutline( void ); BOARD_OUTLINE* GetBoardOutline( void ) { return &m_boardOutline; }
const std::list< IDF_OUTLINE* >* GetBoardOutlines( void );
// Operations for OTHER OUTLINES // Operations for OTHER OUTLINES
const std::map<std::string, OTHER_OUTLINE*>* GetOtherOutlines( void ); const std::map<std::string, OTHER_OUTLINE*>* GetOtherOutlines( void ) const { return &m_otherOutlines; }
/// XXX - TO BE IMPLEMENTED /// XXX - TO BE IMPLEMENTED
// //
@ -533,7 +534,7 @@ public:
std::list<IDF_DRILL_DATA*>& GetBoardDrills( void ) std::list<IDF_DRILL_DATA*>& GetBoardDrills( void )
{ {
return board_drills; return m_drills;
} }
IDF_DRILL_DATA* AddBoardDrill( double aDia, double aXpos, double aYpos, IDF_DRILL_DATA* AddBoardDrill( double aDia, double aXpos, double aYpos,
@ -575,7 +576,7 @@ public:
// return error string // return error string
const std::string& GetError( void ) const std::string& GetError( void )
{ {
return errormsg; return m_errormsg;
} }
private: private:
@ -629,69 +630,52 @@ private:
bool writeLibFile( const std::string& aFileName ); bool writeLibFile( const std::string& aFileName );
#ifndef DISABLE_IDF_OWNERSHIP #ifndef DISABLE_IDF_OWNERSHIP
bool checkComponentOwnership( int aSourceLine, const char* aSourceFunc, bool checkComponentOwnership( int aSourceLine, const char* aSourceFunc, IDF3_COMPONENT* aComponent );
IDF3_COMPONENT* aComponent );
#endif #endif
std::map< std::string, std::string > uidFileList; // map of files opened and UIDs std::map<std::string, std::string> m_uidFileList; // map of files opened and UIDs
std::list< std::string > uidLibList; // list of UIDs read from a library file std::list<std::string> m_uidLibList; // list of UIDs read from a library file
// string for passing error messages to user // string for passing error messages to user
std::string errormsg; std::string m_errormsg;
std::list< IDF_NOTE* > notes; // IDF notes std::list< IDF_NOTE*> m_notes; // IDF notes
std::list< std::string > noteComments; // comment list for NOTES section std::list<std::string> m_noteComments; // comment list for NOTES section
std::list< std::string > drillComments; // comment list for DRILL section std::list<std::string> m_drillComments; // comment list for DRILL section
std::list< std::string > placeComments; // comment list for PLACEMENT section std::list<std::string> m_placeComments; // comment list for PLACEMENT section
std::list<IDF_DRILL_DATA*> board_drills; std::list<IDF_DRILL_DATA*> m_drills;
std::map< std::string, IDF3_COMPONENT*> components; // drill and placement data for components std::map<std::string, IDF3_COMPONENT*> m_components; // drill and placement data for components
std::map<std::string, IDF3_COMP_OUTLINE*> m_componentOutlines; // component outlines (data for library file).
// component outlines (data for library file). std::string m_boardName;
std::map< std::string, IDF3_COMP_OUTLINE*> compOutlines; IDF3::CAD_TYPE m_cadType;
std::string boardName; IDF3::IDF_UNIT m_unit;
IDF3::CAD_TYPE cadType; IDF3::IDF_VERSION m_idfVer; // IDF version of Board or Library
IDF3::IDF_UNIT unit;
IDF3::IDF_VERSION idfVer; // IDF version of Board or Library
// counter for automatically numbered NOREFDES items int m_refDesCounter; // counter for automatically numbered NOREFDES items
int iRefDes; std::string m_refDesString;
std::string sRefDes;
std::string idfSource; // SOURCE string to use when writing BOARD and LIBRARY headers std::string m_idfSource; // SOURCE string to use when writing BOARD and LIBRARY headers
std::string brdSource; // SOURCE string as retrieved from a BOARD file std::string m_brdSource; // SOURCE string as retrieved from a BOARD file
std::string libSource; // SOURCE string as retrieved from a LIBRARY file std::string m_libSource; // SOURCE string as retrieved from a LIBRARY file
std::string brdDate; // DATE string from BOARD file std::string m_brdDate; // DATE string from BOARD file
std::string libDate; // DATE string from LIBRARY file std::string m_libDate; // DATE string from LIBRARY file
int brdFileVersion; // File Version from BOARD file int m_brdFileVersion; // File Version from BOARD file
int libFileVersion; // File Version from LIBRARY file int m_libFileVersion; // File Version from LIBRARY file
int userPrec; // user may store any integer here int m_userPrec; // user may store any integer here
double userScale; // user may store a scale for translating to arbitrary units double m_userScale; // user may store a scale for translating to arbitrary units
double userXoff; // user may specify an arbitrary X/Y offset double m_userXoff; // user may specify an arbitrary X/Y offset
double userYoff; double m_userYoff;
// main board outline and cutouts BOARD_OUTLINE m_boardOutline; // main board outline and cutouts
BOARD_OUTLINE olnBoard; std::map<std::string, OTHER_OUTLINE*> m_otherOutlines; // OTHER outlines
std::list<ROUTE_OUTLINE*> m_routeOutlines; // ROUTE outlines
std::list<PLACE_OUTLINE*> m_placeOutlines; // PLACEMENT outlines
std::multimap<std::string, GROUP_OUTLINE*> m_groupOutlines; // PLACEMENT GROUP outlines
// OTHER outlines std::list<ROUTE_KO_OUTLINE*> m_routeKeepoutOutlines; // ROUTE KEEPOUT outlines
std::map<std::string, OTHER_OUTLINE*> olnOther; std::list<VIA_KO_OUTLINE*> m_viaKeepoutOutlines; // VIA KEEPOUT outlines
std::list<PLACE_KO_OUTLINE*> m_placeKeepoutOutlines; // PLACE KEEPOUT outlines
// ROUTE outlines
std::list<ROUTE_OUTLINE*> olnRoute;
// PLACEMENT outlines
std::list<PLACE_OUTLINE*> olnPlace;
// ROUTE KEEPOUT outlines
std::list<ROUTE_KO_OUTLINE*> olnRouteKeepout;
// VIA KEEPOUT outlines
std::list<VIA_KO_OUTLINE*> olnViaKeepout;
// PLACE KEEPOUT outlines
std::list<PLACE_KO_OUTLINE*> olnPlaceKeepout;
// PLACEMENT GROUP outlines
std::multimap<std::string, GROUP_OUTLINE*> olnGroup;
}; };
#endif // IDF_PARSER_H #endif // IDF_PARSER_H