Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

peripherals: use std::set for changed settings instead of std::vector

  • Loading branch information...
commit ed34efe4667e2500fdbd4ecdeada8ff7eec02d9b 1 parent b4d5d21
Lars Op den Kamp opdenkamp authored
12 xbmc/peripherals/devices/Peripheral.cpp
View
@@ -340,7 +340,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, bool bValue)
bool bChanged(boolSetting->GetData() != bValue);
boolSetting->SetData(bValue);
if (bChanged && m_bInitialised)
- m_changedSettings.push_back(strKey);
+ m_changedSettings.insert(strKey);
}
}
}
@@ -356,7 +356,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, int iValue)
bool bChanged(intSetting->GetData() != iValue);
intSetting->SetData(iValue);
if (bChanged && m_bInitialised)
- m_changedSettings.push_back(strKey);
+ m_changedSettings.insert(strKey);
}
}
}
@@ -372,7 +372,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, float fValue)
bool bChanged(floatSetting->GetData() != fValue);
floatSetting->SetData(fValue);
if (bChanged && m_bInitialised)
- m_changedSettings.push_back(strKey);
+ m_changedSettings.insert(strKey);
}
}
}
@@ -405,7 +405,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, const CStdString &strValu
bool bChanged(!stringSetting->GetData().Equals(strValue));
stringSetting->SetData(strValue);
if (bChanged && m_bInitialised)
- m_changedSettings.push_back(strKey);
+ m_changedSettings.insert(strKey);
}
}
else if ((*it).second->GetType() == SETTINGS_TYPE_INT)
@@ -468,7 +468,7 @@ void CPeripheral::PersistSettings(bool bExiting /* = false */)
if (!bExiting)
{
- for (vector<CStdString>::iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); it++)
+ for (set<CStdString>::const_iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); it++)
OnSettingChanged(*it);
}
m_changedSettings.clear();
@@ -499,7 +499,7 @@ void CPeripheral::ResetDefaultSettings(void)
map<CStdString, CSetting *>::iterator it = m_settings.begin();
while (it != m_settings.end())
{
- m_changedSettings.push_back((*it).first);
+ m_changedSettings.insert((*it).first);
++it;
}
4 xbmc/peripherals/devices/Peripheral.h
View
@@ -20,7 +20,7 @@
*
*/
-#include <vector>
+#include <set>
#include "utils/StdString.h"
#include "peripherals/PeripheralTypes.h"
@@ -167,6 +167,6 @@ namespace PERIPHERALS
std::vector<PeripheralFeature> m_features;
std::vector<CPeripheral *> m_subDevices;
std::map<CStdString, CSetting *> m_settings;
- std::vector<CStdString> m_changedSettings;
+ std::set<CStdString> m_changedSettings;
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.