1
/***************************************************************************
2
Copyright 2006 David Nolden <david.nolden.kdevelop@art-master.de>
3
***************************************************************************/
5
/***************************************************************************
7
* This program is free software; you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation; either version 2 of the License, or *
10
* (at your option) any later version. *
12
***************************************************************************/
18
#include "rpp/pp-macro.h"
19
#include "cppduchainexport.h"
22
* Represents a set of c++ preprocess-macros.
32
class KDEVCPPDUCHAIN_EXPORT MacroSet {
34
typedef std::set< rpp::pp_macro, rpp::pp_macro::NameCompare > Macros;
35
MacroSet() : m_idHashValid( false ), m_valueHashValid( false ) {
38
void addMacro( const rpp::pp_macro& macro );
41
void read( QDataStream& stream );
44
void write( QDataStream& stream ) const;
46
bool hasMacro( const QString& name ) const;
47
bool hasMacro( const KDevelop::HashedString& name ) const;
48
rpp::pp_macro macro( const KDevelop::HashedString& name ) const;
50
size_t idHash() const;
51
size_t valueHash() const;
53
const Macros& macros() const {
59
void merge( const MacroSet& macros );
61
void computeHash() const;
63
mutable bool m_idHashValid;
64
mutable bool m_valueHashValid;
65
mutable size_t m_idHash; //Hash that represents the ids of all macros
66
mutable size_t m_valueHash; //Hash that represents the values of all macros