beautypg.com

Using virtual binary objects 12 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 514

background image

C H A P T E R 1 2

Special-Purpose Objects for Data Storage and Retrieval

12-8

Using Special-Purpose Data Storage Objects

You can use the

IsSameEntry

function to compare entries and aliases to each

other; this function returns

true

for any two aliases or references to the same

entry. For example:

// return entries that contain "bob" and "Apple"

local myCurs:= namesSoup:Query({ entireWords: true,

words:["Bob", "Apple"]});

local aBob:= myCurs:Entry();

// keep an alias to bob around

local bobAlias := MakeEntryAlias(aBob);

// the following comparison returns true

IsSameEntry(aBob, bobAlias)

The

IsEntryAlias

function returns

true

if its argument is an entry alias, as

shown in the following example:

// return entries that contain "bob" and "Apple"

local myCurs:= namesSoup:Query({ entireWords: true,

words:["Bob", "Apple"]});

// keep an alias to bob around

local bobAlias := MakeEntryAlias(myCurs:Entry());

// the following test returns true

IsEntryAlias(bobAlias);

Using Virtual Binary Objects

12

This section describes how to use a virtual binary object to store binary data that is
too large to fit into the NewtonScript heap. Topics discussed include:

creating compressed or uncompressed VBOs

saving VBOs in soup entries

adding data to VBOs

undoing changes to VBO data

In addition to the subjects discussed here, see “VBO Functions and Methods”
(page 9-74) in Newton Programmer’s Reference for descriptions of VBO utility
functions.

Creating Virtual Binary Objects

12

When you create a VBO, you specify whether its associated binary data is to be
stored in compressed or uncompressed format. Whether you create compressed or
uncompressed VBO objects is a question of space versus speed: uncompressed
data provides faster access, but requires more store space than the equivalent
compressed data.