View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.github.maven_nar.cpptasks.ide;
21  
22  import org.apache.tools.ant.types.EnumeratedAttribute;
23  
24  import com.github.maven_nar.cpptasks.apple.XcodeProjectWriter;
25  import com.github.maven_nar.cpptasks.borland.CBuilderXProjectWriter;
26  import com.github.maven_nar.cpptasks.msvc.MsvcProjectWriter;
27  import com.github.maven_nar.cpptasks.msvc.VisualStudioNETProjectWriter;
28  
29  /**
30   * Enumeration of supported project file generators.
31   *
32   * <table width="100%" border="1">
33   * <thead>Supported project generators </thead>
34   * <tr>
35   * <td>cbuilderx</td>
36   * <td>Borland C++BuilderX</td>
37   * </tr>
38   * <tr>
39   * <td>msvc5</td>
40   * <td>Microsoft Visual C++ 97</td>
41   * </tr>
42   * <tr>
43   * <td>msvc6</td>
44   * <td>Microsoft Visual C++ 6</td>
45   * </tr>
46   * <tr>
47   * <td>msvc7</td>
48   * <td>Microsoft Visual C++.NET</td>
49   * </tr>
50   * <tr>
51   * <td>msvc71</td>
52   * <td>Microsoft Visual C++.NET 2003</td>
53   * </tr>
54   * <tr>
55   * <td>msvc8</td>
56   * <td>Microsoft Visual C++ 2005</td>
57   * </tr>
58   * <tr>
59   * <td>msvc9</td>
60   * <td>Microsoft Visual C++ 2008</td>
61   * </tr>
62   * <tr>
63   * <td>xcode</td>
64   * <td>Apple Xcode</td>
65   * </tr>
66   * </table>
67   *
68   * @author Curt Arnold
69   *
70   */
71  public final class ProjectWriterEnum extends EnumeratedAttribute {
72    /**
73     * Enumeration values.
74     */
75    private static String[] values = new String[] {
76        "cbuilderx", "msvc5", "msvc6", "msvc7", "msvc71", "msvc8", "msvc9", "xcode"
77    };
78  
79    /**
80     * Project writers associated with enumeration values.
81     */
82    private static ProjectWriter[] writers = new ProjectWriter[] {
83        new CBuilderXProjectWriter(), new MsvcProjectWriter("5.00"), new MsvcProjectWriter("6.00"),
84        new VisualStudioNETProjectWriter("7.00", "TRUE", "FALSE"),
85        new VisualStudioNETProjectWriter("7.10", "TRUE", "FALSE"),
86        new VisualStudioNETProjectWriter("8.00", "true", "false"),
87        new VisualStudioNETProjectWriter("9.00", "true", "false"), new XcodeProjectWriter()
88    };
89  
90    /**
91     * Gets ProjectWriter associated with enumeration value.
92     *
93     * @return project writer
94     */
95    public ProjectWriter getProjectWriter() {
96      return writers[this.getIndex()];
97    }
98  
99    /**
100    * Gets acceptible values for enumeration.
101    *
102    * @return acceptible values
103    */
104   @Override
105   public String[] getValues() {
106     return values.clone();
107   }
108 }