Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
mhwd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Applications
mhwd
Commits
638812a0
Commit
638812a0
authored
Jun 28, 2015
by
Łukasz Matysiak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use range based for loops
parent
eb5b10d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
24 deletions
+15
-24
src/Data.cpp
src/Data.cpp
+15
-24
No files found.
src/Data.cpp
View file @
638812a0
...
...
@@ -325,24 +325,21 @@ std::vector<std::shared_ptr<Config>> Data::getAllLocalRequirements(std::shared_p
}
// Check if this config is required by another installed config
for
(
auto
&&
installedConfig
=
installedConfigs
.
begin
();
installedConfig
!=
installedConfigs
.
end
();
++
installedConfig
)
for
(
auto
&
installedConfig
:
installedConfigs
)
{
for
(
auto
&&
dependency
=
(
*
installedConfig
)
->
dependencies_
.
begin
();
dependency
!=
(
*
installedConfig
)
->
dependencies_
.
end
();
dependency
++
)
for
(
const
auto
&
dependency
:
installedConfig
->
dependencies_
)
{
if
(
(
*
dependency
)
==
config
->
name_
)
if
(
dependency
==
config
->
name_
)
{
// Check if already in vector
bool
found
=
std
::
find_if
(
requirements
.
begin
(),
requirements
.
end
(),
[
&
installedConfig
](
const
std
::
shared_ptr
<
Config
>&
req
)
{
return
req
->
name_
==
(
*
installedConfig
)
->
name_
;
return
req
->
name_
==
installedConfig
->
name_
;
})
!=
requirements
.
end
();
if
(
!
found
)
{
requirements
.
emplace_back
(
*
installedConfig
);
requirements
.
emplace_back
(
installedConfig
);
break
;
}
}
...
...
@@ -464,39 +461,34 @@ Vita::string Data::getRightConfigPath(Vita::string str, Vita::string baseConfigP
void
Data
::
updateConfigData
()
{
// Clear config vectors in each device element
for
(
auto
&&
PCIDevice
=
PCIDevices
.
begin
();
PCIDevice
!=
PCIDevices
.
end
();
PCIDevice
++
)
for
(
auto
&
PCIDevice
:
PCIDevices
)
{
(
*
PCIDevice
)
->
availableConfigs_
.
clear
();
PCIDevice
->
availableConfigs_
.
clear
();
}
for
(
auto
&&
USBDevice
=
USBDevices
.
begin
();
USBDevice
!=
USBDevices
.
end
();
USBDevice
++
)
for
(
auto
&
USBDevice
:
USBDevices
)
{
(
*
USBDevice
)
->
availableConfigs_
.
clear
();
USBDevice
->
availableConfigs_
.
clear
();
}
allPCIConfigs
.
clear
();
allUSBConfigs
.
clear
();
// Refill data
fillAllConfigs
(
"PCI"
);
fillAllConfigs
(
"USB"
);
setMatchingConfigs
(
PCIDevices
,
allPCIConfigs
,
false
);
setMatchingConfigs
(
USBDevices
,
allUSBConfigs
,
false
);
// Update also installed config data
updateInstalledConfigData
();
}
void
Data
::
setMatchingConfigs
(
const
std
::
vector
<
std
::
shared_ptr
<
Device
>>&
devices
,
std
::
vector
<
std
::
shared_ptr
<
Config
>>&
configs
,
bool
setAsInstalled
)
{
for
(
auto
&&
config
=
configs
.
begin
();
config
!=
configs
.
end
();
++
config
)
for
(
auto
&
config
:
configs
)
{
setMatchingConfig
(
(
*
config
)
,
devices
,
setAsInstalled
);
setMatchingConfig
(
config
,
devices
,
setAsInstalled
);
}
}
...
...
@@ -508,16 +500,15 @@ void Data::setMatchingConfig(std::shared_ptr<Config> config,
getAllDevicesOfConfig
(
devices
,
config
,
foundDevices
);
// Set config to all matching devices
for
(
auto
&&
foundDevice
=
foundDevices
.
begin
();
foundDevice
!=
foundDevices
.
end
();
++
foundDevice
)
for
(
auto
&
foundDevice
:
foundDevices
)
{
if
(
setAsInstalled
)
{
addConfigSorted
(
(
*
foundDevice
)
->
installedConfigs_
,
config
);
addConfigSorted
(
foundDevice
->
installedConfigs_
,
config
);
}
else
{
addConfigSorted
(
(
*
foundDevice
)
->
availableConfigs_
,
config
);
addConfigSorted
(
foundDevice
->
availableConfigs_
,
config
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment