summaryrefslogtreecommitdiffstats
path: root/src/java/org/anarres/cpp/Version.java
diff options
context:
space:
mode:
authorShevek <[email protected]>2008-05-07 17:01:57 +0000
committerShevek <[email protected]>2008-05-07 17:01:57 +0000
commita857c3d76feb46c758cbcca8064a90a9a3c88c5c (patch)
treee37c3afe6d3c7fc48fc1cda388223aa846770018 /src/java/org/anarres/cpp/Version.java
parent92696dfdf29df87956b8ac45d09889401ab1afb6 (diff)
dev towards 1.2 release?
Diffstat (limited to 'src/java/org/anarres/cpp/Version.java')
-rw-r--r--src/java/org/anarres/cpp/Version.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/java/org/anarres/cpp/Version.java b/src/java/org/anarres/cpp/Version.java
new file mode 100644
index 0000000..6780506
--- /dev/null
+++ b/src/java/org/anarres/cpp/Version.java
@@ -0,0 +1,51 @@
+package org.anarres.cpp;
+
+/**
+ * System version metadata for Anarres Java C Preprocessor ${version}.
+ *
+ * This class contains a main() and may be run to print the version.
+ */
+public class Version {
+
+ /* Don't instantiate me */
+ private Version() {
+ }
+
+ private static final String VERSION = "${version}";
+
+ private static final int major;
+ private static final int minor;
+ private static final int patch;
+
+ static {
+ String[] tmp = VERSION.split("\\.");
+ major = Integer.parseInt(tmp[0]);
+ minor = Integer.parseInt(tmp[1]);
+ patch = Integer.parseInt(tmp[2]);
+ }
+
+ public static String getVersion() {
+ return VERSION;
+ }
+
+ public static int getMajor() {
+ return major;
+ }
+
+ public static int getMinor() {
+ return minor;
+ }
+
+ public static int getPatch() {
+ return patch;
+ }
+
+ public static void main(String[] args) {
+ System.out.println("Version " + VERSION);
+ System.out.println("getVersion() returns " + getVersion());
+ System.out.println("getMajor() returns " + getMajor());
+ System.out.println("getMinor() returns " + getMinor());
+ System.out.println("getPatch() returns " + getPatch());
+ }
+
+}