File: pstring.h

package info (click to toggle)
libhtml-template-pro-perl 0.9510-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,492 kB
  • ctags: 849
  • sloc: ansic: 1,840; perl: 1,474; yacc: 410; pascal: 118; makefile: 7
file content (60 lines) | stat: -rw-r--r-- 1,568 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*! \file pstring.h
 * \brief string type.
 *
 * \author Igor Vlasenko <vlasenko@imath.kiev.ua>
 * \warning This header file should never be included directly.
 * Include <tmplpro.h> instead.
 */

#ifndef _PSTRING_H
#define _PSTRING_H	1

/** \struct PSTRING

    \brief string type used in htmltmplpro.

    \code
    typedef struct PSTRING {
      const char* begin;
      const char* endnext;
    } PSTRING;
    \endcode


    The string is delimited by two pointers, begin and endnext.
    The length of the string is calculated as endnext - begin.
    The empty string has begin == endnext. 

    \warning It is possible for empty string to have begin == endnext == NULL.
    \warning Contents of the memory area, passed as PSTRING, should always be treated as const.
    \warning Contents of the memory area, passed as PSTRING, can be destroyed after the callback function
    completed. To be used afterwards the string content should be copied.
 */

typedef struct PSTRING {
  const char* begin;   /*!< pointer to begin of the string. */
  const char* endnext; /*!< pointer to the byte next to the last char of the string. */
} PSTRING;

/** \struct MPSTRING

    \brief Modifiable PSTRING.

    \code
    typedef struct MPSTRING {
      char* begin;
      char* endnext;
    } PSTRING;
    \endcode

    The same as PSTING, but in non-constant memory.

 */


typedef struct MPSTRING {
  char* begin;   /*!< pointer to begin of the string. */
  char* endnext; /*!< pointer to the byte next to the last char of the string. */
} MPSTRING;

#endif /* pstring.h */