📄 sectorposition.h
字号:
//// Copyright (c) 2003 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#ifndef DXR3PLAYER_DVD_SECTORPOSITION_H#define DXR3PLAYER_DVD_SECTORPOSITION_H//------------------------------------------------------------------------------#include <cstdlib>#include <cstdio>//------------------------------------------------------------------------------namespace dvd {//------------------------------------------------------------------------------/** * Class describing the sector position within a DVD. */class SectorPosition{public: /** * The VTS of the Video Manager */ static const unsigned VTS_VMG = 0; /** * The VTS that indicates that the DVD should exit */ static const unsigned VTS_EXIT = (unsigned)-1;private: /** * Indicate the VTS we are in. 0 stands for the Video Manager, * VTS_EXIT when the DVD has exit. */ unsigned vtsNumber; /** * Indicate if we are in the menu or not. */ bool inMenu; /** * The number of the sector we are in. */ size_t sectorNumber;public: /** * Construct the position with the given values (or their * defaults). */ SectorPosition(unsigned vtsNumber = VTS_VMG, bool inMenu = true, size_t sectorNumber = 0); /** * Reset the position. */ void reset(); /** * Set the VTS number of the position. */ void setVTSNumber(unsigned vtsNo); /** * Get the VTS number. */ unsigned getVTSNumber() const; /** * Set the VTS number to indicate that we should exit. */ void exit(); /** * Determine if the position is in the video manager. */ bool isInVideoManager() const; /** * Determine if we should exit. */ bool atExit() const; /** * Set the in-menu indicator. */ void setInMenu(); /** * Clear the in-menu indicator. */ void clearInMenu(); /** * Determine if the position is in a menu. */ bool isInMenu() const; /** * Set the sector number. */ void setSectorNumber(size_t sectorNo); /** * Get the sector number. */ size_t getSectorNumber() const; /** * Determine if this position is equal to the other one. */ bool equals(const SectorPosition& other) const; /** * Copy this position from the given other one. */ void copy(const SectorPosition& from); /** * Save the sector position to the given file. * * @return if the saving has succeeded */ bool save(FILE* f) const; /** * Load the sector position from the given file. * * @return if the loading has succeeded */ bool load(FILE* f);};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline SectorPosition::SectorPosition(unsigned vtsNumber, bool inMenu, size_t sectorNumber) : vtsNumber(vtsNumber), inMenu(inMenu), sectorNumber(sectorNumber){}//------------------------------------------------------------------------------inline void SectorPosition::setVTSNumber(unsigned vtsNo){ vtsNumber = vtsNo;}//------------------------------------------------------------------------------inline void SectorPosition::exit(){ vtsNumber = VTS_EXIT;}//------------------------------------------------------------------------------inline unsigned SectorPosition::getVTSNumber() const{ return vtsNumber;}//------------------------------------------------------------------------------inline bool SectorPosition::isInVideoManager() const{ return vtsNumber == VTS_VMG;}//------------------------------------------------------------------------------inline bool SectorPosition::atExit() const{ return vtsNumber == VTS_EXIT;}//------------------------------------------------------------------------------inline void SectorPosition::setInMenu(){ inMenu = true;}//------------------------------------------------------------------------------inline void SectorPosition::clearInMenu(){ inMenu = false;}//------------------------------------------------------------------------------inline bool SectorPosition::isInMenu() const{ return inMenu;}//------------------------------------------------------------------------------inline void SectorPosition::setSectorNumber(size_t sectorNo){ sectorNumber = sectorNo;}//------------------------------------------------------------------------------inline size_t SectorPosition::getSectorNumber() const{ return sectorNumber;}//------------------------------------------------------------------------------inline bool operator==(const SectorPosition& p1, const SectorPosition& p2){ return p1.equals(p2);}//------------------------------------------------------------------------------} /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_SECTORPOSITION_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -