www.mooseframework.org
FileLineInfo.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef FILELINEINFO_H
16 #define FILELINEINFO_H
17 
18 #include <string>
19 #include <map>
20 
25 {
26 public:
27  FileLineInfo();
28  FileLineInfo(const std::string & f, int l);
32  bool isValid() const;
33  int line() const;
34  std::string file() const;
35 
36 protected:
37  int _line;
38  std::string _file;
39 };
40 
47 {
48 public:
55  void addInfo(const std::string & key0, const std::string & file, int line);
56 
64  void
65  addInfo(const std::string & key0, const std::string & key1, const std::string & file, int line);
66 
75  void addInfo(const std::string & key0,
76  const std::string & key1,
77  const std::string & key2,
78  const std::string & file,
79  int line);
80 
86  FileLineInfo getInfo(const std::string & key0) const;
87 
94  FileLineInfo getInfo(const std::string & key0, const std::string & key1) const;
95 
104  getInfo(const std::string & key0, const std::string & key1, const std::string & key2) const;
105 
106 protected:
110  std::string makeKey(const std::string & key0, const std::string & key1) const;
111 
115  std::string
116  makeKey(const std::string & key0, const std::string & key1, const std::string & key2) const;
117  std::map<std::string, FileLineInfo> _map;
118 };
119 
120 #endif // FILELINEINFO_H
std::map< std::string, FileLineInfo > _map
Definition: FileLineInfo.h:117
int line() const
Definition: FileLineInfo.C:28
bool isValid() const
Definition: FileLineInfo.C:22
std::string _file
Definition: FileLineInfo.h:38
Holds file and line information.
Definition: FileLineInfo.h:24
A mapping between a series of keys to a FileLineInfo.
Definition: FileLineInfo.h:46
std::string file() const
Definition: FileLineInfo.C:34