QElectroTech  0.70
Public Member Functions | Private Member Functions | Private Attributes | List of all members
QETArguments Class Reference

#include <qetarguments.h>

Public Member Functions

 QETArguments (QObject *=nullptr)
 
 QETArguments (const QList< QString > &, QObject *=nullptr)
 
 QETArguments (const QETArguments &)
 
QETArgumentsoperator= (const QETArguments &)
 
 ~QETArguments () override
 
virtual void setArguments (const QList< QString > &)
 
virtual QList< QString > arguments () const
 
virtual QList< QString > files () const
 
virtual QList< QString > projectFiles () const
 
virtual QList< QString > elementFiles () const
 
virtual QList< QString > titleBlockTemplateFiles () const
 
virtual bool langDirSpecified () const
 
virtual QString langDir () const
 
virtual bool printHelpRequested () const
 
virtual bool printLicenseRequested () const
 
virtual bool printVersionRequested () const
 
virtual QList< QString > options () const
 
virtual QList< QString > unknownOptions () const
 

Private Member Functions

void clear ()
 
void parseArguments (const QList< QString > &)
 
void handleFileArgument (const QString &)
 
void handleOptionArgument (const QString &)
 

Private Attributes

QList< QString > project_files_
 
QList< QString > element_files_
 
QList< QString > tbt_files_
 
QList< QString > options_
 
QList< QString > unknown_options_
 
QString lang_dir_
 
bool print_help_
 
bool print_license_
 
bool print_version_
 

Detailed Description

This class represents a set of arguments the application has received as parameters. Initialized from a list of strings, an instance of this class provides access to the differents options and files given on the command line.

Definition at line 26 of file qetarguments.h.

Constructor & Destructor Documentation

◆ QETArguments() [1/3]

QETArguments::QETArguments ( QObject *  parent = nullptr)

Constructeur par defaut Cree un objet sans argument.

Definition at line 25 of file qetarguments.cpp.

◆ QETArguments() [2/3]

QETArguments::QETArguments ( const QList< QString > &  args,
QObject *  parent = nullptr 
)

Constructeur

Parameters
argsArguments a analyser et memoriser
parentQObject parent

Definition at line 38 of file qetarguments.cpp.

References parseArguments().

◆ QETArguments() [3/3]

QETArguments::QETArguments ( const QETArguments qet_arguments)

Constructeur de copie - la copie reprend le parent de l'original

Parameters
qet_argumentsObjet a copier

Definition at line 51 of file qetarguments.cpp.

◆ ~QETArguments()

QETArguments::~QETArguments ( )
override

Destructeur

Definition at line 103 of file qetarguments.cpp.

Member Function Documentation

◆ arguments()

QList< QString > QETArguments::arguments ( ) const
virtual
Returns
tous les arguments (projets et elements) passes en parametres dans l'ordre suivant : options connues puis inconnues, fichiers de types projet puis element.

Definition at line 120 of file qetarguments.cpp.

References element_files_, options_, project_files_, tbt_files_, and unknown_options_.

Referenced by main(), and parseArguments().

◆ clear()

void QETArguments::clear ( )
private

Oublie tous les arguments de cet objet

Definition at line 170 of file qetarguments.cpp.

References element_files_, options_, project_files_, and unknown_options_.

Referenced by parseArguments().

◆ elementFiles()

QList< QString > QETArguments::elementFiles ( ) const
virtual
Returns
les fichiers de type element

Definition at line 142 of file qetarguments.cpp.

References element_files_.

Referenced by QETApp::openFiles().

◆ files()

QList< QString > QETArguments::files ( ) const
virtual
Returns
tous les fichiers (projets et elements) passes en parametres. Les fichiers de type projet viennent avant les fichiers de type element.

Definition at line 128 of file qetarguments.cpp.

References element_files_, project_files_, and tbt_files_.

Referenced by QETApp::QETApp().

◆ handleFileArgument()

void QETArguments::handleFileArgument ( const QString &  file)
private

Gere les arguments correspondant a un fichier existant.

Definition at line 211 of file qetarguments.cpp.

References element_files_, project_files_, tbt_files_, and TITLEBLOCKS_FILE_EXTENSION.

Referenced by parseArguments().

◆ handleOptionArgument()

void QETArguments::handleOptionArgument ( const QString &  option)
private

Gere les arguments correspondant potentiellement a une option. Les options reconnues sont : –common-elements-dir= –common-tbt-dir –config-dir= –lang-dir= –help –version -v –license

Definition at line 239 of file qetarguments.cpp.

References lang_dir_, options_, print_help_, print_license_, print_version_, and unknown_options_.

Referenced by parseArguments().

◆ langDir()

QString QETArguments::langDir ( ) const
virtual
Returns
le dossier de langue specifie par l'utilisateur. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee.

Definition at line 352 of file qetarguments.cpp.

References lang_dir_.

Referenced by QETApp::parseArguments().

◆ langDirSpecified()

bool QETArguments::langDirSpecified ( ) const
virtual
Returns
true si l'utilisateur a specifie un dossier pour les fichiers de langue

Definition at line 344 of file qetarguments.cpp.

References lang_dir_.

Referenced by QETApp::parseArguments().

◆ operator=()

QETArguments & QETArguments::operator= ( const QETArguments qet_arguments)

Operateur d'affectation - la copie ne reprend pas le parent de l'original

Parameters
qet_argumentsObjet a copier

Definition at line 78 of file qetarguments.cpp.

References element_files_, lang_dir_, options_, print_help_, print_license_, print_version_, project_files_, tbt_files_, and unknown_options_.

◆ options()

QList< QString > QETArguments::options ( ) const
virtual
Returns
les options reconnues

Definition at line 156 of file qetarguments.cpp.

References options_.

◆ parseArguments()

void QETArguments::parseArguments ( const QList< QString > &  arguments)
private

Analyse des arguments et les retient dans cet objet. Si cet objet contenait deja des arguments, ceux-ci sont oublies.

Parameters
argumentsArguments a analyser

Definition at line 191 of file qetarguments.cpp.

References arguments(), clear(), handleFileArgument(), and handleOptionArgument().

Referenced by QETArguments(), and setArguments().

◆ printHelpRequested()

bool QETArguments::printHelpRequested ( ) const
virtual
Returns
true si les arguments comportent une demande d'affichage de l'aide, false sinon

Definition at line 360 of file qetarguments.cpp.

References print_help_.

Referenced by QETApp::parseArguments().

◆ printLicenseRequested()

bool QETArguments::printLicenseRequested ( ) const
virtual
Returns
true si les arguments comportent une demande d'affichage de la licence, false sinon

Definition at line 368 of file qetarguments.cpp.

References print_license_.

Referenced by QETApp::parseArguments().

◆ printVersionRequested()

bool QETArguments::printVersionRequested ( ) const
virtual
Returns
true si les arguments comportent une demande d'affichage de la version, false sinon

Definition at line 376 of file qetarguments.cpp.

References print_version_.

Referenced by QETApp::parseArguments().

◆ projectFiles()

QList< QString > QETArguments::projectFiles ( ) const
virtual
Returns
les fichiers de type projet

Definition at line 135 of file qetarguments.cpp.

References project_files_.

Referenced by QETApp::openFiles().

◆ setArguments()

void QETArguments::setArguments ( const QList< QString > &  args)
virtual

Definit les arguments de cet objet. Si cet objet contenait deja des arguments, ceux-ci sont oublies.

Parameters
argsArguments a analyser et memoriser

Definition at line 111 of file qetarguments.cpp.

References parseArguments().

◆ titleBlockTemplateFiles()

QList< QString > QETArguments::titleBlockTemplateFiles ( ) const
virtual
Returns
title block template files

Definition at line 149 of file qetarguments.cpp.

References tbt_files_.

Referenced by QETApp::openFiles().

◆ unknownOptions()

QList< QString > QETArguments::unknownOptions ( ) const
virtual
Returns
les options non reconnues

Definition at line 163 of file qetarguments.cpp.

References unknown_options_.

Member Data Documentation

◆ element_files_

QList<QString> QETArguments::element_files_
private

Definition at line 74 of file qetarguments.h.

Referenced by arguments(), clear(), elementFiles(), files(), handleFileArgument(), and operator=().

◆ lang_dir_

QString QETArguments::lang_dir_
private

Definition at line 87 of file qetarguments.h.

Referenced by handleOptionArgument(), langDir(), langDirSpecified(), and operator=().

◆ options_

QList<QString> QETArguments::options_
private

Definition at line 76 of file qetarguments.h.

Referenced by arguments(), clear(), handleOptionArgument(), operator=(), and options().

◆ print_help_

bool QETArguments::print_help_
private

Definition at line 88 of file qetarguments.h.

Referenced by handleOptionArgument(), operator=(), and printHelpRequested().

◆ print_license_

bool QETArguments::print_license_
private

Definition at line 89 of file qetarguments.h.

Referenced by handleOptionArgument(), operator=(), and printLicenseRequested().

◆ print_version_

bool QETArguments::print_version_
private

Definition at line 90 of file qetarguments.h.

Referenced by handleOptionArgument(), operator=(), and printVersionRequested().

◆ project_files_

QList<QString> QETArguments::project_files_
private

Definition at line 73 of file qetarguments.h.

Referenced by arguments(), clear(), files(), handleFileArgument(), operator=(), and projectFiles().

◆ tbt_files_

QList<QString> QETArguments::tbt_files_
private

◆ unknown_options_

QList<QString> QETArguments::unknown_options_
private

Definition at line 77 of file qetarguments.h.

Referenced by arguments(), clear(), handleOptionArgument(), operator=(), and unknownOptions().


The documentation for this class was generated from the following files: