Deprecator.cc
Go to the documentation of this file.
1 
8 #include <string>
9 #include <map>
10 #include <utility>
11 #include <utl/Deprecator.h>
12 #include <utl/TabularStream.h>
13 #include <utl/ErrorLogger.h>
14 
15 using namespace std;
16 
17 
18 namespace utl {
19 
20  void
21  Deprecator::Deprecated(const std::string& theInterface,
22  const std::string& theVersion,
23  const std::string& theNewUsageHint)
24  {
25  const DataMap::iterator infoIter = fData.find(theInterface);
26 
27  if (infoIter == fData.end())
28  fData.insert(make_pair(theInterface, DeprecationInfo(theNewUsageHint, theVersion)));
29  else
30  infoIter->second.IncrementUsage();
31 
32  WARNING_TERSE("Outdated interface used: " + theInterface);
33  }
34 
35 
36  string
37  Deprecator::GetReport()
38  const
39  {
40  TabularStream result("l|r|l|l");
41  result << "Interface" << endc
42  << "Count" << endc
43  << "Since" << endc
44  << "Hint" << endr
45  << hline;
46  for (const auto& ii : fData)
47  result << ii.first << endc
48  << ii.second.GetCount() << endc
49  << ii.second.GetVersion() << endc
50  << ii.second.GetHint() << endr;
51  result << delr;
52  return result.Str();
53  }
54 
55 }
const Data result[]
const EndRow endr
class to format data in tabular form
std::string Str()
const DeleteRow delr
#define WARNING_TERSE(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:177
Information about the deprecated interface.
Definition: Deprecator.h:85
const HLine hline('-')
const EndColumn endc

, generated on Tue Sep 26 2023.