1/* 2 * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include "TargetAddressTableColumn.h" 8 9#include <stdio.h> 10 11 12TargetAddressTableColumn::TargetAddressTableColumn(int32 modelIndex, 13 const char* title, float width, float minWidth, float maxWidth, 14 uint32 truncate, alignment align) 15 : 16 StringTableColumn(modelIndex, title, width, minWidth, maxWidth, truncate, 17 align) 18{ 19} 20 21 22BField* 23TargetAddressTableColumn::PrepareField(const BVariant& value) const 24{ 25 char buffer[64]; 26 snprintf(buffer, sizeof(buffer), "%#" B_PRIx64, value.ToUInt64()); 27 28 return StringTableColumn::PrepareField( 29 BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); 30} 31 32 33int 34TargetAddressTableColumn::CompareValues(const BVariant& a, const BVariant& b) 35{ 36 uint64 valueA = a.ToUInt64(); 37 uint64 valueB = b.ToUInt64(); 38 return valueA < valueB ? -1 : (valueA == valueB ? 0 : 1); 39} 40