Directory: | ./ |
---|---|
File: | tmp_project/PhoenixOptionParser/src/value_completion.cpp |
Date: | 2025-03-14 11:54:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 12 | 12 | 100.0% |
Branches: | 17 | 17 | 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 | #include "value_completion.h" | ||
8 | |||
9 | ///Complete the given value | ||
10 | /** @param baseValue : base value to be completed | ||
11 | * @param vecPossibleValue : vector of possible values to be used | ||
12 | * @return completed PString | ||
13 | */ | ||
14 | 3 | PString value_completion(const PString & baseValue, const PVecString & vecPossibleValue){ | |
15 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | PString strBashCompletion(""), separator(""); |
16 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
|
3 | if(baseValue == ""){ |
17 |
2/2✓ Branch 4 taken 6 times.
✓ Branch 5 taken 2 times.
|
8 | for(PVecString::const_iterator it(vecPossibleValue.begin()); it != vecPossibleValue.end(); ++it){ |
18 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
6 | strBashCompletion += separator + *it; |
19 |
1/1✓ Branch 1 taken 6 times.
|
6 | separator = " "; |
20 | } | ||
21 | }else{ | ||
22 |
2/2✓ Branch 4 taken 3 times.
✓ Branch 5 taken 1 times.
|
4 | for(PVecString::const_iterator it(vecPossibleValue.begin()); it != vecPossibleValue.end(); ++it){ |
23 |
3/3✓ Branch 2 taken 3 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
|
3 | if(it->isSameBegining(baseValue)){ |
24 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | strBashCompletion += separator + *it; |
25 |
1/1✓ Branch 1 taken 1 times.
|
1 | separator = " "; |
26 | } | ||
27 | } | ||
28 | } | ||
29 | 6 | return strBashCompletion; | |
30 | 3 | } | |
31 | |||
32 | |||
33 |