Playlist Generator  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Public Member Functions | Protected Attributes | Properties
SBJsonStreamWriter Class Reference

The Stream Writer class. More...

#import <SBJsonStreamWriter.h>

Inheritance diagram for SBJsonStreamWriter:
NSObject

List of all members.

Public Member Functions

(BOOL) - writeObject:
(BOOL) - writeArray:
(BOOL) - writeObjectOpen
(BOOL) - writeObjectClose
(BOOL) - writeArrayOpen
(BOOL) - writeArrayClose
(BOOL) - writeNull
(BOOL) - writeBool:
(BOOL) - writeNumber:
(BOOL) - writeString:
(BOOL) - writeValue:
(void) - appendBytes:length:

Protected Attributes

NSMutableDictionary * cache

Properties

SBJsonStreamWriterStatestate
NSMutableArray * stateStack
id< SBJsonStreamWriterDelegatedelegate
 delegate to receive JSON output Delegate that will receive messages with output.
NSUInteger maxDepth
 The maximum recursing depth.
BOOL humanReadable
 Whether we are generating human-readable (multiline) JSON.
BOOL sortKeys
 Whether or not to sort the dictionary keys in the output.
NSStringerror
 Contains the error description after an error has occured.

Detailed Description

The Stream Writer class.

Accepts a stream of messages and writes JSON of these to its delegate object.

This class provides a range of high-, mid- and low-level methods. You can mix and match calls to these. For example, you may want to call -writeArrayOpen to start an array and then repeatedly call -writeObject: with various objects before finishing off with a -writeArrayClose call.

See also:
JSON to Objective-C

Member Function Documentation

- (void) appendBytes: (const void *)  bytes
length: (NSUInteger)  length 
- (BOOL) writeArray: (NSArray *)  array

Write an NSArray to the JSON stream.

Returns:
YES if successful, or NO on failure
- (BOOL) writeArrayClose

Close the current Array being written

Returns:
YES if successful, or NO on failure
- (BOOL) writeArrayOpen

Start writing an Array to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeBool: (BOOL)  x

Write a boolean to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeNull

Write a null to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeNumber: (NSNumber*)  n

Write a Number to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeObject: (NSDictionary*)  dict

Write an NSDictionary to the JSON stream.

Returns:
YES if successful, or NO on failure
- (BOOL) writeObjectClose

Close the current object being written

Returns:
YES if successful, or NO on failure
- (BOOL) writeObjectOpen

Start writing an Object to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeString: (NSString*)  s

Write a String to the stream

Returns:
YES if successful, or NO on failure
- (BOOL) writeValue: (id)  v

Member Data Documentation

- (NSMutableDictionary*) cache [protected]

Property Documentation

- (id<SBJsonStreamWriterDelegate>) delegate [read, write, retain]

delegate to receive JSON output Delegate that will receive messages with output.

- (NSString*) error [read, write, copy]

Contains the error description after an error has occured.

- (BOOL) humanReadable [read, write, assign]

Whether we are generating human-readable (multiline) JSON.

Set whether or not to generate human-readable JSON. The default is NO, which produces JSON without any whitespace between tokens. If set to YES, generates human-readable JSON with linebreaks after each array value and dictionary key/value pair, indented two spaces per nesting level.

- (NSUInteger) maxDepth [read, write, assign]

The maximum recursing depth.

Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0.

- (BOOL) sortKeys [read, write, assign]

Whether or not to sort the dictionary keys in the output.

If this is set to YES, the dictionary keys in the JSON output will be in sorted order. (This is useful if you need to compare two structures, for example.) The default is NO.

- (SBJsonStreamWriterState*) state [read, write, retain]
- (NSMutableArray*) stateStack [read, assign]

The documentation for this class was generated from the following files: