--- parser3/src/classes/hashfile.C 2003/11/06 11:13:24 1.28 +++ parser3/src/classes/hashfile.C 2003/11/20 16:34:23 1.32 @@ -6,7 +6,7 @@ */ -static const char* IDENT="$Id: hashfile.C,v 1.28 2003/11/06 11:13:24 paf Exp $"; +static const char * const IDENT="$Id: hashfile.C,v 1.32 2003/11/20 16:34:23 paf Exp $"; #include "classes.h" @@ -19,7 +19,7 @@ static const char* IDENT="$Id: hashfile. class MHashfile : public Methoded { public: // VStateless_class - Value *create_new_value() { return new VHashfile; } + Value *create_new_value(Pool& apool) { return new VHashfile(apool); } public: MHashfile(); @@ -39,7 +39,7 @@ static void _open(Request& r, MethodPara self.open(r.absolute(params.as_string(0, "filename must be string"))); } -static void _hash(Request& r, MethodParams& params) { +static void _hash(Request& r, MethodParams&) { VHashfile& self=GET_SELF(r, VHashfile); // write out result @@ -50,6 +50,11 @@ static void _hash(Request& r, MethodPara static void _delete(Request& r, MethodParams& params) { VHashfile& self=GET_SELF(r, VHashfile); + if(!params.count()) { + // ^hashfile.delete[] asked to delete hashfile itself + self.delete_files(); + return; + } // key const String &key=params.as_string(0, "key must be string"); // remove @@ -119,7 +124,7 @@ MHashfile::MHashfile(): Methoded("hashfi // ^hash[] add_native_method("hash", Method::CT_DYNAMIC, _hash, 0, 0); // ^hashfile.delete[key] - add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1); + add_native_method("delete", Method::CT_DYNAMIC, _delete, 0, 1); // ^hashfile.clear[] add_native_method("clear", Method::CT_DYNAMIC, _clear, 0, 0); // ^hashfile.foreach[key;value]{code}[delim]