Directory: | ./ |
---|---|
File: | src/Representation/representation.cpp |
Date: | 2025-03-14 12:14:21 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 18 | 18 | 100.0% |
Branches: | 15 | 16 | 93.8% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include "representation.h" | ||
8 | |||
9 | ///Say if the current function is a function prototype | ||
10 | /** @param fct : PFunction | ||
11 | * @return true if the function is a function prototype, false otherwise | ||
12 | */ | ||
13 | 48 | bool repr_isFunction(const PFunction & fct){ | |
14 | 48 | return fct.getOtherCode() == ""; | |
15 | } | ||
16 | |||
17 | ///Set a PArchLib | ||
18 | /** @param arch : name of the architecture | ||
19 | * @param libName : name of the library for the corresponding architecture | ||
20 | * @return corresponding PArchLib | ||
21 | */ | ||
22 | 22 | PArchLib createArchLib(const PString & arch, const PString & libName){ | |
23 | 22 | PArchLib archLib; | |
24 |
1/1✓ Branch 1 taken 22 times.
|
22 | archLib.setArchitecture(arch); |
25 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | archLib.setName(libName); |
26 | 22 | return archLib; | |
27 | } | ||
28 | |||
29 | ///Add a PArchLib in the vector of Architecture if the libName is not empty | ||
30 | /** @param[out] vecArch : vector of architecture to be updated | ||
31 | * @param arch : name of the architecture | ||
32 | * @param libName : name of the library | ||
33 | */ | ||
34 | 30 | void addArch(PVecArchLib & vecArch, const PString & arch, const PString & libName){ | |
35 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 2 taken 8 times.
|
30 | if(libName != ""){ |
36 |
1/1✓ Branch 2 taken 22 times.
|
22 | vecArch.push_back(createArchLib(arch, libName)); |
37 | } | ||
38 | 30 | } | |
39 | |||
40 | ///Get the first non empty library file name | ||
41 | /** @param vecArch : vector of architecture | ||
42 | * @return library file name or empty string if none is found | ||
43 | */ | ||
44 | 6 | PPath getLibraryFile(const PVecArchLib & vecArch){ | |
45 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | PPath libName(""); |
46 | 6 | PVecArchLib::const_iterator it(vecArch.begin()); | |
47 |
5/6✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 6 times.
|
12 | while(it != vecArch.end() && libName == ""){ |
48 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
6 | libName = it->getName(); |
49 | 6 | ++it; | |
50 | } | ||
51 | 12 | return libName; | |
52 | } | ||
53 | |||
54 |