// See method declaration for details. void DrawPrimitivesTaskList::ExtractIndexData(IndexQueue& index_queue) { for(auto i = draw_primitives_tasks.begin(); i != draw_primitives_tasks.end(); ++i) { i->SetBaseIndex(index_queue.size()); i->GetIndexData(index_queue); } }
/* Retrieve the default category/categories from the document */ UInt16 GetDefaultCategories ( DocumentInfo* docInfo ) /* THROWS */ { UInt16 categories; MemHandle handle; Err err; handle = NULL; categories = 0; if ( docInfo->location == RAM ) err = OpenRAMDocument( docInfo ); else err = OpenVFSDocument( docInfo ); THROW_IF( err != errNone, err ); GetIndexData(); ErrTry { Header* categoryRecord; Char* name; UInt16 totalSize; UInt16 size; UInt8 index; handle = FindRecord( CATEGORY_ID, NULL ); if ( handle != NULL ) { categoryRecord = MemHandleLock( handle ); size = 0; totalSize = categoryRecord->size; name = (Char*)( categoryRecord + 1 ); do { index = GetCategoryIndex( name ); if ( index == dmAllCategories ) { index = AddCategoryToFreePosition( name ); } if ( index != dmAllCategories ) categories |= ( 1 << index ); size += StrLen( name ) + 1; name += StrLen( name ) + 1; } while ( size < totalSize ); MemHandleUnlock( handle ); FreeRecordHandle( &handle ); } else { categories = 0; } } ErrCatch( UNUSED_PARAM( err ) ) { categories = 0; } ErrEndCatch if ( docInfo->location == RAM ) { CloseRAMDocument(); } else { if ( handle != NULL ) MemHandleFree( handle ); CloseVFSDocument(); } if ( categories == 0 ) return UNFILED_CATEGORY; else return categories; }
/* Return the publication date if found in the doc; returns 0xFFFF if not found */ UInt32 GetPublicationDate ( DocumentInfo* docInfo ) /* THROWS */ { Err err; UInt32 date; MemHandle handle; handle = NULL; date = 0xffff; if ( docInfo->location == RAM ) err = OpenRAMDocument( docInfo ); else err = OpenVFSDocument( docInfo ); THROW_IF( err != errNone, err ); GetIndexData(); ErrTry { handle = FindRecord( METADATA_ID, NULL ); if ( handle != NULL ) { Header* metaHeader; UInt16 numOfRecords; MetadataElementHeader* metadata; metaHeader = MemHandleLock( handle ); THROW_IF( metaHeader->type != DATATYPE_METADATA, dmErrCorruptDatabase ); numOfRecords = *( (UInt16*)( metaHeader + 1) ); metadata = (MetadataElementHeader*)( ((UInt16*)( metaHeader + 1 )) + 1 ); while ( 0 < numOfRecords-- ) { if ( metadata->typecode == METADATA_PUBLICATION_DATE ) { date = *( (UInt32*)( metadata->argument )); break; } else { /* advance to the next metadata record */ metadata = NEXT_METADATA_RECORD( metadata ); } } MemHandleUnlock( handle ); FreeRecordHandle( &handle ); } } ErrCatch( UNUSED_PARAM( err ) ) { date = 0xffff; } ErrEndCatch if ( docInfo->location == RAM ) { CloseRAMDocument(); } else { if ( handle != NULL ) MemHandleFree( handle ); CloseVFSDocument(); } return date; }