Introduction

CreamCream is a set of C++ classes designed to provide a fast, lightweight framework for Mac OS scriptable applications that comply with the Apple Event Object Model (AEOM).

Cream Basics

Cream does not use Apple's Object Support Library. In fact, it replaces it entirely. So, the familiar OSL tokens are gone in Cream: they're replaced by first-class C++ objects. Resolving an object specifier does not yield a token, but an object derived from the TScriptableObject mix-in class. OSL accessor callbacks are gone, too. When Cream needs to access a sub-element of a scriptable object, it calls a suitable virtual function of TScriptableObject.

Cream supports all the standard key forms of object specifiers (index, name, unique ID, property, range and test) with very little effort on your application's part. If your scriptable object has properties, you usually need to override only two methods: GetProperty and SetProperty.

If your scriptable object has elements, at the very least you need to override two methods called AccessFirst and AccessNext. Cream will automatically implement access by index, counting, ranges and tests. Of course, you can override more methods to make resolution faster. For example, if your elements support random access, you should override AccessByIndex. If you know the number of elements beforehand, you should override CountElements, and so on.

Cream is especially good at resolving test object specifiers (aka whose clauses). Test object specifiers are turned into C++ objects called searches, used to test whether a candidate object in the search space passes the test or not. Without additional information about the search space, Cream must test each candidate in turn. This can take a long time for search spaces containing thousands of elements, but even in the exhaustive search case, Cream can be significantly faster than the OSL, because resolution of object specifiers is factored out of the search loop as much as possible. And of course, you can create your own custom searches when you know how to look for something in your search spaces without iterating through all the candidates.

The Cream 1.0d10 distribution comes with a demo application (a bare-bones styled text editor) and with a suite of test scripts that exercise various aspects of the scripting implementation.

Downloadable Files

Version History

1998-11-06  1.0d6  First public release
1999-04-22  1.0d7  More forms of whose clauses supported
                   Recompiled with latest Metrowerks C++ compiler
                   Added proportional scrollbars, live scrolling and translucent drags to demo app
                   New sample scripts
2002-01-09  1.0d8  Minor changes for compatibility with CodeWarrior Pro 7, Universal Headers 3.4 and PowerPlant 2.x.
2002-01-09  1.0d9  Carbonized. Tested successfully with Mac OS X 10.1.2 and Mac OS 9.2.2 w/ CarbonLib 1.5
2002-07-01  1.0d10 Removed all dependencies on Jens Alfke's AEGizmos.
                   Tested successfully with the WWDC 2002 prerelease version of Jaguar.

Legalese

Cream is copyrighted by Marco Piovanelli, who reserves all rights on the original source code. Applications may freely incorporate Cream or any portions thereof.