From: alfred Date: Fri, 29 Sep 2006 07:04:34 +0000 (+0000) Subject: enhance MsaOwner.java X-Git-Tag: edk2-stable201903~24233 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b88170614f5c89173d7b9672369980c62a678cb9 enhance MsaOwner.java git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1641 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java index 44b1dca907..46cd82a32a 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java @@ -40,10 +40,75 @@ public class MsaOwner { private ExternsDocument.Externs externs = null; private List listarch = new ArrayList(); - private Map mapfilenames = new HashMap(); //this need to be installed manually when msa is to be written - private Map mapprotocols = new HashMap(); + //private Map mapfilenames = new HashMap(); //this need to be installed manually when msa is to be written + //private Map mapprotocols = new HashMap(); //-----------------------------msaheader-------------------------------------// + + public final boolean addLibraryClass (String name, UsageTypes.Enum usage) { + Iterator classit = libclassdefs.getLibraryClassList().iterator(); + while (classit.hasNext()) { + if (classit.next().getKeyword() == name) { + MigrationTool.ui.println ("Warning: Duplicate LibraryClass"); + return false; + } + } + + LibraryClassDocument.LibraryClass classname; + List arch = new ArrayList(); + classname = libclassdefs.addNewLibraryClass(); + classname.setKeyword(name); + arch.add(usage); + classname.setSupArchList(arch); + return true; + } + + public final boolean addGuid (String guidname, UsageTypes.Enum usage) { + if (guids == null) { + guids = msa.addNewGuids(); + } + + Iterator guidit = guids.getGuidCNamesList().iterator(); + while (guidit.hasNext()) { + if (guidit.next().getGuidCName() == guidname) { + MigrationTool.ui.println ("Warning: Duplicate Guid"); + return false; + } + } + + GuidsDocument.Guids.GuidCNames guid; + List arch = new ArrayList(); + guid = guids.addNewGuidCNames(); + guid.setGuidCName(guidname); + arch.add(usage); + guid.setSupArchList(arch); + return true; + } + + + public final boolean addPpi (String ppiname, UsageTypes.Enum usage) { + if (ppis == null) { + ppis = msa.addNewPPIs(); + } + + Iterator ppiit = ppis.getPpiList().iterator(); + while (ppiit.hasNext()) { + if (ppiit.next().getPpiCName() == ppiname) { + MigrationTool.ui.println ("Warning: Duplicate Ppi"); + return false; + } + } + + PPIsDocument.PPIs.Ppi ppi; + List arch = new ArrayList(); + ppi = ppis.addNewPpi(); + ppi.setPpiCName(ppiname); + arch.add(usage); + ppi.setSupArchList(arch); + return true; + } + + /* private final boolean installProtocols () { if (mapprotocols.isEmpty()) { return false; @@ -67,7 +132,30 @@ public class MsaOwner { return true; } } + */ + public final boolean addProtocol (String proname, UsageTypes.Enum usage) { + if (protocols == null) { + protocols = msa.addNewProtocols(); + } + + Iterator proit = protocols.getProtocolList().iterator(); + while (proit.hasNext()) { + if (proit.next().getProtocolCName() == proname) { + MigrationTool.ui.println ("Warning: Duplicate Protocol"); + return false; + } + } + + ProtocolsDocument.Protocols.Protocol protocol; + List arch = new ArrayList(); + protocol = protocols.addNewProtocol(); + protocol.setProtocolCName(proname); + arch.add(usage); + protocol.setSupArchList(arch); + return true; + } + /* private final boolean installHashFilename () { if (mapfilenames.isEmpty()) { return false; @@ -93,6 +181,24 @@ public class MsaOwner { return true; } } + */ + public final boolean addSourceFile (String name, Enum en) { + Iterator fileit = sourcefiles.getFilenameList().iterator(); + while (fileit.hasNext()) { + if (fileit.next().getStringValue() == name) { + MigrationTool.ui.println ("Warning: Duplicate SourceFileName"); + return false; + } + } + + FilenameDocument.Filename filename; + List arch = new ArrayList(); + filename = sourcefiles.addNewFilename(); + filename.setStringValue(name); + arch.add(en); + filename.setSupArchList(arch); + return true; + } // entry point todo