-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (31 loc) · 925 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*Grant Carroll
Object Oriented Programming
Homework 4 - JSON
*/
#include <iostream>
#include <vector>
#include "JSON_Object_Model/JSON_Object_Model.hpp"
#include "StringToJsonParser.hpp"
using namespace std;
vector<string> formatArguments(char* given[], int numOfArgs);
int main(int argc, char* argv[])
{
JSON_Object* json;
vector<string> listOfArgs;
listOfArgs = formatArguments(argv, argc);
using iter = std::istreambuf_iterator<char>;
string s(iter(std::cin), iter());
stringstream jsonStream(s);
json = (JSON_Object*)ParseJsonObject(jsonStream);
return 0;
}
//Simple function to reformat argv to be used more easily in the printer
vector<string> formatArguments(char* given[], int numOfArgs)
{
vector<string> listOfArgs;
for(int i = 1; i < numOfArgs; i++)
{
listOfArgs.push_back(given[i]);
}
return listOfArgs;
}