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

tdecore

  • tdecore
kstringhandler.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Ian Zepp (icszepp@islc.net)
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kstringhandler.h"
21 #include "tdeglobal.h"
22 
23 static void parsePythonRange( const TQCString &range, uint &start, uint &end )
24 {
25  const int colon = range.find( ':' );
26  if ( colon == -1 ) {
27  start = range.toUInt();
28  end = start;
29  } else if ( colon == int( range.length() - 1 ) ) {
30  start = range.left( colon ).toUInt();
31  } else if ( colon == 0 ) {
32  end = range.mid( 1 ).toUInt();
33  } else {
34  start = range.left( colon ).toInt();
35  end = range.mid( colon + 1 ).toInt();
36  }
37 }
38 
39 TQString KStringHandler::word( const TQString &text , uint pos )
40 {
41  return text.section( ' ', pos, pos );
42 }
43 
44 TQString KStringHandler::word( const TQString &text , const char *range )
45 {
46  // Format in: START:END
47  // Note index starts a 0 (zero)
48  //
49  // 0: first word to end
50  // 1:3 second to fourth words
51  TQStringList list = TQStringList::split( " ", text , true );
52  TQString tmp = "";
53  TQString r = range;
54 
55  if ( text.isEmpty() )
56  return tmp;
57 
58  uint pos = 0, cnt = list.count();
59  parsePythonRange( range, pos, cnt );
60 
61  //
62  // Extract words
63  //
64  int wordsToExtract = cnt-pos+1;
65  TQStringList::Iterator it = list.at( pos);
66 
67  while ( (it != list.end()) && (wordsToExtract-- > 0))
68  {
69  tmp += *it;
70  tmp += " ";
71  it++;
72  }
73 
74  return tmp.stripWhiteSpace();
75 }
76 
77 //
78 // Insertion and removal routines
79 //
80 TQString KStringHandler::insword( const TQString &text , const TQString &word , uint pos )
81 {
82  if ( text.isEmpty() )
83  return word;
84 
85  if ( word.isEmpty() )
86  return text;
87 
88  // Split words and add into list
89  TQStringList list = TQStringList::split( " ", text, true );
90 
91  if ( pos >= list.count() )
92  list.append( word );
93  else
94  list.insert( list.at(pos) , word );
95 
96  // Rejoin
97  return list.join( " " );
98 }
99 
100 TQString KStringHandler::setword( const TQString &text , const TQString &word , uint pos )
101 {
102  if ( text.isEmpty() )
103  return word;
104 
105  if ( word.isEmpty() )
106  return text;
107 
108  // Split words and add into list
109  TQStringList list = TQStringList::split( " ", text, true );
110 
111  if ( pos >= list.count() )
112  list.append( word );
113  else
114  {
115  list.insert( list.remove( list.at(pos) ) , word );
116  }
117 
118  // Rejoin
119  return list.join( " " );
120 }
121 
122 TQString KStringHandler::remrange( const TQString &text , const char *range )
123 {
124  // Format in: START:END
125  // Note index starts a 0 (zero)
126  //
127  // 0: first word to end
128  // 1:3 second to fourth words
129  TQStringList list = TQStringList::split( " ", text , true );
130  TQString tmp = "";
131  TQString r = range;
132 
133  if ( text.isEmpty() )
134  return tmp;
135 
136  uint pos = 0, cnt = list.count();
137  parsePythonRange( range, pos, cnt );
138 
139  //
140  // Remove that range of words
141  //
142  int wordsToDelete = cnt-pos+1;
143  TQStringList::Iterator it = list.at( pos);
144 
145  while ( (it != list.end()) && (wordsToDelete-- > 0))
146  it = list.remove( it );
147 
148  return list.join( " " );
149 }
150 
151 TQString KStringHandler::remword( const TQString &text , uint pos )
152 {
153  TQString tmp = "";
154 
155  if ( text.isEmpty() )
156  return tmp;
157 
158  // Split words and add into list
159  TQStringList list = TQStringList::split( " ", text, true );
160 
161  if ( pos < list.count() )
162  list.remove( list.at( pos ) );
163 
164  // Rejoin
165  return list.join( " " );
166 }
167 
168 TQString KStringHandler::remword( const TQString &text , const TQString &word )
169 {
170  TQString tmp = "";
171 
172  if ( text.isEmpty() )
173  return tmp;
174 
175  if ( word.isEmpty() )
176  return text;
177 
178  // Split words and add into list
179  TQStringList list = TQStringList::split( " ", text, true );
180 
181  TQStringList::Iterator it = list.find(word);
182 
183  if (it != list.end())
184  list.remove( it );
185 
186  // Rejoin
187  return list.join( " " );
188 }
189 
190 //
191 // Capitalization routines
192 //
193 TQString KStringHandler::capwords( const TQString &text )
194 {
195  if ( text.isEmpty() ) {
196  return text;
197  }
198 
199  const TQString strippedText = text.stripWhiteSpace();
200  const TQStringList words = capwords( TQStringList::split( ' ', strippedText ) );
201 
202  TQString result = text;
203  result.replace( strippedText, words.join( " " ) );
204  return result;
205 }
206 
207 TQStringList KStringHandler::capwords( const TQStringList &list )
208 {
209  TQStringList tmp = list;
210  for ( TQStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it ) {
211  *it = ( *it )[ 0 ].upper() + ( *it ).mid( 1 );
212  }
213  return tmp;
214 }
215 
216 //
217 // Reverse routines
218 //
219 TQString KStringHandler::reverse( const TQString &text )
220 {
221  TQString tmp;
222 
223  if ( text.isEmpty() )
224  return tmp;
225 
226  TQStringList list;
227  list = TQStringList::split( " ", text, true );
228  list = reverse( list );
229 
230  return list.join( " " );
231 }
232 
233 TQStringList KStringHandler::reverse( const TQStringList &list )
234 {
235  TQStringList tmp;
236 
237  if ( list.count() == 0 )
238  return tmp;
239 
240  for ( TQStringList::ConstIterator it= list.begin();
241  it != list.end();
242  it++)
243  tmp.prepend( *it );
244 
245  return tmp;
246 }
247 
248 //
249 // Left, Right, Center justification
250 //
251 TQString KStringHandler::ljust( const TQString &text , uint width )
252 {
253  return text.stripWhiteSpace().leftJustify( width );
254 }
255 
256 TQString KStringHandler::rjust( const TQString &text , uint width )
257 {
258  return text.stripWhiteSpace().rightJustify( width );
259 }
260 
261 TQString KStringHandler::center( const TQString &text , uint width )
262 {
263  const TQString s = text.stripWhiteSpace();
264  const unsigned int length = s.length();
265  if ( width <= length ) {
266  return s;
267  }
268 
269  TQString result;
270  result.fill( ' ', ( width - length ) / 2 );
271  result += s;
272 
273  return result.leftJustify( width );
274 }
275 
276 TQString KStringHandler::lsqueeze( const TQString & str, uint maxlen )
277 {
278  if (str.length() > maxlen) {
279  int part = maxlen-3;
280  return TQString("..." + str.right(part));
281  }
282  else return str;
283 }
284 
285 TQString KStringHandler::csqueeze( const TQString & str, uint maxlen )
286 {
287  if (str.length() > maxlen && maxlen > 3) {
288  int part = (maxlen-3)/2;
289  return TQString(str.left(part) + "..." + str.right(part));
290  }
291  else return str;
292 }
293 
294 TQString KStringHandler::rsqueeze( const TQString & str, uint maxlen )
295 {
296  if (str.length() > maxlen) {
297  int part = maxlen-3;
298  return TQString(str.left(part) + "...");
299  }
300  else return str;
301 }
302 
303 TQString KStringHandler::lEmSqueeze(const TQString &name, const TQFontMetrics& fontMetrics, uint maxlen)
304 {
305  return lPixelSqueeze(name, fontMetrics, fontMetrics.maxWidth() * maxlen);
306 }
307 
308 TQString KStringHandler::lPixelSqueeze(const TQString& name, const TQFontMetrics& fontMetrics, uint maxPixels)
309 {
310  uint nameWidth = fontMetrics.width(name);
311 
312  if (maxPixels < nameWidth)
313  {
314  TQString tmp = name;
315  const uint em = fontMetrics.maxWidth();
316  maxPixels -= fontMetrics.width("...");
317 
318  while (maxPixels < nameWidth && !tmp.isEmpty())
319  {
320  int delta = (nameWidth - maxPixels) / em;
321  delta = kClamp(delta, 1, delta); // no max
322 
323  tmp.remove(0, delta);
324  nameWidth = fontMetrics.width(tmp);
325  }
326 
327  return ("..." + tmp);
328  }
329 
330  return name;
331 }
332 
333 TQString KStringHandler::cEmSqueeze(const TQString& name, const TQFontMetrics& fontMetrics, uint maxlen)
334 {
335  return cPixelSqueeze(name, fontMetrics, fontMetrics.maxWidth() * maxlen);
336 }
337 
338 TQString KStringHandler::cPixelSqueeze(const TQString& s, const TQFontMetrics& fm, uint width)
339 {
340  if ( s.isEmpty() || uint( fm.width( s ) ) <= width ) {
341  return s;
342  }
343 
344  const unsigned int length = s.length();
345  if ( length == 2 ) {
346  return s;
347  }
348 
349  const int maxWidth = width - fm.width( '.' ) * 3;
350  if ( maxWidth <= 0 ) {
351  return "...";
352  }
353 
354  unsigned int leftIdx = 0, rightIdx = length;
355  unsigned int leftWidth = fm.charWidth( s, leftIdx++ );
356  unsigned int rightWidth = fm.charWidth( s, --rightIdx );
357  while ( leftWidth + rightWidth < uint( maxWidth ) ) {
358  while ( leftWidth <= rightWidth && leftWidth + rightWidth < uint( maxWidth ) ) {
359  leftWidth += fm.charWidth( s, leftIdx++ );
360  }
361  while ( rightWidth <= leftWidth && leftWidth + rightWidth < uint( maxWidth ) ) {
362  rightWidth += fm.charWidth( s, --rightIdx );
363  }
364  }
365 
366  if ( leftWidth > rightWidth ) {
367  --leftIdx;
368  } else {
369  ++rightIdx;
370  }
371 
372  rightIdx = length - rightIdx;
373  if ( leftIdx == 0 && rightIdx == 1 || leftIdx == 1 && rightIdx == 0 ) {
374  return "...";
375  }
376 
377  return s.left( leftIdx ) + "..." + s.right( rightIdx );
378 }
379 
380 TQString KStringHandler::rEmSqueeze(const TQString& name, const TQFontMetrics& fontMetrics, uint maxlen)
381 {
382  return rPixelSqueeze(name, fontMetrics, fontMetrics.maxWidth() * maxlen);
383 }
384 
385 TQString KStringHandler::rPixelSqueeze(const TQString& name, const TQFontMetrics& fontMetrics, uint maxPixels)
386 {
387  uint nameWidth = fontMetrics.width(name);
388 
389  if (maxPixels < nameWidth)
390  {
391  TQString tmp = name;
392  const uint em = fontMetrics.maxWidth();
393  maxPixels -= fontMetrics.width("...");
394 
395  while (maxPixels < nameWidth && !tmp.isEmpty())
396  {
397  int length = tmp.length();
398  int delta = em ? (nameWidth - maxPixels) / em : length;
399  delta = kClamp(delta, 1, length) ;
400 
401  tmp.remove(length - delta, delta);
402  nameWidth = fontMetrics.width(tmp);
403  }
404 
405  return (tmp + "...");
406  }
407 
408  return name;
409 }
410 
412 
413 bool KStringHandler::matchFileName( const TQString& filename, const TQString& pattern )
414 {
415  int len = filename.length();
416  int pattern_len = pattern.length();
417 
418  if (!pattern_len)
419  return false;
420 
421  // Patterns like "Makefile*"
422  if ( pattern[ pattern_len - 1 ] == (QChar)'*' && len + 1 >= pattern_len ) {
423  if ( pattern[ 0 ] == (QChar)'*' )
424  {
425  return filename.find(pattern.mid(1, pattern_len - 2)) != -1;
426  }
427 
428  const TQChar *c1 = pattern.unicode();
429  const TQChar *c2 = filename.unicode();
430  int cnt = 1;
431  while ( cnt < pattern_len && *c1++ == *c2++ )
432  ++cnt;
433  return cnt == pattern_len;
434  }
435 
436  // Patterns like "*~", "*.extension"
437  if ( pattern[ 0 ] == (QChar)'*' && len + 1 >= pattern_len )
438  {
439  const TQChar *c1 = pattern.unicode() + pattern_len - 1;
440  const TQChar *c2 = filename.unicode() + len - 1;
441  int cnt = 1;
442  while ( cnt < pattern_len && *c1-- == *c2-- )
443  ++cnt;
444  return cnt == pattern_len;
445  }
446 
447  // Patterns like "Makefile"
448  return ( filename == pattern );
449 }
450 
451  TQStringList
452 KStringHandler::perlSplit(const TQString & sep, const TQString & s, uint max)
453 {
454  bool ignoreMax = 0 == max;
455 
456  TQStringList l;
457 
458  int searchStart = 0;
459 
460  int tokenStart = s.find(sep, searchStart);
461 
462  while (-1 != tokenStart && (ignoreMax || l.count() < max - 1))
463  {
464  if (!s.mid(searchStart, tokenStart - searchStart).isEmpty())
465  l << s.mid(searchStart, tokenStart - searchStart);
466 
467  searchStart = tokenStart + sep.length();
468  tokenStart = s.find(sep, searchStart);
469  }
470 
471  if (!s.mid(searchStart, s.length() - searchStart).isEmpty())
472  l << s.mid(searchStart, s.length() - searchStart);
473 
474  return l;
475 }
476 
477  TQStringList
478 KStringHandler::perlSplit(const TQChar & sep, const TQString & s, uint max)
479 {
480  bool ignoreMax = 0 == max;
481 
482  TQStringList l;
483 
484  int searchStart = 0;
485 
486  int tokenStart = s.find(sep, searchStart);
487 
488  while (-1 != tokenStart && (ignoreMax || l.count() < max - 1))
489  {
490  if (!s.mid(searchStart, tokenStart - searchStart).isEmpty())
491  l << s.mid(searchStart, tokenStart - searchStart);
492 
493  searchStart = tokenStart + 1;
494  tokenStart = s.find(sep, searchStart);
495  }
496 
497  if (!s.mid(searchStart, s.length() - searchStart).isEmpty())
498  l << s.mid(searchStart, s.length() - searchStart);
499 
500  return l;
501 }
502 
503  TQStringList
504 KStringHandler::perlSplit(const TQRegExp & sep, const TQString & s, uint max)
505 {
506  bool ignoreMax = 0 == max;
507 
508  TQStringList l;
509 
510  int searchStart = 0;
511  int tokenStart = sep.search(s, searchStart);
512  int len = sep.matchedLength();
513 
514  while (-1 != tokenStart && (ignoreMax || l.count() < max - 1))
515  {
516  if (!s.mid(searchStart, tokenStart - searchStart).isEmpty())
517  l << s.mid(searchStart, tokenStart - searchStart);
518 
519  searchStart = tokenStart + len;
520  tokenStart = sep.search(s, searchStart);
521  len = sep.matchedLength();
522  }
523 
524  if (!s.mid(searchStart, s.length() - searchStart).isEmpty())
525  l << s.mid(searchStart, s.length() - searchStart);
526 
527  return l;
528 }
529 
530 TQString
531 KStringHandler::tagURLs( const TQString& text )
532 {
533  /*static*/ TQRegExp urlEx("(www\\.(?!\\.)|(fish|(f|ht)tp(|s))://)[\\d\\w\\./,:_~\\?=&;#@\\-\\+\\%\\$]+[\\d\\w/]");
534 
535  TQString richText( text );
536  int urlPos = 0, urlLen;
537  while ((urlPos = urlEx.search(richText, urlPos)) >= 0)
538  {
539  urlLen = urlEx.matchedLength();
540  TQString href = richText.mid( urlPos, urlLen );
541  // Qt doesn't support (?<=pattern) so we do it here
542  if((urlPos > 0) && richText[urlPos-1].isLetterOrNumber()){
543  urlPos++;
544  continue;
545  }
546  // Don't use TQString::arg since %01, %20, etc could be in the string
547  TQString anchor = "<a href=\"" + href + "\">" + href + "</a>";
548  richText.replace( urlPos, urlLen, anchor );
549 
550 
551  urlPos += anchor.length();
552  }
553  return richText;
554 }
555 
556 TQString KStringHandler::obscure( const TQString &str )
557 {
558  TQString result;
559  const TQChar *unicode = str.unicode();
560  for ( uint i = 0; i < str.length(); ++i )
561  result += ( unicode[ i ].unicode() < 0x21 ) ? unicode[ i ] :
562  TQChar( 0x1001F - unicode[ i ].unicode() );
563 
564  return result;
565 }
566 
567 bool KStringHandler::isUtf8(const char *buf)
568 {
569  int i, n;
570  unsigned char c;
571  bool gotone = false;
572 
573  if (!buf)
574  return true; // whatever, just don't crash
575 
576 #define F 0 /* character never appears in text */
577 #define T 1 /* character appears in plain ASCII text */
578 #define I 2 /* character appears in ISO-8859 text */
579 #define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
580 
581  static const unsigned char text_chars[256] = {
582  /* BEL BS HT LF FF CR */
583  F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */
584  /* ESC */
585  F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */
586  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */
587  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */
588  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */
589  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */
590  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */
591  T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */
592  /* NEL */
593  X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */
594  X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */
595  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */
596  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */
597  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */
598  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */
599  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */
600  I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */
601  };
602 
603  /* *ulen = 0; */
604  for (i = 0; (c = buf[i]); i++) {
605  if ((c & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */
606  /*
607  * Even if the whole file is valid UTF-8 sequences,
608  * still reject it if it uses weird control characters.
609  */
610 
611  if (text_chars[c] != T)
612  return false;
613 
614  } else if ((c & 0x40) == 0) { /* 10xxxxxx never 1st byte */
615  return false;
616  } else { /* 11xxxxxx begins UTF-8 */
617  int following;
618 
619  if ((c & 0x20) == 0) { /* 110xxxxx */
620  following = 1;
621  } else if ((c & 0x10) == 0) { /* 1110xxxx */
622  following = 2;
623  } else if ((c & 0x08) == 0) { /* 11110xxx */
624  following = 3;
625  } else if ((c & 0x04) == 0) { /* 111110xx */
626  following = 4;
627  } else if ((c & 0x02) == 0) { /* 1111110x */
628  following = 5;
629  } else
630  return false;
631 
632  for (n = 0; n < following; n++) {
633  i++;
634  if (!(c = buf[i]))
635  goto done;
636 
637  if ((c & 0x80) == 0 || (c & 0x40))
638  return false;
639  }
640  gotone = true;
641  }
642  }
643 done:
644  return gotone; /* don't claim it's UTF-8 if it's all 7-bit */
645 }
646 
647 #undef F
648 #undef T
649 #undef I
650 #undef X
651 
652 TQString KStringHandler::from8Bit( const char *str )
653 {
654  if (!str)
655  return TQString::null;
656  if (!*str) {
657  static const TQString &emptyString = TDEGlobal::staticQString("");
658  return emptyString;
659  }
660  return KStringHandler::isUtf8( str ) ?
661  TQString::fromUtf8( str ) :
662  TQString::fromLocal8Bit( str );
663 }
KStringHandler::reverse
static TQString reverse(const TQString &text)
Reverses the order of the words in a string "hello there" becomes "there hello" (string) ...
Definition: kstringhandler.cpp:219
KStringHandler::rsqueeze
static TQString rsqueeze(const TQString &str, uint maxlen=40)
Substitute characters at the end of a string by "...".
Definition: kstringhandler.cpp:294
KStringHandler::csqueeze
static TQString csqueeze(const TQString &str, uint maxlen=40)
Substitute characters at the middle of a string by "...".
Definition: kstringhandler.cpp:285
KStringHandler::word
static TQString word(const TQString &text, uint pos) KDE_DEPRECATED
Returns the nth word in the string if found Returns a EMPTY (not null) string otherwise.
Definition: kstringhandler.cpp:39
KStringHandler::tagURLs
static TQString tagURLs(const TQString &text)
This method auto-detects URLs in strings, and adds HTML markup to them so that richtext or HTML-enabl...
Definition: kstringhandler.cpp:531
KStringHandler::obscure
static TQString obscure(const TQString &str)
Obscure string by using a simple symmetric encryption.
Definition: kstringhandler.cpp:556
KStringHandler::from8Bit
static TQString from8Bit(const char *str)
Construct TQString from a c string, guessing whether it is UTF8- or Local8Bit-encoded.
Definition: kstringhandler.cpp:652
KStringHandler::remrange
static TQString remrange(const TQString &text, const char *range)
Removes a word or ranges of words from the string, and returns a new string.
Definition: kstringhandler.cpp:122
KStringHandler::cEmSqueeze
static TQString cEmSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxlen=30)
Substitute characters in the middle of a string by "...".
Definition: kstringhandler.cpp:333
KStringHandler::capwords
static TQString capwords(const TQString &text)
Capitalizes each word in the string "hello there" becomes "Hello There" (string)
Definition: kstringhandler.cpp:193
KStringHandler::insword
static TQString insword(const TQString &text, const TQString &word, uint pos)
Inserts a word into the string, and returns a new string with the word included.
Definition: kstringhandler.cpp:80
KStringHandler::lPixelSqueeze
static TQString lPixelSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxPixels)
Substitute characters at the beginning of a string by "...".
Definition: kstringhandler.cpp:308
KStringHandler::rPixelSqueeze
static TQString rPixelSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxPixels)
Substitute characters at the end of a string by "...".
Definition: kstringhandler.cpp:385
KStringHandler::cPixelSqueeze
static TQString cPixelSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxPixels)
Substitute characters in the middle of a string by "...".
Definition: kstringhandler.cpp:338
KStringHandler::remword
static TQString remword(const TQString &text, uint pos)
Removes a word at the given index, and returns a new string.
Definition: kstringhandler.cpp:151
TDEGlobal::staticQString
static const TQString & staticQString(const char *str)
Creates a static TQString.
Definition: tdeglobal.cpp:148
KStringHandler::rEmSqueeze
static TQString rEmSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxlen=30)
Substitute characters at the end of a string by "...".
Definition: kstringhandler.cpp:380
KStringHandler::lsqueeze
static TQString lsqueeze(const TQString &str, uint maxlen=40)
Substitute characters at the beginning of a string by "...".
Definition: kstringhandler.cpp:276
KStringHandler::center
static TQString center(const TQString &text, uint width)
Centers a string and returns a string at least 'width' characters wide.
Definition: kstringhandler.cpp:261
KStringHandler::matchFileName
static bool matchFileName(const TQString &filename, const TQString &pattern)
Match a filename.
Definition: kstringhandler.cpp:413
X
Definition: fixx11h.h:31
KStringHandler::isUtf8
static bool isUtf8(const char *str)
Guess whether a string is UTF8 encoded.
Definition: kstringhandler.cpp:567
KStringHandler::setword
static TQString setword(const TQString &text, const TQString &word, uint pos)
Replaces a word in the string, and returns a new string with the word included.
Definition: kstringhandler.cpp:100
KStringHandler::lEmSqueeze
static TQString lEmSqueeze(const TQString &name, const TQFontMetrics &fontMetrics, uint maxlen=30)
Substitute characters at the beginning of a string by "...".
Definition: kstringhandler.cpp:303
KStringHandler::ljust
static TQString ljust(const TQString &text, uint width) KDE_DEPRECATED
Left-justifies a string and returns a string at least 'width' characters wide.
Definition: kstringhandler.cpp:251
KStringHandler::rjust
static TQString rjust(const TQString &text, uint width) KDE_DEPRECATED
Right-justifies a string and returns a string at least 'width' characters wide.
Definition: kstringhandler.cpp:256
KStringHandler::perlSplit
static TQStringList perlSplit(const TQString &sep, const TQString &s, uint max=0)
Split a TQString into a TQStringList in a similar fashion to the static TQStringList function in Qt...
Definition: kstringhandler.cpp:452

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

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