---------------------------------------------------------------------
CLASS: ExtentList --JD
PUBLIC METHODS:
ExtentList(size) - Constructor (defaults to room for ten)
error() - returns the error state of the list (inline)
clear() - shrinks and deallocates the list (inline)
append(ext) - appends an entry to the list
insertAt() - inserts an entry at the specified location.
operator[](i) - accesses the ith entry in the list
at() - returns a pointer to the ith entry in the list
remove(n) - removes the nth entry in the list
getCount() - returns the number of entries in the list (inline)
totalBytes() - returns the sum of the entry lengths
USAGE NOTES:
Bounds are checked on operator[], setting the state returned by
error(). If an out of bounds location is accessed, an empty
extent, with contents equal to the default Extent constructor) is
returned.
In general, extents with length > 2^30 should be avoided, because
UDF/ISO disallows them.
----------------------------------------------------------------------
---------------------------------------------------------------------
METHOD: ExtentList::insertAt() --JKH
Adds a copy of the argument item to the list at the specified index.
ARGUMENTS:
UINT32 index IN Where to add item
const Extent& ext IN Item to add to the list
RETURNS: None.
PRECONDITIONS: None.
POSTCONDITIONS:
--A copy of the item will be added to the list.
-----------------------------------------------------------------------------
void
NSR::ExtentList::insertAt(UINT32 index, const Extent& ext)
---------------------------------------------------------------------
METHOD: ExtentList::at() --JKH
Returns a pointer to the specified item given by the argument index
(beginning at 0).
ARGUMENTS:
UINT32 index IN Index of desired list item.
RETURNS:
Returns a pointer to the desired item on success, NULL on error (such as
an index out of range).
PRECONDITIONS:
--Index is in the range [0,# of items in list)
POSTCONDITIONS:
--See return values
-----------------------------------------------------------------------------
NSR::Extent *
NSR::ExtentList::at(UINT32 index)
const NSR::Extent *
NSR::ExtentList::at(UINT32 index) const
NSR::FileSetInfo *
NSR::FileSetList::at(UINT32 index)
const NSR::FileSetInfo *
NSR::FileSetList::at(UINT32 index) const
NSR::VolumeInfo *
NSR::VolumeInfoList::at(UINT32 index)
const NSR::VolumeInfo *
NSR::VolumeInfoList::at(UINT32 index) const
---------------------------------------------------------------------
METHOD: ExtentList::totalBytes() --JKH
Returns the number of bytes in the entire list.
ARGUMENTS: None.
RETURNS: See above.
PRECONDITIONS: None.
POSTCONDITIONS: See above.
-----------------------------------------------------------------------------
NSR::UINT32 NSR::ExtentList::totalBytes() const {
UINT32 total = 0;
for (unsigned i = 0; i < entries(); i++) {
check for overflow; ifso, return max UINT32
if ( total + at(i)->len < total ) {
total = 0xFFFFFFFF;
break;
}
total += at(i)->len;
}
return total;
}
----------------------------------------------------------------------
METHOD: ExtentList::numSectors --DVM
Returns the number of sectors held in the extent list.
----------------------------------------------------------------------
Uses totalBytes() method.
----------------------------------------------------------------------
NSR::UINT32
NSR::ExtentList::numBlocks(UINT32 blockSize) const