|
JubeatPlus 3.9.11
|
A byte-oriented scanner over an NSData 's bytes.
More...
#include <CDataScanner.h>


Instance Methods | |
| (instancetype) | - init |
| Initialises an empty scanner with no data. | |
| (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) | - setData: |
| Points the scanner at some bytes. | |
| (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 character set of number-literal characters. | |
Protected Attributes | |
| 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 . | |
Properties | |
| 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. | |
A byte-oriented scanner over an NSData 's bytes.
The byte-oriented scanner superclass; not reconstructed as its own file yet, so it is forward-declared here as an NSObject subclass exposing only what CJSONScanner uses.
The scanner keeps three raw pointers into the data: start (the first byte), end (one past the last byte), and current (the next byte to read). scanLocation is the cursor's byte offset, current - start . The scan-and-advance methods move current forward and return whether they matched.
See TYPES_PENDING.md.
The two byte-cursor ivars are named as TouchJSON names them, without an underscore, and are reached directly by -scanNotQuoteCharactersIntoString: .
| - (unichar) currentCharacter |
The character at the cursor without consuming it.
unichar . | - (unichar) currentCharacter |
The character at the cursor without consuming it.
| - (instancetype) init |
Initialises an empty scanner with no data.
Implemented in CJSONScanner.
| + (void) initialize |
Primes the shared character set of number-literal characters.
Implemented in CJSONScanner.
| - (instancetype) initWithData: | (nullable NSData *) | someData |
Initialises the scanner and points it at some bytes.
| someData | The bytes to scan. |
| - (NSUInteger) lineOfScanLocation |
The one-based-ish count of line breaks before the cursor.
| - (NSData *) remainingData |
The bytes from the cursor to the end.
| - (NSString *) remainingString |
The bytes from the cursor to the end, decoded as a UTF-8 string.
| - (unichar) scanCharacter |
Consumes and returns the character at the cursor.
unichar . | - (unichar) scanCharacter |
Consumes and returns the character at the cursor.
| - (BOOL) scanCharacter: | (unichar) | character |
Consumes the cursor character when it matches.
| character | The character to match. |
| - (BOOL) scanCharacter: | (unichar) | character |
Consumes the cursor character when it matches.
| character | The character to match. |
| - (BOOL) scanCharactersFromSet: | (NSCharacterSet *) | set | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes the run of characters that are members of a set.
| set | The set whose members are consumed. |
| outString | Where to return the consumed run, when the caller wants it. |
| - (BOOL) scanCPlusPlusStyleComment: | (NSString *_Nullable *_Nullable) | outComment |
Consumes a C++-style // comment through to the end of the line.
| outComment | Where to return the comment's inner text, when the caller wants it. |
| - (BOOL) scanCStyleComment: | (NSString *_Nullable *_Nullable) | outComment |
Consumes a C-style block comment (slash-star to star-slash).
| outComment | Where to return the comment's inner text, when the caller wants it. |
| - (BOOL) scanDataOfLength: | (NSUInteger) | scanLength | |
| intoData: | (NSData *_Nullable *_Nullable) | outData |
Consumes a fixed number of bytes, returning them as an NSData .
| scanLength | The number of bytes to consume. |
| outData | Where to return the consumed bytes, when the caller wants it. |
| - (BOOL) scanDataOfLength: | (NSUInteger) | scanLength | |
| intoPointer: | (const void *_Nullable *_Nullable) | outPointer |
Consumes a fixed number of bytes, returning a pointer into the data.
| scanLength | The number of bytes to consume. |
| outPointer | Where to return the pointer to the consumed bytes, when the caller wants it. |
| - (BOOL) scanDecimalNumber: | (NSDecimalNumber *_Nullable *_Nullable) | outNumber |
Consumes a number literal, always decoding it to an NSDecimalNumber .
| outNumber | Where to return the decoded number, when the caller wants it. |
| - (NSUInteger) scanLocation |
The current byte offset.
| - (BOOL) scanNumber: | (NSNumber *_Nullable *_Nullable) | outNumber |
Consumes a number literal, decoding it to an integer or a decimal.
| outNumber | Where to return the decoded number, when the caller wants it. |
| - (BOOL) scanNumber: | (NSNumber *_Nullable *_Nullable) | outNumber |
Consumes a JSON number literal.
| outNumber | On success, the scanned number; may be nullptr . |
| - (BOOL) scanString: | (NSString *) | string | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes a fixed string, optionally returning it.
| string | The string to match at the cursor. |
| outString | Where to return the matched string, when the caller wants it. |
| - (BOOL) scanUpToCharactersFromSet: | (NSCharacterSet *) | set | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes everything up to the next character that is a member of a set.
| set | The set whose first member stops the scan. |
| outString | Where to return the skipped-over text, when the caller wants it. |
| - (BOOL) scanUpToString: | (NSString *) | string | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes everything up to the next occurrence of a string.
| string | The delimiter to stop before. |
| outString | Where to return the skipped-over text, when the caller wants it. |
| - (BOOL) scanUTF8String: | (const char *) | string | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes a fixed UTF-8 run, optionally returning it as a string.
| string | The NUL-terminated bytes to match at the cursor. |
| outString | Where to return the matched run, when the caller wants it. |
| - (BOOL) scanUTF8String: | (const char *) | string | |
| intoString: | (NSString *_Nullable *_Nullable) | outString |
Consumes a fixed UTF-8 run, optionally returning it.
| string | The UTF-8 run to match. |
| outString | On a match, the matched run; may be nullptr . |
| - (void) setData: | (nullable NSData *) | data |
| - (void) setScanLocation: | (NSUInteger) | location |
Rewinds or advances the cursor to a byte offset.
| location | The byte offset to move the cursor to. |
| - (void) skipWhitespace |
Advances the cursor past any whitespace.
| - (NSDictionary *) userInfoForScanLocation |
Diagnostic user info describing where the cursor is: its line, column, offset, and a snippet marking the position.
| - (NSDictionary *) userInfoForScanLocation |
Diagnostic user-info describing where the cursor is.
|
readwritenonatomicstrongprotected |
The bytes being scanned; retained.
The bytes being scanned.
Setting new bytes resets the cursor to the start.
|
readnonatomicassign |
The number of bytes between the cursor and the end of the data.
|
readnonatomicassign |
Whether the cursor has reached or passed the end of the data.
|
readwritenonatomicassign |
The cursor's byte offset from the start of the data.