https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FileLineInfo.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include <string>
13#include <map>
14
19{
20public:
22 FileLineInfo(const std::string & f, int l);
26 bool isValid() const;
27 int line() const;
28 std::string file() const;
29
30protected:
31 int _line;
32 std::string _file;
33};
34
41{
42public:
49 void addInfo(const std::string & key0, const std::string & file, int line);
50
58 void
59 addInfo(const std::string & key0, const std::string & key1, const std::string & file, int line);
60
69 void addInfo(const std::string & key0,
70 const std::string & key1,
71 const std::string & key2,
72 const std::string & file,
73 int line);
74
80 FileLineInfo getInfo(const std::string & key0) const;
81
88 FileLineInfo getInfo(const std::string & key0, const std::string & key1) const;
89
98 getInfo(const std::string & key0, const std::string & key1, const std::string & key2) const;
99
100protected:
104 std::string makeKey(const std::string & key0, const std::string & key1) const;
105
109 std::string
110 makeKey(const std::string & key0, const std::string & key1, const std::string & key2) const;
111 std::map<std::string, FileLineInfo> _map;
112};
A mapping between a series of keys to a FileLineInfo.
void addInfo(const std::string &key0, const std::string &file, int line)
Associate a key with file/line info.
std::map< std::string, FileLineInfo > _map
FileLineInfo getInfo(const std::string &key0) const
Get file/line info for a key.
std::string makeKey(const std::string &key0, const std::string &key1) const
Makes a unique key for the map given two strings.
Holds file and line information.
bool isValid() const
int line() const
std::string _file
std::string file() const