src/libtsduck/base/tsUString.cpp
ts::UString::ArgMixInContext::ArgMixInContext(UString& result, const UChar* fmt, const std::initializer_list<ArgMixIn>& args) :
    ArgMixContext(fmt, true),
    _result(result),
    _arg(args.begin()),
    _end(args.end())
{
    // Loop into format, stop at each '%' sequence.
    while (*_fmt != CHAR_NULL) {

        // Locate the next '%' or end of string.
        const UChar* const start = _fmt;
        while (*_fmt != CHAR_NULL && *_fmt != u'%') {
            ++_fmt;
        }

        // Copy this literal sequence directly into the result.
        result.append(start, _fmt - start);

        // Process '%' sequence.
        if (*_fmt == u'%') {
            ++_fmt;
            processArg();
        }
    }

    // Report extraneous parameters.
    if (_arg != _end && debugActive()) {
        debug(u"extraneous " + Decimal(_end - _arg) + u" arguments");
    }
}
//----------------------------------------------------------------------------
// Analysis context of a Format string.
//----------------------------------------------------------------------------
Analysis context of a Format string.
Analysis context of a Format string .
ts::UString::ArgMixInContext::ArgMixInContext(UString& result, const UChar* fmt, const std::initializer_list<ArgMixIn>& args) :
    ArgMixContext(fmt, true),
    _result(result),
    _arg(args.begin()),
    _end(args.end())
{
    while (*_fmt != CHAR_NULL) {
        const UChar* const start = _fmt;
        while (*_fmt != CHAR_NULL && *_fmt != u'%') {
            ++_fmt;
        }
        result.append(start, _fmt - start);
        if (*_fmt == u'%') {
            ++_fmt;
            processArg();
        }
    }
    if (_arg != _end && debugActive()) {
        debug(u"extraneous " + Decimal(_end - _arg) + u" arguments");
    }
}
ts :: UString :: ArgMixInContext :: ArgMixInContext ( UString & result , const UChar * fmt , const std :: initializer_list < ArgMixIn > & args ) : ArgMixContext ( fmt , true ) , _result ( result ) , _arg ( args . begin ( ) ) , _end ( args . end ( ) ) { while ( * _fmt != CHAR_NULL ) { const UChar * const start = _fmt ; while ( * _fmt != CHAR_NULL && * _fmt != u' ' ) { ++ _fmt ; } result . append ( start , _fmt - start ) ; if ( * _fmt == u' ' ) { ++ _fmt ; processArg ( ) ; } } if ( _arg != _end && debugActive ( ) ) { debug ( u" " + Decimal ( _end - _arg ) + u" " ) ; } }
Analysis context of a Format string.
Analysis context of a Format string .
// Loop into format, stop at each '%' sequence. // Locate the next '%' or end of string. // Copy this literal sequence directly into the result. // Process '%' sequence. // Report extraneous parameters.