/* * Copyright 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Text; namespace ZXing.QrCode.Internal { /// satorux@google.com (Satoru Takabayashi) - creator /// dswitkin@google.com (Daniel Switkin) - ported from C++ public sealed class QRCode { /// /// /// public static int NUM_MASK_PATTERNS = 8; /// /// Initializes a new instance of the class. /// public QRCode() { MaskPattern = -1; } /// /// Gets or sets the mode. /// /// /// The mode. /// public Mode Mode { get; set; } /// /// Gets or sets the EC level. /// /// /// The EC level. /// public ErrorCorrectionLevel ECLevel { get; set; } /// /// Gets or sets the version. /// /// /// The version. /// public Version Version { get; set; } /// /// Gets or sets the mask pattern. /// /// /// The mask pattern. /// public int MaskPattern { get; set; } /// /// Gets or sets the matrix. /// /// /// The matrix. /// public ByteMatrix Matrix { get; set; } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override String ToString() { var result = new StringBuilder(200); result.Append("<<\n"); result.Append(" mode: "); result.Append(Mode); result.Append("\n ecLevel: "); result.Append(ECLevel); result.Append("\n version: "); if (Version == null) result.Append("null"); else result.Append(Version); result.Append("\n maskPattern: "); result.Append(MaskPattern); if (Matrix == null) { result.Append("\n matrix: null\n"); } else { result.Append("\n matrix:\n"); result.Append(Matrix.ToString()); } result.Append(">>\n"); return result.ToString(); } /// /// Check if "mask_pattern" is valid. /// /// The mask pattern. /// /// true if [is valid mask pattern] [the specified mask pattern]; otherwise, false. /// public static bool isValidMaskPattern(int maskPattern) { return maskPattern >= 0 && maskPattern < NUM_MASK_PATTERNS; } } }