ProteoWizard
KwCVMap.hpp
Go to the documentation of this file.
1//
2// $Id$
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"
30
31namespace bxp = boost::xpressive;
32
33namespace pwiz{
34namespace identdata{
35
37{
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
58typedef boost::shared_ptr<CVMap> CVMapPtr;
59
61{
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
77protected:
78 bxp::sregex pattern;
79};
80
81typedef 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//
110PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMap& cm);
111PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMapPtr cmp);
112PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const CVMap* cmp);
113
114PWIZ_API_DECL std::istream& operator>>(std::istream& is, CVMapPtr& cm);
115
116PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const std::vector<CVMapPtr>& cmVec);
117PWIZ_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
#define PWIZ_API_DECL
Definition Export.hpp:32
std::ostream & operator<<(std::ostream &os, const Diff< object_type, config_type > &diff)
stream insertion of Diff results
Definition diff_std.hpp:200
boost::shared_ptr< CVMap > CVMapPtr
Definition KwCVMap.hpp:58
PWIZ_API_DECL std::istream & operator>>(std::istream &is, CVMapPtr &cm)
boost::shared_ptr< RegexCVMap > RegexCVMapPtr
Definition KwCVMap.hpp:81
virtual bool operator()(const CVMap &right) const
virtual bool operator()(const CVMapPtr &right) const
virtual bool operator==(const CVMap &right) const
virtual bool operator==(const CVMapPtr &right) const
std::string keyword
Definition KwCVMap.hpp:45
virtual bool operator==(const CVMap &right) const
CVMap(const std::string &keyword, cv::CVID cvid, const std::string &path)
virtual const char * getTag() const
static CVMap * createMap(const std::vector< std::string > &quad)
CVMap(const std::string &keyword, cv::CVID cvid, const std::string &path, const std::string &dependant)
virtual bool operator()(const std::string &text) const
std::string dependant
Definition KwCVMap.hpp:48
virtual bool operator()(const std::string &text) const
virtual const char * getTag() const
virtual bxp::smatch match(std::string &text)
RegexCVMap(const std::string &pattern, cv::CVID cvid, const std::string &path, const std::string &dependant)
void setPattern(const std::string &pattern)
RegexCVMap(const std::string &pattern, cv::CVID cvid, const std::string &path)
virtual bool operator()(const CVMapPtr &right) const
virtual bool operator==(const CVMap &right) const
virtual bool operator==(const CVMapPtr &right) const
virtual bool operator()(const CVMap &right) const
StringMatchCVMap(const std::string &keyword)