35#define _Class _JSONPath
37#pragma mark - JSONPath
61 const uint8_t *bytes = (uint8_t *) c + matches[1].location;
62 const size_t length = matches[1].
length;
65 if (*segment->
chars ==
'.') {
76 }
else if (*segment->
chars ==
'[') {
79 const unsigned long index = strtoul(segment->
chars + 1, NULL, 10);
80 if (index < array->count) {
94#pragma mark - Class lifecycle
103 _re =
re(
"(.[^.\\[]+|\\[[0-9]+\\])", 0);
127 .interfaceOffset = offsetof(
JSONPath, interface),
128 .interfaceSize =
sizeof(JSONPathInterface),
A wrapper for placing boolean primitives into collections, etc.
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define cast(type, obj)
Safely cast obj to type.
Immutable key-value stores.
static void destroy(Class *clazz)
static void initialize(Class *clazz)
A minimal JSONPath implementation.
A wrapper for placing numeric primitives into collections, etc.
Extended POSIX regular expressions.
void * ident
The identity type, similar to Objective-C id.
#define do_once(once, block)
Executes the given block at most one time.
ident objectAtIndex(const Array *self, int index)
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
ident interface
The interface of the Class.
Immutable key-value stores.
ident objectForKeyPath(const Dictionary *self, const char *path)
ident objectForKey(const Dictionary *self, const ident key)
A minimal JSONPath implementation.
Class * _JSONPath(void)
The JSONPath archetype.
MutableArray * array(void)
Returns a new MutableArray.
MutableDictionary * dictionary(void)
Returns a new MutableDictionary.
Class * _Object(void)
The Object archetype.
A location and length into contiguous collections.
ssize_t location
The location.
Extended POSIX regular expressions.
_Bool matchesCharacters(const Regexp *self, const char *chars, int options, Range **matches)
Matches this regular expression against the given characters.
OBJECTIVELY_EXPORT Regexp * re(const char *pattern, int options)
A convenience function for instantiating Regexps.
char * chars
The backing null-terminated UTF-8 encoded character array.
size_t length
The length of the String in bytes.
String * stringWithBytes(const uint8_t *bytes, size_t length, StringEncoding encoding)
Returns a new String by decoding length of bytes to UTF-8.
String * substring(const String *string, const Range range)
Creates a new String from a subset of this one.