Directory: | ./ |
---|---|
File: | tmp_project/PhoenixFileParser/src/PFileParser_impl.h |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 10 | 10 | 100.0% |
Branches: | 8 | 8 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #ifndef __PFILE_PARSER_IMPL_H__ | ||
8 | #define __PFILE_PARSER_IMPL_H__ | ||
9 | |||
10 | #include "PFileParser.h" | ||
11 | |||
12 | ///Check if one key of the map, matches the current token | ||
13 | /** @param[out] matchKey : matching key (on success) | ||
14 | * @param[out] matchValue : matching value (on success) | ||
15 | * @param patern : map of patterns to be checked | ||
16 | * @return true if one of the map key matches the current token, false otherwise | ||
17 | */ | ||
18 | template<typename T> | ||
19 | 3 | bool PFileParser::isMatchToken(PString & matchKey, T & matchValue, const std::map<PString, T> & patern){ | |
20 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
|
3 | if(patern.size() == 0lu) return false; |
21 | 2 | typename std::map<PString, T>::const_iterator it(patern.begin()); | |
22 |
2/2✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
3 | while(it != patern.end()){ |
23 |
3/3✓ Branch 2 taken 2 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1 times.
|
2 | if(isMatchToken(it->first)){ |
24 |
1/1✓ Branch 2 taken 1 times.
|
1 | matchKey = it->first; |
25 | 1 | matchValue = it->second; | |
26 | 1 | return true; | |
27 | } | ||
28 | 1 | ++it; | |
29 | } | ||
30 | 1 | return false; | |
31 | } | ||
32 | |||
33 | |||
34 | #endif | ||
35 |