ProteoWizard
KwCVMap.hpp
Go to the documentation of this file.
1 //
2 // $Id: KwCVMap.hpp 6909 2014-11-19 17:18:29Z chambm $
3 //
4 // Original author: Robert Burke <robert.burke@proteowizard.org>
5 //
6 // Copyright 2010 Spielberg Family Center for Applied Proteomics
7 // University of Southern California, Los Angeles, California 90033
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 #ifndef _KWCVMAP_HPP_
23 #define _KWCVMAP_HPP_
24 
25 #include <string>
26 #include <vector>
27 #include "boost/shared_ptr.hpp"
28 #include "boost/xpressive/xpressive_dynamic.hpp"
29 #include "pwiz/data/common/cv.hpp"
30 
31 namespace bxp = boost::xpressive;
32 
33 namespace pwiz{
34 namespace identdata{
35 
37 {
38  CVMap();
39  CVMap(const std::string& keyword, cv::CVID cvid,
40  const std::string& path);
41  CVMap(const std::string& keyword, cv::CVID cvid,
42  const std::string& path, const std::string& dependant);
43  virtual ~CVMap() {}
44 
45  std::string keyword;
46  cv::CVID cvid;
47  std::string path;
48  std::string dependant;
49 
50  static CVMap* createMap(const std::vector<std::string>& quad);
51 
52  virtual const char* getTag() const;
53 
54  virtual bool operator()(const std::string& text) const;
55  virtual bool operator==(const CVMap& right) const;
56 };
57 
58 typedef boost::shared_ptr<CVMap> CVMapPtr;
59 
61 {
62  RegexCVMap();
63  RegexCVMap(const std::string& pattern, cv::CVID cvid,
64  const std::string& path);
65  RegexCVMap(const std::string& pattern, cv::CVID cvid,
66  const std::string& path, const std::string& dependant);
67  virtual ~RegexCVMap();
68 
69  void setPattern(const std::string& pattern);
70 
71  virtual bxp::smatch match(std::string& text);
72 
73  virtual const char* getTag() const;
74 
75  virtual bool operator()(const std::string& text) const;
76 
77 protected:
78  bxp::sregex pattern;
79 };
80 
81 typedef boost::shared_ptr<RegexCVMap> RegexCVMapPtr;
82 
83 //
84 // Part matching classes.
85 //
87 {
88  StringMatchCVMap(const std::string& keyword);
89 
90  virtual bool operator()(const CVMap& right) const;
91  virtual bool operator()(const CVMapPtr& right) const;
92  virtual bool operator==(const CVMap& right) const;
93  virtual bool operator==(const CVMapPtr& right) const;
94 };
95 
97 {
98  CVIDMatchCVMap(cv::CVID cvid);
99 
100  virtual bool operator()(const CVMap& right) const;
101  virtual bool operator()(const CVMapPtr& right) const;
102  virtual bool operator==(const CVMap& right) const;
103  virtual bool operator==(const CVMapPtr& right) const;
104 };
105 
106 
107 //
108 // Useful operators
109 //
110 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMap& cm);
111 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMapPtr cmp);
112 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMap* cmp);
113 
114 PWIZ_API_DECL std::istream& operator>>(std::istream& is, CVMapPtr& cm);
115 
116 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const std::vector<CVMapPtr>& cmVec);
117 PWIZ_API_DECL std::istream& operator>>(std::istream& is, std::vector<CVMapPtr>& cmVec);
118 
119 } // namespace identdata
120 } // namespace pwiz
121 
122 #endif // _KWCVMAP_HPP_
123 
std::string keyword
Definition: KwCVMap.hpp:45
PWIZ_API_DECL std::ostream & operator<<(std::ostream &os, const data::Diff< IdentData, DiffConfig > &diff)
boost::shared_ptr< CVMap > CVMapPtr
Definition: KwCVMap.hpp:58
#define PWIZ_API_DECL
Definition: Export.hpp:32
PWIZ_API_DECL std::istream & operator>>(std::istream &is, CVMapPtr &cm)
std::string dependant
Definition: KwCVMap.hpp:48
boost::shared_ptr< RegexCVMap > RegexCVMapPtr
Definition: KwCVMap.hpp:81
std::string path
Definition: KwCVMap.hpp:47
PWIZ_API_DECL bool operator==(const TruncatedLorentzianParameters &t, const TruncatedLorentzianParameters &u)