Coconut Framework  beta
CNStringElement.h
Go to the documentation of this file.
1 
8 #ifndef CNSTRINGELEMENT_H
9 #define CNSTRINGELEMENT_H
10 
11 #include "CNForwarders.h"
12 #include <string.h>
13 #include <stdint.h>
14 
18  size_t referenceCount ;
20  size_t maxContextSize ;
23  /* Context of the string element is put here */
24 } ;
25 
33 struct CNStringElement *
34 CNAllocateStringElement(size_t len, const unsigned char * str, struct CNResource * resource) ;
35 
42 struct CNStringElement *
43 CNCopyStringElement(const struct CNStringElement * src, struct CNResource * resource) ;
44 
49 static inline void
51 {
52  dst->referenceCount += 1 ;
53 }
54 
60 void
61 CNReleaseStringElement(struct CNResource * resource, struct CNStringElement * dst) ;
62 
68 unsigned char *
69 CNContextOfStringElement(const struct CNStringElement * src) ;
70 
76 static inline size_t
78 {
79  return src->currentContextLength ;
80 }
81 
87 static inline size_t
89 {
90  return src->maxContextSize ;
91 }
92 
98 struct CNMemoryProfile
99 CNProfileOfStringElement(const struct CNStringElement * src) ;
100 
101 #endif /* CNSTRINGELEMENT_H */
static void CNRetainStringElement(struct CNStringElement *dst)
Retain the reference count of string element.
Definition: CNStringElement.h:50
Forward declaration of data types.
Information to present memory profile.
Definition: CNMemoryProfile.h:16
size_t maxContextSize
Definition: CNStringElement.h:20
unsigned char * CNContextOfStringElement(const struct CNStringElement *src)
Get context of the string element.
struct CNStringElement * CNCopyStringElement(const struct CNStringElement *src, struct CNResource *resource)
Allocate a copy of source string element.
struct CNStringElement * CNAllocateStringElement(size_t len, const unsigned char *str, struct CNResource *resource)
Allocate string element.
static size_t CNContextLengthOfStringElement(const struct CNStringElement *src)
Get context length of the string element.
Definition: CNStringElement.h:77
void CNReleaseStringElement(struct CNResource *resource, struct CNStringElement *dst)
Release the reference count of string element.
Definition: CNStringElement.h:16
struct CNMemoryProfile CNProfileOfStringElement(const struct CNStringElement *src)
Get memory profile of string element.
size_t referenceCount
Definition: CNStringElement.h:18
static size_t CNMaxContextSizeOfStringElement(const struct CNStringElement *src)
Get max context size of string elemnet.
Definition: CNStringElement.h:88
size_t currentContextLength
Definition: CNStringElement.h:22