diff -r 000000000000 -r 638b9c697799 apicompatanamdw/compatanalysercmd/headeranalyser/src/MacroAnalyser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/apicompatanamdw/compatanalysercmd/headeranalyser/src/MacroAnalyser.h Tue Jan 12 14:52:39 2010 +0530 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __MACRO_ANALYSER_H__ +#define __MACRO_ANALYSER_H__ +#include +#include +#include +#include "TChange.h" +#include "CPPParser.h" +#include "AnalyserParams.h" + +using namespace std; + + +/** +* The MacroAnalysis class analyses differences between the baseline and +* the current version macro definitions and adds issues to +* the ReportGenerator. +*/ +class MacroAnalyser +{ +public: + /** + * Constructor + * + * @param filebase base file to analyse + * @param filecurrent current file to analyse + * @param basebundle base header bundle used in analyse + * @param currentbundle current header bundle used in analyse + */ + MacroAnalyser(string filebase, string filecurrent, vector basebundle, vector currentbundle); + + + /** + * Destructor + */ + ~MacroAnalyser(void); + + /** + * Do the whole analysing + */ + void Analyse(list& aMacroFiles); + + /** + * Get removed macros + * @return map of removed macros + */ + map > > >& getRemoved(); + + /** + * Get changed macros + * @return map of changed macros + */ + map,string> > > >& getChanged(); + + /** + * Get base duplicates + * @return map of duplicates in base headers + */ + map > >& getBaseDuplicates(); + + /** + * Get current duplicates + * @return map of duplicates in current headers + */ + map > >& getCurrentDuplicates(); + + /** + * Find macros + * @param aLine line to search + * @return pair of macros found + */ + static pair FindMacro(string aLine); + +private: + /** + * Parses macros + * @param aFile the file to parse from + * @param bundlefiles bundle of headers to parse + * @param aRemoved pointer to removed items map + * @param aAddToRemoved add findings to removed, if true (default=NULL) + * @return map of duplicates in current headers (default=false) + */ + map,string> > > parseMacros(ifstream& aFile, vector& bundlefiles, map > > >* aRemoved = NULL, bool aAddToRemoved = false); + + /** + * Find duplicates + * @param basefilename baseline filename + * @param currentfilename currentline filename + * @param aBaseline baseline headers + * @param aCurrent currentline headers + * @param aRemovedList list of removed items + * @param baselinedup baseline duplicates + * @param currentdup current duplicates + * @return true if duplicates are found + */ + bool findDuplicates(const string& basefilename, const string& currentfilename, list,string> >& aBaseline, + list,string> >& aCurrent, TChange > >& aRemovedList, + map > >& baselinedup, map > >& currentdup); +private: + + //! Base header to check + string iBaseFile; + + //! Current header to check + string iCurrentFile; + + //! Changed macros list + map,string> > > > iChanged; + + //! Map of removed items + map > > > iRemoved; + + //! Base duplicate items + map > > iBaseDuplicates; + + //! Current duplicate items + map > > iCurrentDuplicates; + + //! Bundle of base files + vector iBaseBundle; + + //! Bundle of current files + vector iCurrentBundle; + + //! List of not removed files + list iNotRemovedFiles; + + //! Parameter to analyser + AnalyserParams iParams; + +}; +#endif