edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
edbee::NewlineCommand Class Reference

Inserts a newline. When smarttab is enabled it also inser leading tabs/spaces. More...

#include <newlinecommand.h>

+ Inheritance diagram for edbee::NewlineCommand:
+ Collaboration diagram for edbee::NewlineCommand:

Public Types

enum  NewLineType { NormalNewline = 0 , AddLineBefore = 1 , AddLineAfter = 2 }
 

Public Member Functions

 NewlineCommand (NewLineType method)
 Constructs the newline command.
 
QString calculateSmartIndent (TextEditorController *controller, TextRange &range)
 This method calculates the required 'smart' indent value at the given positon.
 
virtual void executeNormalNewline (TextEditorController *controller)
 Executes a 'normal' newline operation.
 
virtual void executeSpecialNewline (TextEditorController *controller, bool nextLine)
 Executes a special newline operation. (Inserts a newline before or the current line)
 
virtual void execute (TextEditorController *controller) override
 Executes the insert newline command.
 
virtual QString toString () override
 Returns the command name.
 
- Public Member Functions inherited from edbee::TextEditorCommand
 TextEditorCommand ()
 The default constructor.
 
virtual ~TextEditorCommand ()
 A blank virtual destructor.
 
virtual bool readonly ()
 Tis method should return true if it's executable in readonly mode.
 

Detailed Description

Inserts a newline. When smarttab is enabled it also inser leading tabs/spaces.

Member Enumeration Documentation

◆ NewLineType

Enumerator
NormalNewline 
AddLineBefore 
AddLineAfter 

Constructor & Destructor Documentation

◆ NewlineCommand()

edbee::NewlineCommand::NewlineCommand ( NewlineCommand::NewLineType method)

Constructs the newline command.

Parameters
metodthe method

Member Function Documentation

◆ calculateSmartIndent()

QString edbee::NewlineCommand::calculateSmartIndent ( TextEditorController * controller,
TextRange & range )

This method calculates the required 'smart' indent value at the given positon.

Parameters
controllerthe controller
rangethe range to calculate the smart tab for

◆ execute()

void edbee::NewlineCommand::execute ( TextEditorController * controller)
overridevirtual

Executes the insert newline command.

Parameters
controllerthe controller to execute this command for

Implements edbee::TextEditorCommand.

◆ executeNormalNewline()

void edbee::NewlineCommand::executeNormalNewline ( TextEditorController * controller)
virtual

Executes a 'normal' newline operation.

◆ executeSpecialNewline()

void edbee::NewlineCommand::executeSpecialNewline ( TextEditorController * controller,
bool nextLine )
virtual

Executes a special newline operation. (Inserts a newline before or the current line)

Parameters
controllerthe controller to execute this operation for
nextLinea nextline operation

◆ toString()

QString edbee::NewlineCommand::toString ( )
overridevirtual

Returns the command name.

Implements edbee::TextEditorCommand.


The documentation for this class was generated from the following files: