Coconut Framework
beta
|
Define CNString class. More...
#include "CNObject.h"
#include "CNList.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | CNStringMethods |
Methods for CNString. More... | |
struct | CNString |
Fixed size string class. More... | |
Typedefs | |
typedef void(* | CNVisitStringElementFuncRef )(size_t elmlen, const unsigned char *elmstr, void *info) |
Functions | |
struct CNString * | CNAllocateStringWithCString (size_t len, const unsigned char *str, struct CNResource *resource) |
Allocate CNString object. More... | |
struct CNString * | CNAllocateEmptyString (struct CNResource *resource) |
Allocate empty string. More... | |
static void | CNRetainString (struct CNString *dst) |
Retain CNString object. More... | |
static void | CNReleaseString (struct CNString *dst) |
Release CNString object. More... | |
static size_t | CNLengthOfString (const struct CNString *src) |
Get length of the string. More... | |
static uint64_t | CNHashValueOfString (const struct CNString *src) |
Get hash value of source string. More... | |
static struct CNObject * | CNObjectOfString (struct CNString *src) |
Get super class of CNString. More... | |
struct CNString * | CNCopyString (struct CNString *src) |
Allocate the copy of string. More... | |
void | CNAppendStringToString (struct CNString *dst, struct CNString *src) |
Append context of source string into destination. More... | |
void | CNAppendCStringToString (struct CNString *dst, size_t len, const unsigned char *src) |
Append C-String to String. More... | |
static struct CNString * | CNAddStrings (struct CNString *src0, struct CNString *src1) |
Allocate added string. More... | |
void | CNMoveStringToString (struct CNString *dst, struct CNString *src) |
Move context of source string into destination. More... | |
struct CNString * | CNPrintToString (struct CNResource *resource, const char *format,...) |
Allocate string with printf format. More... | |
void | CNPutStringToCString (unsigned char *dst, const struct CNString *src) |
Put context of string into buffer. More... | |
void | CNPrintString (FILE *fp, const struct CNString *src) |
Put context of string into file stream. More... | |
CNBoolean | CNIsSameStrings (const struct CNString *src0, const struct CNString *src1) |
Compare CNStrings. More... | |
CNBoolean | CNIsSameStringAndCString (const struct CNString *src0, size_t len1, const unsigned char *src1) |
Compare CNString and C-String. More... | |
void | CNVisitStringElements (const struct CNString *src, CNVisitStringElementFuncRef func, void *info) |
Visit all elements in the string. More... | |
struct CNMemoryProfile | CNProfileOfString (const struct CNString *src) |
Get memory profile of string. More... | |
Define CNString class.
typedef void(* CNVisitStringElementFuncRef)(size_t elmlen, const unsigned char *elmstr, void *info) |
Function to visit all elements in CNString
struct CNString* CNAllocateStringWithCString | ( | size_t | len, |
const unsigned char * | str, | ||
struct CNResource * | resource | ||
) |
Allocate CNString object.
str | Allocated string |
NULL | Allocation failed |
len | Length of source string |
str | Source string |
resource | Resource to allocate the string object. |
struct CNString* CNAllocateEmptyString | ( | struct CNResource * | resource | ) |
Allocate empty string.
str | Allocated string |
NULL | Allocation failed |
resource | Resource to allocate the string object |
|
inlinestatic |
Retain CNString object.
dst | Destination string object |
References CNRetainObject(), and CNString::superClass.
|
inlinestatic |
Release CNString object.
dst | Destination string object |
References CNReleaseObject(), and CNString::superClass.
|
inlinestatic |
Get length of the string.
src | Source string |
References CNString::length.
|
inlinestatic |
Get hash value of source string.
src | Source string |
References CNString::hashValue.
Get super class of CNString.
src | Source string |
References CNString::superClass.
Allocate the copy of string.
src | Source string |
Referenced by CNAddStrings().
Append context of source string into destination.
dst | Destination string |
src | Source string |
Referenced by CNAddStrings().
void CNAppendCStringToString | ( | struct CNString * | dst, |
size_t | len, | ||
const unsigned char * | src | ||
) |
Append C-String to String.
dst | Destination string |
len | Length of source string |
src | Source string |
Allocate added string.
src0 | Source string 0 |
src1 | Source string 1 |
References CNAppendStringToString(), and CNCopyString().
Move context of source string into destination.
dst | Destination string |
src | Source string |
struct CNString* CNPrintToString | ( | struct CNResource * | resource, |
const char * | format, | ||
... | |||
) |
Allocate string with printf format.
resource | Resource to allocate the string |
format | Print format |
void CNPutStringToCString | ( | unsigned char * | dst, |
const struct CNString * | src | ||
) |
Put context of string into buffer.
dst | Destination buffer |
src | Source string |
void CNPrintString | ( | FILE * | fp, |
const struct CNString * | src | ||
) |
Put context of string into file stream.
fp | Destination file stream |
src | Source string |
Compare CNStrings.
TRUE | They have same context |
FALSE | They have different context |
src0 | Source string 0 |
src1 | Source string 1 |
CNBoolean CNIsSameStringAndCString | ( | const struct CNString * | src0, |
size_t | len1, | ||
const unsigned char * | src1 | ||
) |
Compare CNString and C-String.
TRUE | They have same context |
FALSE | They have different context |
src0 | Source string 0 |
len1 | Length of source string 1 |
src1 | Source string 1 |
void CNVisitStringElements | ( | const struct CNString * | src, |
CNVisitStringElementFuncRef | func, | ||
void * | info | ||
) |
Visit all elements in the string.
src | Source string |
func | Visit function for each elements |
info | User defined parameter, this is passed to the visit function |
struct CNMemoryProfile CNProfileOfString | ( | const struct CNString * | src | ) |
Get memory profile of string.
src | Source string |