All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IncludedFiles.cpp
Go to the documentation of this file.
1 // $Id:$
2 // ============================================================================
3 // STD:
4 // ============================================================================
5 #include <assert.h>
6 // ============================================================================
7 // BOOST:
8 // ============================================================================
9 #include <boost/foreach.hpp>
10 // ============================================================================
11 #include "IncludedFiles.h"
12 #include "Position.h"
13 // ============================================================================
14 namespace gp = Gaudi::Parsers;
15 // ============================================================================
16 bool gp::IncludedFiles::IsIncluded(const std::string& filename) const {
17  return container_.find(filename) != container_.end();
18 }
19 // ============================================================================
20 bool gp::IncludedFiles::AddFile(const std::string& filename,
21  const Position& from){
22  if (!IsIncluded(filename)) {
23  container_.insert(Container::value_type(filename, from));
24  return true;
25  }
26  return false;
27 }
28 // ============================================================================
29 bool gp::IncludedFiles::GetPosition(const std::string& filename,
30  const Position** pos) const {
31  Container::const_iterator iter = container_.find(filename);
32  if (iter != container_.end()) {
33  *pos = &iter->second;
34  assert(pos != NULL);
35  return true;
36  }
37  return false;
38 }
39 // ============================================================================