Eeschema Eagle Import: Assign timestamps for modules

This commit is contained in:
Maciej Suminski
2017-10-20 08:38:39 +02:00
parent f5e7c2ee48
commit 2adc3d48b4
4 changed files with 37 additions and 9 deletions
+22 -7
View File
@@ -26,13 +26,9 @@
#include <eagle_parser.h>
#include <wx/xml/xml.h>
#include <wx/string.h>
#include <wx/filename.h>
#include <convert_to_biu.h>
using std::string;
#include <functional>
#include <sstream>
#include <iomanip>
// Template specializations below parse wxString to the used types:
// - string
@@ -175,6 +171,25 @@ unsigned long timeStamp( wxXmlNode* aTree )
}
time_t moduleTstamp( const string& aName, const string& aValue )
{
std::size_t h1 = std::hash<string>{}( aName );
std::size_t h2 = std::hash<string>{}( aValue );
return ((h1 ^ h2 << 1) & 0xffffffff);
}
string modulePath( const string& aName, const string& aValue )
{
std::ostringstream s;
s << '/' << std::setfill('0') << std::uppercase << std::hex << std::setw(8)
<< moduleTstamp( aName, aValue );
return s.str();
}
wxPoint kicad_arc_center( const wxPoint& aStart, const wxPoint& aEnd, double aAngle )
{
// Eagle give us start and end.