Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
// $XConsortium: Feature.cc /main/3 1996/06/11 17:06:39 cde-hal $
#include "SymTab.h"
#include "Feature.h"
#include "FeatureValue.h"
#include <assert.h>
#include <stdarg.h>
Feature::Feature(const Symbol &name, FeatureValue *value)
: f_name(name),
f_value(value)
{
}
Feature::Feature(const Feature &orig_feature)
: f_name(orig_feature.name()),
f_value(orig_feature.value()->clone())
{
}
unsigned int Feature::operator==(const Feature &f )
{
return f.name() == f_name;
}
Feature::~Feature()
{
delete f_value ;
}
FeatureValue *
Feature::evaluate() const
{
return f_value->evaluate();
}
// /////////////////////////////////////////////////////////////////////////
// Printing
// /////////////////////////////////////////////////////////////////////////
ostream &operator << (ostream &o, const Feature &f)
{
return f.print(o);
}
ostream &
Feature::print(ostream &o) const
{
return o << f_name << ": " << *f_value ;
}
void
Feature::merge(const Feature &feature_to_merge)
{
assert(f_name == feature_to_merge.name());
if (*f_value == *feature_to_merge.value())
;
else
{
FeatureValue *new_value = f_value->merge(*feature_to_merge.value());
delete f_value ;
f_value = new_value ;
}
}