ErrorCorrectionLevel.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef __ERROR_CORRECTION_LEVEL_H__
  2. #define __ERROR_CORRECTION_LEVEL_H__
  3. /*
  4. * ErrorCorrectionLevel.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/ReaderException.h>
  22. namespace zxing {
  23. namespace qrcode {
  24. class ErrorCorrectionLevel {
  25. private:
  26. int ordinal_;
  27. int bits_;
  28. std::string name_;
  29. ErrorCorrectionLevel(int inOrdinal, int bits, char const* name);
  30. static ErrorCorrectionLevel *FOR_BITS[];
  31. static int N_LEVELS;
  32. public:
  33. static ErrorCorrectionLevel L;
  34. static ErrorCorrectionLevel M;
  35. static ErrorCorrectionLevel Q;
  36. static ErrorCorrectionLevel H;
  37. int ordinal() const;
  38. int bits() const;
  39. std::string const& name() const;
  40. operator std::string const& () const;
  41. static ErrorCorrectionLevel& forBits(int bits);
  42. };
  43. }
  44. }
  45. #endif // __ERROR_CORRECTION_LEVEL_H__