27 #ifndef SCRIBO_DEBUG_OPTION_CHECK_HH
28 # define SCRIBO_DEBUG_OPTION_CHECK_HH
34 # include <mln/core/contract.hh>
35 # include <scribo/debug/logger.hh>
43 bool check_xml_format(
const std::vector<const char *>& args);
44 bool check_ocr_lang(
const std::vector<const char *>& args);
45 bool check_sauvola_first_subsampling(
const std::vector<const char *>& args);
46 bool check_sauvola_split_ntrue(
const std::vector<const char *>& args);
47 bool check_verbose_mode(
const std::vector<const char *>& args);
49 # ifndef MLN_INCLUDE_ONLY
52 bool check_xml_format(
const std::vector<const char *>& args)
54 static const char *values[] =
61 mln_assertion(args.size() == 1);
63 for (
int i = 0; values[i]; ++i)
64 if (!strcmp(values[i], args[0]))
67 std::cerr <<
"Error: invalid xml format : " << args[0] << std::endl;
73 bool check_ocr_lang(
const std::vector<const char *>& args)
75 static const char *values[] =
87 mln_assertion(args.size() == 1);
89 for (
int i = 0; values[i]; ++i)
90 if (!strcmp(values[i], args[0]))
93 std::cerr <<
"Error: invalid OCR language : " << args[0] << std::endl;
98 bool check_sauvola_first_subsampling(
const std::vector<const char *>& args)
100 mln_assertion(args.size() == 1);
102 int ratio = atoi(args[0]);
104 if (ratio == 2 || ratio == 3)
107 std::cerr <<
"Error: invalid subsampling ratio : " << args[0] << std::endl;
113 bool check_sauvola_split_ntrue(
const std::vector<const char *>& args)
115 mln_assertion(args.size() == 1);
117 int ntrue = atoi(args[0]);
119 if (ntrue == 1 || ntrue == 2 || ntrue == 3)
122 std::cerr <<
"Error: invalid subsampling ratio : " << args[0] << std::endl;
128 bool check_verbose_mode(
const std::vector<const char *>& args)
130 mln_assertion(args.size() == 1);
135 std::cerr <<
"Error: Invalid verbose mode " << args[0] << std::endl;
141 # endif // ! MLN_INCLUDE_ONLY
147 #endif // ! SCRIBO_DEBUG_OPTION_CHECK_HH