• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kded
 

kded

kctimefactory.cpp

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 "tdesycoca.h"
00021 #include "tdesycocatype.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(TQDataStream &str)
00045 {
00046   KSycocaFactory::saveHeader(str);
00047 
00048   str << m_dictOffset;
00049 }
00050 
00051 void
00052 KCTimeInfo::save(TQDataStream &str)
00053 {
00054   KSycocaFactory::save(str);
00055 
00056   m_dictOffset = str.device()->at();
00057   TQDictIterator<TQ_UINT32> it(ctimeDict);
00058   while( it.current())
00059   {
00060      str << it.currentKey() << *(it.current());
00061      ++it;
00062   }   
00063   str << TQString::null << (TQ_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 TQString &path, TQ_UINT32 ctime)
00073 {
00074   assert(!path.isEmpty());
00075   ctimeDict.replace(path, new TQ_UINT32(ctime));
00076 }
00077 
00078 TQ_UINT32
00079 KCTimeInfo::ctime(const TQString &path)
00080 {
00081   TQ_UINT32 *ctimeP = ctimeDict[path];
00082   return ctimeP ? *ctimeP : 0;
00083 }
00084 
00085 void
00086 KCTimeInfo::fillCTimeDict(TQDict<TQ_UINT32> &dict)
00087 {
00088     assert(m_str);
00089     m_str->device()->at(m_dictOffset);
00090     TQString path;
00091     TQ_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 TQ_UINT32(ctime));
00098     }
00099 }

kded

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

kded

Skip menu "kded"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kded by doxygen 1.7.1
This website is maintained by Timothy Pearson.