- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages
- Examples

# fastformat/fastformat.h

Go to the documentation of this file.

    00001 /* /////////////////////////////////////////////////////////////////////////
    00002  * File:        fastformat/fastformat.h
    00003  *
    00004  * Purpose:     FastFormat Core API.
    00005  *
    00006  * Created:     18th September 2006
    00007  * Updated:     22nd June 2010
    00008  *
    00009  * Home:        http://www.fastformat.org/
    00010  *
    00011  * Copyright (c) 2006-2010, Matthew Wilson and Synesis Software
    00012  * All rights reserved.
    00013  *
    00014  * Redistribution and use in source and binary forms, with or without
    00015  * modification, are permitted provided that the following conditions are
    00016  * met:
    00017  *
    00018  * - Redistributions of source code must retain the above copyright notice,
    00019  *   this list of conditions and the following disclaimer.
    00020  * - Redistributions in binary form must reproduce the above copyright
    00021  *   notice, this list of conditions and the following disclaimer in the
    00022  *   documentation and/or other materials provided with the distribution.
    00023  * - Neither the names of Matthew Wilson and Synesis Software nor the names
    00024  *   of any contributors may be used to endorse or promote products derived
    00025  *   from this software without specific prior written permission.
    00026  *
    00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    00028  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    00029  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    00030  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    00031  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    00032  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    00033  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    00034  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    00035  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00036  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00037  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00038  *
    00039  * ////////////////////////////////////////////////////////////////////// */
    00040
    00041
    00047 #ifndef FASTFORMAT_INCL_FASTFORMAT_H_FASTFORMAT
    00048 #define FASTFORMAT_INCL_FASTFORMAT_H_FASTFORMAT
    00049
    00050 /* /////////////////////////////////////////////////////////////////////////
    00051  * Version information
    00052  */
    00053
    00054 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00055 # define FASTFORMAT_VER_FASTFORMAT_H_FASTFORMAT_MAJOR       1
    00056 # define FASTFORMAT_VER_FASTFORMAT_H_FASTFORMAT_MINOR       19
    00057 # define FASTFORMAT_VER_FASTFORMAT_H_FASTFORMAT_REVISION    14
    00058 # define FASTFORMAT_VER_FASTFORMAT_H_FASTFORMAT_EDIT        81
    00059 #endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00060
    00077 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00078 # define FASTFORMAT_VER_0_1_1               0x00010100
    00079 # define FASTFORMAT_VER_0_1_2               0x00010200
    00080 # define FASTFORMAT_VER_0_1_3               0x00010300
    00081 # define FASTFORMAT_VER_0_1_4               0x00010400
    00082 # define FASTFORMAT_VER_0_1_5               0x00010500
    00083 # define FASTFORMAT_VER_0_1_6               0x00010600
    00084 # define FASTFORMAT_VER_0_1_7               0x000107ff
    00085 # define FASTFORMAT_VER_0_1_8               0x000108ff
    00086 # define FASTFORMAT_VER_0_1_9               0x000109ff
    00087 # define FASTFORMAT_VER_0_1_10              0x00010aff
    00088 # define FASTFORMAT_VER_0_1_11              0x00010bff
    00089 # define FASTFORMAT_VER_0_1_12              0x00010cff
    00090 # define FASTFORMAT_VER_0_2_1_ALPHA_1       0x00020101
    00091 # define FASTFORMAT_VER_0_2_1_ALPHA_2       0x00020102
    00092 # define FASTFORMAT_VER_0_2_1_ALPHA_3       0x00020103
    00093 # define FASTFORMAT_VER_0_2_1_ALPHA_4       0x00020104
    00094 # define FASTFORMAT_VER_0_2_1_ALPHA_5       0x00020105
    00095 # define FASTFORMAT_VER_0_2_1_ALPHA_6       0x00020106
    00096 # define FASTFORMAT_VER_0_2_1_ALPHA_7       0x00020107
    00097 # define FASTFORMAT_VER_0_2_1_ALPHA_8       0x00020108
    00098 # define FASTFORMAT_VER_0_2_1_ALPHA_9       0x00020109
    00099 # define FASTFORMAT_VER_0_2_1_ALPHA_10      0x0002010a
    00100 # define FASTFORMAT_VER_0_2_1_ALPHA_11      0x0002010b
    00101 # define FASTFORMAT_VER_0_2_1_ALPHA_12      0x0002010c
    00102 # define FASTFORMAT_VER_0_2_1_BETA_1        0x00020181
    00103 # define FASTFORMAT_VER_0_2_1_BETA_3        0x00020183
    00104 # define FASTFORMAT_VER_0_2_1_BETA_4        0x00020184
    00105 # define FASTFORMAT_VER_0_2_1_BETA_5        0x00020185
    00106 # define FASTFORMAT_VER_0_2_1_BETA_6        0x00020186
    00107 # define FASTFORMAT_VER_0_2_1_BETA_7        0x00020187
    00108 # define FASTFORMAT_VER_0_2_1_BETA_8        0x00020188
    00109 # define FASTFORMAT_VER_0_2_1_BETA_9        0x00020189
    00110 # define FASTFORMAT_VER_0_2_1_BETA_10       0x0002018a
    00111 # define FASTFORMAT_VER_0_2_1               0x000201ff
    00112 # define FASTFORMAT_VER_0_3_1_ALPHA_1       0x00030101
    00113 # define FASTFORMAT_VER_0_3_1_BETA_1        0x00030181
    00114 # define FASTFORMAT_VER_0_3_1_BETA_2        0x00030182
    00115 # define FASTFORMAT_VER_0_3_1_BETA_3        0x00030183
    00116 # define FASTFORMAT_VER_0_3_1_BETA_4        0x00030184
    00117 # define FASTFORMAT_VER_0_3_1_BETA_5        0x00030185
    00118 # define FASTFORMAT_VER_0_3_2_BETA_1        0x00030281
    00119 # define FASTFORMAT_VER_0_3_2_BETA_2        0x00030282
    00120 # define FASTFORMAT_VER_0_3_2_BETA_3        0x00030283
    00121 # define FASTFORMAT_VER_0_3_2_BETA_4        0x00030284
    00122 # define FASTFORMAT_VER_0_3_2               0x000302ff
    00123 # define FASTFORMAT_VER_0_3_3               0x000303ff
    00124 # define FASTFORMAT_VER_0_3_4               0x000304ff
    00125 # define FASTFORMAT_VER_0_4_1               0x00040101
    00126 # define FASTFORMAT_VER_0_4_2               0x000402ff
    00127 # define FASTFORMAT_VER_0_4_3               0x000403ff
    00128 # define FASTFORMAT_VER_0_4_4               0x000404ff
    00129 # define FASTFORMAT_VER_0_4_5               0x000405ff
    00130 # define FASTFORMAT_VER_0_4_6               0x000406ff
    00131 # define FASTFORMAT_VER_0_5_1_ALPHA_1       0x00050101
    00132 # define FASTFORMAT_VER_0_5_2               0x000502ff
    00133 # define FASTFORMAT_VER_0_5_3               0x000503ff
    00134 # define FASTFORMAT_VER_0_5_4               0x000504ff
    00135 # define FASTFORMAT_VER_0_5_5               0x000505ff
    00136 # define FASTFORMAT_VER_0_5_6               0x000506ff
    00137 # define FASTFORMAT_VER_0_5_7               0x000507ff
    00138 # define FASTFORMAT_VER_0_5_8               0x000508ff
    00139 # define FASTFORMAT_VER_0_5_9               0x000509ff
    00140 # define FASTFORMAT_VER_0_6_1_ALPHA_1       0x00060101
    00141 #endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00142
    00143 #define FASTFORMAT_VER_MAJOR           0
    00144 #define FASTFORMAT_VER_MINOR           6
    00145 #define FASTFORMAT_VER_REVISION        1
    00146
    00147 #define FASTFORMAT_VER                 FASTFORMAT_VER_0_6_1_ALPHA_1
    00148
    00149 /* /////////////////////////////////////////////////////////////////////////
    00150  * Includes - 1
    00151  */
    00152
    00153 #include <stddef.h>     /* for size_t */
    00154
    00155 /* /////////////////////////////////////////////////////////////////////////
    00156  * Feature detection
    00157  */
    00158
    00159 /* By default, FastFormat is a multi-byte string library
    00160  */
    00161 #ifndef FASTFORMAT_USE_WIDE_STRINGS
    00162 # if defined(_WIN32) && \
    00163      defined(UNICODE) && \
    00164      defined(_UNICODE)
    00165 #  define FASTFORMAT_USE_WIDE_STRINGS
    00166 # endif /* _WIN32 && UNICODE && _UNICODE */
    00167 #endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    00168
    00169 /* /////////////////////////////////////////////////////////////////////////
    00170  * Includes - 2
    00171  */
    00172
    00173 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00174 # ifndef _WCHAR_T_DEFINED
    00175 #  include <wchar.h>    /* for wchar_t (if not built-in) */
    00176 # endif /* !_WCHAR_T_DEFINED */
    00177 #endif /* FASTFORMAT_USE_WIDE_STRINGS */
    00178
    00179 #include <fastformat/internal/string_encoding.h>
    00180
    00181 /* /////////////////////////////////////////////////////////////////////////
    00182  * Namespace
    00183  */
    00184
    00185 #if !defined(__cplusplus) && \
    00186     !defined(FASTFORMAT_DOCUMENTATION_SKIP_SECTION) && \
    00187     !defined(FASTFORMAT_NO_NAMESPACE)
    00188 # define FASTFORMAT_NO_NAMESPACE
    00189 #endif /* __cplusplus, etc. */
    00190
    00191 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00192
    00197 namespace fastformat
    00198 {
    00199 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00200
    00201 /* /////////////////////////////////////////////////////////////////////////
    00202  * Includes - 3
    00203  */
    00204
    00205 #ifdef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00206 # include "./internal/shim_macros.h"
    00207 #else /* ? FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00208 # include <fastformat/internal/shim_macros.h>
    00209 #endif /* FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00210
    00211 /* /////////////////////////////////////////////////////////////////////////
    00212  * Macros and definitions
    00213  */
    00214
    00255 #if !defined(FASTFORMAT_DECLSPEC)
    00256 # define FASTFORMAT_DECLSPEC
    00257 #endif /* !FASTFORMAT_DECLSPEC */
    00258
    00259 #if defined(__cplusplus) || \
    00260     defined(FASTFORMAT_DOCUMENTATION_SKIP_SECTION)
    00261 # define FASTFORMAT_EXTERN_C           extern "C"
    00262 #else /* ? __cplusplus */
    00263 # define FASTFORMAT_EXTERN_C           extern
    00264 #endif /* !__cplusplus */
    00265
    00266 #if !defined(FASTFORMAT_CALLCONV)
    00267 # define FASTFORMAT_CALLCONV
    00268 #endif /* !FASTFORMAT_CALLCONV */
    00269
    00270 #if defined(FASTFORMAT_DOCUMENTATION_SKIP_SECTION) || \
    00271     !defined(FASTFORMAT_CALL)
    00272 # define FASTFORMAT_CALL(rt)           FASTFORMAT_DECLSPEC FASTFORMAT_EXTERN_C rt FASTFORMAT_CALLCONV
    00273 #endif /* !FASTFORMAT_CALL */
    00274
    00275 /* /////////////////////////////////////////////////////////////////////////
    00276  * Typedefs
    00277  */
    00278
    00285 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00286 typedef wchar_t     ff_char_t;
    00287 #else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    00288 typedef char        ff_char_t;
    00289 #endif /* FASTFORMAT_USE_WIDE_STRINGS */
    00290
    00293 struct ff_string_slice_t
    00294 {
    00295     size_t              len;
    00296     ff_char_t const*    ptr;
    00297 };
    00298 #ifndef __cplusplus
    00299 typedef struct ff_string_slice_t    ff_string_slice_t;
    00300 #endif /* !__cplusplus */
    00301
    00302 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00303
    00305 typedef ff_string_slice_t           string_slice_t;
    00306 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00307
    00311 struct ff_format_element_t;
    00312 #ifndef __cplusplus
    00313 typedef struct ff_format_element_t  ff_format_element_t;
    00314 #endif /* !__cplusplus */
    00315
    00316 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00317
    00319 typedef ff_format_element_t         format_element_t;
    00320 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00321
    00322 /* /////////////////////////////////////////////////////////////////////////
    00323  * Typedefs
    00324  */
    00325
    00330 enum ff_parse_code_t
    00331 {
    00332         FF_PARSECODE_SUCCESS                =   0
    00333     ,   FF_PARSECODE_INCOMPLETEREPLACEMENT  =   1
    00334     ,   FF_PARSECODE_INVALIDINDEX           =   2
    00335 };
    00336 #ifndef __cplusplus
    00337 typedef struct ff_parse_code_t          ff_parse_code_t;
    00338 #endif /* !__cplusplus */
    00339
    00340 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00341
    00343 typedef ff_parse_code_t                 parse_code_t;
    00344 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00345
    00346
    00351 enum ff_replacement_code_t
    00352 {
    00353         FF_REPLACEMENTCODE_SUCCESS                  =   0
    00354     ,   FF_REPLACEMENTCODE_MISSING_ARGUMENT         =   1
    00355     ,   FF_REPLACEMENTCODE_UNREFERENCED_ARGUMENT    =   2
    00356 };
    00357 #ifndef __cplusplus
    00358 typedef struct ff_replacement_code_t    ff_replacement_code_t;
    00359 #endif /* !__cplusplus */
    00360
    00361 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00362
    00364 typedef ff_replacement_code_t           replacement_code_t;
    00365 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00366
    00367
    00403 typedef int (FASTFORMAT_CALLCONV* fastformat_illformedHandler_t)(
    00404     void*               param
    00405 ,   ff_parse_code_t     code
    00406 ,   ff_char_t const*    format
    00407 ,   size_t              formatLen
    00408 ,   size_t              replacementIndex
    00409 ,   ff_char_t const*    defect
    00410 ,   size_t              defectLen
    00411 ,   int                 parameterIndex
    00412 ,   void*               reserved0
    00413 ,   size_t              reserved1
    00414 ,   void*               reserved2
    00415 );
    00416
    00417 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00418
    00420 typedef fastformat_illformedHandler_t  illformedHandler_t;
    00421 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00422
    00428 struct ff_illformed_handler_info_t
    00429 {
    00430     fastformat_illformedHandler_t   handler;
    00431     void*                           param;
    00432 };
    00433
    00434 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00435
    00437 typedef ff_illformed_handler_info_t     illformed_handler_info_t;
    00438 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00439
    00487 typedef int (FASTFORMAT_CALLCONV* fastformat_mismatchedHandler_t)(
    00488     void*                   param
    00489 ,   ff_replacement_code_t   code
    00490 ,   size_t                  numParameters
    00491 ,   int                     parameterIndex
    00492 ,   ff_string_slice_t*      slice
    00493 ,   void*                   reserved0
    00494 ,   size_t                  reserved1
    00495 ,   void*                   reserved2
    00496 );
    00497
    00498 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00499
    00501 typedef fastformat_mismatchedHandler_t  mismatchedHandler_t;
    00502 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00503
    00509 struct ff_mismatched_handler_info_t
    00510 {
    00511     fastformat_mismatchedHandler_t  handler;
    00512     void*                           param;
    00513 };
    00514
    00515 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00516
    00518 typedef ff_mismatched_handler_info_t    mismatched_handler_info_t;
    00519 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00520
    00521 /* /////////////////////////////////////////////////////////////////////////
    00522  * API Initialisation Functions
    00523  */
    00524
    00547 FASTFORMAT_CALL(int) fastformat_init(void);
    00548
    00568 FASTFORMAT_CALL(void) fastformat_uninit(void);
    00569
    00570 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00571 FASTFORMAT_CALL(void) fastformat_exitProcess(int code);
    00572 #endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00573
    00583 FASTFORMAT_CALL(ff_char_t const*) fastformat_getInitCodeString(int code);
    00584
    00592 FASTFORMAT_CALL(size_t) fastformat_getInitCodeStringLength(int code);
    00593
    00594 #ifndef FASTFORMAT_NO_NAMESPACE
    00595
    00599 inline int init()
    00600 {
    00601     return fastformat_init();
    00602 }
    00603
    00608 inline void uninit()
    00609 {
    00610     fastformat_uninit();
    00611 }
    00612
    00617 inline ff_char_t const* getInitCodeString(int code)
    00618 {
    00619     return fastformat_getInitCodeString(code);
    00620 }
    00621
    00626 inline size_t getInitCodeStringLength(int code)
    00627 {
    00628     return fastformat_getInitCodeStringLength(code);
    00629 }
    00630 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00631
    00632 /* /////////////////////////////////////////////////////////////////////////
    00633  * Configuration Functions
    00634  */
    00635
    00642 FASTFORMAT_CALL(ff_illformed_handler_info_t) fastformat_getProcessIllformedHandler(void);
    00643
    00653 FASTFORMAT_CALL(ff_illformed_handler_info_t) fastformat_setProcessIllformedHandler(fastformat_illformedHandler_t handler, void* param);
    00654
    00661 FASTFORMAT_CALL(ff_illformed_handler_info_t) fastformat_getThreadIllformedHandler(void);
    00662
    00672 FASTFORMAT_CALL(ff_illformed_handler_info_t) fastformat_setThreadIllformedHandler(fastformat_illformedHandler_t handler, void* param);
    00673
    00674
    00681 FASTFORMAT_CALL(ff_mismatched_handler_info_t) fastformat_getProcessMismatchedHandler(void);
    00682
    00692 FASTFORMAT_CALL(ff_mismatched_handler_info_t) fastformat_setProcessMismatchedHandler(fastformat_mismatchedHandler_t handler, void* param);
    00693
    00700 FASTFORMAT_CALL(ff_mismatched_handler_info_t) fastformat_getThreadMismatchedHandler(void);
    00701
    00711 FASTFORMAT_CALL(ff_mismatched_handler_info_t) fastformat_setThreadMismatchedHandler(fastformat_mismatchedHandler_t handler, void* param);
    00712
    00713 /* /////////////////////////////////////////////////////////////////////////
    00714  * API Parsing Functions
    00715  */
    00716
    00727 FASTFORMAT_CALL(size_t) fastformat_calculateNumberOfRequiredReplacements(
    00728     ff_char_t const*    format
    00729 ,   size_t              cchFormat
    00730 );
    00731
    00756 FASTFORMAT_CALL(unsigned) fastformat_parseFormat(
    00757     ff_char_t const*                format
    00758 ,   size_t                          cchFormat
    00759 ,   ff_format_element_t*            formatElements
    00760 ,   size_t                          numFormatElements
    00761 ,   fastformat_illformedHandler_t   handler
    00762 ,   void*                           param
    00763 );
    00764
    00770 FASTFORMAT_CALL(size_t) fastformat_fillReplacements(
    00771     ff_string_slice_t*              resultElements      /*<! Pointer to an array of result elements. This must have at least the number of elements indicated for the pattern elements. */
    00772 ,   ff_format_element_t const*      formatElements      /*<! Pointer to an array of pattern elements. */
    00773 ,   size_t                          numElements         /*<! Number of pattern elements. */
    00774 ,   ff_string_slice_t const*        arguments           /*<! Pointer to an array of replacement parameters. */
    00775 ,   size_t                          numArguments        /*<! The number of replacement parameters. */
    00776 ,   fastformat_mismatchedHandler_t  handler
    00777 ,   void*                           param
    00778 ,   size_t*                         pnumResultElements
    00779 );
    00780
    00784 FASTFORMAT_CALL(size_t) fastformat_accumulateSliceLengths(
    00785     size_t                      numSlices
    00786 ,   ff_string_slice_t const*    slices
    00787 );
    00788
    00789 /* /////////////////////////////////////////////////////////////////////////
    00790  * API Format Caching Functions
    00791  */
    00792
    00804 FASTFORMAT_CALL(unsigned) fastformat_lookupPattern(
    00805     ff_char_t const*            pattern
    00806 ,   size_t                      cchPattern
    00807 ,   ff_format_element_t const** elements
    00808 );
    00809
    00810 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00811 FASTFORMAT_CALL(ff_char_t const*) fastformat_getSpacesSlice(size_t len);
    00812 FASTFORMAT_CALL(ff_char_t const*) fastformat_getHashesSlice(size_t len);
    00813 #endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00814
    00815 /* /////////////////////////////////////////////////////////////////////////
    00816  * API Utility Functions
    00817  */
    00818
    00822 FASTFORMAT_CALL(ff_string_slice_t) fastformat_getNewlineForPlatform(void);
    00823
    00824 /* /////////////////////////////////////////////////////////////////////////
    00825  * C++ API Functions
    00826  */
    00827
    00828 #ifndef FASTFORMAT_NO_NAMESPACE
    00829
    00834 inline ff_illformed_handler_info_t getProcessIllformedHandler()
    00835 {
    00836     return fastformat_getProcessIllformedHandler();
    00837 }
    00838
    00843 inline ff_illformed_handler_info_t setProcessIllformedHandler(illformedHandler_t handler, void* param)
    00844 {
    00845     return fastformat_setProcessIllformedHandler(handler, param);
    00846 }
    00847
    00852 inline ff_illformed_handler_info_t getThreadIllformedHandler()
    00853 {
    00854     return fastformat_getThreadIllformedHandler();
    00855 }
    00856
    00861 inline ff_illformed_handler_info_t setThreadIllformedHandler(illformedHandler_t handler, void* param)
    00862 {
    00863     return fastformat_setThreadIllformedHandler(handler, param);
    00864 }
    00865
    00870 inline ff_mismatched_handler_info_t getProcessMismatchedHandler()
    00871 {
    00872     return fastformat_getProcessMismatchedHandler();
    00873 }
    00874
    00879 inline ff_mismatched_handler_info_t setProcessMismatchedHandler(mismatchedHandler_t handler, void* param)
    00880 {
    00881     return fastformat_setProcessMismatchedHandler(handler, param);
    00882 }
    00883
    00888 inline ff_mismatched_handler_info_t getThreadMismatchedHandler()
    00889 {
    00890     return fastformat_getThreadMismatchedHandler();
    00891 }
    00892
    00897 inline ff_mismatched_handler_info_t setThreadMismatchedHandler(mismatchedHandler_t handler, void* param)
    00898 {
    00899     return fastformat_setThreadMismatchedHandler(handler, param);
    00900 }
    00901
    00906 inline string_slice_t getNewlineForPlatform()
    00907 {
    00908     return fastformat_getNewlineForPlatform();
    00909 }
    00910
    00911 #endif /* !FASTFORMAT_NO_NAMESPACE */
    00912
    00913 /* /////////////////////////////////////////////////////////////////////////
    00914  * Internal functions
    00915  */
    00916
    00917 # ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
    00918 /*
    00919  * \param cb The number of bytes to allocate
    00920  *
    00921  * \return the NULL pointer if allocation failed, otherwise a pointer to a
    00922  *   correctly aligned block of bytes, all of whose values are 0x00.
    00923  */
    00924 FASTFORMAT_CALL(void*) fastformat_malloc(size_t cb);
    00925 # endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */
    00926
    00927 /* /////////////////////////////////////////////////////////////////////////
    00928  * String Access Shims
    00929  */
    00930
    00932 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00933 inline wchar_t const* c_str_data_w(
    00934 #else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    00935 inline char const* c_str_data_a(
    00936 #endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    00937     ff_string_slice_t const& slice
    00938 )
    00939 {
    00940     return slice.ptr;
    00941 }
    00942
    00944 inline ff_char_t const* c_str_data(
    00945     ff_string_slice_t const& slice
    00946 )
    00947 {
    00948 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00949     return c_str_data_w(slice);
    00950 #else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    00951     return c_str_data_a(slice);
    00952 #endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    00953 }
    00954
    00956 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00957 inline size_t c_str_len_w(
    00958 #else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    00959 inline size_t c_str_len_a(
    00960 #endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    00961     ff_string_slice_t const& slice
    00962 )
    00963 {
    00964     return slice.len;
    00965 }
    00966
    00968 inline size_t c_str_len(
    00969     ff_string_slice_t const& slice
    00970 )
    00971 {
    00972 #ifdef FASTFORMAT_USE_WIDE_STRINGS
    00973     return c_str_len_w(slice);
    00974 #else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    00975     return c_str_len_a(slice);
    00976 #endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    00977 }
    00978
    00979 /* /////////////////////////////////////////////////////////////////////////
    00980  * Namespace
    00981  */
    00982
    00983 #if !defined(FASTFORMAT_NO_NAMESPACE)
    00984
    00988 namespace util
    00989 {}
    00990
    00998 namespace filters
    00999 {}
    01000
    01004 namespace iterators
    01005 {}
    01006
    01013 namespace sinks
    01014 {}
    01015
    01021 namespace internal
    01022 {}
    01023
    01024 } /* namespace fastformat */
    01025
    01026
    01027 # ifndef _STLSOFT_NO_NAMESPACE
    01028 namespace stlsoft
    01029 {
    01030 # endif /* !_STLSOFT_NO_NAMESPACE */
    01031
    01032 #  ifdef FASTFORMAT_USE_WIDE_STRINGS
    01033     using ::fastformat::c_str_data_w;
    01034     using ::fastformat::c_str_len_w;
    01035 #  else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    01036     using ::fastformat::c_str_data_a;
    01037     using ::fastformat::c_str_len_a;
    01038 #  endif /* FASTFORMAT_USE_WIDE_STRINGS */
    01039     using ::fastformat::c_str_data;
    01040     using ::fastformat::c_str_len;
    01041
    01042 # ifndef _STLSOFT_NO_NAMESPACE
    01043 } /* namespace stlsoft */
    01044 # endif /* !_STLSOFT_NO_NAMESPACE */
    01045
    01046
    01047 #else /* ? !FASTFORMAT_NO_NAMESPACE */
    01048
    01049 # ifndef _STLSOFT_NO_NAMESPACE
    01050 namespace stlsoft
    01051 {
    01052
    01053 #  ifdef FASTFORMAT_USE_WIDE_STRINGS
    01054 inline wchar_t const* c_str_data_w(
    01055 #  else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    01056 inline char const* c_str_data_a(
    01057 #  endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    01058     ff_string_slice_t const& slice
    01059 )
    01060 {
    01061     return slice.ptr;
    01062 }
    01063
    01064 inline ff_char_t const* c_str_data(
    01065     ff_string_slice_t const& slice
    01066 )
    01067 {
    01068     return slice.ptr;
    01069 }
    01070
    01071 #  ifdef FASTFORMAT_USE_WIDE_STRINGS
    01072 inline size_t c_str_len_w(
    01073 #  else /* ? FASTFORMAT_USE_WIDE_STRINGS */
    01074 inline size_t c_str_len_a(
    01075 #  endif /* !FASTFORMAT_USE_WIDE_STRINGS */
    01076     ff_string_slice_t const& slice
    01077 )
    01078 {
    01079     return slice.len;
    01080 }
    01081
    01082 inline size_t c_str_len(
    01083     ff_string_slice_t const& slice
    01084 )
    01085 {
    01086     return slice.len;
    01087 }
    01088
    01089 } /* namespace stlsoft */
    01090 # endif /* !_STLSOFT_NO_NAMESPACE */
    01091
    01092 #endif /* !FASTFORMAT_NO_NAMESPACE */
    01093
    01094 /* /////////////////////////////////////////////////////////////////////////
    01095  * Inclusion
    01096  */
    01097
    01098 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
    01099 # pragma once
    01100 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
    01101
    01102 /* ////////////////////////////////////////////////////////////////////// */
    01103
    01104 #endif /* FASTFORMAT_INCL_FASTFORMAT_H_FASTFORMAT */
    01105
    01106 /* ///////////////////////////// end of file //////////////////////////// */

FastFormat Library documentation © Matthew Wilson, 2006-2009 |