Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/dll/europa/cse476/gnode.h
1074 views
1
#ifndef _GNODE_H_
2
#define _GNODE_H_
3
4
#include <iostream.h>
5
6
class List;
7
8
void trim(char *text); // GOOD
9
10
// genericNode -- holds any lexical or phrase object
11
class genericNode {
12
public:
13
// constructor: pass it a string containing a lexical or phrase
14
// object in the format used in our lexicon.txt and grammar.txt
15
genericNode(char *obj); // GOOD
16
genericNode(char *word, List *features); // GOOD except feature doesn't copy
17
~genericNode();
18
19
friend ostream &operator<<(ostream &out_file, const genericNode &n); // GOOD
20
21
// GOOD: sort of.. this routine leaks memory because the lists for
22
// assignment it makes aren't properly deallocated upon unification failure
23
friend List *unify(genericNode &s, genericNode &g);
24
friend List *cmpFeatures(List &a, List &b);
25
List *lookupFeature(const char *name) const;
26
friend genericNode *substitute(genericNode *old, List *assign);
27
28
char *word(void); // GOOD
29
List *features(void);
30
31
private:
32
char *name;
33
List *featureList;
34
};
35
36
#endif
37
38