예제 #1
0
char* pri_print_(char* s, size_t cch, int i, size_t& cchWritten)
{
    STLSOFT_ASSERT(NULL != s);
    STLSOFT_ASSERT(i >= 0);
    STLSOFT_ASSERT(i < 256);
    STLSOFT_ASSERT(cch >= 6);

    s[0]        = '\0';
    s[cch - 1]  = '\0';

    char* r = const_cast<char*>(stlsoft::integer_to_string(s, cch - 1, i, &cchWritten));

    s[cch - 2]  = '>';  ++cchWritten;
    *--r        = '<';  ++cchWritten;

    return r;
}
예제 #2
0
    /// Tokenise the given string with the given delimiter
    ///
    /// \param str The string whose contents will be tokenised
    /// \param delim The delimiter to perform the tokenisation
    ///
    /// \note The tokeniser class takes a copy of \c str. It does not alter the contents of \c str
    string_tokeniser(string_type const& str, delimiter_type const& delim)
        : m_str(str)
        , m_delimiter(delim)
    {
        STLSOFT_MESSAGE_ASSERT("Delimiter of zero-length", 0 != comparator_type::length(m_delimiter));

        STLSOFT_ASSERT(is_valid());
    }
예제 #3
0
inline void call_set_null(T *&pt, void (T::*F)())
{
    STLSOFT_ASSERT(NULL != pt);

    (pt->*F)();

    pt = NULL;
}
예제 #4
0
inline
C const*
integer_to_string(C* buf, ss_size_t cchBuf, ss_uint64_t const& i, ss_size_t* pcchRes)
{
    STLSOFT_ASSERT(NULL != pcchRes);

    return unsigned_integer_to_string(buf, cchBuf, i, pcchRes);
}
예제 #5
0
inline bool
find_next_token(
    C const*&   p0
,   C const*&   p1
,   C           delim
)
{
    STLSOFT_ASSERT(NULL != p0);
    STLSOFT_ASSERT(NULL != p1);
    STLSOFT_ASSERT(p0 <= p1);

    if('\0' == *p1)
    {
        p0 = p1;

        return false;
    }

    if(p0 != p1)
    {
        p0 = ++p1;
    }
    else
    {
        p0 = p1;
    }

    if(delim == *p1)
    {
        ++p0;
        ++p1;
    }
    else for(;; ++p1)
    {
        if('\0' == *p1)
        {
            return p0 != p1;
        }
        else if(delim == *p1)
        {
            break;
        }
    }

    return true;
}
예제 #6
0
    static string_type empty_string()
    {
        // This character array is initialised to 0, which conveniently happens to
        // be the empty string, by the module/application load, so it is
        // guaranteed to be valid, and there are no threading/race conditions
        static char_type    s_empty[1];

        STLSOFT_ASSERT(s_empty[0] == '\0'); // Paranoid check

        return s_empty;
    }
예제 #7
0
    /// Writes the results, according to the given flags
    class_type& write(size_t numResults, ff_string_slice_t const* results, int flags)
    {
        stlsoft::auto_buffer<iovec>     vectors(numResults + 2);
        ff_string_slice_t               crlf = fastformat_getNewlineForPlatform();

#ifdef STLSOFT_CF_THROW_BAD_ALLOC
        if(!vectors.empty())
#endif /* STLSOFT_CF_THROW_BAD_ALLOC */
        {
            STLSOFT_ASSERT(vectors.size() == numResults + 2);

            { for(size_t i = 0; i != vectors.size() - 2; ++i)
            {
                vectors[i].iov_base =   const_cast<char*>(results[i].ptr);
                vectors[i].iov_len  =   results[i].len;
            }}

            if(!m_delim.empty())
            {
                vectors[vectors.size() - 2].iov_base    =   const_cast<char*>(m_delim.data());
                vectors[vectors.size() - 2].iov_len     =   m_delim.size();
            }
            else
            {
                vectors.resize(vectors.size() - 1);
            }

            if(flags::ff_newLine & flags)
            {
                vectors[vectors.size() - 1].iov_base    =   const_cast<char*>(crlf.ptr);
                vectors[vectors.size() - 1].iov_len     =   crlf.len;
            }
            else
            {
                vectors.resize(vectors.size() - 1);
            }

            if(::writev(m_fh, &vectors[0], static_cast<int>(vectors.size())) < 0)
            {
#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
                throw platformstl::platform_exception("failed to write vector payload", errno);
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
            }

#if 0
            if(flags::ff_flush & flags)
            {
                ::flush(m_fh);
            }
#endif /* 0 */
        }

        return *this;
    }
    value_type minmax_element(P pr) const
    {
        ss_bool_t   bRetrieved;
        value_type  result;

        m_r.for_each_cancelable(minmax_element_2_function<value_type, P>(bRetrieved, pr, result));

        STLSOFT_ASSERT(bRetrieved);

        return result;
    }
예제 #9
0
inline
C const*
signed_integer_to_string(C* buf, ss_size_t cchBuf, I i, ss_size_t* cchRes)
{
    STLSOFT_ASSERT(NULL != cchRes);

    C const* psz = signed_integer_to_string<C, I>(buf, cchBuf, i);

    *cchRes = cchBuf - (psz - (buf - 1));

    return psz;
}
    inline
    bool
    string_lookup_from_slice_(
        L const*    input
    ,   L const**   output
    ,   ss_size_t   numMappings
    ,   L const*    fromMappings
    ,   L const*    toMappings
    )
    {
        STLSOFT_ASSERT(NULL != output);
        STLSOFT_ASSERT(0 == numMappings || (NULL != fromMappings && NULL != toMappings));

        *output = NULL;

        if(0 == numMappings)
        {
            return false;
        }

        if(0 == input->len)
        {
            return false;
        }

        { for(ss_size_t i = 0; i != numMappings; ++i)
        {
            L const& from = fromMappings[i];

            if( input->len == from.len &&
                0 == ::memcmp(input->ptr, from.ptr, sizeof(C) * input->len))
            {
                *output = toMappings + i;

                return true;
            }
        }}

        return false;
    }
예제 #11
0
inline
/* static */
DISPID
object_helper::
    internal_GetIDOfName(
        object const&   o,
        LPCOLESTR methodName
    ) /* const */
    {
        DISPID      dispids[1]  =   { 0 };
        HRESULT     hr          =   internal_has_member(o, methodName, &dispids[0]);

        if(FAILED(hr))
        {
            if(DISP_E_UNKNOWNNAME == hr)
            {
#if 0
                stlsoft::exception_string_creator creator(256u);

                creator
                    .append("Unknown name: '")
                    .append(methodName)
                    .append('\'')
                    ;

                throw invocation_exception(creator.c_str(), hr);
#else /* ? 0 */
                typedef winstl::system_traits<char> traits_t;

                static const char           msg[] = "Unknown name: '";
                winstl::w2a                 a(methodName);
                stlsoft::auto_buffer<char>  buff(STLSOFT_NUM_ELEMENTS(msg) + a.size() + 1);

                traits_t::char_copy(&buff[0], msg, STLSOFT_NUM_ELEMENTS(msg) - 1);
                traits_t::char_copy(&buff[0] + (STLSOFT_NUM_ELEMENTS(msg) - 1), a, a.size());
                buff[(STLSOFT_NUM_ELEMENTS(msg) - 1) + a.size()] = '\'';
                buff[(STLSOFT_NUM_ELEMENTS(msg) - 1) + a.size() + 1] = '\0';

                STLSOFT_ASSERT(1 + ::strlen(buff.data()) == buff.size());   // Guard against changing "size()" for winstl::wide2multibyte

                throw invocation_exception(buff.data(), hr);
#endif /* 0 */
            }
            else
            {
                throw invocation_exception("GetIDsOfNames failed", hr);
            }
        }

        return dispids[0];
    }
예제 #12
0
static int main_(int /* argc */, char** /* argv */)
{
#ifdef FASTFORMAT_USE_WIDE_STRINGS

#else /* ? FASTFORMAT_USE_WIDE_STRINGS */

    char const* arg0    =   "abcdefghi";
    const char  arg1[]  =            "jklmnopq";
    std::string arg2    =                    "rstuvwxyz";

    {
        char    buff[30];

        ff::sinks::c_string_sink   sink(STLSOFT_NUM_ELEMENTS(buff), &buff[0]);

        ff::write(sink, arg0);

        STLSOFT_ASSERT(9u == sink.size());

        ff::write(sink, arg1);

        STLSOFT_ASSERT(17u == sink.size());

        ff::write(sink, arg2);

        STLSOFT_ASSERT(26u == sink.size());

        STLSOFT_ASSERT(0 == ::strcmp("abcdefghijklmnopqrstuvwxyz", buff));
    }

    try
    {
        char    buff[20];

        ff::sinks::c_string_sink   sink(STLSOFT_NUM_ELEMENTS(buff), &buff[0]);

        ff::write(sink, arg0);

        STLSOFT_ASSERT(9u == sink.size());

        ff::write(sink, arg1);

        STLSOFT_ASSERT(17u == sink.size());

        ff::write(sink, arg2); // Teleport to ... 

        STLSOFT_MESSAGE_ASSERT("should never get here", 0);
    }
    catch(std::out_of_range& /* x */)
    {
        // ... here!
    }

#endif /* FASTFORMAT_USE_WIDE_STRINGS */

    return EXIT_SUCCESS;
}
예제 #13
0
inline
/* static */
void
object_helper::
    internal_Invoke(
        object const&   o,
        DISPID      dispid
    ,   WORD        flags
    ,   VARIANT*    result
    ) /* const */
    {
        STLSOFT_ASSERT(NULL != result);

        internal_Invoke(o, dispid, flags, NULL, 0, result);
    }
예제 #14
0
static int pantheios_be_WindowsSyslog_logEntry_(
    void*               feToken
,   void*               beToken
,   int                 severity
,   pan_char_t const*   entry
,   size_t              cchEntry
)
{
#ifdef PANTHEIOS_USE_WIDE_STRINGS
    stlsoft::w2m e(entry, cchEntry);

    STLSOFT_ASSERT(e.size() <= cchEntry);

    return pantheios_be_WindowsSyslog_logEntry_a_(feToken, beToken, severity, e.data(), e.size());
#else /* ? PANTHEIOS_USE_WIDE_STRINGS */
    return pantheios_be_WindowsSyslog_logEntry_a_(feToken, beToken, severity, entry, cchEntry);
#endif /* PANTHEIOS_USE_WIDE_STRINGS */
}
예제 #15
0
inline
/* static */
void
object_helper::
    internal_Invoke(
        object const&   o,
        DISPID      dispid
    ,   WORD        flags
    ,   DISPPARAMS* pDispParams
    ,   VARIANT*    pVarResult
    ,   EXCEPINFO*  pExcepInfo
    ,   UINT*       puArgErr
    ) /* const */
    {
        STLSOFT_ASSERT(NULL != puArgErr);

        EXCEPINFO   xinfo_  =   { 0, 0, NULL, NULL, NULL, 0, NULL, NULL, 0 };
        ptr_type    disp    =   get_checked_disp_(o.get());
        HRESULT     hr      =   disp->Invoke(dispid, IID_NULL, o.lcid(), flags, pDispParams, pVarResult, (NULL == pExcepInfo) ? (pExcepInfo = &xinfo_,pExcepInfo) : pExcepInfo, puArgErr);

        /* if(DISP_E_TYPEMISMATCH == hr)
        {
            char    msg[101];

            ::sprintf(*puArgErr)

            throw

            ;
        }
        else */
        if(FAILED(hr))
        {
#ifdef __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE
# pragma message(_sscomp_fileline_message("Turn this into an automation_exception / invocation_exception, so can pass in the argErr, and excep info"))
#endif /* __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE */

            // We always free the COM exception info in this scope because
            // we always throw a C++ exception out of it
            stlsoft::scoped_handle<EXCEPINFO*>  scopexi(pExcepInfo, comstl::EXCEPINFO_free);

            throw invocation_exception(dispid, "Method/property invocation failed", hr, pExcepInfo);
        }
    }
static void test_ROLL_ON_ENTRIES()
{
    // Create a file, with rolling quantum of

    unsigned    flags   =   0
                        |   PANTHEIOS_BE_FILE_F_DISCARD_CACHED_CONTENTS
                        |   PANTHEIOS_BE_FILE_F_TRUNCATE
                        |   PANTHEIOS_BE_FILE_F_ROLL_ON_ENTRY_COUNT
                        |   0;

    pantheios_be_file_setFilePath("rolling-log.test.remote", flags, flags, PANTHEIOS_BEID_REMOTE);

    const int   NUM_ENTRIES = 104;

    { for(size_t i = 0; i < NUM_ENTRIES; ++i)
    {
        pantheios::log_NOTICE("stmt #", pantheios::integer(i));
    }}

    pantheios_be_file_setFilePath(NULL, PANTHEIOS_BEID_REMOTE);

    { for(size_t i = 0; i < NUM_ENTRIES; i += ENTRY_QUANTUM)
    {
        size_t  index   =   i / ENTRY_QUANTUM;

        path_t  path    =   "rolling-log.test.remote";

        path /= pantheios::integer(index).c_str();


        file_lines_t    remote_lines(path);
        size_t          numRemote   =   remote_lines.size();

        STLSOFT_ASSERT(index < (NUM_ENTRIES / ENTRY_QUANTUM) ? ENTRY_QUANTUM == numRemote : (NUM_ENTRIES % ENTRY_QUANTUM) == numRemote);

        fs_traits_t::delete_file(path.c_str());
        fs_traits_t::get_last_error();
    }}
}
예제 #17
0
inline
ss_size_t
translate_thousands(
    C*          dest
,   ss_size_t   cchDest
,   C const*    picture
,   C const*    rawNumber
,   C           fmtSep
,   C           outputSep
)
{
    typedef char_traits<C>  traits_t;

    const ss_size_t cchRawNumber    =   traits_t::length(rawNumber);
    auto_buffer<C>  res(1 + 2 * cchRawNumber);
    C const*        pic_next;

    for(pic_next = picture; fmtSep == *pic_next; ++pic_next)
    {}
    STLSOFT_ASSERT('0' != *pic_next);
    STLSOFT_ASSERT('0' < *pic_next);

    C const*        raw_end     =   rawNumber + cchRawNumber;
    C const* const  raw_begin   =   rawNumber;
    C*              res_end     =   &*(res.end() - 1);
    ss_size_t       num         =   static_cast<ss_size_t>(*pic_next - '0');    // Derive the first
    ss_size_t       n           =   num;

    *res_end = '\0';
    for(--raw_end, --res_end; raw_end != raw_begin; --raw_end, --res_end)
    {
        *res_end = *raw_end;
        if( 0 != n &&
            0 == --n)
        {
            if('\0' == *pic_next)
            {
            }
            else if('0' == *pic_next)
            {
                n = num;
            }
            else
            {
                C const* pic_end_next = ++pic_next;

                for(; *pic_end_next == fmtSep; ++pic_end_next)
                {}

                pic_next = pic_end_next;

                if('\0' == *pic_next)
                {
                    *--res_end = outputSep;
                }
                else if('0' == *pic_next)
                {
                    n = num;
                }
                else
                {
                    num =   static_cast<ss_size_t>(*pic_next - '0');
                    n   =   num;
                }
            }

            if(0 != n)
            {
                *--res_end = outputSep;
            }
        }
    }
    *res_end = *raw_end;

    ss_size_t cch = static_cast<ss_size_t>(res.end() - res_end);

    if(NULL != dest)
    {
        if(cch > cchDest)
        {
            cch = cchDest;
        }

        traits_t::copy(dest, res_end, cch);
    }

    return cch;
}
예제 #18
0
    /// Indicates whether the search sequence is empty
    ss_bool_t   empty() const
    {
        STLSOFT_ASSERT(is_valid());

        return begin() == end();
    }
예제 #19
0
    /// Ends the iteration
    ///
    /// \return An iterator representing the end of the sequence
    const_iterator end() const
    {
        STLSOFT_ASSERT(is_valid());

        return const_iterator(traits_type::end(m_str), traits_type::end(m_str), m_delimiter);
    }
예제 #20
0
void interval::construct_()
{
    m_result.reserve(20);

    interval::units units       =   m_units;
    pan_sint64_t    interval    =   m_interval;

    if(0 == interval)
    {
        static pan_char_t const* const s_zeroes[] =
        {
                NULL
            ,   PANTHEIOS_LITERAL_STRING("0 us")
            ,   PANTHEIOS_LITERAL_STRING("0 ms")
            ,   PANTHEIOS_LITERAL_STRING("0 s")
            ,   PANTHEIOS_LITERAL_STRING("0 mins")
            ,   PANTHEIOS_LITERAL_STRING("0 hrs")
            ,   PANTHEIOS_LITERAL_STRING("0 days")
        };

        pan_char_t const* const ptr =   s_zeroes[units];
        size_t const            len =   pan_strlen_(ptr);

        m_result.assign(ptr, len);
    }
    else
    {
        pan_char_t const* u = NULL;

        switch(units)
        {
            case    microseconds:
                if(0 != (interval % 1000))
                {
                    u = PANTHEIOS_LITERAL_STRING("us");
                }
                else
                {
                    interval /= 1000;

            case    milliseconds:
                    if(0 != (interval % 1000))
                    {
                        u = PANTHEIOS_LITERAL_STRING("ms");
                    }
                    else
                    {
                        interval /= 1000;

            case    seconds:
                        if(0 != (interval % 60))
                        {
                            u = PANTHEIOS_LITERAL_STRING("s");
                        }
                        else
                        {
                            interval /= 60;

            case    minutes:
                            if(0 != (interval % 60))
                            {
                                u = (1 == interval) ? PANTHEIOS_LITERAL_STRING("min") : PANTHEIOS_LITERAL_STRING("mins");
                            }
                            else
                            {
                                interval /= 60;

            case    hours:
                                if(0 != (interval % 24))
                                {
                                    u = (1 == interval) ? PANTHEIOS_LITERAL_STRING("hr") : PANTHEIOS_LITERAL_STRING("hrs");
                                }
                                else
                                {
                                    interval /= 24;

            case    days:
                                    u = (1 == interval) ? PANTHEIOS_LITERAL_STRING("day") : PANTHEIOS_LITERAL_STRING("days");
                                }
                            }
                        }
                    }
                break;
                }
        }

        STLSOFT_ASSERT(NULL != u);

        pan_char_t              buf[21];
        size_t                  cch;
#ifdef PANTHEIOS_STLSOFT_1_12_OR_LATER
        pan_char_t const* const num =   stlsoft::integer_to_decimal_string(buf, STLSOFT_NUM_ELEMENTS(buf), interval, &cch);
#else /* ? PANTHEIOS_STLSOFT_1_12_OR_LATER */
        pan_char_t const* const num =   stlsoft::integer_to_string(buf, STLSOFT_NUM_ELEMENTS(buf), interval, cch);
#endif /* PANTHEIOS_STLSOFT_1_12_OR_LATER */

        m_result.assign(num, cch);
        m_result.append(1, ' ');
        m_result.append(u);
    }
}
ff::properties_bundle const& getAppBundle()
{
    STLSOFT_ASSERT(NULL != bundle);

    return *bundle;
}
예제 #22
0
inline C const* signed_integer_to_string(C *buf, ss_size_t cchBuf, I i)
{
#ifndef STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT
// If the compiler does not evaluate -9 % 10 to equal -9, then we need to work
// with it as if an unsigned, and prepend the -ve
    typedef limit_traits<I>                                 limit_traits_t;
    typedef sign_traits<I>                                  sign_traits_t;
    typedef ss_typename_type_k sign_traits_t::signed_type   signed_type_t;
    typedef ss_typename_type_k sign_traits_t::unsigned_type unsigned_type_t;

    // If this fires, something has happened to invoke this function on an
    // unsigned type.
    STLSOFT_STATIC_ASSERT((0 != is_same_type<signed_type_t, I>::value));

    C const* psz;

    if(i == limit_traits_t::minimum())
    {
        STLSOFT_ASSERT(i == -i);

        // Special case of the (signed) minimum, since the maximum -ve value
        // of a signed integer cannot be negated.
        //
        // We instead take the equivalent value as an unsigned integer,
        // convert that (as unsigned), and prepend a '-'

        psz = unsigned_integer_to_string(buf, cchBuf, static_cast<unsigned_type_t>(limit_traits_t::minimum()));

        *const_cast<C*>(--psz) = C('-');
    }
    else
    {
        // Just using the unsigned version here for the absence of
        // sign. Perversely, The invoked function is still a signed
        // specialisation.
        psz = unsigned_integer_to_string(buf, cchBuf, i);

        if(i < 0)
        {
            *const_cast<C*>(--psz) = C('-');
        }
    }

    return psz;
#else /* ? STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT */
// Compiler evaluates -9 % 10 to equal -9, so use the full -ve algorithm. This
// is chosen because it is more efficient on most compilers than calling the
// unsigned peer and converting.

#if defined(STLSOFT_COMPILER_IS_MSVC)
    typedef I           rem_t;
#else /* ? compiler */
    typedef ss_sint_t   rem_t;
#endif /* compiler */

    C   *psz    =   buf + cchBuf - 1;  // Set pointer to last character.

    *psz = 0;   // Set the terminating null character.

    if(i < 0)
    {
        do
        {
            rem_t   lsd = static_cast<rem_t>(i % 10);   // Determine the least significant digit.

            i = static_cast<I>(i / 10);                 // Deal with next most significant.

            --psz;                                      // Move back.

#ifdef STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS
            *psz = get_digit_character(static_cast<C*>(NULL))[lsd];
#else /* ? STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */
            *psz = get_digit_character<C>()[lsd];
#endif /* STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */

        } while(i != 0);

        *(--psz) = C('-');              // Prepend the minus sign.
    }
    else
    {
        do
        {
            rem_t   lsd = static_cast<rem_t>(i % 10);   // Determine the least significant digit.

            i = static_cast<I>(i / 10);                 // Deal with next most significant.

            --psz;                                      // Move back.

#ifdef STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS
            *psz = get_digit_character(static_cast<C*>(NULL))[lsd];
#else /* ? STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */
            *psz = get_digit_character<C>()[lsd];
#endif /* STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */

        } while(i != 0);
    }

    STLSOFT_ASSERT(!(psz < buf));

    return psz;
#endif /* !STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT */
}
static int main_(int /* argc */, char** /*argv*/)
{
    fastformat::fmtln(std::cout, "format with two replacements; #1={0}, #2={1}", 10, 200);

    try
    {
        fastformat::fmtln(std::cout, "{0,", 10);
    }
    catch(fastformat::illformed_format_exception& x)
    {
        fprintf(stdout, "illformed_format_exception: %s\n", x.what());
    }
    catch(fastformat::format_parsing_exception& x)
    {
        fprintf(stdout, "format_parsing_exception: %s\n", x.what());
    }
    catch(fastformat::missing_argument_exception& x)
    {
        fprintf(stdout, "missing_argument_exception: %s\n", x.what());
    }
    catch(fastformat::unreferenced_argument_exception& x)
    {
        fprintf(stdout, "unreferenced_argument_exception: %s\n", x.what());
    }
    catch(fastformat::mismatched_replacements_exception& x)
    {
        fprintf(stdout, "mismatched_replacements_exception: %s\n", x.what());
    }

    try
    {
        fastformat::fmtln(std::cout, "format string with no replacements", 10, 200);
    }
    catch(fastformat::fastformat_exception& x)
    {
        fprintf(stdout, "exception: %s\n", x.what());
    }

    try
    {
        fastformat::ignore_unreferenced_arguments_scope scoper;

        fastformat::fmtln(std::cout, "format string with no replacements", 10, 200);
    }
    catch(fastformat::fastformat_exception& x)
    {
        fprintf(stdout, "exception: %s\n", x.what());
    }

    try
    {
        fastformat::fmtln(std::cout, "{0,,,}{1,,,}", 10, 200);
    }
    catch(fastformat::fastformat_exception& x)
    {
        fprintf(stdout, "exception: %s\n", x.what());
    }


    try
    {
        fastformat::ignore_missing_arguments_scope scoper;

        std::string str;

        fastformat::fmt(str, "format string with no replacements {0} {1}", 10);

        STLSOFT_ASSERT("format string with no replacements 10 " == str);
    }
    catch(fastformat::fastformat_exception& x)
    {
        fprintf(stdout, "exception: %s\n", x.what());
    }


    return EXIT_SUCCESS;
}
예제 #24
0
    /// Returns the current key+value pair in the range
    const_reference current() const
    {
        STLSOFT_ASSERT(is_open());

        return *m_position;
    }
예제 #25
0
inline void release_reference(I* pi)
{
    STLSOFT_ASSERT(NULL != pi);

    pi->Release();
}
예제 #26
0
inline void add_reference(I* pi)
{
    STLSOFT_ASSERT(NULL != pi);

    pi->AddRef();
}
예제 #27
0
    /// Returns the number of characters in the message
    size_type   size() const
    {
        STLSOFT_ASSERT(m_message.size() > 0);

        return m_message.size() - 1;
    }