void BoxImpl::full_allocate(AllocationInfo& info) { Canvas* c = info.canvas(); GlyphIndex n = box_->count(); Allocation* a = info.component_allocations(); Requisition* r = new Requisition[n]; GlyphIndex i; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { g->request(r[i]); } } layout_->allocate(info.allocation(), n, r, a); delete [] r; Extension& box = info.extension(); Extension child; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { child.clear(); g->allocate(c, a[i], child); box.merge(child); } } }
// GetAllocationInfo void Attribute::GetAllocationInfo(AllocationInfo &info) { DataContainer::GetAllocationInfo(info); info.AddAttributeAllocation(GetSize()); info.AddStringAllocation(fName.GetLength()); }
// GetAllocationInfo void Entry::GetAllocationInfo(AllocationInfo &info) { info.AddEntryAllocation(); info.AddStringAllocation(fName.GetLength()); fNode->GetAllocationInfo(info); }
void Box::allotment(GlyphIndex index, DimensionName d, Allotment& a) const { AllocationTable* table = impl_->allocations_; if (table != nil) { AllocationInfo* info = table->most_recent(); if (info != nil) { Allocation* allocations = info->component_allocations(); a = allocations[index].allotment(d); } } }
// GetAllocationInfo void NodeTable::GetAllocationInfo(AllocationInfo &info) { info.AddNodeTableAllocation(fNodes.ArraySize(), fNodes.VectorSize(), sizeof(NodeHashElement), fNodes.CountElements()); }
// GetAllocationInfo void Volume::GetAllocationInfo(AllocationInfo &info) { // tables info.AddOtherAllocation(sizeof(NodeTable)); fNodeTable->GetAllocationInfo(info); info.AddOtherAllocation(sizeof(DirectoryEntryTable)); fDirectoryEntryTable->GetAllocationInfo(info); info.AddOtherAllocation(sizeof(NodeAttributeTable)); fNodeAttributeTable->GetAllocationInfo(info); // node hierarchy fRootDirectory->GetAllocationInfo(info); // name info.AddStringAllocation(fName.GetLength()); // block allocator info.AddOtherAllocation(sizeof(BlockAllocator)); fBlockAllocator->GetAllocationInfo(info); }
void BoxImpl::offset_allocate(AllocationInfo& info, Coord dx, Coord dy) { Canvas* c = info.canvas(); Allocation* a = info.component_allocations(); Extension& box = info.extension(); Extension child; GlyphIndex n = box_->count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { Allocation& a_i = a[i]; Allotment& ax = a_i.x_allotment(); Allotment& ay = a_i.y_allotment(); ax.offset(dx); ay.offset(dy); child.clear(); g->allocate(c, a_i, child); box.merge(child); } } }
AllocationInfo& BoxImpl::info(Canvas* c, const Allocation& a, Extension& ext) { if (allocations_ == nil) { allocations_ = new AllocationTable(box_->count()); } AllocationInfo* info = allocations_->find(c, a); if (info == nil) { Coord dx, dy; info = allocations_->find_same_size(c, a, dx, dy); if (info != nil) { info->extension(ext); offset_allocate(*info, dx, dy); } else { info = allocations_->allocate(c, a); info->extension(ext); full_allocate(*info); } } ext = info->extension(); return *info; }
// GetAllocationInfo void File::GetAllocationInfo(AllocationInfo &info) { info.AddFileAllocation(GetSize()); }
// GetAllocationInfo void SymLink::GetAllocationInfo(AllocationInfo &info) { info.AddSymLinkAllocation(GetSize()); }