Alias.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2006 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Util/units/Alias.h
10 
11 #ifndef __Alias_h
12 #define __Alias_h
13 
14 #include "Reference.h"
15 
16 #include <map>
17 #include <string>
18 
20 
21 class Alias : public Reference::Able
22 {
23 public:
24 
26  void add (const std::string& alias, const std::string& name);
27 
29  std::string get_name (const std::string& alias) const;
30 
32  std::string substitute (const std::string& alias) const;
33 
35  std::string get_alias (const std::string& name) const;
36 
37 protected:
38 
39  std::map<std::string, std::string> aliases;
40 
41 };
42 
43 #endif
44 
std::string get_alias(const std::string &name) const
Given a name, return the alias.
Definition: Alias.C:39
A convenient exception handling class.
Definition: Error.h:54
void add(const std::string &alias, const std::string &name)
Add an alias.
Definition: Alias.C:11
Manages Reference::To references to the instance.
Definition: ReferenceAble.h:40
std::string substitute(const std::string &alias) const
Given a word that may be an alias, return the associated name or the word.
Definition: Alias.C:28
Stores keyword-value pairs.
Definition: Alias.h:21
std::string get_name(const std::string &alias) const
Given an alias, return the name.
Definition: Alias.C:17

Generated using doxygen 1.8.17