Skip to content

Commit

Permalink
More use of references and QLatin1String
Browse files Browse the repository at this point in the history
  • Loading branch information
manup committed Feb 1, 2017
1 parent fac4866 commit b6657d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ const QString Group::midsToString() const
result.append(*i);
if (i != end-1)
{
result.append(",");
result.append(QLatin1String(","));
}
}

return result;
}

/*! multiDeviceIds String to vector. */
void Group::setMidsFromString(const QString mids)
void Group::setMidsFromString(const QString &mids)
{
QStringList list = mids.split(",", QString::SkipEmptyParts);
QStringList list = mids.split(QLatin1String(","), QString::SkipEmptyParts);

QStringList::const_iterator i = list.begin();
QStringList::const_iterator end = list.end();
Expand All @@ -148,7 +148,7 @@ void Group::setMidsFromString(const QString mids)
/*! deviceMembership to string. */
const QString Group::dmToString() const
{
QString result = "";
QString result(QLatin1String(""));

std::vector<QString>::const_iterator i = m_deviceMemberships.begin();
std::vector<QString>::const_iterator end = m_deviceMemberships.end();
Expand All @@ -166,9 +166,9 @@ const QString Group::dmToString() const
}

/*! deviceMembership String to vector. */
void Group::setDmFromString(const QString deviceIds)
void Group::setDmFromString(const QString &deviceIds)
{
QStringList list = deviceIds.split(",", QString::SkipEmptyParts);
QStringList list = deviceIds.split(QLatin1String(","), QString::SkipEmptyParts);

QStringList::const_iterator i = list.begin();
QStringList::const_iterator end = list.end();
Expand All @@ -182,7 +182,7 @@ void Group::setDmFromString(const QString deviceIds)
/*! lightsequence to string. */
const QString Group::lightsequenceToString() const
{
QString result = "";
QString result(QLatin1String(""));

std::vector<QString>::const_iterator i = m_lightsequence.begin();
std::vector<QString>::const_iterator end = m_lightsequence.end();
Expand All @@ -192,17 +192,17 @@ const QString Group::lightsequenceToString() const
result.append(*i);
if (i != end-1)
{
result.append(",");
result.append(QLatin1String(","));
}
}

return result;
}

/*! lightsequence String to vector. */
void Group::setLightsequenceFromString(const QString lightsequence)
void Group::setLightsequenceFromString(const QString &lightsequence)
{
QStringList list = lightsequence.split(",", QString::SkipEmptyParts);
QStringList list = lightsequence.split(QLatin1String(","), QString::SkipEmptyParts);

QStringList::const_iterator i = list.begin();
QStringList::const_iterator end = list.end();
Expand Down
6 changes: 3 additions & 3 deletions group.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class Group
void setColorLoopActive(bool colorLoopActive);
bool isColorLoopActive() const;
const QString midsToString() const;
void setMidsFromString(const QString mids);
void setMidsFromString(const QString &mids);
const QString dmToString() const;
void setDmFromString(const QString deviceIds);
void setDmFromString(const QString &deviceIds);
const QString lightsequenceToString() const;
void setLightsequenceFromString(const QString deviceIds);
void setLightsequenceFromString(const QString &deviceIds);
Scene *getScene(quint8 sceneId);
bool addDeviceMembership(const QString &id);

Expand Down

0 comments on commit b6657d7

Please sign in to comment.