// --------------------------------------------------------------------------- void CGeorgesImpl::MakeTyp( const std::string& filename, TType type, TUI ui, const std::string& _min, const std::string& _max, const std::string& _default, const std::vector< std::pair< std::string, std::string > >* const _pvpredef ) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Create a type CType t; t.Type = (CType::TType)type; t.UIType = (CType::TUI)ui; t.Min= _min; t.Max = _max; t.Default = _default; if (_pvpredef) { t.Definitions.resize (_pvpredef->size ()); uint i; for (i=0; i<_pvpredef->size (); i++) { t.Definitions[i].Label = (*_pvpredef)[i].first; t.Definitions[i].Value = (*_pvpredef)[i].second; } } // Save the type COFile output; if (output.open (filename)) { try { // XML stream COXml outputXml; outputXml.init (&output); // Write t.write (outputXml.getDocument ()); } catch (Exception &e) { nlwarning ("Error during writing file '%s' : ", filename.c_str (), e.what ()); } } else { nlwarning ("Can't open the file %s for writing", filename.c_str ()); } }