-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQueryExample.cpp
More file actions
46 lines (45 loc) · 2.12 KB
/
QueryExample.cpp
File metadata and controls
46 lines (45 loc) · 2.12 KB
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
/**
* @file QueryExample.cpp
*
* @copyright Copyright (C) 2013-2014 SDML (www.srcML.org)
*
* The srcML Toolkit is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The srcML Toolkit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the srcML Toolkit; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string>
#include <srcType.hpp>
#include <cassert>
#include <iostream>
int main(int argc, char** argv){
srcTypeNS::srcType typeDict;
typeDict.ReadArchiveFile(argv[1]);
typeDict.SetContext("code.cpp", "Foo");
{
auto nameprofile = typeDict.FindVariable("coo");
std::cerr<<"Name: "<<nameprofile.front().nameOfIdentifier<<" Type: "<< nameprofile.front().nameOfType<<std::endl;
assert(nameprofile.front().nameOfType == "Object"
&& typeDict.IsPrimitive(nameprofile.front().nameOfType) == false
&& nameprofile.front().namespaces.front() == "std");
}
{
auto nameprofile = typeDict.FindVariable("ke_e4e");
std::cerr<<"Name: "<<nameprofile.front().nameOfIdentifier<<" Type: "<< nameprofile.front().nameOfType<<std::endl;
assert(nameprofile.front().nameOfType == "Object" && typeDict.IsPrimitive(nameprofile.front().nameOfType) == false && nameprofile.front().isConstValue && nameprofile.front().namespaces.front() == "std");
}
{
auto nameprofile = typeDict.FindVariable("caa34");
std::cerr<<"Name: "<<nameprofile.front().nameOfIdentifier<<" Type: "<< nameprofile.front().nameOfType<<std::endl;
assert(nameprofile.front().nameOfType == "Object" && typeDict.IsPrimitive(nameprofile.front().nameOfType) == false && nameprofile.front().isConstValue && nameprofile.front().namespaces.front() == "std");
}
}