--- /dev/null
+/*\r
+ * \r
+ * Copyright 2004 The Ant-Contrib project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks;\r
+\r
+import java.io.IOException;\r
+import java.io.Writer;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.types.DataType;\r
+import org.apache.tools.ant.types.Reference;\r
+\r
+/**\r
+ * Version Information. (Non-functional prototype)\r
+ * \r
+ */\r
+public class VersionInfo extends DataType {\r
+ /**\r
+ * if property.\r
+ */\r
+ private String ifCond;\r
+ /**\r
+ * unless property.\r
+ */\r
+ private String unlessCond;\r
+\r
+ /**\r
+ * extends property.\r
+ */\r
+ private String extendsId;\r
+ \r
+ /**\r
+ * file version.\r
+ *\r
+ */\r
+ private String fileVersion;\r
+ /**\r
+ * Product version.\r
+ *\r
+ */\r
+ private String productVersion;\r
+ /**\r
+ * file language.\r
+ *\r
+ */\r
+ private String language;\r
+ \r
+ /**\r
+ * comments.\r
+ *\r
+ */\r
+ private String fileComments;\r
+ /**\r
+ * Company name.\r
+ *\r
+ */\r
+ private String companyName;\r
+ /**\r
+ * Description.\r
+ *\r
+ */\r
+ private String description;\r
+ /**\r
+ * internal name.\r
+ */\r
+ private String internalName;\r
+ /**\r
+ * legal copyright.\r
+ *\r
+ */\r
+ private String legalCopyright;\r
+ /**\r
+ * legal trademark.\r
+ *\r
+ */\r
+ private String legalTrademark;\r
+ /**\r
+ * original filename.\r
+ *\r
+ */\r
+ private String originalFilename;\r
+ /**\r
+ * private build.\r
+ *\r
+ */\r
+ private String privateBuild;\r
+ /**\r
+ * product name.\r
+ *\r
+ */\r
+ private String productName;\r
+ /**\r
+ * Special build\r
+ */\r
+ private String specialBuild;\r
+ /**\r
+ * compatibility version\r
+ *\r
+ */\r
+ private String compatibilityVersion;\r
+ \r
+\r
+ /**\r
+ * Constructor.\r
+ *\r
+ */\r
+ public VersionInfo() {\r
+ }\r
+ public void execute() throws org.apache.tools.ant.BuildException {\r
+ throw new org.apache.tools.ant.BuildException(\r
+ "Not an actual task, but looks like one for documentation purposes");\r
+ }\r
+ /**\r
+ * Returns true if the define's if and unless conditions (if any) are\r
+ * satisfied.\r
+ * \r
+ * @exception BuildException\r
+ * throws build exception if name is not set\r
+ */\r
+ public final boolean isActive() throws BuildException {\r
+ return CUtil.isActive(getProject(), ifCond, unlessCond);\r
+ }\r
+ /**\r
+ * Sets an id that can be used to reference this element.\r
+ * \r
+ * @param id\r
+ * id\r
+ */\r
+ public void setId(String id) {\r
+ //\r
+ // this is actually accomplished by a different\r
+ // mechanism, but we can document it\r
+ //\r
+ }\r
+ /**\r
+ * Sets the name of a version info that this info extends.\r
+ * \r
+ * @param id\r
+ * id\r
+ */\r
+ public void setExtends(String id) {\r
+ extendsId = id;\r
+ }\r
+\r
+ \r
+ /**\r
+ * Sets the property name for the 'if' condition.\r
+ * \r
+ * The define will be ignored unless the property is defined.\r
+ * \r
+ * The value of the property is insignificant, but values that would imply\r
+ * misinterpretation ("false", "no") will throw an exception when\r
+ * evaluated.\r
+ * \r
+ * @param propName\r
+ * property name\r
+ */\r
+ public final void setIf(String propName) {\r
+ ifCond = propName;\r
+ }\r
+ /**\r
+ * Specifies that this element should behave as if the content of the\r
+ * element with the matching id attribute was inserted at this location. If\r
+ * specified, no other attributes should be specified.\r
+ * \r
+ */\r
+ public void setRefid(Reference r) throws BuildException {\r
+ super.setRefid(r);\r
+ }\r
+ /**\r
+ * Set the property name for the 'unless' condition.\r
+ * \r
+ * If named property is set, the define will be ignored.\r
+ * \r
+ * The value of the property is insignificant, but values that would imply\r
+ * misinterpretation ("false", "no") of the behavior will throw an\r
+ * exception when evaluated.\r
+ * \r
+ * @param propName\r
+ * name of property\r
+ */\r
+ public final void setUnless(String propName) {\r
+ unlessCond = propName;\r
+ }\r
+ /**\r
+ * Gets file version.\r
+ * @return file version, may be null.\r
+ *\r
+ */\r
+ public String getFileversion() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getFileversion();\r
+ }\r
+ return fileVersion;\r
+ }\r
+ /**\r
+ * Gets Product version.\r
+ * @return product version, may be null\r
+ */\r
+ public String getProductversion() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getProductversion();\r
+ }\r
+ return productVersion;\r
+ }\r
+ /**\r
+ * Gets compatibility version.\r
+ * @return compatibility version, may be null\r
+ */\r
+ public String getCompatibilityversion() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getCompatibilityversion();\r
+ }\r
+ return compatibilityVersion;\r
+ }\r
+ /**\r
+ * Gets file language, should be an IETF RFC 3066 identifier, for example, en-US.\r
+ * @return language, may be null.\r
+ */\r
+ public String getLanguage() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getLanguage();\r
+ }\r
+ return language;\r
+ }\r
+ \r
+ /**\r
+ * Gets comments.\r
+ * @return comments, may be null.\r
+ */\r
+ public String getFilecomments() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getFilecomments();\r
+ }\r
+ return fileComments;\r
+ }\r
+ /**\r
+ * Gets Company name.\r
+ * @return company name, may be null.\r
+ */\r
+ public String getCompanyname() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getCompanyname();\r
+ }\r
+ return companyName;\r
+ }\r
+ /**\r
+ * Gets Description.\r
+ * @return description, may be null.\r
+ */\r
+ public String getDescription() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getDescription();\r
+ }\r
+ return description;\r
+ }\r
+ /**\r
+ * Gets internal name.\r
+ * @return internal name, may be null.\r
+ */\r
+ public String getInternalname() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getInternalname();\r
+ }\r
+ return internalName;\r
+ }\r
+ /**\r
+ * Gets legal copyright.\r
+ * @return legal copyright, may be null.\r
+ */\r
+ public String getLegalcopyright() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getLegalcopyright();\r
+ }\r
+ return legalCopyright;\r
+ }\r
+ /**\r
+ * Gets legal trademark.\r
+ * @return legal trademark, may be null;\r
+ */\r
+ public String getLegaltrademark() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getLegaltrademark();\r
+ }\r
+ return legalTrademark;\r
+ }\r
+ /**\r
+ * Gets original filename.\r
+ * @return original filename, may be null.\r
+ */\r
+ public String getOriginalfilename() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getOriginalfilename();\r
+ }\r
+ return originalFilename;\r
+ }\r
+ /**\r
+ * Gets private build.\r
+ * @return private build, may be null.\r
+ */\r
+ public String getPrivatebuild() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getPrivatebuild();\r
+ }\r
+ return privateBuild;\r
+ }\r
+ /**\r
+ * Gets product name.\r
+ * @return product name, may be null.\r
+ */\r
+ public String getProductname() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getProductname();\r
+ }\r
+ return productName;\r
+ }\r
+ /**\r
+ * Special build\r
+ * @return special build, may be null.\r
+ */\r
+ public String getSpecialbuild() {\r
+ if (isReference()) {\r
+ VersionInfo refVersion = (VersionInfo) \r
+ getCheckedRef(VersionInfo.class,\r
+ "VersionInfo");\r
+ return refVersion.getSpecialbuild();\r
+ }\r
+ return specialBuild;\r
+ }\r
+\r
+ /**\r
+ * Sets file version.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setFileversion(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ fileVersion = value;\r
+ }\r
+ /**\r
+ * Sets product version.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setProductversion(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ productVersion = value;\r
+ }\r
+ /**\r
+ * Sets compatibility version.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setCompatibilityversion(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ compatibilityVersion = value;\r
+ }\r
+ /**\r
+ * Sets language.\r
+ * @param value new value, should be an IETF RFC 3066 language identifier.\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setLanguage(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ language = value;\r
+ }\r
+ /**\r
+ * Sets comments.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setFilecomments(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ fileComments = value;\r
+ }\r
+\r
+ /**\r
+ * Sets company name.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setCompanyname(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ companyName = value;\r
+ }\r
+\r
+\r
+ /**\r
+ * Sets internal name. Internal name will automatically be\r
+ * specified from build step, only set this value if\r
+ * intentionally overriding that value.\r
+ * \r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setInternalname(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ internalName = value;\r
+ }\r
+ \r
+ /**\r
+ * Sets legal copyright.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setLegalcopyright(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ legalCopyright = value;\r
+ }\r
+ /**\r
+ * Sets legal trademark.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setLegaltrademark(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ legalTrademark = value;\r
+ }\r
+ /**\r
+ * Sets original name. Only set this value if\r
+ * intentionally overriding the value from the build set.\r
+ * \r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setOriginalfilename(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ originalFilename = value;\r
+ }\r
+ /**\r
+ * Sets private build.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setPrivatebuild(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ privateBuild = value;\r
+ }\r
+ /**\r
+ * Sets product name.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setProductname(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ productName= value;\r
+ }\r
+ /**\r
+ * Sets private build.\r
+ * @param value new value\r
+ * @throws BuildException if specified with refid\r
+ */\r
+ public void setSpecialbuild(String value) throws BuildException {\r
+ if (isReference()) {\r
+ throw tooManyAttributes();\r
+ }\r
+ specialBuild = value;\r
+ }\r
+ \r
+ /**\r
+ * Writes windows resource \r
+ * @param writer writer, may not be null.\r
+ * @param project project, may not be null\r
+ * @param executableName name of executable\r
+ */\r
+ public void writeResource(final Writer writer, \r
+ final Project p, \r
+ final String executableName) throws IOException {\r
+ // TODO:\r
+ \r
+ }\r
+ \r
+}\r