Coconut Framework
beta
|
Define CNFixedString class. More...
#include "CNType.h"
#include "CNMemoryProfile.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | CNFixedString |
Persistent string. There are only one object for each context of string. More... | |
Typedefs | |
typedef CNBoolean(* | CNVisitFixedStringPoolFuncRef )(const struct CNFixedString *str, void *userdata) |
Functions | |
void | CNSetupFixedStringPool (void) |
Initialize pool for CNFixedString. More... | |
struct CNFixedString * | CNAllocateFixedString (size_t len, const unsigned char *str) |
Allocate CNFixedString object. More... | |
static size_t | CNLengthOfFixedString (const struct CNFixedString *src) |
Get length of CNFixedString. More... | |
static const unsigned char * | CNContentOfFixedString (const struct CNFixedString *src) |
Get content of CNFixedString. More... | |
static uint64_t | CNUniqueIdOfFixedString (const struct CNFixedString *src) |
Get hash value of CNFixedString. More... | |
static CNBoolean | CNIsSameFixedString (const struct CNFixedString *s0, const struct CNFixedString *s1) |
Check 2 string has same context or not. More... | |
CNBoolean | CNForeachFixedStringInFixedStringPool (CNVisitFixedStringPoolFuncRef visitfunc, void *userdata) |
Get all fixed string in fixed string pool. More... | |
struct CNFixedString * | CNSearchFixedStringById (uint64_t src) |
Search fixed-string in pool by the id. More... | |
struct CNFixedString * | CNSearchFixedStringByUTF8String (size_t srclen, const unsigned char *srcstr) |
Search fixed-string in pool by the string. More... | |
void | CNPrintFixedString (FILE *outfp, const struct CNFixedString *src) |
Print fixed-string. More... | |
struct CNMemoryProfile | CNProfileOfFixedStringPool (void) |
Get memory usage information. More... | |
Define CNFixedString class.
typedef CNBoolean(* CNVisitFixedStringPoolFuncRef)(const struct CNFixedString *str, void *userdata) |
Function to visit fixed-string pool and get fixed-string from it
void CNSetupFixedStringPool | ( | void | ) |
Initialize pool for CNFixedString.
struct CNFixedString* CNAllocateFixedString | ( | size_t | len, |
const unsigned char * | str | ||
) |
Allocate CNFixedString object.
len | Length of source string |
str | Source string |
|
inlinestatic |
Get length of CNFixedString.
src | Source string |
References CNFixedString::length.
Referenced by CNPutFixedStringToText().
|
inlinestatic |
Get content of CNFixedString.
src | Source string |
References CNFixedString::content.
Referenced by CNPutFixedStringToText().
|
inlinestatic |
Get hash value of CNFixedString.
src | Source string |
References CNFixedString::uniqId.
|
inlinestatic |
Check 2 string has same context or not.
TRUE | They have same contexts. |
FALSE | They have different contexts |
s0 | Source string 0 |
s1 | Source string 1 |
CNBoolean CNForeachFixedStringInFixedStringPool | ( | CNVisitFixedStringPoolFuncRef | visitfunc, |
void * | userdata | ||
) |
Get all fixed string in fixed string pool.
TRUE | Every elements are visited |
FALSE | Every elements are NOT visited |
visitfunc | Function to visit each fixed string |
userdata | Data pointer to be used in the visit function |
struct CNFixedString* CNSearchFixedStringById | ( | uint64_t | src | ) |
Search fixed-string in pool by the id.
str | The string which has the id |
NULL | There are no string which has the id |
src | Source fixed-string id |
struct CNFixedString* CNSearchFixedStringByUTF8String | ( | size_t | srclen, |
const unsigned char * | srcstr | ||
) |
Search fixed-string in pool by the string.
str | The string which has the id |
NULL | There are no string which has the id |
srclen | Length of source string |
srcstr | Source UTF8 string |
void CNPrintFixedString | ( | FILE * | outfp, |
const struct CNFixedString * | src | ||
) |
Print fixed-string.
outfp | Output file stream |
src | Source fixed-string |
struct CNMemoryProfile CNProfileOfFixedStringPool | ( | void | ) |
Get memory usage information.