Coconut Framework  beta
Classes | Functions
CNText.h File Reference

Define CNText class. More...

#include "CNObject.h"
#include "CNBuffer.h"
#include "CNPool.h"
#include "CNFixedString.h"
#include "CNString.h"
#include "CNForwarders.h"
#include <stdio.h>

Go to the source code of this file.

Classes

struct  CNText
 

Functions

struct CNTextCNAllocateText (struct CNResource *resource)
 Allocate CNText object. More...
 
static struct CNResource * CNResourceOfText (struct CNText *src)
 Get resource for this text. More...
 
static void CNReleaseText (struct CNText *dst)
 Release text object. More...
 
void CNPushSectionToText (struct CNText *dst, const unsigned char *beginstr, const unsigned char *endstr)
 Allocate new section as a child of section. More...
 
void CNPopSectionFromText (struct CNText *dst)
 Move to the parent section from current section. More...
 
static void CNPutUTF8StringToText (struct CNText *dst, size_t srclen, const unsigned char *srcstr)
 Put string to text. More...
 
static void CNPutFixedStringToText (struct CNText *dst, const struct CNFixedString *src)
 Put fixed string to text. More...
 
void CNPutStringToText (struct CNText *dst, const struct CNString *src)
 Put string to text. More...
 
void CNPutSignedIntegerToText (struct CNText *dst, int64_t src)
 Put signed integer to text. More...
 
void CNPutUnsignedIntegerToText (struct CNText *dst, uint64_t src)
 Put unsigned integer to text. More...
 
void CNPutFloatToText (struct CNText *dst, double src)
 Put floating point value to text. More...
 
void CNPutCharToText (struct CNText *dst, char src)
 Put character value to text. More...
 
void CNFlushText (struct CNText *dst)
 Flush the context of text buffer into text data. More...
 
void CNClearText (struct CNText *dst)
 Make clean text buffer. More...
 
void CNPrintText (FILE *outfp, struct CNText *src)
 Print text. More...
 

Detailed Description

Define CNText class.

Copyright
Copyright (C) 2013 Steel Wheels Project

Function Documentation

struct CNText* CNAllocateText ( struct CNResource *  resource)

Allocate CNText object.

Returns
Allocated object
Parameters
resourceResource to allocate the object
static struct CNResource* CNResourceOfText ( struct CNText src)
static

Get resource for this text.

Returns
Resource for text
Parameters
srcSource text

References CNResourceOfObject(), and CNText::superClass.

static void CNReleaseText ( struct CNText dst)
inlinestatic

Release text object.

Parameters
dstDestination object

References CNReleaseObject(), and CNText::superClass.

void CNPushSectionToText ( struct CNText dst,
const unsigned char *  beginstr,
const unsigned char *  endstr 
)

Allocate new section as a child of section.

Parameters
dstDestination text
beginstrBegging of the section
endstrEnd of the section
void CNPopSectionFromText ( struct CNText dst)

Move to the parent section from current section.

Parameters
dstDestination text
static void CNPutUTF8StringToText ( struct CNText dst,
size_t  srclen,
const unsigned char *  srcstr 
)
inlinestatic

Put string to text.

Parameters
dstDestination text
srclenLength of source string
srcstrSource string

References CNPutBytesToBuffer(), and CNText::currentBuffer.

static void CNPutFixedStringToText ( struct CNText dst,
const struct CNFixedString src 
)
inlinestatic

Put fixed string to text.

Parameters
dstDestination text
srcSource string

References CNContentOfFixedString(), CNLengthOfFixedString(), CNPutBytesToBuffer(), and CNText::currentBuffer.

void CNPutStringToText ( struct CNText dst,
const struct CNString src 
)

Put string to text.

Parameters
dstDestination text
srcSource value
void CNPutSignedIntegerToText ( struct CNText dst,
int64_t  src 
)

Put signed integer to text.

Parameters
dstDestination text
srcSource value
void CNPutUnsignedIntegerToText ( struct CNText dst,
uint64_t  src 
)

Put unsigned integer to text.

Parameters
dstDestination text
srcSource value
void CNPutFloatToText ( struct CNText dst,
double  src 
)

Put floating point value to text.

Parameters
dstDestination text
srcSource value
void CNPutCharToText ( struct CNText dst,
char  src 
)

Put character value to text.

Parameters
dstDestination text
srcSource value
void CNFlushText ( struct CNText dst)

Flush the context of text buffer into text data.

Parameters
dstDestination text
Note
This function is called in the other functions, so you do not have to call this. But this function can be used to reduce the size of text buffer in the CNText object.
void CNClearText ( struct CNText dst)

Make clean text buffer.

Parameters
dstDestination text buffer
void CNPrintText ( FILE *  outfp,
struct CNText src 
)

Print text.

Parameters
outfpOutput file stream
srcSource text