Korean translation from Chang Hyun Park
[zxing.git] / csharp / BarcodeFormat.cs
index 3cdf6bf..811419d 100755 (executable)
@@ -1,4 +1,4 @@
-/*\r
+/*\r
 * Copyright 2007 ZXing authors\r
 *\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * See the License for the specific language governing permissions and\r
 * limitations under the License.\r
 */\r
+using System;\r
 namespace com.google.zxing\r
 {\r
-    using System;\r
+       \r
+       /// <summary> Enumerates barcode formats known to this package.\r
+       /// \r
+       /// </summary>\r
+       /// <author>  Sean Owen\r
+       /// </author>\r
+       /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source \r
+       /// </author>\r
 \r
-    /// <summary> Enumerates barcode formats known to this package.\r
-    /// *\r
-    /// </summary>\r
-    /// <author>  Sean Owen\r
-    /// \r
-    /// </author>\r
-    public sealed class BarcodeFormat\r
-    {\r
-\r
-        // No, we can't use an enum here. J2ME doesn't support it.\r
-\r
-        /// <summary>QR Code 2D barcode format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'QR_CODE '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE");\r
-\r
-        /// <summary>DataMatrix 2D barcode format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'DATAMATRIX '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX");\r
-\r
-        /// <summary>UPC-E 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_E '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat UPC_E = new BarcodeFormat("UPC_E");\r
-\r
-        /// <summary>UPC-A 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_A '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat UPC_A = new BarcodeFormat("UPC_A");\r
-\r
-        /// <summary>EAN-8 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_8 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8");\r
-\r
-        /// <summary>EAN-13 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_13 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13");\r
-\r
-        /// <summary>Code 128 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_128 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128");\r
-\r
-        /// <summary>Code 39 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_39 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39");\r
-\r
-        /// <summary>ITF (Interleaved Two of Five) 1D format. \r
-        /// </summary>\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'ITF '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        public static readonly BarcodeFormat ITF = new BarcodeFormat("ITF");\r
-\r
-        //UPGRADE_NOTE: Final was removed from the declaration of 'name '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'\r
-        private System.String name;\r
-\r
-        private BarcodeFormat(System.String name)\r
-        {\r
-            this.name = name;\r
-        }\r
-\r
-        public override System.String ToString()\r
-        {\r
-            return name;\r
-        }\r
-    }\r
+       public sealed class BarcodeFormat\r
+       {\r
+               public System.String Name\r
+               {\r
+                       get\r
+                       {\r
+                               return name;\r
+                       }\r
+                       \r
+               }\r
+               \r
+               // No, we can't use an enum here. J2ME doesn't support it.\r
+               \r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'VALUES '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               private static readonly System.Collections.Hashtable VALUES = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());\r
+               \r
+               /// <summary>QR Code 2D barcode format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'QR_CODE '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE");\r
+               \r
+               /// <summary>DataMatrix 2D barcode format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'DATAMATRIX '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX");\r
+               \r
+               /// <summary>UPC-E 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_E '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat UPC_E = new BarcodeFormat("UPC_E");\r
+               \r
+               /// <summary>UPC-A 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_A '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat UPC_A = new BarcodeFormat("UPC_A");\r
+               \r
+               /// <summary>EAN-8 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_8 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8");\r
+               \r
+               /// <summary>EAN-13 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_13 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13");\r
+               \r
+               /// <summary>Code 128 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_128 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128");\r
+               \r
+               /// <summary>Code 39 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_39 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39");\r
+               \r
+               /// <summary>ITF (Interleaved Two of Five) 1D format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'ITF '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat ITF = new BarcodeFormat("ITF");\r
+               \r
+               /// <summary>PDF417 format. </summary>\r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'PDF417 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               public static readonly BarcodeFormat PDF417 = new BarcodeFormat("PDF417");\r
+               \r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'name '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               private System.String name;\r
+               \r
+               private BarcodeFormat(System.String name)\r
+               {\r
+                       this.name = name;\r
+                       VALUES[name] = this;\r
+               }\r
+               \r
+               public override System.String ToString()\r
+               {\r
+                       return name;\r
+               }\r
+               \r
+               public static BarcodeFormat valueOf(System.String name)\r
+               {\r
+                       BarcodeFormat format = (BarcodeFormat) VALUES[name];\r
+                       if (format == null)\r
+                       {\r
+                               throw new System.ArgumentException();\r
+                       }\r
+                       return format;\r
+               }\r
+       }\r
 }
\ No newline at end of file