Replaced all std::cout with kDebug.
[tagua/yd.git] / src / loader / context.cpp
blob0d836e30108075faebb1ee37db75461f08ad3720
1 /*
2 Copyright (c) 2006-2008 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #include "common.h"
12 #include <KDebug>
13 #include "loader/context.h"
15 namespace Loader {
18 Context::Cache Context::s_cache;
21 void Context::flush() {
22 for(KeySet::iterator i = m_references.begin();
23 i != m_references.end(); ) {
24 Cache::iterator cit = s_cache.find(*i);
25 Q_ASSERT(cit != s_cache.end());
26 Q_ASSERT(cit->second.m_ref_count > 0);
28 m_references.erase(i++);
30 if( !--cit->second.m_ref_count )
31 s_cache.erase(cit);
36 Context::~Context() {
37 flush();
38 Q_ASSERT(m_references.empty());
41 } //end namespace Loader