FormatInformation.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __FORMAT_INFORMATION_H__
  2. #define __FORMAT_INFORMATION_H__
  3. /*
  4. * FormatInformation.h
  5. * zxing
  6. *
  7. * Copyright 2010 ZXing authors All rights reserved.
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. #include <zxing/qrcode/ErrorCorrectionLevel.h>
  22. #include <zxing/common/Counted.h>
  23. #include <iostream>
  24. namespace zxing {
  25. namespace qrcode {
  26. class FormatInformation : public Counted {
  27. private:
  28. static int FORMAT_INFO_MASK_QR;
  29. static int FORMAT_INFO_DECODE_LOOKUP[][2];
  30. static int N_FORMAT_INFO_DECODE_LOOKUPS;
  31. static int BITS_SET_IN_HALF_BYTE[];
  32. ErrorCorrectionLevel &errorCorrectionLevel_;
  33. char dataMask_;
  34. FormatInformation(int formatInfo);
  35. public:
  36. static int numBitsDiffering(int a, int b);
  37. static Ref<FormatInformation> decodeFormatInformation(int maskedFormatInfo1, int maskedFormatInfo2);
  38. static Ref<FormatInformation> doDecodeFormatInformation(int maskedFormatInfo1, int maskedFormatInfo2);
  39. ErrorCorrectionLevel &getErrorCorrectionLevel();
  40. char getDataMask();
  41. friend bool operator==(const FormatInformation &a, const FormatInformation &b);
  42. friend std::ostream& operator<<(std::ostream& out, const FormatInformation& fi);
  43. };
  44. }
  45. }
  46. #endif // __FORMAT_INFORMATION_H__