Field3D
PatternMatch.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------//
2 
3 /*
4  * Copyright (c) 2009 Sony Pictures Imageworks Inc
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution. Neither the name of Sony Pictures Imageworks nor the
18  * names of its contributors may be used to endorse or promote
19  * products derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33  * OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 //----------------------------------------------------------------------------//
37 
42 //----------------------------------------------------------------------------//
43 
44 #ifndef _INCLUDED_PatternMatch_H_
45 #define _INCLUDED_PatternMatch_H_
46 
47 #include <vector>
48 
49 // Boost includes
50 #include <boost/foreach.hpp>
51 #include <boost/tokenizer.hpp>
52 #include <boost/thread/mutex.hpp>
53 
54 #include "Field.h"
55 
56 //----------------------------------------------------------------------------//
57 
58 #include "ns.h"
59 
61 
62 //----------------------------------------------------------------------------//
63 
64 enum MatchFlags {
67 };
68 
69 //----------------------------------------------------------------------------//
70 
72 std::vector<std::string>
73 split(const std::string &s);
74 
75 //----------------------------------------------------------------------------//
76 
78 std::vector<std::string>
79 split(const std::string &s, const std::string &separatorChars);
80 
81 //----------------------------------------------------------------------------//
82 
84 bool
85 match(const std::string &name, const std::string &attribute,
86  const std::vector<std::string> &patterns,
87  const MatchFlags flags = MatchEmptyPattern);
88 bool
89 match(const std::string &name, const std::string &attribute,
90  const std::string &patterns,
91  const MatchFlags flags = MatchEmptyPattern);
92 
93 //----------------------------------------------------------------------------//
94 
96 bool
97 match(const std::string &attribute, const std::vector<std::string> &patterns,
98  const MatchFlags flags = MatchEmptyPattern);
99 bool
100 match(const std::string &attribute, const std::string &patterns,
101  const MatchFlags flags = MatchEmptyPattern);
102 
103 //----------------------------------------------------------------------------//
104 
106 bool
107 match(const FieldRes *f, const std::vector<std::string> &patterns,
108  const MatchFlags flags = MatchEmptyPattern);
109 bool
110 match(const FieldRes *f, const std::string &patterns,
111  const MatchFlags flags = MatchEmptyPattern);
112 
113 //----------------------------------------------------------------------------//
114 
116 
117 //----------------------------------------------------------------------------//
118 
119 #endif // Include guard
FIELD3D_NAMESPACE_HEADER_CLOSE
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition: ns.h:58
split
std::vector< std::string > split(const std::string &s)
Splits a string into a vector of strings, using ',' as the separator.
Definition: PatternMatch.cpp:75
MatchNoFlags
Definition: PatternMatch.h:65
FieldRes
Definition: Field.h:207
ns.h
match
bool match(const std::string &name, const std::string &attribute, const std::vector< std::string > &patterns, const MatchFlags flags=MatchEmptyPattern)
Matches a <name>:<attribute> string against a set of patterns.
Definition: PatternMatch.cpp:102
MatchFlags
MatchFlags
Definition: PatternMatch.h:64
Field.h
Contains Field, WritableField and ResizableField classes.
MatchEmptyPattern
Definition: PatternMatch.h:66
FIELD3D_NAMESPACE_OPEN
Definition: FieldMapping.cpp:74