classes(3U)

πŸ’– classes(3U) β€” InterViews Reference Manual πŸ’–

okay so bestie, welcome to the classes page. it's giving unique identifiers for catalog-managed objects and component views, and honestly? iconic. ✨

πŸ’… NAME πŸ’…

classes β€” unique identifiers for catalog-managed objects and component views 🫢

✨ SYNOPSIS ✨

#include <Unidraw/classes.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first thing: classes for catalog-managed objects β€” and yes, that includes components, commands, tools, state variables, and transfer functions β€” have to be associated with mutually-unique class identifiers that can be written onto disk. why? because it lets a creator object call the appropriate constructor as part of recreating an object from disk. periodt. πŸ’Ύβœ¨

also, there has to be a mechanism for creating an appropriate view given a subject. like, there must be an association between a subject class and the allowable view classes for that subject. that association is established by defining class identifiers for component views. these identifiers are formed by concatenating the identifier for a given component subject class with an identifier that specifies a view category. for example, the class identifier for the PostScript external view of a line component is the concatenation of the identifier for the line component subject class and the POSTSCRIPT_VIEW identifier, which specifies the category of external views for generating PostScript. this makes it possible to create an instance of the appropriate PostScript external view subclass given a line component subject. slay. 🎨

the class identifiers for the Unidraw base and predefined derived classes are specified in the classes.h include file. applications that define new catalog-managed objects or component views should define unique class identifiers in a similar manner. class identifiers for catalog-managed objects are simply integers with mnemonic macro definitions, usually the class name in all-uppercase. for example, the identifier for the LineComp component subject class is:

#define LINE_COMP 9030

view class identifiers are specified using the Combine macro. its first argument is the macro definition of the corresponding component subject identifier; its second argument is an identifier for the view category. the Combine macro itself is then defined with a mnemonic name. for example, the identifier for the PostScript external view class PSLine (which generates PostScript for the line component subject) is defined as:

#define PS_LINE Combine(LINE_COMP, POSTSCRIPT_VIEW)

where the POSTSCRIPT_VIEW view category identifier is defined as:

#define POSTSCRIPT_VIEW 9103
⚠️ N.B.: All class identifiers in a given application must be unique. no cap, this one is serious. πŸ’€

🌈 SEE ALSO 🌈

Catalog(3U), Creator(3U) β€” go read those too, bestie πŸ“šπŸ’–

kisses, Unidraw πŸ’… β€” 12 June 1990 πŸŽ€