Commit 06f28a8c authored by darin's avatar darin

Reviewed by Eric.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6193
          remove some unused KWQ code

        * kcanvas/KCanvasCreator.cpp: (KCanvasCreator::self): Don't use static deleter for
        two reasons: (1) We don't want any globals with constructors in any of our frameworks
        because they slow down framework load time. (2) There's no need to destroy this object at
        process termination time -- it's extra work with no benefit. Because of both these
        reasons, our KStaticDeleter implementation was basically a no-op.
        * ksvg2/svg/SVGDOMImplementationImpl.cpp: (SVGDOMImplementationImpl::self): Ditto.
        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::setDocumentChanged): Ditto.

        * khtml/html/html_canvasimpl.cpp: Removed include of kstringhandler.h.
        * khtml/html/html_imageimpl.cpp: Ditto.

        * khtml/khtmlpart_p.h: Removed something that was in an "APPLE_CANGES" ifdef.

        * ForwardingHeaders/kstaticdeleter.h: Removed.
        * ForwardingHeaders/kstringhandler.h: Removed.
        * kwq/KWQKStaticDeleter.h: Removed.
        * kwq/KWQKStringHandler.h: Removed.
        * kwq/KWQKStringHandler.mm: Removed.

        * WebCore.xcodeproj/project.pbxproj: Removed files.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 17dfb301
2005-12-22 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6193
remove some unused KWQ code
* kcanvas/KCanvasCreator.cpp: (KCanvasCreator::self): Don't use static deleter for
two reasons: (1) We don't want any globals with constructors in any of our frameworks
because they slow down framework load time. (2) There's no need to destroy this object at
process termination time -- it's extra work with no benefit. Because of both these
reasons, our KStaticDeleter implementation was basically a no-op.
* ksvg2/svg/SVGDOMImplementationImpl.cpp: (SVGDOMImplementationImpl::self): Ditto.
* khtml/xml/dom_docimpl.cpp: (DocumentImpl::setDocumentChanged): Ditto.
* khtml/html/html_canvasimpl.cpp: Removed include of kstringhandler.h.
* khtml/html/html_imageimpl.cpp: Ditto.
* khtml/khtmlpart_p.h: Removed something that was in an "APPLE_CANGES" ifdef.
* ForwardingHeaders/kstaticdeleter.h: Removed.
* ForwardingHeaders/kstringhandler.h: Removed.
* kwq/KWQKStaticDeleter.h: Removed.
* kwq/KWQKStringHandler.h: Removed.
* kwq/KWQKStringHandler.mm: Removed.
* WebCore.xcodeproj/project.pbxproj: Removed files.
2005-12-22 Darin Adler <darin@apple.com>
Reviewed by Eric.
......
......@@ -215,8 +215,6 @@
93F1996108245E59001E9ABC /* KWQKPartsPart.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866C02DE3B3201EA4122 /* KWQKPartsPart.h */; };
93F1996308245E59001E9ABC /* KWQKSSLKeyGen.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866202DE3B1101EA4122 /* KWQKSSLKeyGen.h */; };
93F1996408245E59001E9ABC /* KWQKStandardDirs.h in Headers */ = {isa = PBXBuildFile; fileRef = F58785FF02DE382001EA4122 /* KWQKStandardDirs.h */; };
93F1996508245E59001E9ABC /* KWQKStaticDeleter.h in Headers */ = {isa = PBXBuildFile; fileRef = F58785FE02DE382001EA4122 /* KWQKStaticDeleter.h */; };
93F1996608245E59001E9ABC /* KWQKStringHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860002DE382001EA4122 /* KWQKStringHandler.h */; };
93F1996708245E59001E9ABC /* KWQKURL.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860202DE382001EA4122 /* KWQKURL.h */; };
93F1996808245E59001E9ABC /* KWQKWin.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860402DE382001EA4122 /* KWQKWin.h */; };
93F1996908245E59001E9ABC /* KWQKWinModule.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860502DE382001EA4122 /* KWQKWinModule.h */; };
......@@ -405,7 +403,6 @@
93F19A3208245E59001E9ABC /* KWQKLocale.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850402DE375901EA4122 /* KWQKLocale.mm */; };
93F19A3308245E59001E9ABC /* KWQKPartsEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850802DE375901EA4122 /* KWQKPartsEvent.mm */; };
93F19A3408245E59001E9ABC /* KWQKStandardDirs.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850C02DE375901EA4122 /* KWQKStandardDirs.mm */; };
93F19A3508245E59001E9ABC /* KWQKStringHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850D02DE375901EA4122 /* KWQKStringHandler.mm */; };
93F19A3608245E59001E9ABC /* KWQKURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850E02DE375901EA4122 /* KWQKURL.mm */; };
93F19A3708245E59001E9ABC /* KWQKWin.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850F02DE375901EA4122 /* KWQKWin.mm */; };
93F19A3808245E59001E9ABC /* KWQKWinModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587851002DE375901EA4122 /* KWQKWinModule.mm */; };
......@@ -740,8 +737,6 @@
A88AD1A40952480A001DD196 /* KWQKPartsPart.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866C02DE3B3201EA4122 /* KWQKPartsPart.h */; };
A88AD1A50952480A001DD196 /* KWQKSSLKeyGen.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866202DE3B1101EA4122 /* KWQKSSLKeyGen.h */; };
A88AD1A60952480A001DD196 /* KWQKStandardDirs.h in Headers */ = {isa = PBXBuildFile; fileRef = F58785FF02DE382001EA4122 /* KWQKStandardDirs.h */; };
A88AD1A70952480A001DD196 /* KWQKStaticDeleter.h in Headers */ = {isa = PBXBuildFile; fileRef = F58785FE02DE382001EA4122 /* KWQKStaticDeleter.h */; };
A88AD1A80952480A001DD196 /* KWQKStringHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860002DE382001EA4122 /* KWQKStringHandler.h */; };
A88AD1A90952480A001DD196 /* KWQKURL.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860202DE382001EA4122 /* KWQKURL.h */; };
A88AD1AA0952480A001DD196 /* KWQKWin.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860402DE382001EA4122 /* KWQKWin.h */; };
A88AD1AB0952480A001DD196 /* KWQKWinModule.h in Headers */ = {isa = PBXBuildFile; fileRef = F587860502DE382001EA4122 /* KWQKWinModule.h */; };
......@@ -972,7 +967,6 @@
A88AD28F0952480A001DD196 /* KWQKLocale.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850402DE375901EA4122 /* KWQKLocale.mm */; };
A88AD2900952480A001DD196 /* KWQKPartsEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850802DE375901EA4122 /* KWQKPartsEvent.mm */; };
A88AD2910952480A001DD196 /* KWQKStandardDirs.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850C02DE375901EA4122 /* KWQKStandardDirs.mm */; };
A88AD2920952480A001DD196 /* KWQKStringHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850D02DE375901EA4122 /* KWQKStringHandler.mm */; };
A88AD2930952480A001DD196 /* KWQKURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850E02DE375901EA4122 /* KWQKURL.mm */; };
A88AD2940952480A001DD196 /* KWQKWin.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850F02DE375901EA4122 /* KWQKWin.mm */; };
A88AD2950952480A001DD196 /* KWQKWinModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587851002DE375901EA4122 /* KWQKWinModule.mm */; };
......@@ -2567,7 +2561,6 @@
F587850402DE375901EA4122 /* KWQKLocale.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKLocale.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587850802DE375901EA4122 /* KWQKPartsEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKPartsEvent.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587850C02DE375901EA4122 /* KWQKStandardDirs.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKStandardDirs.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587850D02DE375901EA4122 /* KWQKStringHandler.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKStringHandler.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587850E02DE375901EA4122 /* KWQKURL.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKURL.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587850F02DE375901EA4122 /* KWQKWin.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKWin.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587851002DE375901EA4122 /* KWQKWinModule.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKWinModule.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -2637,9 +2630,7 @@
F58785F802DE382001EA4122 /* KWQKInstance.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKInstance.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58785FA02DE382001EA4122 /* KWQKLocale.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKLocale.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58785FD02DE382001EA4122 /* KWQKStandardDirs.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKStandardDirs.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58785FE02DE382001EA4122 /* KWQKStaticDeleter.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKStaticDeleter.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58785FF02DE382001EA4122 /* KWQKStandardDirs.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKStandardDirs.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587860002DE382001EA4122 /* KWQKStringHandler.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKStringHandler.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587860202DE382001EA4122 /* KWQKURL.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKURL.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587860402DE382001EA4122 /* KWQKWin.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKWin.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587860502DE382001EA4122 /* KWQKWinModule.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQKWinModule.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -4020,12 +4011,9 @@
F58785F802DE382001EA4122 /* KWQKInstance.h */,
F58785FA02DE382001EA4122 /* KWQKLocale.h */,
F587850402DE375901EA4122 /* KWQKLocale.mm */,
F58785FE02DE382001EA4122 /* KWQKStaticDeleter.h */,
F58785FD02DE382001EA4122 /* KWQKStandardDirs.h */,
F58785FF02DE382001EA4122 /* KWQKStandardDirs.h */,
F587850C02DE375901EA4122 /* KWQKStandardDirs.mm */,
F587860002DE382001EA4122 /* KWQKStringHandler.h */,
F587850D02DE375901EA4122 /* KWQKStringHandler.mm */,
F587860202DE382001EA4122 /* KWQKURL.h */,
F587850E02DE375901EA4122 /* KWQKURL.mm */,
F587860402DE382001EA4122 /* KWQKWin.h */,
......@@ -4375,8 +4363,6 @@
93F1996108245E59001E9ABC /* KWQKPartsPart.h in Headers */,
93F1996308245E59001E9ABC /* KWQKSSLKeyGen.h in Headers */,
93F1996408245E59001E9ABC /* KWQKStandardDirs.h in Headers */,
93F1996508245E59001E9ABC /* KWQKStaticDeleter.h in Headers */,
93F1996608245E59001E9ABC /* KWQKStringHandler.h in Headers */,
93F1996708245E59001E9ABC /* KWQKURL.h in Headers */,
93F1996808245E59001E9ABC /* KWQKWin.h in Headers */,
93F1996908245E59001E9ABC /* KWQKWinModule.h in Headers */,
......@@ -4879,8 +4865,6 @@
A88AD1A40952480A001DD196 /* KWQKPartsPart.h in Headers */,
A88AD1A50952480A001DD196 /* KWQKSSLKeyGen.h in Headers */,
A88AD1A60952480A001DD196 /* KWQKStandardDirs.h in Headers */,
A88AD1A70952480A001DD196 /* KWQKStaticDeleter.h in Headers */,
A88AD1A80952480A001DD196 /* KWQKStringHandler.h in Headers */,
A88AD1A90952480A001DD196 /* KWQKURL.h in Headers */,
A88AD1AA0952480A001DD196 /* KWQKWin.h in Headers */,
A88AD1AB0952480A001DD196 /* KWQKWinModule.h in Headers */,
......@@ -6188,7 +6172,6 @@
93F19A3208245E59001E9ABC /* KWQKLocale.mm in Sources */,
93F19A3308245E59001E9ABC /* KWQKPartsEvent.mm in Sources */,
93F19A3408245E59001E9ABC /* KWQKStandardDirs.mm in Sources */,
93F19A3508245E59001E9ABC /* KWQKStringHandler.mm in Sources */,
93F19A3608245E59001E9ABC /* KWQKURL.mm in Sources */,
93F19A3708245E59001E9ABC /* KWQKWin.mm in Sources */,
93F19A3808245E59001E9ABC /* KWQKWinModule.mm in Sources */,
......@@ -6620,7 +6603,6 @@
A88AD28F0952480A001DD196 /* KWQKLocale.mm in Sources */,
A88AD2900952480A001DD196 /* KWQKPartsEvent.mm in Sources */,
A88AD2910952480A001DD196 /* KWQKStandardDirs.mm in Sources */,
A88AD2920952480A001DD196 /* KWQKStringHandler.mm in Sources */,
A88AD2930952480A001DD196 /* KWQKURL.mm in Sources */,
A88AD2940952480A001DD196 /* KWQKWin.mm in Sources */,
A88AD2950952480A001DD196 /* KWQKWinModule.mm in Sources */,
......
......@@ -24,7 +24,6 @@
#include <math.h>
#include <kdebug.h>
#include <kstaticdeleter.h>
#include "kcanvas/KCanvas.h"
#include "KCanvasPath.h"
......@@ -32,7 +31,6 @@
#include "KRenderingDevice.h"
#include "KCanvasContainer.h"
static KStaticDeleter<KCanvasCreator> canvasCreatorDeleter;
KCanvasCreator *KCanvasCreator::s_creator = 0;
KCanvasCreator::KCanvasCreator()
......@@ -46,7 +44,7 @@ KCanvasCreator::~KCanvasCreator()
KCanvasCreator *KCanvasCreator::self()
{
if(!s_creator)
s_creator = canvasCreatorDeleter.setObject(s_creator, new KCanvasCreator());
s_creator = new KCanvasCreator();
return s_creator;
}
......
......@@ -30,7 +30,6 @@
#include "khtmlview.h"
#include "khtml_part.h"
#include <kstringhandler.h>
#include <kdebug.h>
#include "rendering/render_canvasimage.h"
......
......@@ -30,7 +30,6 @@
#include "khtmlview.h"
#include "khtml_part.h"
#include <kstringhandler.h>
#include <kdebug.h>
#include "rendering/render_image.h"
......
......@@ -199,9 +199,6 @@ public:
RefPtr<khtml::Decoder> m_decoder;
QString m_encoding;
QString m_sheetUsed;
#if !APPLE_CANGES
long m_cacheId;
#endif
QString scheduledScript;
RefPtr<DOM::NodeImpl> scheduledScriptNode;
......
......@@ -48,7 +48,6 @@
#include <qpaintdevicemetrics.h>
#include <qregexp.h>
#include <kdebug.h>
#include <kstaticdeleter.h>
#include "rendering/render_canvas.h"
#include "rendering/render_frames.h"
......@@ -60,7 +59,6 @@
#include "khtml_part.h"
#include <kglobalsettings.h>
#include <kstringhandler.h>
#include "khtml_settings.h"
#include "khtmlpart_p.h"
......@@ -369,7 +367,6 @@ HTMLDocumentImpl *DOMImplementationImpl::createHTMLDocument(const DOMString &tit
// ------------------------------------------------------------------------
KStaticDeleter< QPtrList<DocumentImpl> > s_changedDocumentsDeleter;
QPtrList<DocumentImpl> * DocumentImpl::changedDocuments = 0;
// KHTMLView might be 0
......@@ -1007,7 +1004,7 @@ TreeWalkerImpl *DocumentImpl::createTreeWalker(NodeImpl *root, unsigned whatToSh
void DocumentImpl::setDocumentChanged(bool b)
{
if (!changedDocuments)
changedDocuments = s_changedDocumentsDeleter.setObject(changedDocuments, new QPtrList<DocumentImpl>());
changedDocuments = new QPtrList<DocumentImpl>;
if (b && !m_docChanged)
changedDocuments->append(this);
......
......@@ -21,7 +21,6 @@
*/
#include "config.h"
#include <kstaticdeleter.h>
#include <kdom/kdom.h>
#include <kdom/Helper.h>
......@@ -42,7 +41,6 @@
using namespace KSVG;
static KStaticDeleter<SVGDOMImplementationImpl> instanceDeleter;
SVGDOMImplementationImpl *SVGDOMImplementationImpl::s_instance = 0;
QStringList SVGDOMImplementationImpl::s_features;
......@@ -61,7 +59,7 @@ SVGDOMImplementationImpl *SVGDOMImplementationImpl::self()
{
if(!s_instance)
{
s_instance = instanceDeleter.setObject(s_instance, new SVGDOMImplementationImpl());
s_instance = new SVGDOMImplementationImpl();
// 1.1 features
s_features.append(QString::fromLatin1("SVG"));
......
/*
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KSTATICDELETER_H_
#define KSTATICDELETER_H_
// We don't believe in freeing memory at exit time.
// It just touches memory pages and slows down quitting.
// All the users of this just free memory, so it's OK to not delete.
template <class T> class KStaticDeleter {
public:
T *setObject(T *&global, T *ptr, bool array = false) { global = ptr; return ptr; }
};
#endif
/*
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KSTRINGHANDLER_H_
#define KSTRINGHANDLER_H_
#include "KWQString.h"
class KStringHandler {
public:
static QString csqueeze(const QString &, uint maxlen = 40);
};
#endif
/*
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#import "KWQKStringHandler.h"
QString KStringHandler::csqueeze(const QString &str, uint maxlen)
{
if (str.length() > maxlen && maxlen > 3) {
int part = (maxlen-3)/2;
return QString(str.left(part) + "..." + str.right(part));
}
else return str;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment