Files
Arquivotheca.Solaris-2.5/lib/fn/libxfn/BindingSet.cc
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

56 lines
1.1 KiB
C++
Executable File

/*
* Copyright (c) 1992 - 1994 by Sun Microsystems, Inc.
*/
#pragma ident "@(#)BindingSet.cc 1.3 94/08/04 SMI"
#include "BindingSet.hh"
#include "hash.hh"
BindingSetItem::BindingSetItem(const FN_string &n, const FN_ref &r)
: name(n), ref(r)
{
}
BindingSetItem::~BindingSetItem()
{
}
SetItem *
BindingSetItem::copy()
{
return ((SetItem *)(new BindingSetItem(name, ref)));
}
int
BindingSetItem::key_match(const void *key, int case_sense)
{
return (name.compare(*(const FN_string *)key,
case_sense? FN_STRING_CASE_SENSITIVE: FN_STRING_CASE_INSENSITIVE)
== 0);
}
int
BindingSetItem::item_match(SetItem &item, int case_sense)
{
return (name.compare(((BindingSetItem &)item).name,
case_sense? FN_STRING_CASE_SENSITIVE: FN_STRING_CASE_INSENSITIVE)
== 0);
}
unsigned long
BindingSetItem::key_hash()
{
return (get_hashval_nocase((const char *)name.contents(), name.bytecount()));
}
unsigned long
BindingSetItem::key_hash(const void *key)
{
const FN_string *n;
n = (const FN_string *)key;
return (get_hashval_nocase((const char *)n->contents(), n->bytecount()));
}