static int check(const int i) { const char *oldtextdomain = textdomain(NULL); const char *newtextdomain = textdomain(GETTEXT_PACKAGE); const char *newcodeset = MY_CODESET; const char *oldcodeset = bind_textdomain_codeset(GETTEXT_PACKAGE, NULL); const char *realcodeset = bind_textdomain_codeset(GETTEXT_PACKAGE, MY_CODESET); const char *orig = testcases[i].orig; const char *transl = gettext(testcases[i].orig); const char *latin1 = testcases[i].latin1; const char *utf8 = testcases[i].utf8; printf( "Old textdomain: %s\n" "New textdomain: %s\n", oldtextdomain, newtextdomain ); if (NULL != oldcodeset) { printf( "Old codeset: \"%s\" (locale default)\n", nl_langinfo(CODESET) ); } else { printf( "Old codeset: \"%s\"\n", oldcodeset ); } printf( "Wanted codeset: %s\n" "Real codeset: %s\n", newcodeset, realcodeset ); printf( "Original: %s\n" "Translated: %s\n" "iso-8859-1: %s\n" "utf-8: %s\n", orig, transl, latin1, utf8 ); #if defined(CODESET_UTF_8) return (my_streq(transl, utf8)); #elif defined(CODESET_LATIN_1) return (my_streq(transl, latin1)); #else /* make sure my_streq is used once */ return (my_streq(orig, orig)); #endif }
const Formatter* Formatter::get(const char* fmt) { if(!fmt || my_streq(fmt, "")) return g_defaultFormatter; if( my_streq(fmt, "MATLAB")) return &matlabFormatter; if( my_streq(fmt, "CSV")) return &csvFormatter; if( my_streq(fmt, "PYTHON")) return &pythonFormatter; if( my_streq(fmt, "NUMPY")) return &numpyFormatter; if( my_streq(fmt, "C")) return &cFormatter; CV_Error(CV_StsBadArg, "Unknown formatter"); return g_defaultFormatter; }