3a30488cea70c2520caa270e6024efd04ded6eb6
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / IncludePath.java
1 /** @file
2 This file is used to nest elements which is meant for include path name
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 package org.tianocore.framework.tasks;
16
17 import java.io.File;
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.StringTokenizer;
21
22 public class IncludePath implements NestElement {
23 /**
24 IncludePath nested element Class
25 class member
26 -name : name of include path
27 -file : name of file including include path
28 **/
29 private String path = "";
30 private File file;
31 private List<String> nameList = new ArrayList<String>();
32
33 /**
34 get class member "file"
35
36 @returns The File object
37 **/
38 public File getFile() {
39 return this.file;
40 }
41
42 /**
43 set class member "file"
44
45 @param file The name of include path
46 **/
47 public void setFile(File file) {
48 this.file = file;
49 }
50
51 /**
52 get class member "file"
53
54 @returns The name of include path
55 **/
56 public String getPath() {
57 return this.path;
58 }
59
60 /**
61 get class member "name"
62
63 @returns The name of include path
64 **/
65 public String getName() {
66 return this.path;
67 }
68
69 /**
70 set class member "name"
71
72 @param name The name of include path
73 **/
74 public void setName(String name){
75 this.path = "-I " + name;
76 }
77
78 /**
79 set class member "path"
80
81 @param name name of file including include paths
82 **/
83 public void setPath(String name) {
84 this.path = " -I " + name;
85 }
86
87 /**
88 override Object.toString()
89
90 @returns name of file including include paths
91 **/
92 public String toString() {
93 return getPath();
94 }
95
96 /**
97 set class member "list"
98
99 @param fileNameList name list of include paths, sperated by space, tab,
100 comma or semi-comma
101 **/
102 public void setList(String fileNameList) {
103 if (fileNameList != null && fileNameList.length() > 0) {
104 StringTokenizer tokens = new StringTokenizer(fileNameList, " \t,;", false);
105 while (tokens.hasMoreTokens()) {
106 String fileName = tokens.nextToken().trim();
107 if (fileName.length() > 0) {
108 this.nameList.add(fileName);
109 }
110 }
111 }
112 }
113
114 /**
115 get class member "list"
116
117 @returns The include paths list.
118 **/
119 public List<String> getList() {
120 return nameList;
121 }
122 }
123