OpenStructure
info_set.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  Author: Ansgar Philippsen
23 */
24 
25 #include <map>
26 
27 #include <ost/base.hh>
28 #include "module_config.hh"
29 #include "info_group.hh"
30 
31 namespace ost { namespace info {
32 
34 public:
35  InfoSet(const String& name="");
36 
37  // retrieve name of this set
38  String GetName() const;
39 
40  // regex match of given String to all entries
41  bool Match(const String& s) const;
42 
43  // add a new entry
44  void Add(const String& entry);
45 
46  // clear all entries
47  void Clear();
48 
49 private:
50  String name_;
51  std::vector<String> entry_list_;
52 };
53 
54 typedef std::map<String,InfoSet> InfoSetMap;
55 
56 /*
57  for each <set> in the given group, iterates
58  over the <entry/> tags and assembles an
59  info set; the map of all sets is then returned
60 */
61 DLLEXPORT InfoSetMap ExtractSets(const InfoGroup&);
62 
63 }} // ns
String GetName() const
bool Match(const String &s) const
void Add(const String &entry)
InfoSet(const String &name="")
#define DLLEXPORT_OST_INFO
std::string String
Definition: base.hh:54
std::map< String, InfoSet > InfoSetMap
Definition: info_set.hh:54
DLLEXPORT InfoSetMap ExtractSets(const InfoGroup &)
Definition: base.dox:1