Click here to Skip to main content
15,895,784 members
Articles / Desktop Programming / MFC

LintProject - Improving the Usability of PC-Lint with Visual C++ Solutions and Projects

,
Rate me:
Please Sign up or sign in to vote.
4.83/5 (36 votes)
29 Jan 2009CPOL13 min read 281.5K   1.7K   52  
Utility to run PC-Lint on Visual C++ solutions and projects, generating XML and HTML reports of the results.
/************************************************************************
 *
 *  Description : CProjectConfiguration - class to represent a project
 *                configuration.
 *
 *     (c) Copyright 1996-2008 by Anna-Jayne Metcalfe (anna@riverblade.co.uk)
 *     and Beth Mackenzie (beth@riverblade.co.uk) / Riverblade Limited
 *
 *  Licence Terms:
 *
 *     This code may be freely reused, subject to the licence terms below.
 *     Please do let us know of any bugs you find or improvements you make,
 *     so that we can pass them on to the rest of the development community.
 *
 *     This code is free software; you can redistribute it and/or
 *     modify it under the terms of the Code Project Open License (CPOL)
 *     version 1.0 (http://www.codeproject.com/info/cpol10.aspx).
 *
 *     This code 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
 *     Code Project Open Licence for further details.
 *
 ************************************************************************
 *    $Archive: /Projects/AddIns/Visual Lint/Development/Libraries/AddInSolutionModel/Include/ProjectConfiguration.h $
 *   $Revision: 3 $
 *       $Date: 14/04/08 11:31 $
 *     $Author: Anna $
 * 
 * $Nokeywords: $
 ************************************************************************/

/// \file	
/// \brief CProjectConfiguration declaration.

#pragma once



namespace Riverblade
{
	namespace Libraries
	{
		namespace AddInSolutionModel
		{
			/// \brief Interface class used to return information on a file configuration.
			///
			//lint -esym(1925, *::CFileConfiguration::*)		(Elective Note -- Symbol 'CFileConfiguration::m_....' is a public data member -- Effective C++ #20)
			class CFileConfiguration
			{
				// Construction/destruction
				public:
					CFileConfiguration(void);

					CFileConfiguration(const CFileConfiguration& src);

					virtual ~CFileConfiguration(void);



				// Operators
				public:
					CFileConfiguration& operator=(const CFileConfiguration& src);

					bool operator==(const CFileConfiguration& src) const;


				// Data members
				public:
					CString						m_sPreprocessorDefinitions;				///< Preprocessor definitions.
					CString						m_sAdditionalIncludeDirectories;		///< Additional include directories.
					CString						m_sAdditionalCommandLineOptions;		///< Additional command line options (used only with VS2002 onwards)


				// Operations
				public:
					bool						IsEmpty(void) const;

			};


			/// \brief Interface class used to return information on a project configuration.
			///
			//lint -esym(1925, *::CProjectConfiguration::*)		(Elective Note -- Symbol 'CProjectConfiguration::m_....' is a public data member -- Effective C++ #20)
			class CProjectConfiguration
			{
				// Construction/destruction
				public:
					CProjectConfiguration(void);

					CProjectConfiguration(const CProjectConfiguration& src);

					virtual ~CProjectConfiguration(void);


				// Definitions
				public:
					// The following are taken from VCProjectEngineLibrary for completeness
					//
					/// \brief Project configuration types.
					///
					enum ConfigurationTypes
					{
						typeUnknown			= 0,
						typeApplication		= 1,
						typeDynamicLibrary	= 2,
						typeStaticLibrary	= 4,
						typeGeneric			= 10
					};


					/// \brief Describes how (if at all) MFC is used in a project configuration.
					///
					enum useOfMfc
					{
						useMfcStdWin		= 0,
						useMfcStatic		= 1,
						useMfcDynamic		= 2
					};


					/// \brief Describes how (if at all) ATL is used in a project configuration.
					///
					enum useOfATL
					{
						useATLNotSet		= 0,
						useATLStatic		= 1,
						useATLDynamic		= 2
					};


					/// \brief Describes the character set used in a project.
					///
					enum charSet
					{
						charSetNotSet		= 0,
						charSetUnicode		= 1,
						charSetMBCS			= 2
					};


				// Operators
				public:
					CProjectConfiguration& operator=(const CProjectConfiguration& src);

					bool operator==(const CProjectConfiguration& src) const;

					/// \brief Case independent string->file configuration map
					typedef CAtlMap<CString, CFileConfiguration, CStringElementTraitsI<CString> > CMapStringToFileConfigI;


				// Data members
				public:
					CString						m_sName;								///< Project name.
					CString						m_sIntermediateFolder;					///< Intermediate files folder.
					int							m_eConfigurationType;					///< Configuration type	(e.g. typeDynamicLibrary).
					int							m_eCharacterSet;						///< Character set (e.g. charSetUnicode).
					bool						m_bMinimiseRTL;							///< "Minimise Runtime Library usage" flag.
					int							m_eUseOfMfc;							///< Describes how MFC is used (if at all).
					int							m_eUseOfAtl;							///< Describes how ATL is used (if at all).
					CString						m_sPreprocessorDefinitions;				///< Preprocessor definitions.
					CString						m_sAdditionalIncludeDirectories;		///< Additional include directories.
					int							m_eRuntimeLibrary;						///< Runtime library type.
					bool						m_bEnableRuntimeTypeInfo;				///< \em true if RTTI is enabled; \em false otherwise.
					bool						m_bForceConformanceInForLoopScope;		///< \em true if ANSI compliant for loop scoping is in effect; \em false otherwise.
					bool						m_bNativeWideChars;						///< \em true if wchar_t is a native type; \em false otherwise.
					CString						m_sAdditionalCommandLineOptions;		///< Additional command line options (used only with VS2002 onwards)

					CMapStringToFileConfigI		m_mapPerFileConfiguration;				///< Configuration for individual files.



				// Operations
				public:
					CString						GetFileAdditionalIncludes(const CString& sPathName) const;
					bool						SetFileAdditionalIncludes(const CString& sPathName, const CString& sAdditionalIncludes);

					CString						GetFilePreprocessorDefinitions(const CString& sPathName) const;
					bool						SetFilePreprocessorDefinitions(const CString& sPathName, const CString& sPreprocessorDefinitions);

					CFileConfiguration			GetFileConfiguration(const CString& sPathName) const;
					bool						SetFileConfiguration(const CString& sPathName, const CFileConfiguration& config);
			};


		};	// namespace AddInSolutionModel
	};	// namespace Libraries
};	//namespace Riverblade

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Riverblade Limited
United Kingdom United Kingdom
I haven't always written software for a living. When I graduated from Surrey University in 1989, it was with an Electronic Engineering degree, but unfortunately that never really gave me the opportunity to do anything particularly interesting (with the possible exception of designing Darth Vader's Codpiece * for the UK Army in 1990).
    * Also known as the Standard Army Bootswitch. But that's another story...
Since the opportunity arose to lead a software team developing C++ software for Avionic Test Systems in 1996, I've not looked back. More recently I've been involved in the development of subsea acoustic navigation systems, digital TV broadcast systems, port security/tracking systems, and most recently software development tools with my own company, Riverblade Ltd.

One of my personal specialities is IDE plug-in development. ResOrg was my first attempt at a plug-in, but my day to day work is with Visual Lint, an interactive code analysis tool environment with works within the Visual Studio and Eclipse IDEs or on build servers.

I love lots of things, but particularly music, photography and anything connected with history or engineering. I despise ignorant, intolerant and obstructive people - and it shows...I can be a bolshy cow if you wind me up the wrong way...Laugh | :laugh:

I'm currently based 15 minutes walk from the beach in Bournemouth on the south coast of England. Since I moved here I've grown to love the place - even if it is full of grockles in Summer!

Written By
Software Developer Riverblade Ltd
United Kingdom United Kingdom
I'm a software developer and/or tester with Riverblade Ltd (www.riverblade.co.uk) developing our core product range including our Visual Lint integration product and Lint Project Professional.

I incorporate a number of technologies into a daily basis including Windows API, C++ (VS2008), Managed C++, CLI, Databases, Java, JNI, Eclipse Framework, CDT and of course Visual Studio Extensibility (VSIP VSX).

In my spare time I enjoy cooking (prepping ingredients from scratch!), running, cycling, swimming, reading, interested in experimental electronic music (such as ClockDVA), movies, volunteering my IT skills where I can.

Comments and Discussions