Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse C/C++ Developer Guide
Previous Page Home Next Page

Code templates

The Opens the Code Templates preference page C/C++ > Code Style > Code Templates preference page lets you configure the format of newly generated code stubs, comments and files.

The code templates page contains templates that are used by actions that generate code and/or source files. E.g. the New Class wizard uses source and header file templates to create new files and code templates to insert generated method stubs. Templates contain variables that are substituted when the template is applied. Some variables are available in all templates, some are specific to templates.

Action

Description

New...

Opens the Code Template dialog to create a new file template.

Edit...

Opens the Code Template dialog to edit the currently selected code template.

Remove

Removes a user added file template. Predefined templates cannot be removed.

Import...

Imports templates from the file system.

Export...

Exports all selected templates to the file system.

Export All...

Exports all templates to the file system.

Comment Templates

Template Name

Specifies

Files

Header comment for new source or header files.

Note that this template can be referenced in source and header file templates with ${filecomment}.

Types

The comment for new types.

Note that this template can be referenced in source and header file templates with ${typecomment}.

Fields

The comment for new fields.

Constructors

The comment for new constructors.

Destructors

The comment for new destructors.

Methods

The comment for new methods.

Code Templates

Template Name

Description

Method body

The 'Method body' templates are used when new method is created.

Constructor body

The 'Constructor body' templates are used when a constructor is created.

Destructor body

The 'Destructor body' templates are used when the destructor is created.

File Templates

File templates can not only be defined and modified for C/C++ files, but also for other content types, like Assembly files or plain text files. The New File from Template wizard can be used to create new files based on one of the templates defined in this page.

Template Name

Description

Default C++ source template

Used by the New Class wizard and the New Source File wizard when a new C++ source file is created.

The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template.

Default C++ header template

Used by the New Class wizard and the New Header File wizard when a new C++ header file is created.

The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template.

Default C source template

Used by the New Source File wizard when a new C source file is created.

The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template.

Default C header template

Used by the New Header File wizard when a new C source file is created.

The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template.

Other file templates

File templates can be defined for other content types, e.g. Assembly or plain text.

Edit Template dialog

The following fields and buttons appear in the dialog:

Action

Description

Name

The name of the template. Only available for file templates.

Type

The file type (content type) of the template. Only available for file templates.

Description

A description of the template

Pattern

The template pattern.

Insert Variables...

Displays a list of pre-defined template specific variables.

Related concepts
Coding aids

Related reference
C/C++ editor preferences

IBM Copyright Statement

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire