From: Matt W. <st...@gm...> - 2015-09-27 23:46:27
|
Pantheios 1.0.1 beta 215 introduces the showPlus format flag, which causes leading pluses to be applied to integers (just as leading minuses will appear for negative numbers). It is used as follows: #include #include int main() { pan::log_INFORMATIONAL("log -10:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(-10, 0, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); pan::log_INFORMATIONAL("log +10:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(+10, 0, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); pan::log_INFORMATIONAL("log -10 into 10-width:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10, 10, 0), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(-10, 10, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); pan::log_INFORMATIONAL("log +10 into 10-width:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10, 10, 0), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(+10, 10, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); pan::log_INFORMATIONAL("log -10 into 10-width left-justified:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10, -10, 0), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(-10, -10, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); pan::log_INFORMATIONAL("log +10 into 10-width left-justified:"); pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10, -10, 0), "'"); pan::log_INFORMATIONAL("with showPlus: '", pan::i(+10, -10, pan::fmt::showPlus), "'"); pan::log_INFORMATIONAL("----------\n"); return 0; } PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.scratch.showPlus.integer"); which gives the output: [test.scratch.showPlus.integer...]: log -10: [test.scratch.showPlus.integer...]: without showPlus: '-10' [test.scratch.showPlus.integer...]: with showPlus: '-10' [test.scratch.showPlus.integer...]: ---------- [test.scratch.showPlus.integer...]: log +10: [test.scratch.showPlus.integer...]: without showPlus: '10' [test.scratch.showPlus.integer...]: with showPlus: '+10' [test.scratch.showPlus.integer...]: ---------- [test.scratch.showPlus.integer...]: log -10 into 10-width: [test.scratch.showPlus.integer...]: without showPlus: ' -10' [test.scratch.showPlus.integer...]: with showPlus: ' -10' [test.scratch.showPlus.integer...]: ---------- [test.scratch.showPlus.integer...]: log +10 into 10-width: [test.scratch.showPlus.integer...]: without showPlus: ' 10' [test.scratch.showPlus.integer...]: with showPlus: ' +10' [test.scratch.showPlus.integer...]: ---------- [test.scratch.showPlus.integer...]: log -10 into 10-width left-justified: [test.scratch.showPlus.integer...]: without showPlus: '-10 ' [test.scratch.showPlus.integer...]: with showPlus: '-10 ' [test.scratch.showPlus.integer...]: ---------- [test.scratch.showPlus.integer...]: log +10 into 10-width left-justified: [test.scratch.showPlus.integer...]: without showPlus: '10 ' [test.scratch.showPlus.integer...]: with showPlus: '+10 ' [test.scratch.showPlus.integer...]: ---------- -- Posted By Matt Wilson to Pantheios Tips 'n' Tricks at 9/27/2015 04:14:00 PM |