JubeatPlus 3.9.11
Loading...
Searching...
No Matches
CJSONScanner Class Reference

Scans JSON text into Foundation objects. More...

#include <CJSONScanner.h>

Inheritance diagram for CJSONScanner:
Collaboration diagram for CJSONScanner:

Instance Methods

(instancetype) - init
 Builds a scanner with no null object substitution and non-strict escapes.
(BOOL) - setData:error:
 Points the scanner at some JSON text, sniffing its encoding and re-encoding it to UTF-8.
(void) - setData:
 Points the scanner at some JSON text, discarding any encoding failure.
(BOOL) - scanJSONObject:error:
 Scans whatever the text describes, dispatching on the first non-space character.
(BOOL) - scanJSONDictionary:error:
 Scans, requiring a dictionary.
(BOOL) - scanJSONArray:error:
 Scans, requiring an array.
(BOOL) - scanJSONStringConstant:error:
 Scans a quoted JSON string, decoding its backslash escapes.
(BOOL) - scanJSONNumberConstant:error:
 Scans a JSON number literal.
(BOOL) - scanNotQuoteCharactersIntoString:
 Consumes the run of characters up to the next quote or backslash.
(NSError *) - error:description:
 Builds an NSError in the scanner's domain, with a description and the cursor's user info.
Instance Methods inherited from CDataScanner
(instancetype) - initWithData:
 Initialises the scanner and points it at some bytes.
(unichar) - currentCharacter
 The character at the cursor without consuming it.
(unichar) - scanCharacter
 Consumes and returns the character at the cursor.
(BOOL) - scanCharacter:
 Consumes the cursor character when it matches.
(BOOL) - scanUTF8String:intoString:
 Consumes a fixed UTF-8 run, optionally returning it as a string.
(BOOL) - scanString:intoString:
 Consumes a fixed string, optionally returning it.
(BOOL) - scanCharactersFromSet:intoString:
 Consumes the run of characters that are members of a set.
(BOOL) - scanUpToString:intoString:
 Consumes everything up to the next occurrence of a string.
(BOOL) - scanUpToCharactersFromSet:intoString:
 Consumes everything up to the next character that is a member of a set.
(BOOL) - scanNumber:
 Consumes a number literal, decoding it to an integer or a decimal.
(BOOL) - scanDecimalNumber:
 Consumes a number literal, always decoding it to an NSDecimalNumber .
(BOOL) - scanDataOfLength:intoPointer:
 Consumes a fixed number of bytes, returning a pointer into the data.
(BOOL) - scanDataOfLength:intoData:
 Consumes a fixed number of bytes, returning them as an NSData .
(void) - skipWhitespace
 Advances the cursor past any whitespace.
(nullable NSString *) - remainingString
 The bytes from the cursor to the end, decoded as a UTF-8 string.
(NSData *) - remainingData
 The bytes from the cursor to the end.
(BOOL) - scanCStyleComment:
 Consumes a C-style block comment (slash-star to star-slash).
(BOOL) - scanCPlusPlusStyleComment:
 Consumes a C++-style // comment through to the end of the line.
(NSUInteger) - lineOfScanLocation
 The one-based-ish count of line breaks before the cursor.
(NSDictionary *) - userInfoForScanLocation
 Diagnostic user info describing where the cursor is: its line, column, offset, and a snippet marking the position.
(void) - skipWhitespace
 Advances past any whitespace at the cursor.
(unichar) - currentCharacter
 The character at the cursor without consuming it.
(unichar) - scanCharacter
 Consumes and returns the character at the cursor.
(BOOL) - scanCharacter:
 Consumes the cursor character when it matches.
(BOOL) - scanUTF8String:intoString:
 Consumes a fixed UTF-8 run, optionally returning it.
(BOOL) - scanNumber:
 Consumes a JSON number literal.
(NSUInteger) - scanLocation
 The current byte offset.
(void) - setScanLocation:
 Rewinds or advances the cursor to a byte offset.
(NSDictionary *) - userInfoForScanLocation
 Diagnostic user-info describing where the cursor is.

Class Methods

(void) + initialize
 Primes the shared boxed YES and NO the scanner returns for true and false .

Properties

id nullObject
 What a JSON null becomes.
NSUInteger allowedEncoding
 Which text encoding the input is allowed to be in, tried after the BOM sniff fails.
NSUInteger options
 Scanning options.
BOOL strictEscapeCodes
 Whether an unrecognised backslash escape is an error rather than a literal character.
Properties inherited from CDataScanner
NSUInteger scanLocation
 The cursor's byte offset from the start of the data.
NSUInteger bytesRemaining
 The number of bytes between the cursor and the end of the data.
BOOL isAtEnd
 Whether the cursor has reached or passed the end of the data.

Additional Inherited Members

Protected Attributes inherited from CDataScanner
NSData * data
 The bytes being scanned; retained.
char * start
 The first byte of the input.
char * end
 One past the last byte of the input.
char * current
 The next byte the scanner will read.
NSUInteger length
 The byte count of data .

Detailed Description

Scans JSON text into Foundation objects.

Method Documentation

◆ error:description:

- (NSError *) error: (NSInteger) code
description: (NSString *) description 

Builds an NSError in the scanner's domain, with a description and the cursor's user info.

Parameters
codeThe error code.
descriptionThe localised description.
Returns
The error.
Ghidra address:
0x66854
Ghidra address:
0x66854

◆ init

- (instancetype) init

Builds a scanner with no null object substitution and non-strict escapes.

Returns
The initialised scanner.
Ghidra address:
0x65168
Ghidra address:
0x65168

Implements CDataScanner.

◆ initialize

+ (void) initialize

Primes the shared boxed YES and NO the scanner returns for true and false .

Ghidra address:
0x650c8

Implements CDataScanner.

◆ scanJSONArray:error:

- (BOOL) scanJSONArray: (NSArray *_Nullable *_Nullable) outArray
error: (NSError *_Nullable *_Nullable) outError 

Scans, requiring an array.

Parameters
outArrayWhere to put the result.
outErrorWhere to report a failure.
Returns
Whether the scan succeeded.
Ghidra address:
0x65ccc

◆ scanJSONDictionary:error:

- (BOOL) scanJSONDictionary: (NSDictionary *_Nullable *_Nullable) outDictionary
error: (NSError *_Nullable *_Nullable) outError 

Scans, requiring a dictionary.

Parameters
outDictionaryWhere to put the result.
outErrorWhere to report a failure.
Returns
Whether the scan succeeded.
Ghidra address:
0x65880

◆ scanJSONNumberConstant:error:

- (BOOL) scanJSONNumberConstant: (NSNumber *_Nullable *_Nullable) outNumber
error: (NSError *_Nullable *_Nullable) outError 

Scans a JSON number literal.

Parameters
outNumberWhere to put the result.
outErrorWhere to report a failure.
Returns
Whether the scan succeeded.
Ghidra address:
0x666b4

◆ scanJSONObject:error:

- (BOOL) scanJSONObject: (id _Nullable *_Nullable) outObject
error: (NSError *_Nullable *_Nullable) outError 

Scans whatever the text describes, dispatching on the first non-space character.

Parameters
outObjectWhere to put the result.
outErrorWhere to report a failure.
Returns
Whether the scan succeeded.
Ghidra address:
0x65448

◆ scanJSONStringConstant:error:

- (BOOL) scanJSONStringConstant: (NSString *_Nullable *_Nullable) outString
error: (NSError *_Nullable *_Nullable) outError 

Scans a quoted JSON string, decoding its backslash escapes.

Parameters
outStringWhere to put the result.
outErrorWhere to report a failure.
Returns
Whether the scan succeeded.
Ghidra address:
0x6611c

◆ scanNotQuoteCharactersIntoString:

- (BOOL) scanNotQuoteCharactersIntoString: (NSString *_Nullable *_Nullable) outString

Consumes the run of characters up to the next quote or backslash.

Parameters
outStringWhere to put the run, when the caller wants it.
Returns
Whether any characters were consumed.
Ghidra address:
0x66790

◆ setData:

- (void) setData: (nullable NSData *) data

Points the scanner at some JSON text, discarding any encoding failure.

Parameters
dataThe text.
Ghidra address:
0x65438

Implements CDataScanner.

◆ setData:error:

- (BOOL) setData: (nullable NSData *) data
error: (NSError *_Nullable *_Nullable) outError 

Points the scanner at some JSON text, sniffing its encoding and re-encoding it to UTF-8.

Parameters
dataThe text.
outErrorWhere to report a failure.
Returns
Whether the data was accepted.
Ghidra address:
0x651f4

Property Documentation

◆ options

- (NSUInteger) options
readwritenonatomicassign

Scanning options.

Bit 0 keeps scanned containers mutable; bit 1 keeps scanned strings mutable. Both are otherwise copied to immutable.


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