diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp index 54f3c41955..e63b30bea2 100644 --- a/common/eagle_parser.cpp +++ b/common/eagle_parser.cpp @@ -43,14 +43,14 @@ using std::string; template<> -string Convert( wxString aValue ) +string Convert( const wxString& aValue ) { return aValue.ToStdString(); } template <> -double Convert( wxString aValue ) +double Convert( const wxString& aValue ) { double value; @@ -63,7 +63,7 @@ double Convert( wxString aValue ) template <> -int Convert( wxString aValue ) +int Convert( const wxString& aValue ) { if( aValue.IsEmpty() ) throw XML_PARSER_ERROR( "Conversion to int failed. Original value is empty." ); @@ -73,7 +73,7 @@ int Convert( wxString aValue ) template <> -bool Convert( wxString aValue ) +bool Convert( const wxString& aValue ) { if( aValue != "yes" && aValue != "no" ) throw XML_PARSER_ERROR( "Conversion to bool failed. Original value, '" + @@ -83,10 +83,11 @@ bool Convert( wxString aValue ) return aValue == "yes"; } + /// parse an Eagle XML "rot" field. Unfortunately the DTD seems not to explain /// this format very well. [S][M]R. Examples: "R90", "MR180", "SR180" template<> -EROT Convert( wxString aRot ) +EROT Convert( const wxString& aRot ) { EROT value; @@ -630,15 +631,15 @@ unsigned long timeStamp( wxXmlNode* aTree ) } -wxPoint kicad_arc_center( wxPoint start, wxPoint end, double angle ) +wxPoint kicad_arc_center( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ) { // Eagle give us start and end. // S_ARC wants start to give the center, and end to give the start. - double dx = end.x - start.x, dy = end.y - start.y; - wxPoint mid = (start + end) / 2; + double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y; + wxPoint mid = ( aStart + aEnd ) / 2; - double dlen = sqrt( dx*dx + dy*dy ); - double dist = dlen / ( 2 * tan( DEG2RAD( angle ) / 2 ) ); + double dlen = sqrt( dx * dx + dy * dy ); + double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) ); wxPoint center( mid.x + dist * ( dy / dlen ), diff --git a/include/eagle_parser.h b/include/eagle_parser.h index 2e1fdade55..c45f72d282 100644 --- a/include/eagle_parser.h +++ b/include/eagle_parser.h @@ -159,7 +159,7 @@ public: * type T is unknown. */ template -T Convert( wxString aValue ) +T Convert( const wxString& aValue ) { throw XML_PARSER_ERROR( "Conversion failed. Unknown type." ); } @@ -196,7 +196,7 @@ public: * aData is empty, the attribute is understood as unavailable; otherwise, the * conversion to T is tried. */ - OPTIONAL_XML_ATTRIBUTE( wxString aData ) + OPTIONAL_XML_ATTRIBUTE( const wxString& aData ) { m_isAvailable = !aData.IsEmpty(); @@ -229,7 +229,7 @@ public: * @param aData is a wxString that should be converted to T. If the string is empty, the * attribute is set to unavailable. */ - OPTIONAL_XML_ATTRIBUTE& operator =( wxString aData ) + OPTIONAL_XML_ATTRIBUTE& operator =( const wxString& aData ) { m_isAvailable = !aData.IsEmpty(); @@ -268,7 +268,7 @@ public: * tries to convert a string to the base type. * @param aString is the string that will be converted to the base type. */ - void Set( wxString aString ) + void Set( const wxString& aString ) { m_data = Convert( aString ); } @@ -685,6 +685,6 @@ string makeKey( const string& aFirst, const string& aSecond ); unsigned long timeStamp( wxXmlNode* aTree ); /// Convert an Eagle curve end to a KiCad center for S_ARC -wxPoint kicad_arc_center( wxPoint start, wxPoint end, double angle ); +wxPoint kicad_arc_center( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ); #endif // _EAGLE_PARSER_H_ diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 2a004c4bb7..cf7fe29b56 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1,4 +1,3 @@ - /* * This program source code file is part of KiCad, a free EDA CAD application. *