Skip to content

Commit

Permalink
Don't include all of the standard namespace. (mythfrontend)
Browse files Browse the repository at this point in the history
Including all of the standard namespace is considered bad practice. It
defeats the purpose of namespaces, and pollutes the global name table.
  • Loading branch information
linuxdude42 committed Oct 2, 2020
1 parent b233bfb commit 49779fb
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 69 deletions.
9 changes: 4 additions & 5 deletions mythtv/programs/mythfrontend/channelrecpriority.cpp
Expand Up @@ -3,7 +3,6 @@

#include <algorithm> // For std::sort()
#include <vector> // For std::vector
using namespace std;

#include "tv.h"

Expand Down Expand Up @@ -350,9 +349,9 @@ void ChannelRecPriority::SortList()

int i = 0;
int j = 0;
vector<RecPriorityInfo> sortingList;
std::vector<RecPriorityInfo> sortingList;
QMap<QString, ChannelInfo>::iterator pit;
vector<RecPriorityInfo>::iterator sit;
std::vector<RecPriorityInfo>::iterator sit;

// copy m_channelData into sortingList
for (i = 0, pit = m_channelData.begin(); pit != m_channelData.end();
Expand All @@ -366,12 +365,12 @@ void ChannelRecPriority::SortList()
switch(m_sortType)
{
case byRecPriority:
sort(sortingList.begin(), sortingList.end(),
std::sort(sortingList.begin(), sortingList.end(),
channelRecPrioritySort());
break;
case byChannel:
default:
sort(sortingList.begin(), sortingList.end(),
std::sort(sortingList.begin(), sortingList.end(),
channelSort());
break;
}
Expand Down
12 changes: 6 additions & 6 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -2307,7 +2307,7 @@ static HostComboBoxSetting *GuiVidModeResolution()
"watching a video."));

MythDisplay* display = MythDisplay::AcquireRelease();
vector<MythDisplayMode> scr = display->GetVideoModes();
std::vector<MythDisplayMode> scr = display->GetVideoModes();
MythDisplay::AcquireRelease(false);
for (auto & vmode : scr)
{
Expand Down Expand Up @@ -2357,7 +2357,7 @@ static HostComboBoxSetting *TVVidModeResolution(int idx=-1)
gc->setHelpText(hstr);

MythDisplay* display = MythDisplay::AcquireRelease();
vector<MythDisplayMode> scr = display->GetVideoModes();
std::vector<MythDisplayMode> scr = display->GetVideoModes();
MythDisplay::AcquireRelease(false);
for (auto & vmode : scr)
{
Expand All @@ -2377,7 +2377,7 @@ void HostRefreshRateComboBoxSetting::ChangeResolution(StandardSetting * setting)
QString resolution = setting->getValue();
int hz50 = -1;
int hz60 = -1;
const vector<double> list = GetRefreshRates(resolution);
const std::vector<double> list = GetRefreshRates(resolution);
addSelection(QObject::tr("Auto"), "0");
for (size_t i = 0; i < list.size(); ++i)
{
Expand All @@ -2403,7 +2403,7 @@ void HostRefreshRateComboBoxSetting::ChangeResolution(StandardSetting * setting)
setEnabled(!list.empty());
}

vector<double> HostRefreshRateComboBoxSetting::GetRefreshRates(const QString &res)
std::vector<double> HostRefreshRateComboBoxSetting::GetRefreshRates(const QString &res)
{
QStringList slist = res.split("x");
int width = 0;
Expand All @@ -2416,7 +2416,7 @@ vector<double> HostRefreshRateComboBoxSetting::GetRefreshRates(const QString &re
height = slist[1].toInt(&ok1);
}

vector<double> result;
std::vector<double> result;
if (ok0 && ok1)
{
QSize size(width, height);
Expand Down Expand Up @@ -4626,7 +4626,7 @@ AppearanceSettings::AppearanceSettings()
MythDisplay* display = MythDisplay::AcquireRelease();
if (display->VideoModesAvailable())
{
vector<MythDisplayMode> scr = display->GetVideoModes();
std::vector<MythDisplayMode> scr = display->GetVideoModes();
if (!scr.empty())
addChild(UseVideoModes());
}
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/grabbersettings.cpp
Expand Up @@ -15,8 +15,6 @@
#include "metadatacommon.h"
#include "grabbersettings.h"

using namespace std;

// ---------------------------------------------------

bool GrabberSettings::Create()
Expand Down
15 changes: 7 additions & 8 deletions mythtv/programs/mythfrontend/guidegrid.cpp
Expand Up @@ -5,7 +5,6 @@
#include <algorithm>
#include <cstdint> // for uint64_t
#include <deque> // for _Deque_iterator, operator!=, etc
using namespace std;

//qt
#include <QCoreApplication>
Expand Down Expand Up @@ -576,9 +575,9 @@ void GuideGrid::Load(void)
LoadFromScheduler(m_recList);
fillChannelInfos();

int maxchannel = max((int)GetChannelCount() - 1, 0);
int maxchannel = std::max((int)GetChannelCount() - 1, 0);
setStartChannel((int)(m_currentStartChannel) - (m_channelCount / 2));
m_channelCount = min(m_channelCount, maxchannel + 1);
m_channelCount = std::min(m_channelCount, maxchannel + 1);

for (int y = 0; y < m_channelCount; ++y)
{
Expand Down Expand Up @@ -1409,7 +1408,7 @@ void GuideGrid::fillChannelInfos(bool gotostartchannel)
if (gotostartchannel)
{
int ch = FindChannel(m_startChanID, m_startChanNum, false);
m_currentStartChannel = (uint) max(0, ch);
m_currentStartChannel = (uint) std::max(0, ch);
}

if (m_channelInfos.empty())
Expand Down Expand Up @@ -1551,8 +1550,8 @@ void GuideGrid::fillProgramRowInfos(int firstRow, bool useExistingData)
{
firstRow = 0;
allRows = true;
numRows = min((unsigned int)m_channelInfos.size(),
(unsigned int)m_guideGrid->getChannelCount());
numRows = std::min((unsigned int)m_channelInfos.size(),
(unsigned int)m_guideGrid->getChannelCount());
}
QVector<int> chanNums;
QVector<ProgramList*> proglists;
Expand Down Expand Up @@ -2230,8 +2229,8 @@ void GuideGrid::generateListings()

int maxchannel = 0;
fillChannelInfos();
maxchannel = max((int)GetChannelCount() - 1, 0);
m_channelCount = min(m_guideGrid->getChannelCount(), maxchannel + 1);
maxchannel = std::max((int)GetChannelCount() - 1, 0);
m_channelCount = std::min(m_guideGrid->getChannelCount(), maxchannel + 1);

LoadFromScheduler(m_recList);
fillProgramInfos();
Expand Down
11 changes: 4 additions & 7 deletions mythtv/programs/mythfrontend/guidegrid.h
Expand Up @@ -6,7 +6,6 @@
#include <list>
#include <utility>
#include <vector>
using namespace std;

// qt
#include <QString>
Expand All @@ -26,16 +25,14 @@ using namespace std;
// mythfrontend
#include "schedulecommon.h"

using namespace std;

class ProgramInfo;
class QTimer;
class MythUIButtonList;
class MythUIGuideGrid;

using db_chan_list_t = vector<ChannelInfo> ;
using db_chan_list_list_t = vector<db_chan_list_t>;
using ProgInfoGuideArray = array<array<ProgramInfo *,MAX_DISPLAY_TIMES>,MAX_DISPLAY_CHANS>;
using db_chan_list_t = std::vector<ChannelInfo> ;
using db_chan_list_list_t = std::vector<db_chan_list_t>;
using ProgInfoGuideArray = std::array<std::array<ProgramInfo *,MAX_DISPLAY_TIMES>,MAX_DISPLAY_CHANS>;

class JumpToChannel;
class JumpToChannelListener
Expand Down Expand Up @@ -244,7 +241,7 @@ class GuideGrid : public ScheduleCommon, public JumpToChannelListener
db_chan_list_list_t m_channelInfos;
QMap<uint,uint> m_channelInfoIdx;

vector<ProgramList*> m_programs;
std::vector<ProgramList*> m_programs;
ProgInfoGuideArray m_programInfos {};
ProgramList m_recList;

Expand Down
9 changes: 4 additions & 5 deletions mythtv/programs/mythfrontend/main.cpp
Expand Up @@ -4,7 +4,6 @@
#include <fcntl.h>
#include <iostream>
#include <memory>
using namespace std;

#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -1748,15 +1747,15 @@ static bool WasAutomaticStart(void)
// to record, to obtain guide data or or for a
// daily wakeup/shutdown period
if (abs(startupTime.secsTo(MythDate::current())) <
max(startupSecs, 15 * 60))
std::max(startupSecs, 15 * 60))
{
LOG(VB_GENERAL, LOG_INFO,
"Close to auto-start time, AUTO-Startup assumed");

QString str = gCoreContext->GetSetting("MythFillSuggestedRunTime");
QDateTime guideRunTime = MythDate::fromString(str);
if (guideRunTime.secsTo(MythDate::current()) <
max(startupSecs, 15 * 60))
std::max(startupSecs, 15 * 60))
{
LOG(VB_GENERAL, LOG_INFO,
"Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
Expand Down Expand Up @@ -1899,7 +1898,7 @@ int main(int argc, char **argv)
bBypassAutoDiscovery = true;

if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
cerr << "Unable to ignore SIGPIPE\n";
std::cerr << "Unable to ignore SIGPIPE\n";

if (!cmdline.toString("geometry").isEmpty())
MythMainWindow::ParseGeometryOverride(cmdline.toString("geometry"));
Expand Down Expand Up @@ -2108,7 +2107,7 @@ int main(int argc, char **argv)
fe_sd_notify("STATUS=Loading theme updates");
std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
if (gCoreContext->GetBoolSetting("ThemeUpdateNofications", true))
themeUpdateChecker = make_unique<ThemeUpdateChecker>();
themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();

MythSystemEventHandler sysEventHandler {};

Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/networkcontrol.h
Expand Up @@ -2,7 +2,6 @@
#define NETWORKCONTROL_H_

#include <deque>
using namespace std;

#include <QWaitCondition>
#include <QStringList>
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfrontend/playbackbox.cpp
Expand Up @@ -1721,7 +1721,7 @@ bool PlaybackBox::UpdateUILists(void)
bool isDeletedGroup = (m_recGroup == "Deleted");
bool isLiveTvGroup = (m_recGroup == "LiveTV");

vector<ProgramInfo*> list;
std::vector<ProgramInfo*> list;
bool newest_first = (0==m_allOrder);
m_programInfoCache.GetOrdered(list, newest_first);
for (auto *p : list)
Expand Down Expand Up @@ -4284,7 +4284,7 @@ void PlaybackBox::customEvent(QEvent *event)
ProgramInfo *pginfo = FindProgramInUILists(recordingID);
if (pginfo)
{
pginfo->SetFilesize(max(pginfo->GetFilesize(), fs));
pginfo->SetFilesize(std::max(pginfo->GetFilesize(), fs));
old_avail = pginfo->GetAvailableStatus();
pginfo->SetAvailableStatus(availableStatus, "AVAILABILITY");
}
Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/playbackbox.h
Expand Up @@ -8,7 +8,6 @@
#include <deque>
#include <utility>
#include <vector>
using namespace std;

#include <QStringList>
#include <QDateTime>
Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/playbackboxhelper.cpp
@@ -1,5 +1,4 @@
#include <algorithm>
using namespace std;

#include <QCoreApplication>
#include <QStringList>
Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/prevreclist.cpp
Expand Up @@ -23,7 +23,6 @@
#include <algorithm>
#include <deque> // for _Deque_iterator, operator-, etc
#include <iterator> // for reverse_iterator
using namespace std;

// QT
#include <QDateTime>
Expand Down
3 changes: 1 addition & 2 deletions mythtv/programs/mythfrontend/proglist.cpp
Expand Up @@ -6,7 +6,6 @@
#include <functional>
#include <deque> // for _Deque_iterator, operator-, etc
#include <iterator> // for reverse_iterator
using namespace std;

// Qt
#include <QCoreApplication>
Expand Down Expand Up @@ -992,7 +991,7 @@ void ProgLister::FillViewList(const QString &view)
m_curView = m_viewList.size() - 1;
}

class plCompare : binary_function<const ProgramInfo*, const ProgramInfo*, bool>
class plCompare : std::binary_function<const ProgramInfo*, const ProgramInfo*, bool>
{
public:
virtual bool operator()(const ProgramInfo*, const ProgramInfo*) = 0;
Expand Down
5 changes: 2 additions & 3 deletions mythtv/programs/mythfrontend/programinfocache.h
Expand Up @@ -6,7 +6,6 @@
// C++ headers
#include <cstdint>
#include <vector>
using namespace std;

// Qt headers
#include <QWaitCondition>
Expand Down Expand Up @@ -37,7 +36,7 @@ class ProgramInfoCache
bool Update(const ProgramInfo &pginfo);
bool UpdateFileSize(uint recordingID, uint64_t filesize);
QString GetRecGroup(uint recordingID) const;
void GetOrdered(vector<ProgramInfo*> &list, bool newest_first = false);
void GetOrdered(std::vector<ProgramInfo*> &list, bool newest_first = false);
/// \note This must only be called from the UI thread.
bool empty(void) const { return m_cache.empty(); }
ProgramInfo *GetRecordingInfo(uint recordingID) const;
Expand All @@ -56,7 +55,7 @@ class ProgramInfoCache

mutable QMutex m_lock;
Cache m_cache;
vector<ProgramInfo*> *m_nextCache {nullptr};
std::vector<ProgramInfo*> *m_nextCache {nullptr};
QObject *m_listener {nullptr};
bool m_loadIsQueued {false};
uint m_loadsInProgress {0};
Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/programrecpriority.cpp
Expand Up @@ -4,7 +4,6 @@

// C/C++ headers
#include <vector> // For std::vector
using namespace std;

// QT headers
#include <QDateTime>
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/statusbox.cpp
@@ -1,8 +1,6 @@

#include "statusbox.h"

using namespace std;

#include <QRegExp>
#include <QHostAddress>
#include <QNetworkInterface>
Expand Down
3 changes: 1 addition & 2 deletions mythtv/programs/mythfrontend/statusbox.h
Expand Up @@ -11,7 +11,6 @@
// Std
#include <utility>
#include <vector> // For std::vector
using namespace std;

class ProgramInfo;
class MythUIText;
Expand Down Expand Up @@ -85,7 +84,7 @@ class StatusBox : public MythScreenType

recprof2bps_t m_recordingProfilesBps;

vector<ProgramInfo *> m_expList;
std::vector<ProgramInfo *> m_expList;

MythScreenStack *m_popupStack {nullptr};

Expand Down

0 comments on commit 49779fb

Please sign in to comment.