0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __MACRO_ANALYSER_H__
|
|
20 |
#define __MACRO_ANALYSER_H__
|
|
21 |
#include <map>
|
|
22 |
#include <string>
|
|
23 |
#include <list>
|
|
24 |
#include "TChange.h"
|
|
25 |
#include "CPPParser.h"
|
|
26 |
#include "AnalyserParams.h"
|
|
27 |
|
|
28 |
using namespace std;
|
|
29 |
|
20
|
30 |
#define KEY_VAL_CURRENT "curr_key_val"
|
0
|
31 |
/**
|
|
32 |
* The MacroAnalysis class analyses differences between the baseline and
|
|
33 |
* the current version macro definitions and adds issues to
|
|
34 |
* the ReportGenerator.
|
|
35 |
*/
|
|
36 |
class MacroAnalyser
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Constructor
|
|
41 |
*
|
|
42 |
* @param filebase base file to analyse
|
|
43 |
* @param filecurrent current file to analyse
|
|
44 |
* @param basebundle base header bundle used in analyse
|
|
45 |
* @param currentbundle current header bundle used in analyse
|
|
46 |
*/
|
|
47 |
MacroAnalyser(string filebase, string filecurrent, vector<string> basebundle, vector<string> currentbundle);
|
|
48 |
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Destructor
|
|
52 |
*/
|
|
53 |
~MacroAnalyser(void);
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Do the whole analysing
|
|
57 |
*/
|
|
58 |
void Analyse(list<string>& aMacroFiles);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Get removed macros
|
|
62 |
* @return map of removed macros
|
|
63 |
*/
|
|
64 |
map<string, TChange<list<pair<string,string> > > >& getRemoved();
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Get changed macros
|
|
68 |
* @return map of changed macros
|
|
69 |
*/
|
|
70 |
map<string, TChange<map<string, pair<pair<string, string>,string> > > >& getChanged();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Get base duplicates
|
|
74 |
* @return map of duplicates in base headers
|
|
75 |
*/
|
|
76 |
map<string, vector<pair<string,string> > >& getBaseDuplicates();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Get current duplicates
|
|
80 |
* @return map of duplicates in current headers
|
|
81 |
*/
|
|
82 |
map<string, vector<pair<string,string> > >& getCurrentDuplicates();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Find macros
|
|
86 |
* @param aLine line to search
|
|
87 |
* @return pair of macros found
|
|
88 |
*/
|
|
89 |
static pair<string,string> FindMacro(string aLine);
|
|
90 |
|
|
91 |
private:
|
|
92 |
/**
|
|
93 |
* Parses macros
|
|
94 |
* @param aFile the file to parse from
|
|
95 |
* @param bundlefiles bundle of headers to parse
|
|
96 |
* @param aRemoved pointer to removed items map
|
|
97 |
* @param aAddToRemoved add findings to removed, if true (default=NULL)
|
|
98 |
* @return map of duplicates in current headers (default=false)
|
|
99 |
*/
|
20
|
100 |
map<string, list<pair<pair<string, string>,string> > > parseMacros(ifstream& aFile, vector<string>& bundlefiles, map<string, TChange<list<pair<string,string> > > >* aRemoved = NULL, bool isbaseline = false);
|
0
|
101 |
|
|
102 |
/**
|
|
103 |
* Find duplicates
|
|
104 |
* @param basefilename baseline filename
|
|
105 |
* @param currentfilename currentline filename
|
|
106 |
* @param aBaseline baseline headers
|
|
107 |
* @param aCurrent currentline headers
|
|
108 |
* @param aRemovedList list of removed items
|
|
109 |
* @param baselinedup baseline duplicates
|
|
110 |
* @param currentdup current duplicates
|
|
111 |
* @return true if duplicates are found
|
|
112 |
*/
|
|
113 |
bool findDuplicates(const string& basefilename, const string& currentfilename, list<pair<pair<string, string>,string> >& aBaseline,
|
|
114 |
list<pair<pair<string, string>,string> >& aCurrent, TChange<list<pair<string,string> > >& aRemovedList,
|
|
115 |
map<string, vector<pair<string,string> > >& baselinedup, map<string, vector<pair<string,string> > >& currentdup);
|
|
116 |
private:
|
|
117 |
|
|
118 |
//! Base header to check
|
|
119 |
string iBaseFile;
|
|
120 |
|
|
121 |
//! Current header to check
|
|
122 |
string iCurrentFile;
|
|
123 |
|
|
124 |
//! Changed macros list
|
|
125 |
map<string, TChange<map<string, pair<pair<string, string>,string> > > > iChanged;
|
|
126 |
|
|
127 |
//! Map of removed items
|
|
128 |
map<string, TChange<list<pair<string,string> > > > iRemoved;
|
|
129 |
|
|
130 |
//! Base duplicate items
|
|
131 |
map<string, vector<pair<string,string> > > iBaseDuplicates;
|
|
132 |
|
|
133 |
//! Current duplicate items
|
|
134 |
map<string, vector<pair<string,string> > > iCurrentDuplicates;
|
|
135 |
|
|
136 |
//! Bundle of base files
|
|
137 |
vector<string> iBaseBundle;
|
|
138 |
|
|
139 |
//! Bundle of current files
|
|
140 |
vector<string> iCurrentBundle;
|
|
141 |
|
|
142 |
//! List of not removed files
|
|
143 |
list<string> iNotRemovedFiles;
|
|
144 |
|
|
145 |
//! Parameter to analyser
|
|
146 |
AnalyserParams iParams;
|
|
147 |
|
|
148 |
};
|
|
149 |
#endif
|