69b2971997-06-09Henrik Grubbström (Grubba) /*
7d014c1997-06-09Henrik Grubbström (Grubba)  * $Id: module.pmod.in,v 1.2 1997/06/09 18:44:56 grubba Exp $
69b2971997-06-09Henrik Grubbström (Grubba)  * * YP (NIS) Functionality for Pike * * Per Hedbor & Henrik Grubbström 1996-1997 */ class YpDomain { inherit @module@; }; class YpMap { object(YpDomain) domain; string ypmap; void create(string map,string|void d) { if (d) { domain = YpDomain(d); } else { domain = YpDomain(); } ypmap = map; // Force an error if the map does not exist. domain->match(ypmap, "foo"); } string match(string key) { return(domain->match(ypmap, key)); } string `[](string key) {
7d014c1997-06-09Henrik Grubbström (Grubba)  return(domain->match(ypmap, key));
69b2971997-06-09Henrik Grubbström (Grubba)  } mapping all() { return(domain->all(ypmap)); } mapping cast_to_mapping() { return(domain->all(ypmap)); } void map(function(string,string:void)|array(function(string,string:void)) fn) { return(domain->map(ypmap, fn)); } string server() { return(domain->server()); } int order() { return(domain->order(ypmap)); } int sizeof() { return(sizeof(domain->all(ypmap))); } array(string) indices() { return(indices(domain->all(ypmap))); } array(string) values() {
7d014c1997-06-09Henrik Grubbström (Grubba)  return(values(domain->all(ypmap))); } mixed cast(string type) { switch(type) { case "mapping": return(cast_to_mapping()); default: throw(({ "Yp.YpDomain: Cast to " + type + " not supported.\n", backtrace() })); }
69b2971997-06-09Henrik Grubbström (Grubba)  } };