• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/interfaces

  • KDevelop
  • IDocument
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDevelop::IDocument Class Referenceabstract

#include <idocument.h>

Public Types

enum  DocumentSaveMode { Default = 0x0, Silent = 0x1, Discard = 0x2 }
 
enum  DocumentState { Clean, Modified, Dirty, DirtyAndModified }
 

Public Member Functions

virtual ~IDocument ()
 
virtual void activate (Sublime::View *activeView, KParts::MainWindow *mainWindow)=0
 
virtual KTextEditor::View * activeTextView () const
 
virtual bool close (DocumentSaveMode mode=Default)=0
 
virtual KTextEditor::Cursor cursorPosition () const =0
 
virtual bool isActive () const =0
 
virtual bool isTextDocument () const
 
virtual QMimeType mimeType () const =0
 
virtual KParts::Part * partForView (QWidget *view) const =0
 
virtual QString prettyName () const
 
virtual void reload ()=0
 
virtual bool save (DocumentSaveMode mode=Default)=0
 
virtual void setCursorPosition (const KTextEditor::Cursor &cursor)=0
 
virtual void setPrettyName (const QString &name)
 
virtual void setTextSelection (const KTextEditor::Range &range)=0
 
virtual DocumentState state () const =0
 
virtual QString text (const KTextEditor::Range &range) const
 
virtual KTextEditor::Document * textDocument () const =0
 
virtual QString textLine () const
 
virtual KTextEditor::Range textSelection () const
 
virtual QString textWord () const
 
virtual QUrl url () const =0
 

Protected Member Functions

 IDocument (ICore *)
 
ICore * core ()
 
void notifyActivated ()
 
void notifyContentChanged ()
 
void notifyLoaded ()
 
void notifySaved ()
 
void notifyStateChanged ()
 
void notifyTextDocumentCreated ()
 
void notifyUrlChanged ()
 

Detailed Description

A single document being edited by the IDE.

The base class for tracking a document. It contains the URL, the part, and any associated metadata for the document.

The advantages are:

  • an easier key for use in maps and the like
  • a value which does not change when the filename changes
  • clearer distinction in the code between an open document and a url (which may or may not be open)

Definition at line 57 of file idocument.h.

Member Enumeration Documentation

◆ DocumentSaveMode

enum KDevelop::IDocument::DocumentSaveMode
Enumerator
Default 

standard save mode, gives a warning message if the file was modified outside the editor

Silent 

silent save mode, doesn't warn the user if the file was modified outside the editor

Discard 

discard mode, don't save any unchanged data

Definition at line 70 of file idocument.h.

◆ DocumentState

enum KDevelop::IDocument::DocumentState

Document state.

Enumerator
Clean 

Document is not touched.

Modified 

Document is modified inside the IDE.

Dirty 

Document is modified by an external process.

DirtyAndModified 

Document is modified inside the IDE and at the same time by an external process.

Definition at line 62 of file idocument.h.

Constructor & Destructor Documentation

◆ ~IDocument()

KDevelop::IDocument::~IDocument ( )
virtual

Definition at line 73 of file idocument.cpp.

◆ IDocument()

KDevelop::IDocument::IDocument ( KDevelop::ICore *  core)
explicitprotected

Definition at line 68 of file idocument.cpp.

Member Function Documentation

◆ activate()

virtual void KDevelop::IDocument::activate ( Sublime::View *  activeView,
KParts::MainWindow *  mainWindow 
)
pure virtual

Performs document activation actions if any.

This needs to call notifyActivated()

◆ activeTextView()

KTextEditor::View * KDevelop::IDocument::activeTextView ( ) const
virtual
Returns
the active text view in case it's a text document and it has one.

Definition at line 157 of file idocument.cpp.

◆ close()

virtual bool KDevelop::IDocument::close ( DocumentSaveMode  mode = Default)
pure virtual

Requests that the document be closed.

Returns
whether the document was successfully closed.

◆ core()

KDevelop::ICore * KDevelop::IDocument::core ( )
protected

Definition at line 80 of file idocument.cpp.

◆ cursorPosition()

virtual KTextEditor::Cursor KDevelop::IDocument::cursorPosition ( ) const
pure virtual

Access the current text cursor position, if possible.

Returns
the current text cursor position, or an invalid cursor otherwise.

◆ isActive()

virtual bool KDevelop::IDocument::isActive ( ) const
pure virtual

Enquires whether this document is currently active in the currently active mainwindow.

◆ isTextDocument()

bool KDevelop::IDocument::isTextDocument ( ) const
virtual

Returns whether this document is a text document.

Definition at line 107 of file idocument.cpp.

◆ mimeType()

virtual QMimeType KDevelop::IDocument::mimeType ( ) const
pure virtual

Returns the mimetype of the document.

◆ notifyActivated()

void KDevelop::IDocument::notifyActivated ( )
protected

Definition at line 97 of file idocument.cpp.

◆ notifyContentChanged()

void KDevelop::IDocument::notifyContentChanged ( )
protected

Definition at line 102 of file idocument.cpp.

◆ notifyLoaded()

void KDevelop::IDocument::notifyLoaded ( )
protected

Definition at line 151 of file idocument.cpp.

◆ notifySaved()

void KDevelop::IDocument::notifySaved ( )
protected

Definition at line 87 of file idocument.cpp.

◆ notifyStateChanged()

void KDevelop::IDocument::notifyStateChanged ( )
protected

Definition at line 92 of file idocument.cpp.

◆ notifyTextDocumentCreated()

void KDevelop::IDocument::notifyTextDocumentCreated ( )
protected

Definition at line 112 of file idocument.cpp.

◆ notifyUrlChanged()

void KDevelop::IDocument::notifyUrlChanged ( )
protected

Definition at line 146 of file idocument.cpp.

◆ partForView()

virtual KParts::Part* KDevelop::IDocument::partForView ( QWidget *  view) const
pure virtual

Returns the part for given view if this document is a KPart document or 0 otherwise.

◆ prettyName()

QString KDevelop::IDocument::prettyName ( ) const
virtual

returns the pretty name of this document that was set through setPrettyName(...).

If no pretty name was set, an empty string is returned.

Definition at line 132 of file idocument.cpp.

◆ reload()

virtual void KDevelop::IDocument::reload ( )
pure virtual

Reloads the document.

◆ save()

virtual bool KDevelop::IDocument::save ( DocumentSaveMode  mode = Default)
pure virtual

Saves the document.

Returns
true if the document was saved, false otherwise

◆ setCursorPosition()

virtual void KDevelop::IDocument::setCursorPosition ( const KTextEditor::Cursor &  cursor)
pure virtual

Set the current text cursor position, if possible.

Parameters
cursornew cursor position.

◆ setPrettyName()

void KDevelop::IDocument::setPrettyName ( const QString &  name)
virtual

Set a 'pretty' name for this document.

That name will be used when displaying the document in the UI, instead of the filename and/or path.

Parameters
nameThe pretty name to use. Give an empty name to reset.

Definition at line 139 of file idocument.cpp.

◆ setTextSelection()

virtual void KDevelop::IDocument::setTextSelection ( const KTextEditor::Range &  range)
pure virtual

Set the current text selection, if possible.

Parameters
rangenew cursor position.

◆ state()

virtual DocumentState KDevelop::IDocument::state ( ) const
pure virtual

Checks the state of this document.

Returns
The document state.

◆ text()

QString KDevelop::IDocument::text ( const KTextEditor::Range &  range) const
virtual
Returns
the text in a given range

Definition at line 162 of file idocument.cpp.

◆ textDocument()

virtual KTextEditor::Document* KDevelop::IDocument::textDocument ( ) const
pure virtual

Returns the text editor, if this is a text document or 0 otherwise.

◆ textLine()

QString KDevelop::IDocument::textLine ( ) const
virtual

Retrieve the current text line, if one exists.

Returns
the current text line

Definition at line 122 of file idocument.cpp.

◆ textSelection()

KTextEditor::Range KDevelop::IDocument::textSelection ( ) const
virtual

Retrieve the current text selection, if one exists.

Returns
the current text selection

Definition at line 117 of file idocument.cpp.

◆ textWord()

QString KDevelop::IDocument::textWord ( ) const
virtual

Retrieve the current text word, if one exists.

Returns
the current text word

Definition at line 127 of file idocument.cpp.

◆ url()

virtual QUrl KDevelop::IDocument::url ( ) const
pure virtual

Returns the URL of this document.


The documentation for this class was generated from the following files:
  • idocument.h
  • idocument.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 23:38:10 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/interfaces

Skip menu "kdevplatform/interfaces"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal