void font::clear_cache() { for (dictionary<shared_pointer<font_impl>, string>::iterator i = fonts.iter(); i.is_valid(); ++i) { if (i->get_ref_count() > 1) { gsgl::log(string::format(L"Dangling font reference: '%ls'!", i.get_index().w_string())); throw runtime_exception(L"Dangling font reference: '%ls'!", i.get_index().w_string()); } } fonts.clear(); } // font::clear_cache()
void texture::clear_cache(const gsgl::string & category) { for (dictionary<texture_cache, string>::iterator cat = textures.iter(); cat.is_valid(); ++cat) { if (category == L"__ALL__" || cat.get_index() == category) { for (texture_cache::iterator i = cat->iter(); i.is_valid(); ++i) { if (i->get_ref_count() > 1) throw runtime_exception(L"Dangling texture '%ls'!", i.get_index()); } cat->clear(); } } } // texture::clear_cache()