KDevelop API Documentation

FileTemplate Class Reference

#include <filetemplate.h>

List of all members.

Public Types

enum  Policy { Default, Custom }

Static Public Member Functions

bool exists (KDevPlugin *part, const QString &name, Policy p=Default)
 Returns whether a template with the given name exists in the current project.
QString read (KDevPlugin *part, const QString &name, Policy p=Default)
 Reads a template with the given name (e.g.
QString readFile (KDevPlugin *part, const QString &fileName)
 Reads a template with the given URL and makes variable substitutions (like $AUTHOR$ etc.) in it.
bool copy (KDevPlugin *part, const QString &name, const QString &dest, Policy p=Default)
 Copies a file template with the given name to the file with the name dest and - while copying - performs variable substitutions.
QString fullPathForName (KDevPlugin *part, const QString &name, Policy p=Default)
 Translates a template name into a full path, or suggests a full path for the template in the project directory if it doesn't exist.


Member Enumeration Documentation

enum FileTemplate::Policy
 

Enumeration values:
Default 
Custom 

Definition at line 32 of file filetemplate.h.


Member Function Documentation

bool FileTemplate::copy KDevPlugin part,
const QString name,
const QString dest,
Policy  p = Default
[static]
 

Copies a file template with the given name to the file with the name dest and - while copying - performs variable substitutions.

Definition at line 80 of file filetemplate.cpp.

References read(), and text().

Referenced by ScriptNewFileDialog::accept(), AddFileDialog::accept(), and FileCreatePart::createNewFile().

bool FileTemplate::exists KDevPlugin part,
const QString name,
Policy  p = Default
[static]
 

Returns whether a template with the given name exists in the current project.

File templates are stored in the "templates" subdirectory of a project.

Definition at line 35 of file filetemplate.cpp.

References fullPathForName().

Referenced by ScriptNewFileDialog::accept(), and FileCreatePart::createNewFile().

QString FileTemplate::fullPathForName KDevPlugin part,
const QString name,
Policy  p = Default
[static]
 

Translates a template name into a full path, or suggests a full path for the template in the project directory if it doesn't exist.

Definition at line 102 of file filetemplate.cpp.

References KDevPlugin::project(), and KDevProject::projectDirectory().

Referenced by exists(), and read().

QString FileTemplate::read KDevPlugin part,
const QString name,
Policy  p = Default
[static]
 

Reads a template with the given name (e.g.

"cpp") and makes variable substitutions (like $AUTHOR$ etc.) in it. The resulting string is returned.

Definition at line 43 of file filetemplate.cpp.

References fullPathForName(), and readFile().

Referenced by SubclassingDlg::accept(), copy(), ImplementationWidget::createClass(), CppNewClassDialog::ClassGenerator::gen_implementation(), and CppNewClassDialog::ClassGenerator::gen_interface().

QString FileTemplate::readFile KDevPlugin part,
const QString fileName
[static]
 

Reads a template with the given URL and makes variable substitutions (like $AUTHOR$ etc.) in it.

The resulting string is returned.

Definition at line 54 of file filetemplate.cpp.

References KDevPlugin::projectDom(), and DomUtil::readEntry().

Referenced by read().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:24:54 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003