| 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 0 (3→4) taken 1 times.
✓ Branch 1 (3→5) 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 0 (17→7) taken 2 times.
✓ Branch 1 (17→18) taken 1 times.
|
3 | while(it != patern.end()){ |
| 23 |
3/3✓ Branch 0 (8→9) taken 2 times.
✓ Branch 2 (9→10) taken 1 times.
✓ Branch 3 (9→14) taken 1 times.
|
2 | if(isMatchToken(it->first)){ |
| 24 |
1/1✓ Branch 0 (11→12) 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 |