• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDED

kctimefactory.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries
00002  *  Copyright (C) 2000 Waldo Bastian <bastian@kde.org>
00003  *
00004  *  This library is free software; you can redistribute it and/or
00005  *  modify it under the terms of the GNU Library General Public
00006  *  License version 2 as published by the Free Software Foundation;
00007  *
00008  *  This library is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  *  Library General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU Library General Public License
00014  *  along with this library; see the file COPYING.LIB.  If not, write to
00015  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  *  Boston, MA 02110-1301, USA.
00017  **/
00018 
00019 #include "kctimefactory.h"
00020 #include "ksycoca.h"
00021 #include "ksycocatype.h"
00022 
00023 #include <assert.h>
00024 
00025 KCTimeInfo::KCTimeInfo()
00026  : KSycocaFactory( KST_CTimeInfo ), ctimeDict(977)
00027 {
00028    ctimeDict.setAutoDelete(true);
00029    if (m_str)
00030    {
00031       (*m_str) >> m_dictOffset;
00032    }
00033    else
00034    {
00035       m_dictOffset = 0;
00036    }
00037 }
00038 
00039 KCTimeInfo::~KCTimeInfo()
00040 {
00041 }
00042 
00043 void 
00044 KCTimeInfo::saveHeader(QDataStream &str)
00045 {
00046   KSycocaFactory::saveHeader(str);
00047 
00048   str << m_dictOffset;
00049 }
00050 
00051 void
00052 KCTimeInfo::save(QDataStream &str)
00053 {
00054   KSycocaFactory::save(str);
00055 
00056   m_dictOffset = str.device()->at();
00057   QDictIterator<Q_UINT32> it(ctimeDict);
00058   while( it.current())
00059   {
00060      str << it.currentKey() << *(it.current());
00061      ++it;
00062   }   
00063   str << QString::null << (Q_UINT32) 0;
00064 
00065   int endOfFactoryData = str.device()->at();
00066 
00067   saveHeader(str);
00068   str.device()->at(endOfFactoryData);
00069 }
00070 
00071 void 
00072 KCTimeInfo::addCTime(const QString &path, Q_UINT32 ctime)
00073 {
00074   assert(!path.isEmpty());
00075   ctimeDict.replace(path, new Q_UINT32(ctime));
00076 }
00077 
00078 Q_UINT32
00079 KCTimeInfo::ctime(const QString &path)
00080 {
00081   Q_UINT32 *ctimeP = ctimeDict[path];
00082   return ctimeP ? *ctimeP : 0;
00083 }
00084 
00085 void
00086 KCTimeInfo::fillCTimeDict(QDict<Q_UINT32> &dict)
00087 {
00088     assert(m_str);
00089     m_str->device()->at(m_dictOffset);
00090     QString path;
00091     Q_UINT32 ctime;
00092     while(true)
00093     {
00094       KSycocaEntry::read(*m_str, path);
00095       (*m_str) >> ctime;
00096       if (path.isEmpty()) break;
00097       dict.replace(path, new Q_UINT32(ctime));
00098     }
00099 }

KDED

Skip menu "KDED"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal