X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=csharp%2FBarcodeFormat.cs;h=811419df1539264f9f4abaa8dc41cb4a734357ec;hb=5ddfca65ba34aa863e204a81e87987cb5eae78c6;hp=3cdf6bf9346b14336f6a307fa17625df7949b695;hpb=e35d358134873c3f640672da7cd0c01f02253151;p=zxing.git diff --git a/csharp/BarcodeFormat.cs b/csharp/BarcodeFormat.cs index 3cdf6bf9..811419df 100755 --- a/csharp/BarcodeFormat.cs +++ b/csharp/BarcodeFormat.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,77 +13,96 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +using System; namespace com.google.zxing { - using System; + + /// Enumerates barcode formats known to this package. + /// + /// + /// Sean Owen + /// + /// www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source + /// - /// Enumerates barcode formats known to this package. - /// * - /// - /// Sean Owen - /// - /// - public sealed class BarcodeFormat - { - - // No, we can't use an enum here. J2ME doesn't support it. - - /// QR Code 2D barcode format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'QR_CODE '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); - - /// DataMatrix 2D barcode format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'DATAMATRIX '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX"); - - /// UPC-E 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_E '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); - - /// UPC-A 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'UPC_A '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat UPC_A = new BarcodeFormat("UPC_A"); - - /// EAN-8 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_8 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8"); - - /// EAN-13 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'EAN_13 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13"); - - /// Code 128 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_128 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128"); - - /// Code 39 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'CODE_39 '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39"); - - /// ITF (Interleaved Two of Five) 1D format. - /// - //UPGRADE_NOTE: Final was removed from the declaration of 'ITF '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - public static readonly BarcodeFormat ITF = new BarcodeFormat("ITF"); - - //UPGRADE_NOTE: Final was removed from the declaration of 'name '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"' - private System.String name; - - private BarcodeFormat(System.String name) - { - this.name = name; - } - - public override System.String ToString() - { - return name; - } - } + public sealed class BarcodeFormat + { + public System.String Name + { + get + { + return name; + } + + } + + // No, we can't use an enum here. J2ME doesn't support it. + + //UPGRADE_NOTE: Final was removed from the declaration of 'VALUES '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" + private static readonly System.Collections.Hashtable VALUES = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable()); + + /// QR Code 2D barcode format. + //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'" + public static readonly BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); + + /// DataMatrix 2D barcode format. + //UPGRADE_NOTE: Final was removed from the declaration of 'DATAMATRIX '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" + public static readonly BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX"); + + /// UPC-E 1D format. + //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'" + public static readonly BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); + + /// UPC-A 1D format. + //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'" + public static readonly BarcodeFormat UPC_A = new BarcodeFormat("UPC_A"); + + /// EAN-8 1D format. + //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'" + public static readonly BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8"); + + /// EAN-13 1D format. + //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'" + public static readonly BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13"); + + /// Code 128 1D format. + //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'" + public static readonly BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128"); + + /// Code 39 1D format. + //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'" + public static readonly BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39"); + + /// ITF (Interleaved Two of Five) 1D format. + //UPGRADE_NOTE: Final was removed from the declaration of 'ITF '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" + public static readonly BarcodeFormat ITF = new BarcodeFormat("ITF"); + + /// PDF417 format. + //UPGRADE_NOTE: Final was removed from the declaration of 'PDF417 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" + public static readonly BarcodeFormat PDF417 = new BarcodeFormat("PDF417"); + + //UPGRADE_NOTE: Final was removed from the declaration of 'name '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" + private System.String name; + + private BarcodeFormat(System.String name) + { + this.name = name; + VALUES[name] = this; + } + + public override System.String ToString() + { + return name; + } + + public static BarcodeFormat valueOf(System.String name) + { + BarcodeFormat format = (BarcodeFormat) VALUES[name]; + if (format == null) + { + throw new System.ArgumentException(); + } + return format; + } + } } \ No newline at end of file