-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonParser.h
More file actions
25 lines (21 loc) · 795 Bytes
/
jsonParser.h
File metadata and controls
25 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef __jsonParser_H__
#define __jsonParser_H__
#include "jsmn.h"
#include <stdio.h>
#define ExtractToken(maxLength) extractnToken(it->tokens[it->currentPosition], jsonFile, maxLength)
#define GetNextStringValue(key) getNextStringValue(it,jsonFile,key)
typedef struct{
int currentPosition;
int endPosition;
jsmntok_t *tokens;
int end;
}TokenIterator;
TokenIterator* createTokenIterator(jsmn_parser *parser, jsmntok_t *tokens);
TokenIterator* copyTokenIterator(TokenIterator *it);
char* fileToString(FILE *file);
void getNextObject(TokenIterator *iterator);
void printToken(char* jsonFile, jsmntok_t *token);
void getNextStringValue(TokenIterator*, char*, const char*);
TokenIterator* parseJson(char *jsonFile);
char* extractnToken(jsmntok_t, char*, int);
#endif /* __jsonParser_H__ */