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

interfaces

  • KTextEditor
  • TemplateInterface
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
KTextEditor::TemplateInterface Class Referenceabstract

#include <templateinterface.h>

Public Member Functions

uint templateInterfaceNumber () const
 
bool insertTemplateText (uint line, uint column, const TQString &templateString, const TQMap< TQString, TQString > &initialValues, TQWidget *parentWindow=0)
 

Static Public Member Functions

static bool expandMacros (TQMap< TQString, TQString > &initialValues, TQWidget *parentWindow)
 

Protected Member Functions

void setTemplateInterfaceDCOPSuffix (const TQCString &suffix)
 
virtual bool insertTemplateTextImplementation (uint line, uint column, const TQString &templateString, const TQMap< TQString, TQString > &initialValues, TQWidget *parentWindow=0)=0
 

Friends

class PrivateTemplateInterface
 

Detailed Description

This is an interface for inserting template strings with user editable fields into a document.

Definition at line 37 of file templateinterface.h.

Constructor & Destructor Documentation

◆ TemplateInterface()

TemplateInterface::TemplateInterface ( )

Definition at line 39 of file templateinterface.cpp.

◆ ~TemplateInterface()

TemplateInterface::~TemplateInterface ( )
virtual

Definition at line 44 of file templateinterface.cpp.

Member Function Documentation

◆ expandMacros()

bool TemplateInterface::expandMacros ( TQMap< TQString, TQString > &  initialValues,
TQWidget *  parentWindow 
)
static

Parses templateString for macros in the form [$%]{NAME} and finds the value corresponding to NAME if any.

The NAME string may contain any non-whitespace character execpt '}'

Parameters
initialValuesa map with the keys for the macros to expand. keys with a value are ignored.
parentWindowis used if dialogs have to be shown
Returns
true if all macros was sucessfully expanded
See also
insertTemplateText for a list of supported macros

Definition at line 73 of file templateinterface.cpp.

◆ insertTemplateText()

bool TemplateInterface::insertTemplateText ( uint  line,
uint  column,
const TQString &  templateString,
const TQMap< TQString, TQString > &  initialValues,
TQWidget *  parentWindow = 0 
)

Inserts an interactive ediable template text at line "line", column "col".

parentWindow is used if dialogs have to be shown

Returns
true if inserting the string succeeded

Use insertTemplateText(numLines(), ...) to append text at end of document Template strings look like "for( int ${index}=0;${index}<10;${index}++) { ${cursor} };" or "%{date}"

This syntax is somewhat similiar to the one found in the Eclipse editor.

There are certain common placeholders (macros), which get assigned a default initialValue, If the second parameter does not a given value. For all others the initial value is the name of the placeholder.

Placeholder names may only consist of a-zA-Z0-9_ Common placeholders and values are

  • index: "i"
  • loginname: The current users's loginname
  • firstname: The current user's first name retrieved from tdeabc
  • lastname: The current user's last name retrieved from tdeabc
  • fullname: The current user's first and last name retrieved from tdeabc
  • email: The current user's primary email adress retrieved from tdeabc
  • date: current date
  • time: current time
  • year: current year
  • month: current month
  • day: current day
  • hostname: hostname of the computer
  • cursor: at this position the cursor will be after editing of the template has finished, this has to be taken care of by the actual implementation. The placeholder gets a value of "|" assigned.

If a macro is started with a % (persent sign) like "%{date}" it isn't added to the list editable strings ( for example TAB key navigation) if a value differing from the macro name is found.

If the editor supports some kind of smart indentation, the inserted code should be layouted by the indenter.

Definition at line 152 of file templateinterface.cpp.

◆ insertTemplateTextImplementation()

virtual bool KTextEditor::TemplateInterface::insertTemplateTextImplementation ( uint  line,
uint  column,
const TQString &  templateString,
const TQMap< TQString, TQString > &  initialValues,
TQWidget *  parentWindow = 0 
)
protectedpure virtual

You must implement this, it is called by insertTemplateText, after all default values are inserted.

If you are implementing this interface, this method should work as described in the documentation for insertTemplateText above.

Returns
true if any text was inserted.

◆ setTemplateInterfaceDCOPSuffix()

void TemplateInterface::setTemplateInterfaceDCOPSuffix ( const TQCString &  suffix)
protected

Definition at line 52 of file templateinterface.cpp.

◆ templateInterfaceNumber()

uint TemplateInterface::templateInterfaceNumber ( ) const

Definition at line 47 of file templateinterface.cpp.

Friends And Related Function Documentation

◆ PrivateTemplateInterface

friend class PrivateTemplateInterface
friend

Definition at line 39 of file templateinterface.h.


The documentation for this class was generated from the following files:
  • templateinterface.h
  • templateinterface.cpp

interfaces

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

interfaces

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