diff options
Diffstat (limited to 'recman.cpp')
-rw-r--r-- | recman.cpp | 57 |
1 files changed, 29 insertions, 28 deletions
@@ -14,18 +14,19 @@ #define INDEXFILESUFFIX "/index.vdr" #define LENGTHFILESUFFIX "/length.vdr" -using namespace std::tr1; -using namespace std; +using std::string; +using std::vector; +using std::pair; namespace vdrlive { /** * Implementation of class RecordingsManager: */ - weak_ptr< RecordingsManager > RecordingsManager::m_recMan; - shared_ptr< RecordingsTree > RecordingsManager::m_recTree; - shared_ptr< RecordingsList > RecordingsManager::m_recList; - shared_ptr< DirectoryList > RecordingsManager::m_recDirs; + std::tr1::weak_ptr< RecordingsManager > RecordingsManager::m_recMan; + std::tr1::shared_ptr< RecordingsTree > RecordingsManager::m_recTree; + std::tr1::shared_ptr< RecordingsList > RecordingsManager::m_recList; + std::tr1::shared_ptr< DirectoryList > RecordingsManager::m_recDirs; time_t RecordingsManager::m_recordingsState = 0; string RecordingsManager::m_UpdateFileName; @@ -35,7 +36,7 @@ namespace vdrlive { // use any longer, it will be freed automaticaly, which leads to a // release of the VDR recordings lock. Upon requesting access to // the RecordingsManager via LiveRecordingsManger function, first - // the weak ptr is locked (obtaining a shared_ptr from an possible + // the weak ptr is locked (obtaining a std::tr1::shared_ptr from an possible // existing instance) and if not successfull a new instance is // created, which again locks the VDR Recordings. // @@ -58,7 +59,7 @@ namespace vdrlive { { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsTreePtr(recMan, shared_ptr< RecordingsTree >()); + return RecordingsTreePtr(recMan, std::tr1::shared_ptr< RecordingsTree >()); } return RecordingsTreePtr(recMan, m_recTree); } @@ -67,25 +68,25 @@ namespace vdrlive { { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >()); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >()); } - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); } RecordingsListPtr RecordingsManager::GetRecordingsList(time_t begin, time_t end, bool ascending) const { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >()); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >()); } - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); } DirectoryListPtr RecordingsManager::GetDirectoryList() const { RecordingsManagerPtr recMan = EnsureValidData(); if (!recMan) { - return DirectoryListPtr(recMan, shared_ptr< DirectoryList >()); + return DirectoryListPtr(recMan, std::tr1::shared_ptr< DirectoryList >()); } return DirectoryListPtr(recMan, m_recDirs); } @@ -211,7 +212,7 @@ namespace vdrlive { if (archiveType==1) { string dvdFile = filename + "/dvd.vdr"; - ifstream dvd(dvdFile.c_str()); + std::ifstream dvd(dvdFile.c_str()); if (dvd) { string archiveDisc; @@ -225,7 +226,7 @@ namespace vdrlive { } } else if(archiveType==2) { string hddFile = filename + "/hdd.vdr"; - ifstream hdd(hddFile.c_str()); + std::ifstream hdd(hddFile.c_str()); if (hdd) { string archiveDisc; @@ -274,7 +275,7 @@ namespace vdrlive { RecordingsManagerPtr RecordingsManager::EnsureValidData() { // Get singleton instance of RecordingsManager. 'this' is not - // an instance of shared_ptr of the singleton + // an instance of std::tr1::shared_ptr of the singleton // RecordingsManager, so we obtain it in the overall // recommended way. RecordingsManagerPtr recMan = LiveRecordingsManager(); @@ -298,21 +299,21 @@ namespace vdrlive { m_recDirs.reset(); } if (stateChanged || !m_recTree) { - m_recTree = shared_ptr< RecordingsTree >(new RecordingsTree(recMan)); + m_recTree = std::tr1::shared_ptr< RecordingsTree >(new RecordingsTree(recMan)); } if (!m_recTree) { esyslog("[LIVE]: creation of recordings tree failed!"); return RecordingsManagerPtr(); } if (stateChanged || !m_recList) { - m_recList = shared_ptr< RecordingsList >(new RecordingsList(RecordingsTreePtr(recMan, m_recTree))); + m_recList = std::tr1::shared_ptr< RecordingsList >(new RecordingsList(RecordingsTreePtr(recMan, m_recTree))); } if (!m_recList) { esyslog("[LIVE]: creation of recordings list failed!"); return RecordingsManagerPtr(); } if (stateChanged || !m_recDirs) { - m_recDirs = shared_ptr< DirectoryList >(new DirectoryList(recMan)); + m_recDirs = std::tr1::shared_ptr< DirectoryList >(new DirectoryList(recMan)); } if (!m_recDirs) { esyslog("[LIVE]: creation of directory list failed!"); @@ -546,13 +547,13 @@ namespace vdrlive { * Implementation of class RecordingsTreePtr: */ RecordingsTreePtr::RecordingsTreePtr() : - shared_ptr<RecordingsTree>(), + std::tr1::shared_ptr<RecordingsTree>(), m_recManPtr() { } RecordingsTreePtr::RecordingsTreePtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< RecordingsTree > recTree) : - shared_ptr<RecordingsTree>(recTree), + std::tr1::shared_ptr<RecordingsTree>(recTree), m_recManPtr(recManPtr) { } @@ -572,7 +573,7 @@ namespace vdrlive { return; } - stack< RecordingsItemPtr > treeStack; + std::stack< RecordingsItemPtr > treeStack; treeStack.push(recTree->Root()); while (!treeStack.empty()) { @@ -590,7 +591,7 @@ namespace vdrlive { } } - RecordingsList::RecordingsList(shared_ptr< RecordingsList > recList, bool ascending) : + RecordingsList::RecordingsList(std::tr1::shared_ptr< RecordingsList > recList, bool ascending) : m_pRecVec(new RecVecType(recList->size())) { if (!m_pRecVec) { @@ -604,7 +605,7 @@ namespace vdrlive { } } - RecordingsList::RecordingsList(shared_ptr< RecordingsList > recList, time_t begin, time_t end, bool ascending) : + RecordingsList::RecordingsList(std::tr1::shared_ptr< RecordingsList > recList, time_t begin, time_t end, bool ascending) : m_pRecVec(new RecVecType()) { if (end > begin) { @@ -646,8 +647,8 @@ namespace vdrlive { /** * Implementation of class RecordingsList: */ - RecordingsListPtr::RecordingsListPtr(RecordingsManagerPtr recManPtr, shared_ptr< RecordingsList > recList) : - shared_ptr< RecordingsList >(recList), + RecordingsListPtr::RecordingsListPtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< RecordingsList > recList) : + std::tr1::shared_ptr< RecordingsList >(recList), m_recManPtr(recManPtr) { } @@ -716,8 +717,8 @@ namespace vdrlive { /** * Implementation of class DirectoryListPtr: */ - DirectoryListPtr::DirectoryListPtr(RecordingsManagerPtr recManPtr, shared_ptr< DirectoryList > recDirs) : - shared_ptr< DirectoryList >(recDirs), + DirectoryListPtr::DirectoryListPtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< DirectoryList > recDirs) : + std::tr1::shared_ptr< DirectoryList >(recDirs), m_recManPtr(recManPtr) { } |