00001 /* 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * A WvHConfGen knows how to generate new WvHConf objects in its tree. 00006 * 00007 * See wvhconf.h. 00008 */ 00009 #include "wvhconf.h" 00010 00011 00012 WvHConfGen::~WvHConfGen() 00013 { 00014 // nothing special 00015 } 00016 00017 00018 WvHConf *WvHConfGen::make_tree(WvHConf *parent, const WvHConfKey &key) 00019 { 00020 if (key.isempty()) 00021 return parent; 00022 00023 WvHConf *h = parent->children ? (*parent->children)[*key.first()] : NULL; 00024 00025 if (!h) 00026 h = make_obj(parent, *key.first()); 00027 if (!h) 00028 return NULL; 00029 00030 return make_tree(h, key.skip(1)); 00031 } 00032 00033 00034 WvHConf *WvHConfGen::make_obj(WvHConf *parent, const WvString &name) 00035 { 00036 WvHConf *child = new WvHConf(parent, name); 00037 if (!parent->children) 00038 parent->children = new WvHConfDict(10); 00039 parent->children->add(child, true); 00040 update(child); 00041 return child; 00042 } 00043 00044 00045 void WvHConfGen::update(WvHConf *h) 00046 { 00047 h->dirty = false; 00048 } 00049 00050 00051 void WvHConfGen::load() 00052 { 00053 // do nothing by default 00054 } 00055 00056 00057 void WvHConfGen::save() 00058 { 00059 // do nothing by default 00060 } 00061