libhext: C++ Library Documentation  1.0.12-3ea013c
Result.h
Go to the documentation of this file.
1 // Copyright 2015 Thomas Trapp
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef HEXT_RESULT_H_INCLUDED
16 #define HEXT_RESULT_H_INCLUDED
17 
18 /// @file
19 /// Typedefs for results returned from capturing HTML.
20 
21 #include <map>
22 #include <vector>
23 #include <string>
24 #include <utility>
25 
26 
27 namespace hext {
28 
29 
30 /// A string-pair containing a name and a value. A ResultPair is produced by a
31 /// Capture.
32 using ResultPair = std::pair<std::string, std::string>;
33 
34 
35 /// A multimap containing the values produced by capturing.
36 /// Why std::multimap?
37 /// * The value of a Capture should be accessible by key => associative
38 /// * There may be Captures with duplicate names => multi key
39 /// * The order of Captures should be predictable => sorted
40 using ResultMap = std::multimap<ResultPair::first_type,
41  ResultPair::second_type>;
42 
43 
44 /// A vector containing ResultMap.
45 using Result = std::vector<ResultMap>;
46 
47 
48 } // namespace hext
49 
50 
51 #endif // HEXT_RESULT_H_INCLUDED
52 
std::pair< std::string, std::string > ResultPair
A string-pair containing a name and a value.
Definition: Result.h:32
std::vector< ResultMap > Result
A vector containing ResultMap.
Definition: Result.h:45
std::multimap< ResultPair::first_type, ResultPair::second_type > ResultMap
A multimap containing the values produced by capturing.
Definition: Result.h:41