#include "settings/CxxProjectSettings.h" #include "utility/utility.h" CxxProjectSettings::CxxProjectSettings() { // setlanguage... } CxxProjectSettings::CxxProjectSettings(const FilePath& projectFilePath) : ProjectSettings(projectFilePath) { // setlanguage... } CxxProjectSettings::CxxProjectSettings(std::string projectName, const FilePath& projectFileLocation) : ProjectSettings(projectName, projectFileLocation) { // setlanguage... } CxxProjectSettings::~CxxProjectSettings() { } ProjectType CxxProjectSettings::getProjectType() const { if (!getVisualStudioSolutionPath().empty()) // I think this is crap. VS solution path is not used anymore.. so vs projects are handled like cdb projects { return PROJECT_CXX_VS; } else if (!getCompilationDatabasePath().empty()) { return PROJECT_CXX_CDB; } else { switch (getLanguage()) { case LANGUAGE_C: return PROJECT_C_EMPTY; case LANGUAGE_CPP: return PROJECT_CPP_EMPTY; default: return PROJECT_UNKNOWN; } } return PROJECT_UNKNOWN; } bool CxxProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other) const { if (other.getLanguage() == getLanguage()) { // const CxxProjectSettings* typedOther = dynamic_cast(&other); return( ProjectSettings::equalsExceptNameAndLocation(other)// && // utility::isPermutation(getClasspaths(), typedOther->getClasspaths()) ); } return false; } std::vector CxxProjectSettings::getLanguageStandards() const { std::vector standards; switch (getLanguage()) { case LANGUAGE_CPP: standards.push_back("c++1z"); standards.push_back("gnu++1z"); standards.push_back("c++14"); standards.push_back("gnu++14"); standards.push_back("c++1y"); standards.push_back("gnu++1y"); standards.push_back("c++11"); standards.push_back("gnu++11"); standards.push_back("c++0x"); standards.push_back("gnu++0x"); standards.push_back("c++03"); standards.push_back("c++98"); standards.push_back("gnu++98"); break; case LANGUAGE_C: standards.push_back("c1x"); standards.push_back("gnu1x"); standards.push_back("iso9899:201x"); standards.push_back("c11"); standards.push_back("gnu11"); standards.push_back("iso9899:2011"); standards.push_back("c9x"); standards.push_back("gnu9x"); standards.push_back("iso9899:199x"); standards.push_back("c99"); standards.push_back("gnu99"); standards.push_back("iso9899:1999"); standards.push_back("iso9899:199409"); standards.push_back("c90"); standards.push_back("gnu90"); standards.push_back("iso9899:1990"); standards.push_back("c89"); standards.push_back("gnu89"); break; default: break; } return standards; } std::vector CxxProjectSettings::getHeaderSearchPaths() const { return getPathValues("source/header_search_paths/header_search_path"); } std::vector CxxProjectSettings::getAbsoluteHeaderSearchPaths() const { return makePathsAbsolute(expandPaths(getHeaderSearchPaths())); } bool CxxProjectSettings::setHeaderSearchPaths(const std::vector& headerSearchPaths) { return setPathValues("source/header_search_paths/header_search_path", headerSearchPaths); } std::vector CxxProjectSettings::getFrameworkSearchPaths() const { return getPathValues("source/framework_search_paths/framework_search_path"); } std::vector CxxProjectSettings::getAbsoluteFrameworkSearchPaths() const { return makePathsAbsolute(expandPaths(getFrameworkSearchPaths())); } bool CxxProjectSettings::setFrameworkSearchPaths(const std::vector& frameworkSearchPaths) { return setPathValues("source/framework_search_paths/framework_search_path", frameworkSearchPaths); } std::vector CxxProjectSettings::getCompilerFlags() const { std::vector defaultValues; return getValues("source/compiler_flags/compiler_flag", defaultValues); } bool CxxProjectSettings::setCompilerFlags(const std::vector& compilerFlags) { return setValues("source/compiler_flags/compiler_flag", compilerFlags); } bool CxxProjectSettings::getUseSourcePathsForHeaderSearch() const { return getValue("source/use_source_paths_for_header_search", false); } bool CxxProjectSettings::setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch) { return setValue("source/use_source_paths_for_header_search", useSourcePathsForHeaderSearch); } bool CxxProjectSettings::getHasDefinedUseSourcePathsForHeaderSearch() const { return isValueDefined("source/use_source_paths_for_header_search"); } FilePath CxxProjectSettings::getVisualStudioSolutionPath() const { return FilePath(getValue("source/build_file_path/vs_solution_path", "")); } bool CxxProjectSettings::setVisualStudioSolutionPath(const FilePath& visualStudioSolutionPath) { return setValue("source/build_file_path/vs_solution_path", visualStudioSolutionPath.str()); } FilePath CxxProjectSettings::getCompilationDatabasePath() const { return FilePath(getValue("source/build_file_path/compilation_db_path", "")); } FilePath CxxProjectSettings::getAbsoluteCompilationDatabasePath() const { return makePathAbsolute(expandPath(getCompilationDatabasePath())); } bool CxxProjectSettings::setCompilationDatabasePath(const FilePath& compilationDatabasePath) { return setValue("source/build_file_path/compilation_db_path", compilationDatabasePath.str()); } std::vector CxxProjectSettings::getDefaultSourceExtensions() const { std::vector defaultValues; switch (getLanguage()) { case LANGUAGE_CPP: defaultValues.push_back(".cpp"); defaultValues.push_back(".cxx"); defaultValues.push_back(".cc"); break; case LANGUAGE_C: defaultValues.push_back(".c"); break; default: break; } return defaultValues; } std::string CxxProjectSettings::getDefaultStandard() const { switch (getLanguage()) { case LANGUAGE_CPP: return "c++1z"; case LANGUAGE_C: return "c1x"; default: break; } return ""; }