Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLMemCache.h 00003 ------------------- 00004 begin : vie oct 10 2003 00005 copyright : (C) 2003-2005 by InfoSiAL, S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef FLMEMCACHE_H 00020 #define FLMEMCACHE_H 00021 00022 #include <qstring.h> 00023 #include <qcache.h> 00024 #include <qobject.h> 00025 00026 class FLMemCache 00027 { 00028 public: 00029 00030 static QString *find(const QString &key) { 00031 return str_cache->find(key); 00032 } 00033 00034 static bool insert(const QString &key, const QString &str) { 00035 QString *s = new QString(str); 00036 if (!str_cache->insert(key, s)){ 00037 delete s; 00038 return false; 00039 } 00040 return true; 00041 } 00042 00043 static void init(); 00044 static void clear(); 00045 00046 private: 00047 00048 static QCache<QString> *str_cache; 00049 }; 00050 00051 #endif