This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198793 - No File-templates variables for C++ documentation available
Summary: No File-templates variables for C++ documentation available
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.2.1
Hardware: All All
: P3 normal with 3 votes (vote)
Assignee: atjuan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-22 17:19 UTC by Kirschi
Modified: 2017-02-01 10:16 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kirschi 2011-05-22 17:19:11 UTC
I've found not a single tutorial/help/docs for the C++ file-templates variables (not the template technique) on the web. Like those: %<%CLASSNAME%>%, %<%DEFAULT_HEADER_EXT%>%.
At least a list with all the variables or a way to modify them.

I haven't found any resources on that topic. Only tons of Java's Freemarker tutorials.

And some info on how (if possible) to modify those variables, like the date example in the Java Netbeans wiki: ${date?date?string("yyyy")}
Comment 1 Alexander Simon 2012-05-17 15:49:26 UTC
List of supported template variables is:
-PACKAGE_AND_NAME
-NAME
-EXTENSION
-GUARD_NAME
-CROPPEDNAME
-DATE
-TIME
-QUOTES
-USER
For example template:
-----------------8<-----------------
/*
PACKAGE_AND_NAME=%<%PACKAGE_AND_NAME%>%
NAME=%<%NAME%>%
EXTENSION=%<%EXTENSION%>%
GUARD_NAME=%<%GUARD_NAME%>%
CROPPEDNAME=%<%CROPPEDNAME%>%
DATE=%<%DATE%>%
TIME=%<%TIME%>%
QUOTES=%<%QUOTES%>%
USER=%<%USER%>%
*/
-----------------8<-----------------
will generate following code:
-----------------8<-----------------
/*
PACKAGE_AND_NAME=_home_user_NetBeansProjects_CppApplication_15_newClass
NAME=newClass
EXTENSION=cpp
GUARD_NAME=NEWCLASS_CPP
CROPPEDNAME=newClass
DATE=May 17, 2012
TIME=7:41 PM
QUOTES="
USER=user
*/
-----------------8<-----------------
Comment 2 Xypron 2012-07-28 07:40:30 UTC
Thank you for enumerating the variables available.

How can these variables be preset?

For example I have the following line
* Author: %<%USER%>%
which should exand to
* Author: firstname lastname <email@server.domain>

How can I preset variable %USER%?

Putting the following into user.properties does not work:
user=firstname lastname <email@server.domain>
Comment 3 Goonicus 2013-01-16 08:17:38 UTC
Could somebody answer him? I've found that, when working with C files on a Mac in 7.2.1, %<%USER%>% cannot be changed. I can change the other things in the User.properties file (just for testing purposes; I set name to a static string and &<&NAME&>& did, in fact, return it.)

This has been driving me crazy for a while.
Comment 4 jaisondaniel 2013-07-09 16:45:08 UTC
If you are unable to preset the variable USER then, use different variable like AUTHOR in the user setting(ie, User.properties). and all the places in C++ source code use AUTHOR variable instead of USER. It worked for me in Netbeans 7.3.1 for C++.
Comment 5 jaisondaniel 2013-07-09 16:51:20 UTC
any alternative for freemaker <#include>(which is used in java and other except C++/CND) template in CND(C++).
or when the freemaker will available in C++/CND ?
Comment 6 Quality Engineering 2015-04-27 05:09:32 UTC
Integrated into 'main-silver', will be available in build *201504270341* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/da4cb91c0c54
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing bugs:
- Bug #192074 Add Project Name to File Template Keywords
- Bug #198793 No File-templates variables for C++ documentation available
Migrate c/c++/fortran templates on FreeMarker:
- use FreeMarker variables syntax ${var}
- add license
- change login meme to user name

Avaliable containing project variables:
- project.name
- project.displayName
- project.encoding
- project.license
- project.licensePath

To compatibility old variable "USER" has a previous meaning (login name).

New variable "user" contains login or user name specified in template properties (Tools->Templates-Settings)

If property "project.licensePath" or "project.license" is specified in project properties (nbproject/project.properties or nbproject/private/project.properties),
it is used for licence generating. Othewvise the default licence will be inserted in the created file.
Comment 7 kazssym 2015-04-28 08:06:08 UTC
(In reply to Quality Engineering from comment #6)
> Integrated into 'main-silver', will be available in build *201504270341* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> 
> Changeset: http://hg.netbeans.org/main-silver/rev/da4cb91c0c54
> User: Alexander Simon <alexvsimon@netbeans.org>
> Log: fixing bugs:
> - Bug #192074 Add Project Name to File Template Keywords
> - Bug #198793 No File-templates variables for C++ documentation available
> Migrate c/c++/fortran templates on FreeMarker:
> - use FreeMarker variables syntax ${var}
> - add license
> - change login meme to user name
> 
> Avaliable containing project variables:
> - project.name
> - project.displayName
> - project.encoding
> - project.license
> - project.licensePath
> 
> To compatibility old variable "USER" has a previous meaning (login name).
> 
> New variable "user" contains login or user name specified in template
> properties (Tools->Templates-Settings)
> 
> If property "project.licensePath" or "project.license" is specified in
> project properties (nbproject/project.properties or
> nbproject/private/project.properties),
> it is used for licence generating. Othewvise the default licence will be
> inserted in the created file.

I installed build 201504270341 but I see no notable changes in C/C++ project properties.  Your change has just slipped to the next build?
Comment 8 Alexander Simon 2015-04-28 12:36:32 UTC
(In reply to kazssym from comment #7)
> I installed build 201504270341 but I see no notable changes in C/C++ project
> properties.  Your change has just slipped to the next build?
There is no changes in project properties UI.
Example how to use license:
- Create C/C++ Application
- Create file nbproject/project.properties with content:
project.licensePath=/Templates/Licenses/license-bsd.txt
- Create new C++ main file
Created file will have "BSD 2-Clause License" in the beginning of the file.
Comment 9 Quality Engineering 2015-05-06 02:55:54 UTC
Integrated into 'main-silver', will be available in build *201505060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1337405cecce
User: Alexander Simon <alexvsimon@netbeans.org>
Log: additional fix for Bug #198793 No File-templates variables for C++ documentation available
- support freemaker based template with empty extension
Comment 10 sundbergad 2017-02-01 08:19:14 UTC
(In reply to Alexander Simon from comment #8)
> (In reply to kazssym from comment #7)
> > I installed build 201504270341 but I see no notable changes in C/C++ project
> > properties.  Your change has just slipped to the next build?
> There is no changes in project properties UI.
> Example how to use license:
> - Create C/C++ Application
> - Create file nbproject/project.properties with content:
> project.licensePath=/Templates/Licenses/license-bsd.txt
> - Create new C++ main file
> Created file will have "BSD 2-Clause License" in the beginning of the file.

Hi Simon,
have tried to follow your instruction though nothing is displayed. Using 7.3 (Build 201306052037)
Any ideas?
Comment 11 Alexander Simon 2017-02-01 10:16:35 UTC
(In reply to sundbergad from comment #10)
> (In reply to Alexander Simon from comment #8)
> > (In reply to kazssym from comment #7)
> > > I installed build 201504270341 but I see no notable changes in C/C++ project
> > > properties.  Your change has just slipped to the next build?
> > There is no changes in project properties UI.
> > Example how to use license:
> > - Create C/C++ Application
> > - Create file nbproject/project.properties with content:
> > project.licensePath=/Templates/Licenses/license-bsd.txt
> > - Create new C++ main file
> > Created file will have "BSD 2-Clause License" in the beginning of the file.
> 
> Hi Simon,
> have tried to follow your instruction though nothing is displayed. Using 7.3
> (Build 201306052037)
> Any ideas?

There is no ideas about Netbeans 7.3. Use Netbeans 8.2.

Alexanders