home *** CD-ROM | disk | FTP | other *** search
- /*
- IXAttributeParser.h
- Copyright 1991, NeXT Computer, Inc.
- */
-
- #import <objc/Object.h>
- #import <objc/hashtable.h>
- #import <dpsclient/dpsclient.h>
-
- #import "protocols.h"
-
- @class List, IXAttributeBinder, IXFileConverter, IXWeightingDomain;
-
- // These atoms define standard attributes generated by the attribute parser.
-
- extern NXAtom IXDefaultAttribute;
- extern NXAtom IXContentAttribute;
-
- // These atoms define pasteboard types used by the attribute parser. The
- // former is the for the tokenized format produced by attribute readers. The
- // latter is for file descriptions generated by pasteboard file filters.
-
- extern NXAtom IXAttributeReaderPboardType;
- extern NXAtom IXFileDescriptionPboardType;
-
- // These are the types of weighting applied to tokens by the attribute parser.
- // Absolute weighting produces weights representing the number of occurrences
- // of the token. Frequency weighting produces weights representing the count
- // divided by the total number of tokens in the sample. Peculiarity weighting
- // produces weights representing the frequency relative to a weighting domain.
-
- typedef enum {
- IX_NoWeighting = 0,
- IX_AbsoluteWeighting, IX_FrequencyWeighting, IX_PeculiarityWeighting
- } IXWeightingType;
-
- @interface IXAttributeParser: Object <IXAttributeBinding>
- {
- BOOL _tokenUniquing;
- NXHashTable *_sourceTypes;
- id _attributeBinder;
- id _fileConverter;
- List *_attributeMapping;
- List *_attributeReaders;
- IXWeightingType _weightingType;
- IXWeightingDomain *_weightingDomain;
- unsigned _minimumWeight;
- unsigned _percentPassed;
- }
-
- // This method returns a DPSPortProc that does pasteboard access in the main
- // thread of an appkit program, and takes the port that the proc will wait on.
- + (DPSPortProc)getFilterHandler:(port_t)filterPort;
-
- // These methods manage the list of attribute readers. The source stream is
- // pipelined through the list of readers in the order in which they appear.
-
- - getAttributeReaders:(List *)aList; // fills the list with installed readers.
- - setAttributeReaders:(List *)aList; // sets the readers from the supplied list.
-
- - (BOOL)understandsType:(const char *)type; // always yes until types are added
- - addSourceType:(const char *)type; // adds to the set of understood types
- - removeSourceType:(const char *)type; // removes a previously understood type
-
- @end
-
- @interface IXAttributeParser(Parsing)
-
- - reset; // clears the accumulated attribute bindings
-
- // if type is NULL or empty, this method will type the file
- - parseFile:(const char *)filename ofType:(const char *)type;
- - parseStream:(NXStream *)stream ofType:(const char *)type;
-
- // These methods pass the source through the list of attribute parsers,
- // producing attribute reader format, rather than attribute bindings.
-
- // if type is NULL or empty, this method will type the file
- - (NXStream *)analyzeFile:(const char *)filename ofType:(const char *)type;
- - (NXStream *)analyzeStream:(NXStream *)stream ofType:(const char *)type;
-
- @end
-
- @interface IXAttributeParser(Configuration)
-
- - (unsigned)minimumWeight; // returns minimum weight
- - setMinimumWeight:(unsigned)aMinimum; // sets minimum weight
-
- - (unsigned)percentPassed; // returns per centage passed
- - setPercentPassed:(unsigned)aPercent; // sets per centage passed
-
- - (IXWeightingDomain *)weightingDomain; // returns weighting domain
- - setWeightingDomain:(IXWeightingDomain *)aDomain; // sets weighting domain
-
- - (IXWeightingType)weightingType; // returns weighting type
- - setWeightingType:(IXWeightingType)type; // sets weighting type
-
- - (IXFileConverter *)fileConverter; // returns file converter
- - setFileConverter:(IXFileConverter *)aConverter; // sets file converter
-
- @end
-
-