Use getter functions when accessing string fields in RGBControllers in ProfileManager and cli
This commit is contained in:
parent
abd34f1810
commit
9fb71a30ec
2 changed files with 22 additions and 22 deletions
|
|
@ -249,38 +249,38 @@ bool ProfileManager::LoadDeviceFromListWithOptions
|
|||
\*---------------------------------------------------------*/
|
||||
bool location_check;
|
||||
|
||||
if(load_controller->location.find("HID: ") == 0)
|
||||
if(load_controller->GetLocation().find("HID: ") == 0)
|
||||
{
|
||||
location_check = true;
|
||||
}
|
||||
else if(load_controller->location.find("I2C: ") == 0)
|
||||
else if(load_controller->GetLocation().find("I2C: ") == 0)
|
||||
{
|
||||
std::size_t loc = load_controller->location.rfind(", ");
|
||||
std::size_t loc = load_controller->GetLocation().rfind(", ");
|
||||
if(loc == std::string::npos)
|
||||
{
|
||||
location_check = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string i2c_address = load_controller->location.substr(loc + 2);
|
||||
location_check = temp_controller->location.find(i2c_address) != std::string::npos;
|
||||
std::string i2c_address = load_controller->GetLocation().substr(loc + 2);
|
||||
location_check = temp_controller->GetLocation().find(i2c_address) != std::string::npos;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
location_check = temp_controller->location == load_controller->location;
|
||||
location_check = temp_controller->GetLocation() == load_controller->GetLocation();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Test if saved controller data matches this controller |
|
||||
\*---------------------------------------------------------*/
|
||||
if((temp_controller_used[temp_index] == false )
|
||||
&&(temp_controller->type == load_controller->type )
|
||||
&&(temp_controller->name == load_controller->name )
|
||||
&&(temp_controller->description == load_controller->description)
|
||||
&&(temp_controller->version == load_controller->version )
|
||||
&&(temp_controller->serial == load_controller->serial )
|
||||
&&(location_check == true ))
|
||||
if((temp_controller_used[temp_index] == false )
|
||||
&&(temp_controller->type == load_controller->type )
|
||||
&&(temp_controller->GetName() == load_controller->GetName() )
|
||||
&&(temp_controller->GetDescription() == load_controller->GetDescription())
|
||||
&&(temp_controller->GetVersion() == load_controller->GetVersion() )
|
||||
&&(temp_controller->GetSerial() == load_controller->GetSerial() )
|
||||
&&(location_check == true ))
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set used flag for this temp device |
|
||||
|
|
@ -417,7 +417,7 @@ bool ProfileManager::LoadProfileWithOptions
|
|||
for(std::size_t controller_index = 0; controller_index < controllers.size(); controller_index++)
|
||||
{
|
||||
bool temp_ret_val = LoadDeviceFromListWithOptions(temp_controllers, temp_controller_used, controllers[controller_index], load_size, load_settings);
|
||||
std::string current_name = controllers[controller_index]->name + " @ " + controllers[controller_index]->location;
|
||||
std::string current_name = controllers[controller_index]->name + " @ " + controllers[controller_index]->GetLocation();
|
||||
LOG_INFO("[ProfileManager] Profile loading: %s for %s", ( temp_ret_val ? "Succeeded" : "FAILED!" ), current_name.c_str());
|
||||
ret_val |= temp_ret_val;
|
||||
}
|
||||
|
|
|
|||
16
cli.cpp
16
cli.cpp
|
|
@ -477,33 +477,33 @@ void OptionListDevices(std::vector<RGBController *>& rgb_controllers)
|
|||
/*---------------------------------------------------------*\
|
||||
| Print device description |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!controller->description.empty())
|
||||
if(!controller->GetDescription().empty())
|
||||
{
|
||||
std::cout << " Description: " << controller->description << std::endl;
|
||||
std::cout << " Description: " << controller->GetDescription() << std::endl;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Print device version |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!controller->version.empty())
|
||||
if(!controller->GetVersion().empty())
|
||||
{
|
||||
std::cout << " Version: " << controller->version << std::endl;
|
||||
std::cout << " Version: " << controller->GetLocation() << std::endl;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Print device location |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!controller->location.empty())
|
||||
if(!controller->GetLocation().empty())
|
||||
{
|
||||
std::cout << " Location: " << controller->location << std::endl;
|
||||
std::cout << " Location: " << controller->GetLocation() << std::endl;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Print device serial |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!controller->serial.empty())
|
||||
if(!controller->GetSerial().empty())
|
||||
{
|
||||
std::cout << " Serial: " << controller->serial << std::endl;
|
||||
std::cout << " Serial: " << controller->GetSerial() << std::endl;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue