2016-08-13 10:50:03 +02:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2018-01-14 15:37:52 +01:00
|
|
|
* Copyright (C) 2007-2017 Cppcheck team.
|
2016-08-13 10:50:03 +02:00
|
|
|
*
|
|
|
|
* This program 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#ifndef importprojectH
|
|
|
|
#define importprojectH
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2016-12-06 20:02:43 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include "platform.h"
|
2017-09-30 11:25:46 +02:00
|
|
|
#include "utils.h"
|
2017-05-27 04:33:47 +02:00
|
|
|
|
2016-08-13 10:50:03 +02:00
|
|
|
#include <list>
|
2016-11-11 16:22:14 +01:00
|
|
|
#include <map>
|
2016-08-13 10:50:03 +02:00
|
|
|
#include <set>
|
2017-05-27 04:33:47 +02:00
|
|
|
#include <string>
|
2016-08-13 10:50:03 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
/// @addtogroup Core
|
|
|
|
/// @{
|
|
|
|
|
2017-09-24 22:36:20 +02:00
|
|
|
namespace cppcheck {
|
2017-09-24 22:57:24 +02:00
|
|
|
struct stricmp {
|
|
|
|
bool operator()(const std::string &lhs, const std::string &rhs) const {
|
2017-09-30 11:25:46 +02:00
|
|
|
return caseInsensitiveStringCompare(lhs,rhs) < 0;
|
2017-09-24 22:36:20 +02:00
|
|
|
}
|
2017-09-24 22:57:24 +02:00
|
|
|
};
|
2017-09-24 22:36:20 +02:00
|
|
|
}
|
|
|
|
|
2016-08-13 10:50:03 +02:00
|
|
|
/**
|
|
|
|
* @brief Importing project settings.
|
|
|
|
*/
|
|
|
|
class CPPCHECKLIB ImportProject {
|
|
|
|
public:
|
|
|
|
/** File settings. Multiple configurations for a file is allowed. */
|
2017-11-11 11:13:18 +01:00
|
|
|
struct CPPCHECKLIB FileSettings {
|
2017-08-08 22:57:11 +02:00
|
|
|
FileSettings() : platformType(cppcheck::Platform::Unspecified), msc(false), useMfc(false) {}
|
2016-08-13 10:50:03 +02:00
|
|
|
std::string cfg;
|
|
|
|
std::string filename;
|
|
|
|
std::string defines;
|
2017-08-08 22:26:42 +02:00
|
|
|
std::string cppcheckDefines() const {
|
2017-08-08 22:57:11 +02:00
|
|
|
return defines + (msc ? ";_MSC_VER=1900" : "") + (useMfc ? ";__AFXWIN_H__=1" : "");
|
2017-08-08 22:26:42 +02:00
|
|
|
}
|
2016-08-13 10:50:03 +02:00
|
|
|
std::set<std::string> undefs;
|
|
|
|
std::list<std::string> includePaths;
|
2017-08-03 20:38:24 +02:00
|
|
|
std::list<std::string> systemIncludePaths;
|
|
|
|
std::string standard;
|
2016-08-13 10:50:03 +02:00
|
|
|
cppcheck::Platform::PlatformType platformType;
|
2017-08-08 22:57:11 +02:00
|
|
|
bool msc;
|
2017-08-08 22:26:42 +02:00
|
|
|
bool useMfc;
|
2016-08-13 10:50:03 +02:00
|
|
|
|
|
|
|
void setDefines(std::string defs);
|
2017-09-24 22:36:20 +02:00
|
|
|
void setIncludePaths(const std::string &basepath, const std::list<std::string> &in, std::map<std::string, std::string, cppcheck::stricmp> &variables);
|
2016-08-13 10:50:03 +02:00
|
|
|
};
|
|
|
|
std::list<FileSettings> fileSettings;
|
|
|
|
|
2016-12-06 20:02:43 +01:00
|
|
|
void ignorePaths(const std::vector<std::string> &ipaths);
|
2016-08-21 15:57:38 +02:00
|
|
|
void ignoreOtherConfigs(const std::string &cfg);
|
2016-08-20 13:47:25 +02:00
|
|
|
void ignoreOtherPlatforms(cppcheck::Platform::PlatformType platformType);
|
2016-08-13 10:50:03 +02:00
|
|
|
|
|
|
|
void import(const std::string &filename);
|
2017-12-26 13:04:27 +01:00
|
|
|
protected:
|
2016-08-13 10:50:03 +02:00
|
|
|
void importCompileCommands(std::istream &istr);
|
2017-12-26 13:04:27 +01:00
|
|
|
private:
|
2016-08-13 10:50:03 +02:00
|
|
|
void importSln(std::istream &istr, const std::string &path);
|
2017-09-24 22:36:20 +02:00
|
|
|
void importVcxproj(const std::string &filename, std::map<std::string, std::string, cppcheck::stricmp> &variables, const std::string &additionalIncludeDirectories);
|
2018-05-20 18:19:20 +02:00
|
|
|
void importBcb6Prj(const std::string &projectFilename);
|
2016-08-13 10:50:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/// @}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif // importprojectH
|