23 lines
507 B
C++
23 lines
507 B
C++
#include "pch.h"
|
|
|
|
#include "Method.hpp"
|
|
#include "Tables.hpp"
|
|
|
|
QRCodeMethod Method::determite_method(const byte_list& input)
|
|
{
|
|
QRCodeMethod type = QRCodeMethod::Numeric;
|
|
|
|
for (auto ch : input) { // перебирая байты данных
|
|
if (type == QRCodeMethod::Numeric)
|
|
if (!is_num(ch))
|
|
type = QRCodeMethod::Alphabetic;
|
|
if (type == QRCodeMethod::Alphabetic)
|
|
if (!Tables::is_alphabetic(ch))
|
|
type = QRCodeMethod::Byte;
|
|
if (type == QRCodeMethod::Byte)
|
|
break;
|
|
}
|
|
|
|
return type;
|
|
}
|