cjson

package module
v1.7.18-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

LLGo wrapper of DaveGamble/cJSON

Build Status GitHub release GoDoc Compiler Language

How to install

mkdir build.dir
cd build.dir
cmake ../cJSON
make install

Demos

The _demo directory contains our demos (it start with _ to prevent the go command from compiling it):

  • mkjson: create a json object and print it
How to run demos

To run the demos in directory _demo:

cd <demo-directory>  # eg. cd _demo/mkjson
llgo run .

Documentation

Index

Constants

View Source
const (
	LLGoPackage = "link: cjson"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	Unused [0]byte
}

llgo:type C

func Array

func Array() *JSON

func ArrayRef

func ArrayRef(child *JSON) *JSON

Create an array that only references it's elements so they will not be freed by Delete

func Bool

func Bool(boolean c.Int) *JSON

func False

func False() *JSON

func Null

func Null() *JSON

func Number

func Number(num float64) *JSON

func Object

func Object() *JSON

func ObjectRef

func ObjectRef(child *JSON) *JSON

Create an object that only references it's elements so they will not be freed by Delete

func Raw

func Raw(raw *c.Char) *JSON

raw json

func String

func String(str *c.Char) *JSON

func StringRef

func StringRef(str *c.Char) *JSON

Create a string where valuestring references a string so it will not be freed by Delete

func True

func True() *JSON

func (*JSON) AddItem

func (o *JSON) AddItem(item *JSON) c.Int

Append item to the specified array.

llgo:link (*JSON).AddItem C.cJSON_AddItemToArray

func (*JSON) CStr

func (o *JSON) CStr() *c.Char

llgo:link (*JSON).CStr C.cJSON_PrintUnformatted

func (*JSON) Delete

func (o *JSON) Delete()

Delete a JSON entity and all subentities.

llgo:link (*JSON).Delete C.cJSON_Delete

func (*JSON) Print

func (o *JSON) Print() *c.Char

Render a JSON entity to text for transfer/storage.

llgo:link (*JSON).Print C.cJSON_Print

func (*JSON) PrintBuffered

func (o *JSON) PrintBuffered(prebuffer c.Int, fmt c.Int) *c.Char

Render a JSON entity to text using a buffered strategy.

prebuffer is a guess at the final size. guessing well reduces reallocation.

fmt=0 gives unformatted, =1 gives formatted.

llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered

func (*JSON) PrintUnformatted

func (o *JSON) PrintUnformatted() *c.Char

Render a JSON entity to text for transfer/storage without any formatting.

llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted

func (*JSON) SetItem

func (o *JSON) SetItem(key *c.Char, item *JSON) c.Int

Append item to the specified object.

llgo:link (*JSON).SetItem C.cJSON_AddItemToObject

Directories

Path Synopsis
_demo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL