Apple Newton Utilities User's Guide Page 512

  • Download
  • Add to my manuals
  • Print
  • Page
    / 942
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 511
CHAPTER 12
Special-Purpose Objects for Data Storage and Retrieval
12-6 About Special-Purpose Storage Objects
// create new mock entry w/ no cached frame
local m := NewMockEntry(myHandler, nil);
// referencing m doesn’t create cached frame
local x := m;
// either statement could invoke myHandler:EntryAccess()
local a := x.foo;
local b := m.foo;
To almost all of the system, the mock entry appears to be a normal soup entry;
for example:
m.foo evaluates to 'bar
ClassOf(m) is 'frame
m.baz := 42 adds a slot to the handler.object frame and this modified
frame is returned the next time the mock entry is accessed.
Only the
IsMockEntry global function can determine that m is a mock entry,
rather than a soup entry. Note that the
IsSoupEntry function returns true for
both mock entries and normal soup entries.
Mock Stores, Mock Soups, and Mock Cursors 12
The current implementation of the Newton object system provides only mock
entries; you must implement appropriate mock cursors, mock soups, and mock
stores as required.
The mock store is a frame you supply which responds appropriately to all the
messages that might normally be sent to a store object. For example, when the
mock store’s
GetSoup method is invoked, it should return a mock soup.
The mock soup is a frame you supply which responds appropriately to all the
messages that might normally be sent to a soup object. For example, when the
mock soup’s
Query method is called, the mock soup should return a mock cursor.
Mock soups cannot participate in union soups; however, you can implement your
own mock union soup objects that manage the interaction of your mock soups with
normal soups or union soups.
A mock cursor is a frame you supply that can respond appropriately to all the
messages that might normally be sent to a cursor object. For example, when the
mock cursor’s
Entry method is invoked, it should return a mock entry.
Page view 511
1 2 ... 507 508 509 510 511 512 513 514 515 516 517 ... 941 942

Comments to this Manuals

No comments