I am using doxygen to doxygenate a project that I am currently working on.
My problem is that Doxygen is not extracting any documentation for my .hh files and the classes in them, only for main.cc.
All my .hh files and my main.cc are in the same folder where i have my doxyfile. all my .hh have
/** #file name.hh
#brief whatever
*/
and they also have all the #include"some_header_file.hh" that they need to have.
my headerfiles are classes, so I also have
/** #class class_name
#brief whatever
*/
and all methodes are commented.
In my main file I also have its corresponding #file and #brief.
My doxyfile input configuration is the following one:
INPUT = "."
INPUT_ENCODING = utf-8
FILE_PATTERNS = main.cc \ *.hh
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *~
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
and yes, I also have EXTRACT_ALL = YES.
When I execute doxygen doxyfile it prints, at the end,
lookup cache used 1/65536 hits=0 misses=1
finished...
The result that I get has no information about my files except for main.cc.
How can I solve it?
Related
I have this situation
I have a table in my db containing some file names in a field1 (eg field1: "my file.ext")
NOTE: the filename does not necessarily pass a Typo3 "sanitizeFilename" check -> it may contain spaces " " or other characters that would be removed by the sanitizeFilename () method
I have the file mentioned above, stored on the server that host typo3
In the sys_file table, the file is not present
the "update storage index" scheduler cannot process all the files, and if i launch it, it "destroy" the file name (my file.ext -> my_file.ext), so the name stored in the field of my table doensn't have much sense anymore.
I would need to absorb the above mentioned files in the FAL, in order to use them in an ext typo3.
I had thought of such a solution
<?php
// read from "field1" of my table
// $filename = the name extracted from my table (e.g. : "my file.ext")
// %path = the path of the file : e.g. "/fileadmin/user_upload")
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $defaultStorage->getConfiguration()['basePath'] . $path . $filename)) {
// check the folder
if ($defaultStorage->hasFolder($path)) {
$folder = $defaultStorage->getFolder($path);
} else {
throw new \ Exception ($path . "path not found in AbstractImportCommand in method extractFile");
}
// CHECK IF FILE IS IN FAL
$file = $folder->getStorage()->getFileInFolder($filename, $folder);
if ($file) {
// the file already exists in the FAL
} else {
// create new sys_file
$file = $defaultStorage->addFile(
$_SERVER['DOCUMENT_ROOT'] . "/" . $defaultStorage->getConfiguration()['basePath'] . $path . $filename,
$folder,
DuplicationBehavior::REPLACE
);
}
}
Any suggestion?
Put your code into a command.
(optional) create a sys_file_metadata record for your file if you have information that needs to be stored there
create a sys_file_reference to your content record (before that you should adjust TCA accordingly)
For creating the sys_file_reference there is no api. A function doing so could look like this:
/**
* #param $fileUid
* #param $recordUid
* #param $table
*/
private function createSysFileReference($record, $fileUid, $tableName, $fieldName){
$data['sys_file_reference']['NEW_' . uniqid()] = [
'table_local' => 'sys_file',
'uid_local' => $fileUid,
'tablenames' => $tableName,
'uid_foreign' => $record['uid'],
'fieldname' => $fieldName,
'pid' => $record['pid']
];
$dataHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$dataHandler->start($data, []);
$dataHandler->process_datamap();
}
What you consider as "destroying the filename" is indeed preserving file functionality, so sanitizing the filenames is required.
As example consider a file with white space like "My Pdf.pdf". It will be shown eventually like "My%20Pdf.pdf" in the URL and also saved like this. If you link to it, at least the link text won't show the "%20" and the expectation that links and the name of the file are always synchronized (no matter how it's stored) isn't reliable as it probably depends on several parameters like operating system or browser too. The same problem might occur for many different signs too.
Consider that the problems occur not only when a user is downloading a file but also when a file is uploaded, where the wrong url-encoded name is saved in the database, this name might be saved differently in the filesystem or not be found even if the saved value is the same as in the filesystem, due to the url-encoded signs. Your file references are broken on the server then and according links might not work and images not displayed.
So circumventing FAL beside tables is a bad decision and while it's likely possible to write an own sanitizer, I would refrain from dropping it completely.
I'm trying to convert a project from coffeescript to javascript. I've successfully used the decaffeinate tool but something remains boring to convert manually: JSdoc comments
In coffescript we took the habit to write them like using the formalism of this example:
##
# This will remove the given file from the machine attachments list. If the file was previously uploaded
# to the server, it will be marked for deletion on the server. Otherwise, it will be simply truncated from
# the attachments array.
# #param file {Object} the file to delete
# #returns {boolean}
##
After using decaffeinate, they were transformed to something like that:
// #
// This will remove the given file from the machine attachments list. If the file was previously uploaded
// to the server, it will be marked for deletion on the server. Otherwise, it will be simply truncated from
// the attachments array.
// #param file {Object} the file to delete
// #returns {boolean}
// #
So I've tried to write a perl regex to make them look like the standard JSdoc syntax. But I'm stuck with the central lines: I can't find to way to put a star at the beginning of each lines ... Here's the best I've came to:
find . -type f -name "*.js" | xargs perl -0777 -i -pe 's~// #\n( +// (.+\n)+)( +)// #~/**\n$1$3 */~gm;'
Which results in:
/**
// This will remove the given file from the machine attachments list. If the file was previously uploaded
// to the server, it will be marked for deletion on the server. Otherwise, it will be simply truncated from
// the attachments array.
// #param file {Object} the file to delete
// #returns {boolean}
*/
But ideally, it should be transformed to:
/**
* This will remove the given file from the machine attachments list. If the file was previously uploaded
* to the server, it will be marked for deletion on the server. Otherwise, it will be simply truncated from
* the attachments array.
* #param file {Object} the file to delete
* #returns {boolean}
*/
Here's an example of a complete file to transform: https://gist.github.com/sylvainbx/96e53b879b4dd7ef7cdd153c3fc3c5b8
Any help would be appreciated :)
You can't easily do this within a single regular expression, as you need to capture and replace the first // # differently from the second // #. The following script shows how you can call a subroutine on the right hand side of the replacement and in that subroutine, you can use three simple regular expressions to convert your comment to JSdoc:
#!perl
use strict;
use warnings;
my $js = <<'JS';
foo
// #
// This will remove the given file from the machine attachments list. If the file was previously uploaded
// to the server, it will be marked for deletion on the server. Otherwise, it will be simply truncated from
// the attachments array.
// #param file {Object} the file to delete
// #returns {boolean}
// #
// # List of trainings
bar
JS
sub uncomment {
my($doc) = #_;
$doc =~ s!^// #!/*!;
$doc =~ s!// #$! */!;
$doc =~ s!^//( #)?! $1 ||'' eq '#' ? '/*' : ' *' !gme;
warn $doc;
$doc
}
$js =~ s!(// #\R// (.+\n)+( *)// #\R)!uncomment($1)!gme;
print $js;
Converted to a stand-alone document-to-JSdoc pipe, the following works:
#!perl
use strict;
use warnings;
local $/;
my $js = <>;
sub uncomment {
my($doc) = #_;
$doc =~ s!^// #!/*!;
$doc =~ s!// #$! */!;
$doc =~ s!^//( #)?! $1 ||'' eq '#' ? '/*' : ' *' !gme;
warn $doc;
$doc
}
$js =~ s!(// #\R// (.+?\n)+( *)// #\R)!uncomment($1)!gme;
print $js;
I would like to read meta information from PDF using Perl module Image::ExifTool. I need to process PDFs using cross reference streams (as of PDF 1.5), and the other well established modules like PDF::API2 and CAM::PDF seem not to support them or have limited support.
Anyway, Image::ExifTool reads apparently a number of PDF tags, but if I run the following code:
use Image::ExifTool qw(:Public);
my $file = 'file.pdf';
my $exifTool = new Image::ExifTool;
$exifTool->ExtractInfo($file);
my #tagList = $exifTool->GetFoundTags('File');
for (#tagList){
print "$_\n"
}
I do not seem to be able to get more then these tags:
ExifToolVersion
FileName
Directory
FileSize
FileModifyDate
FileAccessDate
FileCreateDate
FilePermissions
FileType
FileTypeExtension
MIMEType
PDFVersion
Linearized
Author
CreateDate
Creator (1)
ModifyDate
Producer (1)
Subject
Title (1)
XMPToolkit
CreateDate (1)
CreatorTool
ModifyDate (1)
MetadataDate
Producer
Format
Title
Description
Creator
DocumentID
InstanceID
PageLayout
PageMode
PageCount
In particular, I would like to get e.g. the PDF document catalog (Root tag). However running a code like this doesn't return any value:
my $tag = 'Root';
my $exifTool = new Image::ExifTool;
my $info = $exifTool->ImageInfo($file, $tag);
for (sort keys %$info) {
print "$_ => $$info{$_}\n";
}
Help please :-)
To see the parsing enable verbose mode: $exifTool->Options(Verbose => 1); It shows that the Root is indeed being parsed.
7) Root (SubDirectory) -->
+ [Root directory with 7 entries]
| 0) Metadata (SubDirectory) -->
| + [Metadata directory with 3 entries]
I'm unsure what data you need from the root tag, but it's possible to get with the internal API: my $roottag = Image::ExifTool::GetTagTable('Image::ExifTool::PDF::Root');
From Image::ExifTool:
exports not part of the public API, but used by ExifTool modules:
In doxygen I write:
/*! Sample:
\code{.cpp}
void main(int argc, char** argv)
{
if (argc < 2)
{
cout << "no way!" << endl;
}
else
{
foobar(argv[1]);
}
}
\endcode
*/
Now doxygen will generate a perfectly syntax-highlighted code sample for my documentation, but unfortunately it also kills the indentation:
Sample:
void main(int argc, char** argv)
{
if (argc < 2)
{
cout << "no way!" << endl;
}
else
{
foobar(argv[1]);
}
}
What can I do to make doxygen respect my indentation. I know there is \verbatim, but it does not highlight the syntax.
EDIT:
Here's the doxygen configuration, perhaps there's something wrong in there:
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = demo
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ../../../../../Desktop/dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = NO
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = C:\Users\foobar\Desktop\dox\demo.log
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../demo/src/export
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.f90 \
*.f \
*.vhd \
*.vhdl
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER = header.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
MATHJAX_EXTENSIONS =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = FreeSans
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH = \\somewhere\over\the\rainbow
DOTFILE_DIRS =
MSCFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
If you are using Doxygen 1.8.1.1 or older the indentation will be respected.
Doxygen Release 1.8.1.2 removes leading indentation shared by the #code lines. Check the Change log released on 12-07-2012.
I had the same problem and it turned out due to the use of a custom HTML_STYLESHEET: our CSS file defined its own styles for div.fragment used by Doxygen to wrap code snippets which didn't include white-space: pre. Adding it fixed the problem.
Update your doxygen html (.css) stylesheet to the latest version. That fixed the problem for me.
Using doxygen 1.8.1 I get a syntax highlighted code block with indentation respected with the example in the question. Which version of doxygen are you using? Perhaps this is just a case of upgrading your version of doxygen. If this is not the solution you will have to provide a bit more context, i.e. is the example documentation you give in your source code in a .txt or .markdown file?
I did have to change your opening comment character from \ to /, I presume this is just a typo. Also, if your file contains C++ source then the {.cpp} can be left out of \code{.cpp} (i.e. \code by itself is fine).
I had this problem when documenting the same code with the same Doxygen 1.8.11 on another (significantly older) computer. All generated output was re-created, including the CSS.
The indentation was visible in the HTML source but the system-default browser refused to show it properly, and a corresponding CHM file behaved likewise (not surprising as the Microsoft's CHM viewer uses the same browser).
Well, it was the browser which is obviously too old for this. Even Firefox 14, which is also quite old, shows the generated HTML with indentation.
The code says Zend_Form_element_File::setDestination() is deprecated and to use the rename filter. However the rename filter is currently codes such that when path is set, only temporary name is given. Original filename is lost.
<?php
$file = new Zend_Form_Element_File();
$file->setDestination('/var/www/project/public');
?>
vs
<?php
$file = new Zend_Form_Element_File();
$file->addFilter('Rename', array('target' => '/var/www/project/public'));
?>
Any solution to upload files so that it preserves original filename structure but checks for existing file and appends _1.ext or _2.ext?
You need to query the name of the file after upload and then add the Rename filter then. Eg:
if ($form->file->isUploaded()) {
$fileinfo = $form->file->getFileInfo();
$filename = $fileinfo['file']['name'];
$extn = pathinfo($filename,PATHINFO_EXTENSION);
$uploadname = $this->_makeFilename($formData, $extn);
$uploadfilepath = UPLOADED_FILES_PATH . '/' . $uploadname;
$form->file->addFilter('Rename', $uploadfilepath);
$receiveStatus = $form->file->receive();
}
After submitting the form you can inspect the $_FILES['file_element']['name'] check for existing files and then set the rename filter on your form element before calling the :
$form->getValues()/isValid() or $form->file_element->receive().