30 m_fileInput( aInputFile.fn_str() )
37 std::map<wxString, wxString>
kv;
50 if( ( line.size() > 2 && line[line.size() - 2] ==
'|' && line[line.size() - 1] ==
'>' ) )
52 str.append( line, 0, line.size() - 2 );
61 std::size_t token_end = 0;
63 while( token_end < str.size() && token_end != std::string::npos )
65 std::size_t token_start = str.find(
'|', token_end );
66 std::size_t token_equal = str.find(
'=', token_end );
67 std::size_t key_start;
69 if( token_start <= token_equal )
71 key_start = token_start + 1;
76 key_start = token_end;
79 token_end = str.find(
'|', key_start );
81 if( token_equal >= token_end )
86 if( token_end == std::string::npos )
88 token_end = str.size() + 1;
91 std::string keyS = str.substr( key_start, token_equal - key_start );
92 std::string valueS = str.substr( token_equal + 1, token_end - token_equal - 1 );
96 wxString key( keyS.c_str(), wxConvISO8859_1 );
98 wxString canonicalKey = key.Trim(
false ).Trim(
true ).MakeUpper();
102 if( canonicalKey.StartsWith(
"%UTF8%" ) )
103 value = wxString( valueS.c_str(), wxConvUTF8 );
105 value = wxString( valueS.c_str(), wxConvISO8859_1 );
107 if( canonicalKey != wxS(
"PATTERN" ) && canonicalKey != wxS(
"SOURCEFOOTPRINTLIBRARY" ) )
111 value.Replace( wxT(
"ÿ" ), wxT(
" " ) );
115 if( str.rfind(
"|BINARY", 0 ) != 0 )
117 if( canonicalKey == wxT(
"DESIGNATOR" ) || canonicalKey == wxT(
"NAME" )
118 || canonicalKey == wxT(
"TEXT" ) )
124 kv.insert( { canonicalKey, value.Trim() } );
wxString AltiumPropertyToKiCadString(const wxString &aString)
std::map< wxString, wxString > ReadProperties()
ALTIUM_ASCII_PARSER(const wxString &aInputFile)
std::ifstream m_fileInput