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(std::string & matchKey, T & matchValue, const std::map<std::string, T> & patern){ |
20 |
✓✓ |
3 |
if(patern.size() == 0lu) return false; |
21 |
|
2 |
typename std::map<std::string, T>::const_iterator it(patern.begin()); |
22 |
✓✓ |
3 |
while(it != patern.end()){ |
23 |
✓✓✓ |
2 |
if(isMatchToken(it->first)){ |
24 |
✓ |
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 |