Ignore:
Timestamp:
Nov 4, 2000, 8:55:45 PM (25 years ago)
Author:
umoeller
Message:

Updated string helpers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/xstring.h

    r7 r12  
    3333
    3434    /*
    35      *@@ XSTR:
    36      *      string type for the strhx* functions.
    37      *      That's a simple pointer to a PSZ.
     35     *@@ XSTRING:
     36     *
     37     *@@added V0.9.6 (2000-11-01) [umoeller]
    3838     */
    3939
    40     typedef PSZ* XSTR;
     40    typedef struct _XSTRING
     41    {
     42        PSZ             psz;            // ptr to string or NULL
     43        ULONG           ulLength;       // length of *psz
     44        ULONG           cbAllocated;    // memory allocated in *psz
     45                                        // (>= ulLength + 1)
     46    } XSTRING, *PXSTRING;
     47
     48    void xstrInit(PXSTRING pxstr,
     49                  ULONG ulPreAllocate);
     50
     51    void xstrInitSet(PXSTRING pxstr,
     52                     PSZ pszNew);
     53
     54    void xstrInitCopy(PXSTRING pxstr,
     55                      const char *pcszSource);
     56
     57    void xstrClear(PXSTRING pxstr);
     58
     59    PXSTRING xstrCreate(ULONG ulPreAllocate);
     60
     61    VOID xstrFree(PXSTRING pxstr);
     62
     63    ULONG xstrset(PXSTRING pxstr,
     64                  PSZ pszNew);
     65
     66    ULONG xstrcpy(PXSTRING pxstr,
     67                  const char *pcszSource);
     68
     69    ULONG xstrcat(PXSTRING pxstr,
     70                  const char *pcszSource);
    4171
    4272    /*
     
    4979    #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
    5080
    51     ULONG xstrcpy(XSTR ppszBuf,
    52                   const char *pszString);
     81    ULONG xstrrpl(PXSTRING pxstr,
     82                  ULONG ulOfs,
     83                  const XSTRING *pstrSearch,
     84                  const XSTRING *pstrReplace,
     85                  PULONG pulAfterOfs);
    5386
    54     #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    55         ULONG xstrcatDebug(XSTR ppszBuf,
    56                            const char *pszString,
    57                            const char *file,
    58                            unsigned long line,
    59                            const char *function);
    60         #define xstrcat(a, b) xstrcatDebug((a), (b), __FILE__, __LINE__, __FUNCTION__)
    61     #else
    62         ULONG xstrcat(XSTR ppszBuf,
    63                        const char *pszString);
    64     #endif
    65 
    66     #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    67         ULONG xstrrplDebug(PSZ *ppszBuf,
    68                            ULONG ulOfs,
    69                            const char *pszSearch,
    70                            const char *pszReplace,
    71                            PULONG pulAfterOfs,
    72                            const char *file,
    73                            unsigned long line,
    74                            const char *function);
    75         #define xstrrpl(a, b, c, d, e) xstrrplDebug((a), (b), (c), (d), (e), __FILE__, __LINE__, __FUNCTION__)
    76     #else
    77         ULONG xstrrpl(PSZ *ppszBuf,
    78                       ULONG ulOfs,
    79                       const char *pszSearch,
    80                       const char *pszReplace,
    81                       PULONG pulAfterOfs);
    82     #endif
    83 
    84     PSZ xstrins(PSZ pszBuffer,
    85                  ULONG ulInsertOfs,
    86                  const char *pszInsert);
    87 
     87    ULONG xstrcrpl(PXSTRING pxstr,
     88                   ULONG ulOfs,
     89                   const char *pcszSearch,
     90                   const char *pcszReplace,
     91                   PULONG pulAfterOfs);
    8892#endif
    8993
Note: See TracChangeset for help on using the changeset viewer.