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

kate

  • kate
  • part
katetextline.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
3  Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
4 
5  Based on:
6  KateTextLine : Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License version 2 as published by the Free Software Foundation.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef __KATE_TEXTLINE_H__
24 #define __KATE_TEXTLINE_H__
25 
26 #include <ksharedptr.h>
27 
28 #include <tqmemarray.h>
29 #include <tqstring.h>
30 
31 class KateRenderer;
32 class TQTextStream;
33 
41 class KateTextLine : public TDEShared
42 {
43  public:
47  typedef TDESharedPtr<KateTextLine> Ptr;
48 
49  public:
53  enum Flags
54  {
55  flagNoOtherData = 1, // ONLY INTERNAL USE, NEVER EVER SET THAT !!!!
56  flagHlContinue = 2,
57  flagAutoWrapped = 4,
58  flagFoldingColumnsOutdated = 8,
59  flagNoIndentationBasedFolding = 16,
60  flagNoIndentationBasedFoldingAtStart = 32
61  };
62 
63  public:
69  KateTextLine ();
70 
74  ~KateTextLine ();
75 
79  public:
83  inline void setFoldingColumnsOutdated(bool set) { if (set) m_flags |= KateTextLine::flagFoldingColumnsOutdated; else m_flags&=
84  (~KateTextLine::flagFoldingColumnsOutdated);}
85 
90  inline bool foldingColumnsOutdated() { return m_flags & KateTextLine::flagFoldingColumnsOutdated; }
91 
92 
97  inline uint length() const { return m_text.length(); }
98 
103  inline bool hlLineContinue () const { return m_flags & KateTextLine::flagHlContinue; }
104 
109  inline bool isAutoWrapped () const { return m_flags & KateTextLine::flagAutoWrapped; }
110 
115  int firstChar() const;
116 
121  int lastChar() const;
122 
129  int nextNonSpaceChar(uint pos) const;
130 
137  int previousNonSpaceChar(uint pos) const;
138 
145  inline TQChar getChar (uint pos) const { return m_text[pos]; }
146 
151  inline const TQChar *text() const { return m_text.unicode(); }
152 
167  inline uchar *attributes () const { return m_attributes.data(); }
168 
173  inline const TQString& string() const { return m_text; }
174 
181  inline TQString string(uint startCol, uint length) const
182  { return m_text.mid(startCol, length); }
183 
188  const TQChar *firstNonSpace() const;
189 
195  uint indentDepth (uint tabwidth) const;
196 
204  int cursorX(uint pos, uint tabChars) const;
205 
211  uint lengthWithTabs (uint tabChars) const;
212 
219  bool stringAtPos(uint pos, const TQString& match) const;
220 
226  bool startingWith(const TQString& match) const;
227 
233  bool endingWith(const TQString& match) const;
234 
245  bool searchText (uint startCol, const TQString &text,
246  uint *foundAtCol, uint *matchLen,
247  bool casesensitive = true,
248  bool backwards = false);
249 
259  bool searchText (uint startCol, const TQRegExp &regexp,
260  uint *foundAtCol, uint *matchLen,
261  bool backwards = false);
262 
271  inline uchar attribute (uint pos) const
272  {
273  if (pos < m_attributes.size()) return m_attributes[pos];
274  return 0;
275  }
276 
281  inline const TQMemArray<short> &ctxArray () const { return m_ctx; };
282 
286  inline const bool noIndentBasedFolding() const { return m_flags & KateTextLine::flagNoIndentationBasedFolding; };
287  inline const bool noIndentBasedFoldingAtStart() const { return m_flags & KateTextLine::flagNoIndentationBasedFoldingAtStart; };
292  inline const TQMemArray<uint> &foldingListArray () const { return m_foldingList; };
293 
298  inline const TQMemArray<unsigned short> &indentationDepthArray () const { return m_indentationDepth; };
299 
307  void insertText (uint pos, uint insLen, const TQChar *insText, uchar *insAttribs = 0);
308 
314  void removeText (uint pos, uint delLen);
315 
320  void truncate(uint newLen);
321 
326  inline void setHlLineContinue (bool cont)
327  {
328  if (cont) m_flags = m_flags | KateTextLine::flagHlContinue;
329  else m_flags = m_flags & ~ KateTextLine::flagHlContinue;
330  }
331 
336  inline void setAutoWrapped (bool wrapped)
337  {
338  if (wrapped) m_flags = m_flags | KateTextLine::flagAutoWrapped;
339  else m_flags = m_flags & ~ KateTextLine::flagAutoWrapped;
340  }
341 
346  inline void setContext (TQMemArray<short> &val) { m_ctx.assign (val); }
347 
351  inline void setNoIndentBasedFolding(bool val)
352  {
353  if (val) m_flags = m_flags | KateTextLine::flagNoIndentationBasedFolding;
354  else m_flags = m_flags & ~ KateTextLine::flagNoIndentationBasedFolding;
355  }
356 
357  inline void setNoIndentBasedFoldingAtStart(bool val)
358  {
359  if (val) m_flags = m_flags | KateTextLine::flagNoIndentationBasedFoldingAtStart;
360  else m_flags = m_flags & ~ KateTextLine::flagNoIndentationBasedFoldingAtStart;
361  }
362 
367  inline void setFoldingList (TQMemArray<uint> &val) { m_foldingList.assign (val); m_foldingList.detach(); }
368 
373  inline void setIndentationDepth (TQMemArray<unsigned short> &val) { m_indentationDepth.assign (val); }
374 
378  public:
384  inline uint dumpSize (bool withHighlighting) const
385  {
386  return ( 1
387  + sizeof(uint)
388  + (m_text.length() * sizeof(TQChar))
389  + ( withHighlighting ?
390  ( (3 * sizeof(uint))
391  + (m_text.length() * sizeof(uchar))
392  + (m_ctx.size() * sizeof(short))
393  + (m_foldingList.size() * sizeof(uint))
394  + (m_indentationDepth.size() * sizeof(unsigned short))
395  ) : 0
396  )
397  );
398  }
399 
407  char *dump (char *buf, bool withHighlighting) const;
408 
415  char *restore (char *buf);
416 
420  private:
424  TQString m_text;
425 
431  TQMemArray<uchar> m_attributes;
432 
436  TQMemArray<short> m_ctx;
437 
441  TQMemArray<uint> m_foldingList;
442 
446  TQMemArray<unsigned short> m_indentationDepth;
447 
451  uchar m_flags;
452 };
453 
454 #endif

kate

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

kate

Skip menu "kate"
  • 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 kate by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.