enhance ModuleInfo.java
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Guid.java
1 /** @file
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 **/
13 package org.tianocore.migration;
14
15 import java.util.regex.*;
16
17 public class Guid {
18 Guid (String r8, String t, String n, String r9, String gv, String p) {
19 r8name = r8;
20 type = t;
21 name = n;
22 r9name = r9;
23 guidvalue = gv;
24 pack = p;
25 }
26 Guid (String[] linecontext, String t) {
27 r8name = linecontext[1];
28 type = t;
29 name = linecontext[0];
30 r9name = linecontext[2];
31 guidvalue = linecontext[3];
32 pack = linecontext[4];
33 }
34 public String r8name;
35 public String type;
36 public String name;
37 public String r9name;
38 public String guidvalue;
39 public String pack;
40
41 public static Pattern ptnguid = Pattern.compile("g\\w*Guid");
42
43 public static String register(Matcher mtr, ModuleInfo mi, Database db) {
44 String type = null;
45 String temp = null;
46
47 temp = mtr.group();
48 if (MigrationTool.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database
49 type = MigrationTool.db.getGuidType(temp);
50 if (type.matches("Protocol")) {
51 mi.protocols.add(temp);
52 } else if (type.matches("Ppi")) {
53 mi.ppis.add(temp);
54 } else if (type.matches("Guid")) {
55 mi.guids.add(temp);
56 }
57 return temp;
58 }
59 return null;
60 }
61 }