2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: Feature.h /main/4 1996/08/21 15:50:21 drk $ */
33 #include "dti_cc/CC_Slist.h"
34 #include "dti_cc/cc_povec.h"
43 class ResolverStackElement ;
48 class dlist_array<Symbol> ;
50 class dlist_array<Symbol> ;
55 /* **************************************************************
58 a symbol, value pairing where symbol is the feature name
59 * ************************************************************** */
65 Feature(const Symbol &, FeatureValue *);
66 Feature(const Feature &);
70 const Symbol &name() const { return f_name ; }
71 const FeatureValue *value() const { return f_value ; }
73 FeatureValue *evaluate() const;
75 // destructively modifies f_value
76 void merge(const Feature &);
78 ostream &print(ostream &) const ;
80 unsigned int operator==(const Feature&);
83 void assembleChainFeatures(FeatureValue* x);
87 FeatureValue *f_value;
91 /* **************************************************************
94 FeatureSet is is a list of features and their values. Features are
95 represented by symbols. Values can be strings, numbers (int or real)
97 * ************************************************************** */
100 class FeatureSet : public CC_TPtrSlist<Feature>
102 class FeatureSet : public CC_TPtrSlist<Feature>
107 FeatureSet(const FeatureSet &); /* copy */
108 FeatureSet(const FeatureSet &,
109 const FeatureSet &); /* merge */
110 virtual ~FeatureSet();
113 const Feature *lookup(const Symbol *) const ;
114 const Feature *lookup(const Symbol &) const;
115 const Feature *lookup(const char *) const;
117 // find a chain, eg for "prefix.font.size" use */
118 // deep_lookup("prefix","font","size", 0);
119 // returns 0 if not found
120 const Feature *deep_lookup(const char * ...) const ;
121 const Feature *deep_lookup(const Symbol * ...) const ;
125 const Feature *deep_lookup(const dlist_array<Symbol> &) const ;
127 const Feature *deep_lookup(const dlist_array<Symbol> &) const ;
130 // remve a feature that is specified by a chain
131 void removeFeature(const char * ...) ;
133 // returns new feature set with all unresolved expressions resolved
134 FeatureSet *evaluate() const;
135 // evaluate self and place answers into result_set, returns result set
136 FeatureSet *evaluate(FeatureSet *result_set) const ;
138 unsigned int operator == (const FeatureSet &) const ;
140 ostream &print(ostream &) const ;
144 static unsigned int f_print_indent_level ;
148 /* **************************************************************
150 * ************************************************************** */
152 ostream &operator << (ostream &o, const Feature &f);
153 ostream &operator << (ostream &o, const FeatureSet &f);
156 #endif /* _Feature_h */
157 /* DO NOT ADD ANY LINES AFTER THIS #endif */