@@ -59,10 +59,9 @@ OverrideMapUpdater::OverrideMapUpdater(void)
5959 pAssociationMap->InsertEndChild (
6060 pOverrideMapXML->NewComment (" ==================== User Defined Languages ============================ " )
6161 );
62+
6263
63- tinyxml2::XMLElement* pAssoc = pAssociationMap->InsertNewChildElement (" association" );
64- pAssoc->SetAttribute (" id" , " nppexec.xml" );
65- pAssoc->SetAttribute (" userDefinedLangName" , " NppExec" );
64+ /* tinyxml2::XMLElement* pAssoc =*/ add_udl_assoc (" nppexec.xml" , " NppExec" );
6665 }
6766 else {
6867 // TODO: !!! NEED TO ADD ERROR CHECKING !!!
@@ -74,7 +73,30 @@ OverrideMapUpdater::OverrideMapUpdater(void)
7473 }
7574}
7675
76+ // add an <association> tag for a given UDL
77+ // converts wstring to string first
78+ tinyxml2::XMLElement* OverrideMapUpdater::add_udl_assoc (std::wstring wsFilename, std::wstring wsUDLname)
79+ {
80+ return add_udl_assoc (
81+ pcjHelper::wstring_to_utf8 (wsFilename),
82+ pcjHelper::wstring_to_utf8 (wsUDLname)
83+ );
84+ }
85+
86+ // add an <association> tag for a given UDL
87+ tinyxml2::XMLElement* OverrideMapUpdater::add_udl_assoc (std::string sFilename , std::string sUDLname )
88+ {
89+ tinyxml2::XMLElement* pAssoc = pAssociationMap->InsertNewChildElement (" association" );
90+ if (pAssoc) {
91+ pAssoc->SetAttribute (" id" , sFilename .c_str ());
92+ pAssoc->SetAttribute (" userDefinedLangName" , sUDLname .c_str ());
93+ }
94+ return pAssoc;
95+ }
96+
7797bool OverrideMapUpdater::experiment (void )
7898{
79- return false ;
99+ add_udl_assoc (" fake.xml" , " FakeUDL" );
100+ pOverrideMapXML->SaveFile (sOverMapPath ().c_str ());
101+ return true ;
80102}
0 commit comments