-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
60 lines (47 loc) · 1.47 KB
/
README
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
C++ library for using API Wolfram|Alpha v2.0.
Version 1.0
Example: (using query)
#include "Wolfram/WAEngine.h"
...
WAEngine search;
search.query.setInput("text for search");
search.query.addFormat("html");
search.query.addFormat("plaintext");
string queryURL = search.getURL();
...
Example: (read parsed data)
WAEngine search;
...
// Data from Wolfram|Alpha in 'data'
...
search.Parse(data);
int numPod = search.getCountPods();
WAPod * pods = search.getPods();
for (int i = 0; i < numPod; i++)
{
cout << "Pod " << i << endl;
cout << "Title:" << pods[i].getTitle() << endl;
cout << "ID:" << pods[i].getID() << endl;
// Get a count of sub-blocks
int numSubPod = pods[i].getCountSubpods();
int numStates = pods[i].getCountStates();
WASubpod * subpods = pods[i].getSubpods();
WAPodState * states = pods[i].getStates();
// Enumerate a subpods
for (int j = 0; j < numSubPod; j++)
{
cout << "\tSubPod " << j << endl;
// Get a subpod attributes
cout << "\t\tTitle:" << subpods[j].getTitle() << endl;
// Get a built-in img attributes
cout << "\tImg" << endl;
cout << "\t\tTitle:" << subpods[j].getImage()->getTitle() << endl;
cout << "\t\tSrc:" << subpods[j].getImage()->getSrc() << endl;
}
// Enumerate a states
for (int j = 0; j < numStates; j++)
{
cout << "\tStates " << j << endl;
cout << "\t\tName:" << states[j].getName() << endl;
}
}