Initial import of UniversalIndentGUI 1.2.0 from Debian snapshot

(https://snapshot.debian.org/package/universalindentgui/1.2.0-1.1).
The code is available under GPL2 licence.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
master
Michele Calgaro 2 years ago
commit 5bb4d4359a
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -0,0 +1 @@
debian/patches

@ -0,0 +1,2 @@
disable_check_for_update.patch
qsci_rename.patch

@ -0,0 +1,688 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiSettings.h"
#include "SettingsPaths.h"
#include <QSettings>
#include <QPoint>
#include <QSize>
#include <QDir>
#include <QDate>
#include <QStringList>
#include <QCoreApplication>
#include <QMetaMethod>
#include <QMetaProperty>
#include <QWidget>
//! \defgroup grp_Settings All concerning the settings.
/*!
\class UiGuiSettings
\ingroup grp_Settings
\brief Handles the settings of the program. Reads them on startup and saves them on exit.
Is a singleton class and can only be accessed via getInstance().
*/
// Inits the single class instance pointer.
QWeakPointer<UiGuiSettings> UiGuiSettings::_instance;
/*!
\brief The constructor for the settings.
*/
UiGuiSettings::UiGuiSettings() : QObject() {
// Create the main application settings object from the UniversalIndentGUI.ini file.
_qsettings = new QSettings(SettingsPaths::getSettingsPath() + "/UniversalIndentGUI.ini", QSettings::IniFormat, this);
_indenterDirctoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters";
readAvailableTranslations();
initSettings();
}
/*!
\brief Returns the instance of the settings class. If no instance exists, ONE will be created.
*/
QSharedPointer<UiGuiSettings> UiGuiSettings::getInstance() {
QSharedPointer<UiGuiSettings> sharedInstance = _instance.toStrongRef();
if ( sharedInstance.isNull() ) {
// Create the settings object, which loads all UiGui settings from a file.
sharedInstance = QSharedPointer<UiGuiSettings>(new UiGuiSettings());
_instance = sharedInstance.toWeakRef();
}
return sharedInstance;
}
/*!
\brief The destructor saves the settings to a file.
*/
UiGuiSettings::~UiGuiSettings() {
// Convert the language setting from an integer index to a string.
int index = _qsettings->value("UniversalIndentGUI/language", 0).toInt();
if ( index < 0 || index >= _availableTranslations.size() )
index = 0;
_qsettings->setValue( "UniversalIndentGUI/language", _availableTranslations.at(index) );
}
/*!
\brief Scans the translations directory for available translation files and
stores them in the QList \a _availableTranslations.
*/
void UiGuiSettings::readAvailableTranslations() {
QString languageShort;
QStringList languageFileList;
// English is the default language. A translation file does not exist but to have a menu entry, added here.
languageFileList << "universalindent_en.qm";
// Find all translation files in the "translations" directory.
QDir translationDirectory = QDir( SettingsPaths::getGlobalFilesPath() + "/translations" );
languageFileList << translationDirectory.entryList( QStringList("universalindent_*.qm") );
// Loop for each found translation file
foreach ( languageShort, languageFileList ) {
// Remove the leading string "universalindent_" from the filename.
languageShort.remove(0,16);
// Remove trailing file extension ".qm".
languageShort.chop(3);
_availableTranslations.append(languageShort);
}
}
/*!
\brief Returns a list of the mnemonics of the available translations.
*/
QStringList UiGuiSettings::getAvailableTranslations() {
return _availableTranslations;
}
/*!
\brief Returns the value of the by \a settingsName defined setting as QVariant.
If the named setting does not exist, 0 is being returned.
*/
QVariant UiGuiSettings::getValueByName(QString settingName) {
return _qsettings->value("UniversalIndentGUI/" + settingName);
}
/*!
\brief Loads the settings for the main application.
Settings are for example last selected indenter, last loaded source code file and so on.
*/
bool UiGuiSettings::initSettings()
{
// Read the version string saved in the settings file.
_qsettings->setValue( "UniversalIndentGUI/version", _qsettings->value("UniversalIndentGUI/version", "") );
// Read windows last size and position from the settings file.
_qsettings->setValue( "UniversalIndentGUI/maximized", _qsettings->value("UniversalIndentGUI/maximized", false) );
_qsettings->setValue( "UniversalIndentGUI/position", _qsettings->value("UniversalIndentGUI/position", QPoint(50, 50)) );
_qsettings->setValue( "UniversalIndentGUI/size", _qsettings->value("UniversalIndentGUI/size", QSize(800, 600)) );
// Read last selected encoding for the opened source code file.
_qsettings->setValue( "UniversalIndentGUI/encoding", _qsettings->value("UniversalIndentGUI/encoding", "UTF-8") );
// Read maximum length of list for recently opened files.
_qsettings->setValue( "UniversalIndentGUI/recentlyOpenedListSize", _qsettings->value("UniversalIndentGUI/recentlyOpenedListSize", 5) );
// Read if last opened source code file should be loaded on startup.
_qsettings->setValue( "UniversalIndentGUI/loadLastSourceCodeFileOnStartup", _qsettings->value("UniversalIndentGUI/loadLastSourceCodeFileOnStartup", true) );
// Read last opened source code file from the settings file.
_qsettings->setValue( "UniversalIndentGUI/lastSourceCodeFile", _qsettings->value("UniversalIndentGUI/lastSourceCodeFile", _indenterDirctoryStr+"/example.cpp") );
// Read last selected indenter from the settings file.
int selectedIndenter = _qsettings->value("UniversalIndentGUI/selectedIndenter", 0).toInt();
if ( selectedIndenter < 0 ) {
selectedIndenter = 0;
}
_qsettings->setValue( "UniversalIndentGUI/selectedIndenter", selectedIndenter );
// Read if syntax highlighting is enabled.
_qsettings->setValue( "UniversalIndentGUI/SyntaxHighlightingEnabled", _qsettings->value("UniversalIndentGUI/SyntaxHighlightingEnabled", true) );
// Read if white space characters should be displayed.
_qsettings->setValue( "UniversalIndentGUI/whiteSpaceIsVisible", _qsettings->value("UniversalIndentGUI/whiteSpaceIsVisible", false) );
// Read if indenter parameter tool tips are enabled.
_qsettings->setValue( "UniversalIndentGUI/indenterParameterTooltipsEnabled", _qsettings->value("UniversalIndentGUI/indenterParameterTooltipsEnabled", true) );
// Read the tab width from the settings file.
_qsettings->setValue( "UniversalIndentGUI/tabWidth", _qsettings->value("UniversalIndentGUI/tabWidth", 4) );
// Read the last selected language and stores the index it has in the list of available translations.
_qsettings->setValue( "UniversalIndentGUI/language", _availableTranslations.indexOf( _qsettings->value("UniversalIndentGUI/language", "").toString() ) );
// Read the update check settings from the settings file.
_qsettings->setValue( "UniversalIndentGUI/CheckForUpdate", _qsettings->value("UniversalIndentGUI/CheckForUpdate", true) );
_qsettings->setValue( "UniversalIndentGUI/LastUpdateCheck", _qsettings->value("UniversalIndentGUI/LastUpdateCheck", QDate(1900,1,1)) );
// Read the main window state.
_qsettings->setValue( "UniversalIndentGUI/MainWindowState", _qsettings->value("UniversalIndentGUI/MainWindowState", QByteArray()) );
return true;
}
/*!
\brief Register the by \a propertyName defined property of \a obj to be connected to the setting defined by \a settingName.
The \a propertyName must be one of those that are listed in the Qt "Properties" documentation section of a Qt Object.
All further needed info is retrieved via the \a obj's MetaObject, like the to the property bound signal.
*/
bool UiGuiSettings::registerObjectProperty( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
bool connectSuccess = false;
// Connect to the objects destroyed signal, so that it will be correctly unregistered.
connectSuccess = connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( connectSuccess && indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// Connect to the property's value changed signal.
if ( mProp.hasNotifySignal() ) {
QMetaMethod signal = mProp.notifySignal();
//QString teststr = qPrintable(SIGNAL() + QString(signal.signature()));
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = connect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
}
if ( connectSuccess ) {
_registeredObjectProperties[obj] = QStringList() << propertyName << settingName;
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
return false;
}
// If setting already exists, set the objects property to the setting value.
if ( _qsettings->contains("UniversalIndentGUI/" + settingName) ) {
mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName));
}
// Otherwise add the setting and set it to the value of the objects property.
else {
_qsettings->setValue("UniversalIndentGUI/" + settingName, mProp.read(obj));
}
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and registers this property name to that setting name if both were found.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings. If the mentioned setting
name doesn't exist, it will be created.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::registerObjectPropertyRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::registerObjectProperty);
}
/*!
\brief Assigns the by \a settingName defined setting value to the by \a propertyName defined property of \a obj.
Returns true, if the value could be assigned, otherwise returns false, which is the case if settingName doesn't exist
within the settings or if the mentioned propertyName wasn't found for the \a obj.
*/
bool UiGuiSettings::setObjectPropertyToSettingValue( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// If setting already exists, set the objects property to the setting value.
if ( _qsettings->contains("UniversalIndentGUI/" + settingName) ) {
mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName));
}
// The setting didn't exist so return that setting the objects property failed.
else {
//TODO: Write a debug warning to the log.
return false;
}
}
else {
//TODO: Write a debug warning to the log.
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and sets each property to settings value.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::setObjectPropertyToSettingValueRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setObjectPropertyToSettingValue);
}
/*!
\brief Assigns the by \a propertyName defined property's value of \a obj to the by \a settingName defined setting.
If the \a settingName didn't exist yet, it will be created.
Returns true, if the value could be assigned, otherwise returns false, which is the case if the mentioned
propertyName wasn't found for the \a obj.
*/
bool UiGuiSettings::setSettingToObjectPropertyValue( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
setValueByName(settingName, mProp.read(obj));
}
else {
//TODO: Write a debug warning to the log.
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and sets each setting to the property value.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings. If the settingName
didn't exist yet, it will be created.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::setSettingToObjectPropertyValueRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setSettingToObjectPropertyValue);
}
/*!
\brief Iterates over all \a objs child QObjects and checks whether they have the custom properties
"connectedPropertyName" and "connectedSettingName" set. If both are set, it invokes the \a callBackFunc
with both.
*/
bool UiGuiSettings::checkCustomPropertiesAndCallFunction(QObject *obj, bool (UiGuiSettings::*callBackFunc)(QObject *obj, const QString &propertyName, const QString &settingName)) {
bool success = true;
// Find all widgets that have PropertyName and SettingName defined in their style sheet.
QList<QObject *> allObjects = obj->findChildren<QObject *>();
foreach (QObject *object, allObjects) {
QString propertyName = object->property("connectedPropertyName").toString();
QString settingName = object->property("connectedSettingName").toString();
// If property and setting name were found, register that widget with the settings.
if ( !propertyName.isEmpty() && !settingName.isEmpty() ) {
success &= (this->*callBackFunc)( object, propertyName, settingName );
}
}
return success;
}
/*!
\brief The with a certain property registered \a obj gets unregistered.
*/
void UiGuiSettings::unregisterObjectProperty(QObject *obj) {
if ( _registeredObjectProperties.contains(obj) ) {
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = _registeredObjectProperties[obj].first();
QString settingName = _registeredObjectProperties[obj].last();
bool connectSuccess = false;
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// Disconnect to the property's value changed signal.
if ( mProp.hasNotifySignal() ) {
QMetaMethod signal = mProp.notifySignal();
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = disconnect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
}
}
_registeredObjectProperties.remove(obj);
}
}
/*!
\brief Registers a slot form the \a obj by its \a slotName to be invoked, if the by \a settingName defined
setting changes.
The registered slot may have no parameters or exactly one. If it accepts one parameter, whenever the setting
\a settingName changes the slot gets tried to be invoked with the settings value as parameter. This only works,
if the slot parameter is of the same type as the setting.
*/
bool UiGuiSettings::registerObjectSlot(QObject *obj, const QString &slotName, const QString &settingName) {
const QMetaObject *metaObject = obj->metaObject();
bool connectSuccess = false;
// Connect to the objects destroyed signal, so that it will be correctly unregistered.
connectSuccess = connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
QString normalizedSlotName = QMetaObject::normalizedSignature( qPrintable(slotName) );
int indexOfMethod = metaObject->indexOfMethod( qPrintable(normalizedSlotName) );
if ( connectSuccess && indexOfMethod > -1 ) {
QMetaMethod mMethod = metaObject->method(indexOfMethod);
//QMetaMethod::Access access = mMethod.access();
//QMetaMethod::MethodType methType = mMethod.methodType();
// Since the method can at maximum be invoked with the setting value as argument,
// only methods taking max one argument are allowed.
if ( mMethod.parameterTypes().size() <= 1 ) {
_registeredObjectSlots.insert(obj, QStringList() << normalizedSlotName << settingName);
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
return false;
}
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
return false;
}
return true;
}
/*!
\brief If \a obj, \a slotName and \a settingName are given, that certain connection is unregistered.
If only \a obj is given, all to this object registered slot-setting connections are unregistered.
*/
void UiGuiSettings::unregisterObjectSlot(QObject *obj, const QString &slotName, const QString &settingName) {
//const QMetaObject *metaObject = obj->metaObject();
QString normalizedSlotName = QMetaObject::normalizedSignature( qPrintable(slotName) );
QMutableMapIterator<QObject*, QStringList> it(_registeredObjectSlots);
while (it.hasNext()) {
it.next();
if (it.key() == obj && slotName.isEmpty() && settingName.isEmpty())
it.remove();
else if (it.key() == obj && it.value().first() == slotName && it.value().last() == settingName)
it.remove();
}
}
/*!
\brief This private slot gets invoked whenever a registered objects property changes
and distributes the new value to all other to the same settingName registered objects.
*/
void UiGuiSettings::handleObjectPropertyChange() {
QObject *obj = QObject::sender();
QString className = obj->metaObject()->className();
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = _registeredObjectProperties[obj].first();
QString settingName = _registeredObjectProperties[obj].last();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
setValueByName(settingName, mProp.read(obj));
}
}
/*!
\brief Sets the setting defined by \a settingName to \a value.
When setting a changed value, all to this settingName registered objects get
the changed value set too.
If the \a settingName didn't exist yet, it will be created.
*/
void UiGuiSettings::setValueByName(const QString &settingName, const QVariant &value) {
// Do the updating only, if the setting was really changed.
if ( _qsettings->value("UniversalIndentGUI/" + settingName) != value ) {
_qsettings->setValue("UniversalIndentGUI/" + settingName, value);
// Set the new value for all registered object properties for settingName.
for ( QMap<QObject*, QStringList>::ConstIterator it = _registeredObjectProperties.begin(); it != _registeredObjectProperties.end(); ++it ) {
if ( it.value().last() == settingName ) {
QObject *obj = it.key();
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = it.value().first();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
mProp.write(obj, value);
}
}
}
// Invoke all registered object methods for settingName.
for ( QMap<QObject*, QStringList>::ConstIterator it = _registeredObjectSlots.begin(); it != _registeredObjectSlots.end(); ++it ) {
if ( it.value().last() == settingName ) {
QObject *obj = it.key();
const QMetaObject *metaObject = obj->metaObject();
QString slotName = it.value().first();
int indexOfMethod = metaObject->indexOfMethod( qPrintable(slotName) );
if ( indexOfMethod > -1 ) {
QMetaMethod mMethod = metaObject->method(indexOfMethod);
//QMetaMethod::Access access = mMethod.access();
//QMetaMethod::MethodType methType = mMethod.methodType();
bool success = false;
// Handle registered slots taking one parameter.
if ( mMethod.parameterTypes().size() == 1 ) {
if ( mMethod.parameterTypes().first() == value.typeName() ) {
success = invokeMethodWithValue(obj, mMethod, value);
}
}
// Handle registered slots taking zero parameters.
else {
success = mMethod.invoke( obj, Qt::DirectConnection );
}
if ( success == false ) {
// TODO: Write a warning to the log if no success.
}
}
}
}
}
}
#include <QBitArray>
#include <QBitmap>
#include <QBrush>
#include <QCursor>
#include <QDateTime>
#include <QFont>
#include <QIcon>
#include <QKeySequence>
#include <QLocale>
#include <QPalette>
#include <QPen>
#include <QSizePolicy>
#include <QTextFormat>
#include <QTextLength>
#include <QUrl>
#if QT_VERSION >= 0x040600
#include <QMatrix4x4>
#include <QVector2D>
#endif
bool UiGuiSettings::invokeMethodWithValue( QObject *obj, QMetaMethod mMethod, QVariant value )
{
switch (value.type()) {
case QVariant::BitArray :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBitArray, value.toBitArray()) );
case QVariant::Bitmap :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBitmap, value.value<QBitmap>()) );
case QVariant::Bool :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(bool, value.toBool()) );
case QVariant::Brush :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBrush, value.value<QBrush>()) );
case QVariant::ByteArray :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QByteArray, value.toByteArray()) );
case QVariant::Char :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QChar, value.toChar()) );
case QVariant::Color :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QColor, value.value<QColor>()) );
case QVariant::Cursor :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QCursor, value.value<QCursor>()) );
case QVariant::Date :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QDate, value.toDate()) );
case QVariant::DateTime :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QDateTime, value.toDateTime()) );
case QVariant::Double :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(double, value.toDouble()) );
case QVariant::Font :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QFont, value.value<QFont>()) );
case QVariant::Hash :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantHash, value.toHash()) );
case QVariant::Icon :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QIcon, value.value<QIcon>()) );
case QVariant::Image :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QImage, value.value<QImage>()) );
case QVariant::Int :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(int, value.toInt()) );
case QVariant::KeySequence :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QKeySequence, value.value<QKeySequence>()) );
case QVariant::Line :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLine, value.toLine()) );
case QVariant::LineF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLineF, value.toLineF()) );
case QVariant::List :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantList, value.toList()) );
case QVariant::Locale :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLocale, value.toLocale()) );
case QVariant::LongLong :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(qlonglong, value.toLongLong()) );
case QVariant::Map :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantMap, value.toMap()) );
case QVariant::Matrix :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QMatrix, value.value<QMatrix>()) );
case QVariant::Transform :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTransform, value.value<QTransform>()) );
#if QT_VERSION >= 0x040600
case QVariant::Matrix4x4 :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QMatrix4x4, value.value<QMatrix4x4>()) );
#endif
case QVariant::Palette :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPalette, value.value<QPalette>()) );
case QVariant::Pen :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPen, value.value<QPen>()) );
case QVariant::Pixmap :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPixmap, value.value<QPixmap>()) );
case QVariant::Point :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPoint, value.toPoint()) );
// case QVariant::PointArray :
// return Q_ARG(QPointArray, value.value<QPointArray>()) );
case QVariant::PointF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPointF, value.toPointF()) );
case QVariant::Polygon :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPolygon, value.value<QPolygon>()) );
#if QT_VERSION >= 0x040600
case QVariant::Quaternion :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QQuaternion, value.value<QQuaternion>()) );
#endif
case QVariant::Rect :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRect, value.toRect()) );
case QVariant::RectF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRectF, value.toRectF()) );
case QVariant::RegExp :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRegExp, value.toRegExp()) );
case QVariant::Region :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRegion, value.value<QRegion>()) );
case QVariant::Size :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSize, value.toSize()) );
case QVariant::SizeF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSizeF, value.toSizeF()) );
case QVariant::SizePolicy :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSizePolicy, value.value<QSizePolicy>()) );
case QVariant::String :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QString, value.toString()) );
case QVariant::StringList :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QStringList, value.toStringList()) );
case QVariant::TextFormat :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTextFormat, value.value<QTextFormat>()) );
case QVariant::TextLength :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTextLength, value.value<QTextLength>()) );
case QVariant::Time :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTime, value.toTime()) );
case QVariant::UInt :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(uint, value.toUInt()) );
case QVariant::ULongLong :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(qulonglong, value.toULongLong()) );
case QVariant::Url :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QUrl, value.toUrl()) );
#if QT_VERSION >= 0x040600
case QVariant::Vector2D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector2D, value.value<QVector2D>()) );
case QVariant::Vector3D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector3D, value.value<QVector3D>()) );
case QVariant::Vector4D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector4D, value.value<QVector4D>()) );
#endif
default:
return false;
}
}

@ -0,0 +1,201 @@
TEMPLATE = app
QT += network
QT += script
unix:TARGET = universalindentgui
win32:TARGET = UniversalIndentGUI
macx:TARGET = UniversalIndentGUI
DEPENDPATH += resources \
src \
debug \
release
INCLUDEPATH += src
CONFIG += debug_and_release
macx {
# If using as framework qscintilla needs to be build with:
# qmake -spec macx-g++ CONFIG+=sdk CONFIG+=x86_64 CONFIG+=x86 CONFIG+=lib_bundle qscintilla.pro && make && sudo make install
#LIBS += -framework qscintilla2
LIBS += -lqscintilla2
ICON = resources/UniversalIndentGUI.icns
}
else {
LIBS += -lqscintilla2
}
CONFIG(release, debug|release) {
win32:pipe2nul = ">NUL"
unix:pipe2nul = "&> /dev/null"
macx:pipe2nul = "&> /dev/null"
# Language file processing
##########################
message(Updating language files)
lupdate = lupdate
unix:lupdate = lupdate-qt4
macx:lupdate = lupdate
lrelease = lrelease
unix:lrelease = lrelease-qt4
macx:lrelease = lrelease
# Update translation files
message ( Updating universalindent.ts )
system($${lupdate} src -ts ./translations/universalindent.ts -silent)
message ( Updating universalindent_de.ts )
system($${lupdate} src -ts ./translations/universalindent_de.ts -silent)
message ( Updating universalindent_fr.ts )
system($${lupdate} src -ts ./translations/universalindent_fr.ts -silent)
message ( Updating universalindent_ja.ts )
system($${lupdate} src -ts ./translations/universalindent_ja.ts -silent)
message ( Updating universalindent_ru.ts )
system($${lupdate} src -ts ./translations/universalindent_ru.ts -silent)
message ( Updating universalindent_uk.ts )
system($${lupdate} src -ts ./translations/universalindent_uk.ts -silent)
message ( Updating universalindent_zh_TW.ts )
system($${lupdate} src -ts ./translations/universalindent_zh_TW.ts -silent)
# Create translation binaries
message ( Creating translation binaries )
system($${lrelease} ./translations/universalindent_de.ts -qm ./translations/universalindent_de.qm -silent)
system($${lrelease} ./translations/universalindent_fr.ts -qm ./translations/universalindent_fr.qm -silent)
system($${lrelease} ./translations/universalindent_ja.ts -qm ./translations/universalindent_ja.qm -silent)
system($${lrelease} ./translations/universalindent_ru.ts -qm ./translations/universalindent_ru.qm -silent)
system($${lrelease} ./translations/universalindent_uk.ts -qm ./translations/universalindent_uk.qm -silent)
system($${lrelease} ./translations/universalindent_zh_TW.ts -qm ./translations/universalindent_zh_TW.qm -silent)
# Copy Qts own translation files to the local translation directory
message ( Copy Qts own translation files to the local translation directory )
qtTranslationInstallDir = $$[QT_INSTALL_TRANSLATIONS]
win32:qtTranslationInstallDir = $$replace(qtTranslationInstallDir, /, \\)
unix:system(cp $${qtTranslationInstallDir}/qt_de.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_fr.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_ja.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_ru.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_uk.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_zh_TW.qm ./translations/ $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_de.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_fr.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_ja.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_ru.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_uk.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_zh_TW.qm .\\translations\\ /Y $$pipe2nul)
# Defining files that shall be installed when calling "make install"
####################################################################
# Create and install man page
exists( ./doc/universalindentgui.1* ) {
unix:system(rm ./doc/universalindentgui.1*)
}
unix:system(cp ./doc/universalindentgui.man ./doc/universalindentgui.1)
unix:system(gzip -9 ./doc/universalindentgui.1)
unix:documentation.path = /usr/share/man/man1
unix:documentation.files = doc/universalindentgui.1.gz
# Install indenter ini files, examples and some indenters
unix:indenters.path = /usr/share/universalindentgui/indenters
unix:indenters.files = indenters/uigui_*.ini
unix:indenters.files += indenters/example.*
unix:indenters.files += indenters/JsDecoder.js
unix:indenters.files += indenters/phpStylist.php
unix:indenters.files += indenters/phpStylist.txt
unix:indenters.files += indenters/pindent.py
unix:indenters.files += indenters/pindent.txt
unix:indenters.files += indenters/rbeautify.rb
unix:indenters.files += indenters/ruby_formatter.rb
unix:indenters.files += indenters/shellindent.awk
# Install translation files
unix:translation.path = /usr/share/universalindentgui/translations
unix:translation.files = translations/*.qm
# Install highlighter default config
unix:highlighterconfig.path = /usr/share/universalindentgui/config
unix:highlighterconfig.files = config/UiGuiSyntaxHighlightConfig.ini
# Install binary
unix:target.path = /usr/bin
# Set everything that shall be installed
unix:INSTALLS += target \
highlighterconfig \
indenters \
translation \
documentation
}
CONFIG(debug, debug|release) {
DESTDIR = ./debug
DEFINES += _DEBUG DEBUG
} else {
DESTDIR = ./release
}
MOC_DIR = $${DESTDIR}/moc
UI_DIR = $${DESTDIR}/uic
OBJECTS_DIR = $${DESTDIR}/obj
RCC_DIR = $${DESTDIR}/qrc
#message ( destdir is $${DESTDIR}. uic is $${UI_DIR}. moc is $${MOC_DIR})
# Input
HEADERS += src/AboutDialog.h \
src/AboutDialogGraphicsView.h \
src/IndentHandler.h \
src/MainWindow.h \
src/SettingsPaths.h \
src/TemplateBatchScript.h \
src/UiGuiErrorMessage.h \
src/UiGuiHighlighter.h \
src/UiGuiIndentServer.h \
src/UiGuiIniFileParser.h \
src/UiGuiSettings.h \
src/UiGuiSettingsDialog.h \
src/UiGuiSystemInfo.h \
src/UiGuiVersion.h \
src/UpdateCheckDialog.h \
src/debugging/TSLogger.h
FORMS += src/MainWindow.ui \
src/ToolBarWidget.ui \
src/UiGuiSettingsDialog.ui \
src/AboutDialog.ui \
src/UpdateCheckDialog.ui \
src/debugging/TSLoggerDialog.ui
SOURCES += src/AboutDialog.cpp \
src/AboutDialogGraphicsView.cpp \
src/IndentHandler.cpp \
src/main.cpp \
src/MainWindow.cpp \
src/SettingsPaths.cpp \
src/TemplateBatchScript.cpp \
src/UiGuiErrorMessage.cpp \
src/UiGuiHighlighter.cpp \
src/UiGuiIndentServer.cpp \
src/UiGuiIniFileParser.cpp \
src/UiGuiSettings.cpp \
src/UiGuiSettingsDialog.cpp \
src/UiGuiSystemInfo.cpp \
src/UiGuiVersion.cpp \
src/UpdateCheckDialog.cpp \
src/debugging/TSLogger.cpp
RESOURCES += resources/Icons.qrc
RC_FILE = resources/programicon.rc
#message(Creating symbolic links within target dir for debugging)
#macx:system(ln -s $$PWD/config ./debug/config)
#macx:system(ln -s $$PWD/indenters ./debug/indenters)
#macx:system(ln -s $$PWD/translations ./debug/translations)
#macx:system(ln -s $$PWD/config ./release/config)
#macx:system(ln -s $$PWD/indenters ./release/indenters)
#macx:system(ln -s $$PWD/translations ./release/translations)

@ -0,0 +1,741 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
033FA4A2951F6995E4B52E75 /* moc_AboutDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */; settings = {ATTRIBUTES = (); }; };
07182A1FDE8301C8D9EAF7F5 /* UiGuiSettingsDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */; settings = {ATTRIBUTES = (); }; };
0794A9D3A24B32A06CD8CA37 /* TSLogger.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 5EEB118D3C499097B07CA6DC /* TSLogger.cpp */; settings = {ATTRIBUTES = (); }; };
10D0CC7BD2D2E5A3A90EEF25 /* moc_UiGuiHighlighter.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */; settings = {ATTRIBUTES = (); }; };
1446C37D55222BE8281C2D84 /* moc_MainWindow.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */; settings = {ATTRIBUTES = (); }; };
157D8322CB15EB4B4B698465 /* AboutDialogGraphicsView.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */; settings = {ATTRIBUTES = (); }; };
204EDFAF3269B294371D7373 /* QtCore in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = FC65490F7BEA4427C242848C /* QtCore */; };
2B7F90DE44210DB9F5D23F0C /* AboutDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */; settings = {ATTRIBUTES = (); }; };
2CE072BF0886F682F0FE8266 /* moc_UiGuiSettingsDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */; settings = {ATTRIBUTES = (); }; };
2E0B7B483AE3DAFB774883DC /* UiGuiErrorMessage.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */; settings = {ATTRIBUTES = (); }; };
32D9B1CB3877EF0A567B997D /* QtScript in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 9EF9FEB32A7980D519425A9E /* QtScript */; };
358CDAA858B633E7AD0B6646 /* UniversalIndentGUI.icns in Bundle Resources */ = {isa = PBXBuildFile; fileRef = A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */; settings = {ATTRIBUTES = (); }; };
3B7E26C095F17917F557F0BB /* QtGui in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 6988CE9D964BC66484DA49D5 /* QtGui */; };
4393711A82B0A27E8301FEB8 /* moc_UiGuiErrorMessage.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */; settings = {ATTRIBUTES = (); }; };
447799AD66EF47D36B5A72E3 /* moc_IndentHandler.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */; settings = {ATTRIBUTES = (); }; };
45FD613422A15DDFF65F07EB /* TemplateBatchScript.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */; settings = {ATTRIBUTES = (); }; };
4DAB46634D6A37252BC2E3D4 /* qrc_Icons.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 1BB748495103B59368976F44 /* qrc_Icons.cpp */; settings = {ATTRIBUTES = (); }; };
54824FDC5DD27B6216E263F5 /* moc_UpdateCheckDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */; settings = {ATTRIBUTES = (); }; };
64CDA74634FD0C1F9265CF5F /* SettingsPaths.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */; settings = {ATTRIBUTES = (); }; };
83EFC8071DE20B90AE46E0A1 /* UiGuiIndentServer.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */; settings = {ATTRIBUTES = (); }; };
86D03C28F9A095696FA4C465 /* moc_AboutDialogGraphicsView.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */; settings = {ATTRIBUTES = (); }; };
8DCA76267BA4834F731C5BAB /* moc_UiGuiIndentServer.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */; settings = {ATTRIBUTES = (); }; };
8DFAEC14C5621835B85BDBBB /* UiGuiSettings.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */; settings = {ATTRIBUTES = (); }; };
9892D98357F2D175D03F6488 /* moc_UiGuiSettings.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */; settings = {ATTRIBUTES = (); }; };
A56B320001BC86C5B01B08D0 /* UiGuiSystemInfo.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */; settings = {ATTRIBUTES = (); }; };
A87876F3A24FCE545FEAFB05 /* UiGuiVersion.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D038693E47A07F84995184E5 /* UiGuiVersion.cpp */; settings = {ATTRIBUTES = (); }; };
AAC1168526D0C37A3F415917 /* MainWindow.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 1C0B64226A129D35F02DC004 /* MainWindow.cpp */; settings = {ATTRIBUTES = (); }; };
B3D97A9EF6FD086AC8AA1400 /* QtNetwork in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B235A8A774654CA992F5A861 /* QtNetwork */; };
C61FC1CBE0E603A32A3D1D8E /* moc_TSLogger.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */; settings = {ATTRIBUTES = (); }; };
CE0306F2BD402BE1CC71BA98 /* IndentHandler.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 7B749332F0EE106BAF891CBB /* IndentHandler.cpp */; settings = {ATTRIBUTES = (); }; };
D05E9C8E00DF8978FAD6C45F /* UiGuiIniFileParser.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */; settings = {ATTRIBUTES = (); }; };
E938E42F14AC74220066EAA2 /* UniversalIndentGUI.app in Project Copy */ = {isa = PBXBuildFile; fileRef = E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */; };
ED461CD43406DFA44318404B /* UiGuiHighlighter.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */; settings = {ATTRIBUTES = (); }; };
F42AF6C1FF5FF9F82C3E049D /* UpdateCheckDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */; settings = {ATTRIBUTES = (); }; };
FD1638E377D97C82BDB438FB /* main.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 7EC3C68A81EFFF79B6CA22AC /* main.cpp */; settings = {ATTRIBUTES = (); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release;
dstSubfolderSpec = 0;
files = (
E938E42F14AC74220066EAA2 /* UniversalIndentGUI.app in Project Copy */,
);
name = "Project Copy";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
01A925071F5E8C4DEAA029A7 /* UiGuiIniFileParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiIniFileParser.h; path = src/UiGuiIniFileParser.h; sourceTree = "<group>"; };
0405CDFCAFF3A176EB7C5B2B /* SettingsPaths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SettingsPaths.h; path = src/SettingsPaths.h; sourceTree = "<group>"; };
04EC27988BE80C166C06D386 /* ui_AboutDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_AboutDialog.h; path = release/uic/ui_AboutDialog.h; sourceTree = "<group>"; };
0501473B7E166B9D10974B09 /* AboutDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AboutDialog.h; path = src/AboutDialog.h; sourceTree = "<group>"; };
0D2093D6D7971F9434E27A2D /* UiGuiHighlighter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiHighlighter.h; path = src/UiGuiHighlighter.h; sourceTree = "<group>"; };
19D832A234461F61E597073E /* UiGuiErrorMessage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiErrorMessage.h; path = src/UiGuiErrorMessage.h; sourceTree = "<group>"; };
1BB748495103B59368976F44 /* qrc_Icons.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = qrc_Icons.cpp; path = release/qrc/qrc_Icons.cpp; sourceTree = "<group>"; };
1C0B64226A129D35F02DC004 /* MainWindow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MainWindow.cpp; path = src/MainWindow.cpp; sourceTree = "<group>"; };
234F1B047D06A4E84A3BA652 /* UiGuiIndentServer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiIndentServer.h; path = src/UiGuiIndentServer.h; sourceTree = "<group>"; };
2365565B0E8281A9A554DE48 /* IndentHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IndentHandler.h; path = src/IndentHandler.h; sourceTree = "<group>"; };
240575E52D89C74CAFF8C83F /* UpdateCheckDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UpdateCheckDialog.h; path = src/UpdateCheckDialog.h; sourceTree = "<group>"; };
26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSettingsDialog.cpp; path = src/UiGuiSettingsDialog.cpp; sourceTree = "<group>"; };
290E702759265E2A11910569 /* UpdateCheckDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = UpdateCheckDialog.ui; path = src/UpdateCheckDialog.ui; sourceTree = "<group>"; };
3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSettingsDialog.h; path = src/UiGuiSettingsDialog.h; sourceTree = "<group>"; };
3E78CB522F65C3B2CD054660 /* AboutDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = AboutDialog.ui; path = src/AboutDialog.ui; sourceTree = "<group>"; };
4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_TSLogger.cpp; path = release/moc/moc_TSLogger.cpp; sourceTree = "<group>"; };
4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UpdateCheckDialog.cpp; path = src/UpdateCheckDialog.cpp; sourceTree = "<group>"; };
59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_MainWindow.cpp; path = release/moc/moc_MainWindow.cpp; sourceTree = "<group>"; };
5EEB118D3C499097B07CA6DC /* TSLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TSLogger.cpp; path = src/debugging/TSLogger.cpp; sourceTree = "<group>"; };
5FDBC0A18FE03C4893ABD97E /* UiGuiSystemInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSystemInfo.h; path = src/UiGuiSystemInfo.h; sourceTree = "<group>"; };
6988CE9D964BC66484DA49D5 /* QtGui */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtGui; path = /opt/local/lib/libQtGui.4.7.4.dylib; sourceTree = "<absolute>"; };
705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiHighlighter.cpp; path = release/moc/moc_UiGuiHighlighter.cpp; sourceTree = "<group>"; };
71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_AboutDialog.cpp; path = release/moc/moc_AboutDialog.cpp; sourceTree = "<group>"; };
7B749332F0EE106BAF891CBB /* IndentHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = IndentHandler.cpp; path = src/IndentHandler.cpp; sourceTree = "<group>"; };
7DBF76AABA74FE9F8ACD5DB5 /* Icons.qrc */ = {isa = PBXFileReference; lastKnownFileType = text; name = Icons.qrc; path = resources/Icons.qrc; sourceTree = "<group>"; };
7EC3C68A81EFFF79B6CA22AC /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = "<group>"; };
836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiIndentServer.cpp; path = release/moc/moc_UiGuiIndentServer.cpp; sourceTree = "<group>"; };
8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AboutDialog.cpp; path = src/AboutDialog.cpp; sourceTree = "<group>"; };
8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSystemInfo.cpp; path = src/UiGuiSystemInfo.cpp; sourceTree = "<group>"; };
944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSettings.cpp; path = src/UiGuiSettings.cpp; sourceTree = "<group>"; };
957A01A17EA639CF3AC8D438 /* ui_TSLoggerDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_TSLoggerDialog.h; path = release/uic/ui_TSLoggerDialog.h; sourceTree = "<group>"; };
95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiHighlighter.cpp; path = src/UiGuiHighlighter.cpp; sourceTree = "<group>"; };
97D35E3EB9A27948A62C0C38 /* ui_MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_MainWindow.h; path = release/uic/ui_MainWindow.h; sourceTree = "<group>"; };
9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiIndentServer.cpp; path = src/UiGuiIndentServer.cpp; sourceTree = "<group>"; };
998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiErrorMessage.cpp; path = release/moc/moc_UiGuiErrorMessage.cpp; sourceTree = "<group>"; };
9B1A8589DE3DB63FE9FEADAD /* AboutDialogGraphicsView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AboutDialogGraphicsView.h; path = src/AboutDialogGraphicsView.h; sourceTree = "<group>"; };
9EF9FEB32A7980D519425A9E /* QtScript */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtScript; path = /opt/local/lib/libQtScript.4.7.4.dylib; sourceTree = "<absolute>"; };
9FAD1502AC6B577554578224 /* TSLoggerDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = TSLoggerDialog.ui; path = src/debugging/TSLoggerDialog.ui; sourceTree = "<group>"; };
A1FD7528F1BA6EC4A87E142A /* ui_ToolBarWidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_ToolBarWidget.h; path = release/uic/ui_ToolBarWidget.h; sourceTree = "<group>"; };
A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = UniversalIndentGUI.icns; path = resources/UniversalIndentGUI.icns; sourceTree = "<group>"; };
A77AB8EA63A1F08C970A0DB1 /* TemplateBatchScript.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TemplateBatchScript.h; path = src/TemplateBatchScript.h; sourceTree = "<group>"; };
A7CBECAE098937E7541F811C /* MainWindow.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = MainWindow.ui; path = src/MainWindow.ui; sourceTree = "<group>"; };
A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiSettingsDialog.cpp; path = release/moc/moc_UiGuiSettingsDialog.cpp; sourceTree = "<group>"; };
AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SettingsPaths.cpp; path = src/SettingsPaths.cpp; sourceTree = "<group>"; };
AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSettings.h; path = src/UiGuiSettings.h; sourceTree = "<group>"; };
B235A8A774654CA992F5A861 /* QtNetwork */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtNetwork; path = /opt/local/lib/libQtNetwork.4.7.4.dylib; sourceTree = "<absolute>"; };
B3201EB1AA113D49631A1BC2 /* UiGuiSettingsDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = UiGuiSettingsDialog.ui; path = src/UiGuiSettingsDialog.ui; sourceTree = "<group>"; };
B3E50F5A6CE91D794A9AE2AA /* ToolBarWidget.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = ToolBarWidget.ui; path = src/ToolBarWidget.ui; sourceTree = "<group>"; };
BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiIniFileParser.cpp; path = src/UiGuiIniFileParser.cpp; sourceTree = "<group>"; };
C2D745F51D062CD6409FA16C /* ui_UpdateCheckDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_UpdateCheckDialog.h; path = release/uic/ui_UpdateCheckDialog.h; sourceTree = "<group>"; };
D038693E47A07F84995184E5 /* UiGuiVersion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiVersion.cpp; path = src/UiGuiVersion.cpp; sourceTree = "<group>"; };
D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AboutDialogGraphicsView.cpp; path = src/AboutDialogGraphicsView.cpp; sourceTree = "<group>"; };
D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UpdateCheckDialog.cpp; path = release/moc/moc_UpdateCheckDialog.cpp; sourceTree = "<group>"; };
D807F0DE3110F0AD45593FA7 /* MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainWindow.h; path = src/MainWindow.h; sourceTree = "<group>"; };
DCEF1F98F703B62597F530A9 /* ui_UiGuiSettingsDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_UiGuiSettingsDialog.h; path = release/uic/ui_UiGuiSettingsDialog.h; sourceTree = "<group>"; };
DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_IndentHandler.cpp; path = release/moc/moc_IndentHandler.cpp; sourceTree = "<group>"; };
E457C7C0F6FE92258C9ABDE6 /* UniversalIndentGUI.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = UniversalIndentGUI.pro; sourceTree = "<group>"; };
E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UniversalIndentGUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TemplateBatchScript.cpp; path = src/TemplateBatchScript.cpp; sourceTree = "<group>"; };
EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiErrorMessage.cpp; path = src/UiGuiErrorMessage.cpp; sourceTree = "<group>"; };
F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiVersion.h; path = src/UiGuiVersion.h; sourceTree = "<group>"; };
F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiSettings.cpp; path = release/moc/moc_UiGuiSettings.cpp; sourceTree = "<group>"; };
F5BD042A2B240A02A39C20AC /* TSLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TSLogger.h; path = src/debugging/TSLogger.h; sourceTree = "<group>"; };
F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_AboutDialogGraphicsView.cpp; path = release/moc/moc_AboutDialogGraphicsView.cpp; sourceTree = "<group>"; };
FC65490F7BEA4427C242848C /* QtCore */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtCore; path = /opt/local/lib/libQtCore.4.7.4.dylib; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2A1043669E6E5A7426EA502A /* Frameworks & Libraries */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32D9B1CB3877EF0A567B997D /* QtScript in Frameworks & Libraries */,
3B7E26C095F17917F557F0BB /* QtGui in Frameworks & Libraries */,
B3D97A9EF6FD086AC8AA1400 /* QtNetwork in Frameworks & Libraries */,
204EDFAF3269B294371D7373 /* QtCore in Frameworks & Libraries */,
);
name = "Frameworks & Libraries";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
05596AB53D8D521C69802C27 /* UniversalIndentGUI */ = {
isa = PBXGroup;
children = (
FB61758D0F0FDA4BA867C3D5 /* Sources */,
46E892BBB6BB6952967E0561 /* Temporary Sources */,
883D7615C4D2DE3FA1218F12 /* Headers */,
7CABE3C80E79AD2B307756D2 /* Sources [qmake] */,
52C235EBF1C9B07808119459 /* Sources [RCC] */,
EEC299C65D5017EB9DD513B0 /* Sources [UIC] */,
ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */,
E938E42D14AC74220066EAA2 /* Products */,
);
name = UniversalIndentGUI;
sourceTree = "<group>";
};
06674E1DE8D3EB6E763DFFDA /* src */ = {
isa = PBXGroup;
children = (
8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */,
D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */,
7B749332F0EE106BAF891CBB /* IndentHandler.cpp */,
7EC3C68A81EFFF79B6CA22AC /* main.cpp */,
1C0B64226A129D35F02DC004 /* MainWindow.cpp */,
AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */,
E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */,
EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */,
95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */,
9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */,
BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */,
944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */,
26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */,
8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */,
D038693E47A07F84995184E5 /* UiGuiVersion.cpp */,
4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */,
682C39EDA1B6CDF80B0D9214 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
16A82DA2701971900CCC9274 /* resources */ = {
isa = PBXGroup;
children = (
7DBF76AABA74FE9F8ACD5DB5 /* Icons.qrc */,
);
name = resources;
sourceTree = "<group>";
};
17088D39164D72415814D3CE /* moc */ = {
isa = PBXGroup;
children = (
71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */,
F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */,
DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */,
59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */,
998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */,
705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */,
836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */,
F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */,
A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */,
D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */,
4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */,
);
name = moc;
sourceTree = "<group>";
};
46E892BBB6BB6952967E0561 /* Temporary Sources */ = {
isa = PBXGroup;
children = (
BC7AF8B1E3D64E5DB82A180B /* release */,
);
name = "Temporary Sources";
sourceTree = "<group>";
};
52C235EBF1C9B07808119459 /* Sources [RCC] */ = {
isa = PBXGroup;
children = (
16A82DA2701971900CCC9274 /* resources */,
);
name = "Sources [RCC]";
sourceTree = "<group>";
};
682C39EDA1B6CDF80B0D9214 /* debugging */ = {
isa = PBXGroup;
children = (
5EEB118D3C499097B07CA6DC /* TSLogger.cpp */,
);
name = debugging;
sourceTree = "<group>";
};
7CABE3C80E79AD2B307756D2 /* Sources [qmake] */ = {
isa = PBXGroup;
children = (
E457C7C0F6FE92258C9ABDE6 /* UniversalIndentGUI.pro */,
);
name = "Sources [qmake]";
sourceTree = "<group>";
};
8161BBD1CA4ABAD2BDCD1290 /* debugging */ = {
isa = PBXGroup;
children = (
9FAD1502AC6B577554578224 /* TSLoggerDialog.ui */,
);
name = debugging;
sourceTree = "<group>";
};
883D7615C4D2DE3FA1218F12 /* Headers */ = {
isa = PBXGroup;
children = (
F4AF6147B42623F6B3284738 /* src */,
);
name = Headers;
sourceTree = "<group>";
};
A1B6D1488110DA0868414A40 /* src */ = {
isa = PBXGroup;
children = (
A7CBECAE098937E7541F811C /* MainWindow.ui */,
B3E50F5A6CE91D794A9AE2AA /* ToolBarWidget.ui */,
B3201EB1AA113D49631A1BC2 /* UiGuiSettingsDialog.ui */,
3E78CB522F65C3B2CD054660 /* AboutDialog.ui */,
290E702759265E2A11910569 /* UpdateCheckDialog.ui */,
8161BBD1CA4ABAD2BDCD1290 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
A742563A513C5350203403C2 /* uic */ = {
isa = PBXGroup;
children = (
97D35E3EB9A27948A62C0C38 /* ui_MainWindow.h */,
A1FD7528F1BA6EC4A87E142A /* ui_ToolBarWidget.h */,
DCEF1F98F703B62597F530A9 /* ui_UiGuiSettingsDialog.h */,
04EC27988BE80C166C06D386 /* ui_AboutDialog.h */,
C2D745F51D062CD6409FA16C /* ui_UpdateCheckDialog.h */,
957A01A17EA639CF3AC8D438 /* ui_TSLoggerDialog.h */,
);
name = uic;
sourceTree = "<group>";
};
B06B937E4E5DB1B571475081 /* resources */ = {
isa = PBXGroup;
children = (
A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */,
);
name = resources;
sourceTree = "<group>";
};
BC7AF8B1E3D64E5DB82A180B /* release */ = {
isa = PBXGroup;
children = (
17088D39164D72415814D3CE /* moc */,
E60B3FBF3190558138C79865 /* qrc */,
A742563A513C5350203403C2 /* uic */,
);
name = release;
sourceTree = "<group>";
};
CAC892C702EF9F77734C8010 /* debugging */ = {
isa = PBXGroup;
children = (
F5BD042A2B240A02A39C20AC /* TSLogger.h */,
);
name = debugging;
sourceTree = "<group>";
};
E60B3FBF3190558138C79865 /* qrc */ = {
isa = PBXGroup;
children = (
1BB748495103B59368976F44 /* qrc_Icons.cpp */,
);
name = qrc;
sourceTree = "<group>";
};
E938E42D14AC74220066EAA2 /* Products */ = {
isa = PBXGroup;
children = (
E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */,
);
name = Products;
sourceTree = "<group>";
};
ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
9EF9FEB32A7980D519425A9E /* QtScript */,
6988CE9D964BC66484DA49D5 /* QtGui */,
B235A8A774654CA992F5A861 /* QtNetwork */,
FC65490F7BEA4427C242848C /* QtCore */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
EEC299C65D5017EB9DD513B0 /* Sources [UIC] */ = {
isa = PBXGroup;
children = (
A1B6D1488110DA0868414A40 /* src */,
);
name = "Sources [UIC]";
sourceTree = "<group>";
};
F4AF6147B42623F6B3284738 /* src */ = {
isa = PBXGroup;
children = (
0501473B7E166B9D10974B09 /* AboutDialog.h */,
9B1A8589DE3DB63FE9FEADAD /* AboutDialogGraphicsView.h */,
2365565B0E8281A9A554DE48 /* IndentHandler.h */,
D807F0DE3110F0AD45593FA7 /* MainWindow.h */,
0405CDFCAFF3A176EB7C5B2B /* SettingsPaths.h */,
A77AB8EA63A1F08C970A0DB1 /* TemplateBatchScript.h */,
19D832A234461F61E597073E /* UiGuiErrorMessage.h */,
0D2093D6D7971F9434E27A2D /* UiGuiHighlighter.h */,
234F1B047D06A4E84A3BA652 /* UiGuiIndentServer.h */,
01A925071F5E8C4DEAA029A7 /* UiGuiIniFileParser.h */,
AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */,
3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */,
5FDBC0A18FE03C4893ABD97E /* UiGuiSystemInfo.h */,
F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */,
240575E52D89C74CAFF8C83F /* UpdateCheckDialog.h */,
CAC892C702EF9F77734C8010 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
FB61758D0F0FDA4BA867C3D5 /* Sources */ = {
isa = PBXGroup;
children = (
06674E1DE8D3EB6E763DFFDA /* src */,
B06B937E4E5DB1B571475081 /* resources */,
);
name = Sources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */ = {
isa = PBXNativeTarget;
buildConfigurationList = E938E43C14AC74310066EAA2 /* Build configuration list for PBXNativeTarget "UniversalIndentGUI" */;
buildPhases = (
D7BA7D76DAB5DD13389D6332 /* Qt Qmake */,
A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */,
F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */,
C29B8785722055ED95EF7B57 /* Build Sources */,
2A1043669E6E5A7426EA502A /* Frameworks & Libraries */,
3787F99312C85FF0073FD7BA /* Bundle Resources */,
);
buildRules = (
);
dependencies = (
);
name = UniversalIndentGUI;
productInstallPath = release/;
productName = UniversalIndentGUI;
productReference = E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
91B15E841AA80083484172DE /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "UniversalIndentGUI" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 05596AB53D8D521C69802C27 /* UniversalIndentGUI */;
productRefGroup = E938E42D14AC74220066EAA2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
3787F99312C85FF0073FD7BA /* Bundle Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
358CDAA858B633E7AD0B6646 /* UniversalIndentGUI.icns in Bundle Resources */,
);
name = "Bundle Resources";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "Qt Preprocessors";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -C /Volumes/SHARED/Programming/uigui/universalindent/trunk -f 'UniversalIndentGUI.xcodeproj/qt_preprocess.mak'";
};
D7BA7D76DAB5DD13389D6332 /* Qt Qmake */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "Qt Qmake";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -C /Volumes/SHARED/Programming/uigui/universalindent/trunk -f 'UniversalIndentGUI.xcodeproj/qt_makeqmake.mak'";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C29B8785722055ED95EF7B57 /* Build Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2B7F90DE44210DB9F5D23F0C /* AboutDialog.cpp in Build Sources */,
157D8322CB15EB4B4B698465 /* AboutDialogGraphicsView.cpp in Build Sources */,
CE0306F2BD402BE1CC71BA98 /* IndentHandler.cpp in Build Sources */,
FD1638E377D97C82BDB438FB /* main.cpp in Build Sources */,
AAC1168526D0C37A3F415917 /* MainWindow.cpp in Build Sources */,
64CDA74634FD0C1F9265CF5F /* SettingsPaths.cpp in Build Sources */,
45FD613422A15DDFF65F07EB /* TemplateBatchScript.cpp in Build Sources */,
2E0B7B483AE3DAFB774883DC /* UiGuiErrorMessage.cpp in Build Sources */,
ED461CD43406DFA44318404B /* UiGuiHighlighter.cpp in Build Sources */,
83EFC8071DE20B90AE46E0A1 /* UiGuiIndentServer.cpp in Build Sources */,
D05E9C8E00DF8978FAD6C45F /* UiGuiIniFileParser.cpp in Build Sources */,
8DFAEC14C5621835B85BDBBB /* UiGuiSettings.cpp in Build Sources */,
07182A1FDE8301C8D9EAF7F5 /* UiGuiSettingsDialog.cpp in Build Sources */,
A56B320001BC86C5B01B08D0 /* UiGuiSystemInfo.cpp in Build Sources */,
A87876F3A24FCE545FEAFB05 /* UiGuiVersion.cpp in Build Sources */,
F42AF6C1FF5FF9F82C3E049D /* UpdateCheckDialog.cpp in Build Sources */,
0794A9D3A24B32A06CD8CA37 /* TSLogger.cpp in Build Sources */,
033FA4A2951F6995E4B52E75 /* moc_AboutDialog.cpp in Build Sources */,
86D03C28F9A095696FA4C465 /* moc_AboutDialogGraphicsView.cpp in Build Sources */,
447799AD66EF47D36B5A72E3 /* moc_IndentHandler.cpp in Build Sources */,
1446C37D55222BE8281C2D84 /* moc_MainWindow.cpp in Build Sources */,
4393711A82B0A27E8301FEB8 /* moc_UiGuiErrorMessage.cpp in Build Sources */,
10D0CC7BD2D2E5A3A90EEF25 /* moc_UiGuiHighlighter.cpp in Build Sources */,
8DCA76267BA4834F731C5BAB /* moc_UiGuiIndentServer.cpp in Build Sources */,
9892D98357F2D175D03F6488 /* moc_UiGuiSettings.cpp in Build Sources */,
2CE072BF0886F682F0FE8266 /* moc_UiGuiSettingsDialog.cpp in Build Sources */,
54824FDC5DD27B6216E263F5 /* moc_UpdateCheckDialog.cpp in Build Sources */,
C61FC1CBE0E603A32A3D1D8E /* moc_TSLogger.cpp in Build Sources */,
4DAB46634D6A37252BC2E3D4 /* qrc_Icons.cpp in Build Sources */,
);
name = "Build Sources";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
8DB1DD96F65B1BF1FFC506E0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
};
name = Debug;
};
95E1EB2E5DDD587BE5B3E548 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
};
name = Release;
};
E938E43414AC74230066EAA2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Debug;
};
E938E43514AC74230066EAA2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
COPY_PHASE_STRIP = YES;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Release;
};
E938E43614AC74230066EAA2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Default;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "UniversalIndentGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8DB1DD96F65B1BF1FFC506E0 /* Debug */,
95E1EB2E5DDD587BE5B3E548 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E938E43C14AC74310066EAA2 /* Build configuration list for PBXNativeTarget "UniversalIndentGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E938E43414AC74230066EAA2 /* Debug */,
E938E43514AC74230066EAA2 /* Release */,
E938E43614AC74230066EAA2 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
/* End XCConfigurationList section */
};
rootObject = 91B15E841AA80083484172DE /* Project object */;
}

@ -0,0 +1,298 @@
2012-01-01 Version 1.2.0
[add] The Linux version has a menu entry in the application development menu now.
[add] The Linux version has a mime type association to some code files now, so that UiGUI is available as "open with".
[add] Added support for the Visual Basic beautifier VBSBeautifier.
[add] Added support for the SQL beautifier Pl/Sql tidy.
[add] Updated the Artistic Style configuration to support Artistic Style version 2.02.1.
[add] Updated the Uncrustify configuration to support Uncrustify version 0.59.
[add] Updated the PerlTidy configuration to support PerlTidy version 1.74.
[add] Updated the Ruby Script Beautifier to version 2.9.
[fix] Bug ID 3021933: Updated the Artistic Style configuration to support Artistic Style version 2.01.
[fix] Bug ID 3021931: Fixed calling of Artistic Style version 1.22 and later.
[fix] Bug ID 3006513: Fixed compiling UiGUI using GCC 4.5 and later.
[fix] Bug ID 2942381: When loading an indenter configuration file, the settings displayed in the docking widget were correctly updated, but the code wasn't.
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
[fix] Bug ID 3175027: Uncrustify had wrong pop-up comments for two check-boxes.
[fix] Bug ID 2916163: The proxy settings are properly used and applied now.
[fix] Made the JsDecoder integration be compatible with recent Qt versions.
[change] Changed the created shell scripts indenter config file reference. Now each created shell script has a corresponding config file being created in the same dir as the shell script, with the same name but different suffix. But since the config file is referenced by "./", when calling the script the working directory must be the same as the directory containing the config file.
[change] Using TCLAP as command line parser instead of own command line parsing.
[change] Setting a file name as parameter on the command line without any prefix will load this file instead of the last opened one.
[change] Rewritten and improved the internal way how settings are connected to the UI.
[change] Refactored and cleaned up the code.
[change] Will no longer deliver binary bundles linked against Qt statically. Instead delivering all dependent DLLs and libs.
2009-07-16 Version 1.1.0
[add] Added a logging class, that can catch debug output and make trace backs if any problems occur possible.
[add] Added an application icon for Mac OS X.
[change] Feature Request ID 2596302 : Updated the greatcode.ini. Thanks to adxadx who has done this work!
[change] Feature Request ID 2793216: Updated to Uncrustify 0.53.
[change] Updated to JsDecoder version 1.1.0
[fix] Bug ID 2791229: If UiGUI was located in a path containing Unicode characters or such a path needed to be handed over to a called indenter, the indenter could get confused on Windows. So using the Windows 8.3 short path notation.
[fix] On Mac OS X the used default font wasn't monospaced. Switched back to use Courier on Mac.
2009-02-12 Version 1.0.2
[add] Feature Request ID 2498654 : Added support for the Fortran indenter F90ppr. http://universalindent.sf.net/issue/feature/2498654
[add] Made it possible to define "stdin" to be used for an indenter calling.
[change] Made the source code be compilable with the slightly older QScintilla version 2.2.
[change] When starting the very first time without any existing application settings, do not show the mainwindow at position 0,0. On Mac the window couldn't be moved because the window title bar was hidden under the Mac menu bar.
[change] When using a non Windows system the default editor font type is now Monospace instead of Courier. The latter was not found properly.
[change] For security reason using a randomly generated temporary directory name on Unix based systems.
[change] Improved the GUI updates for the Notepad++ plugin a bit. Not what I would call "good" yet.
[fix] Bug ID 2284777 : The Notepad++ plugin was falsely linked against Qt debug dlls, which were not included. http://universalindent.sf.net/issue/bug/2284777
[fix] Bug ID 2594251 : The new version available check didn't work anymore since version 1.0.1. http://universalindent.sf.net/issue/bug/2594251
[fix] Avoid a crash if an uigui ini file with faulty header info is read, where the indenter executable was empty.
[fix] Some application settings were tried to be read from a wrong directory when running in multi user mode.
2008-10-14 Version 1.0.1
[add] Feature Request ID 2161471 : Added support for the Python indenter pindent.
[add] Feature Request ID 1883444 : Added support for the JSP indenter JSPPP.
[add] Feature Request ID 1867563 : Added support for the XML indenter XML Indent.
[add] Support for French language. Thanks to Erwan "leg".
[change] Some small translation corrections.
[change] Improved the "new version available" check.
[change] On Mac and Linux a one pixel frame was shown around the whole screen when about dialog is visible. Removed that.
[change] Updated to Uncrustify version 0.49 from SVN repository.
[change] Using a new logo icon for UniversalIndentGUI. The logo was created by Erwan "leg". Thanks!
[fix] Bug ID 2173527 : Could not load Artistic Style config file properly if both parameters "--brackets=linux" and "--brackets=break-closing" were set. http://universalindent.sf.net/issue/2173527
[fix] The distributed version of GNU Indent was using a misspelled configuration file, thus lieve preview didn't correctly work. Using original GNU Win32 version now.
[fix] In version 1.0.0 the creation of batch files for indenters undet Windows always created a bash/shell script instead of batch.
[fix] Keyboard shortcuts for enabling/disabling "Live Preview" and syntax highlighting didn't work.
2008-09-30 Version 1.0.0 non public release. Only presented for Qt Centre programming contest.
[add] Made it possible to start UiGUI in different modes via parameters: Normal (full UI), plugin (only indenter menu, server active), server only.
[add] Added a server functionality. Future plan is to let UiGUI run also as server so plugins from other editors can send indent requests over TCP/IP to it. Very early state right now.
[add] Created a plugin for Notepad++. This plugin shows the indenter parameter menu and lets the user indent the selected or whole text. Live preview works also. Still has some eventloop graphic update problems.
[add] Added support for two (rather simple) Ruby beautifiers, ruby_formatter and rbeautify.
[add] Feature Request ID 1985475 : Added the possibility to reset all indenter parameters to default values. http://universalindent.sf.net/issue/1985475
[add] Feature Request ID 1989585 : Added a context menu in indenter parameters widget and moved all functions handling these actions from the main window to the indent handler. http://universalindent.sf.net/issue/1989585
[add] Feature Request ID 1977033 : Now supporting the Cobol intender Cobol Beautifier. http://universalindent.sf.net/issue/1977033
[add] Feature Request ID 2080832 : Now showing the cursors current line and column number in the statusbars down right corner. http://universalindent.sf.net/issue/2080832
[change] Using Qt >= 4.4.x now and thereby implemented an animated 3D about dialog.
[change] Using QScintilla >= 2.3 now and thereby added support for Cmake, Fortran[77], Pascal, PostScript, TCL, VHDL, XML and YAML.
[change] Reformatted the about dialog to only contain one QTextEdit. Also added some more links to that text.
[change] Limited the size of the combobox showing the indenters because with the supported programming languages in the name, the comobox was to large in width.
[change] Prevent php file from being tried to be executed directly. That could happen if the file has the execution flag set. However that should never be the case, so this is a workaround.
[change] Added a new class UiguiIniFileParser which will replace the currently used QSettings for reading the indenter parameters. Thus parameters appear in the menu in the same order as in the ini file and are no longer alphabetically sorted.
[change] Redesigned the user interface and code a bit. The indenter selection combo box along with the manual button are now placed in docking widget where all indenter parameters are placed. This is done in preparation to pull out the complete indent handler, so it can be used as plugin for Notepad++ or Eclipse etc.]
[change] Made reading the indenter config files more tolerant. If the user disobeys case sensitivity when editing the config file by hand, the values are correctly parsed anyway.
[change] Feature Request ID 1989587 : There is no longer any need to have a current value setting in the ini files. A default value is enough. http://universalindent.sf.net/issue/1989587
[change] Completely removed QT3Support functions.
[change] Removed all compiler warnings.
[change] Changed the way internal settings are handled. Using QObject propertys for connected setting name now.
[fix] The by each indenter supported programming languages, written in braces, are removed from the created shell scripts name.
[fix] Corrected the move/mv commands parameter in the created shell and batch script when calling recursive.
[fix] Bug ID 1986471 : The file modification flag did not work properly. Reason was that QScintilla can not set its textedit component modified flag to true by a function call. http://universalindent.sf.net/issue/1986471
2008-05-26 Version 0.8.2
[add] Feature Request ID 1971206 : Now showing by the indenter supported programming languages next to indenter name.
[add] Feature Request ID 1971181 : Added support for the HTML indenter HTB.
[add] Feature Request ID 1867562 : Added support for the HTML indenter hindent.
[add] Added support for the php indenter phpStylist version 1.0.
[add] Added the possibility to directly setting php files as indenter. The suffix .php is recognized and php used as default interpreter.
[add] Extended the created batch/shell script so it is able to indent only one file given as parameter or a whole directory recursively with a defined file suffix.
[add] Feature Request ID 1885911 : Added the possibility to open a file on applications start, that is handed over as parameter on the command line.
[add] Feature Request ID 1729429 : Added the possibility to drag'n drop in any source code file for opening it.
[change] Created indenter shell scripts now automatically have the executable flag set to true.
[change] Completed the support for all perl tidy parameters.
[change] Updated to uncrustify version 0.46.
[fix] Bug ID 1933074 : On Unix systems the user config files were stored in his home dir in the subfolder ".config". Now they are directly stored in ".universalindentgui".
[fix] Fixed a bug where the string "<html><body>" was prepended to the output code. Occurred for example when using the shell indenter.
2008-03-27 Version 0.8.1
[add] Feature Request ID 1909450 : Added support for the PEAR PHP beautifier. Thus PHP beautifying is also possible on Linux and Mac OS X. (Needs the PEAR package "PHP_Beautifier" to be installed and a path entry pointing to the PHP dir.)
[add] Added support and translations for Russian and Ukrainian language. Thanks to Oleksandr (http://korytskyy.lviv.ua).
[add] Feature Request ID 1901935 : From now on files are saved with the same encoding as they were opened and no longer always UTF-8. Also it is possible to save the file with any other encoding.
[change] The detection whether to run in portable mode now depends on where the "config" folder resides and no longer the "indenters" folder. This is needed to be able to correctly run on Windows multiuser systems.
[change] Removed the word "beta" whereever it occurred, since UiGUI isn't that beta anymore.
[fix] Bug ID 1910773 : On Unix systems the globally available files, like indenters, translations etc are not longer installed to /etc/universalindentgui but to /usr/share/universalindentgui.
2008-01-17 Version 0.8.0 Beta
[add] Feature Request ID 1849297 : Added support for indenters written in JavaScript using an internal interpreter. Have a look into the README.txt to get to know, what steps are needed for that.
[add] Added support for a simple JavaScript indenter written in JavaScript itself.
[add] Added support for a simple shell code indenter written in awk.
[add] Feature Request ID 1736946 : It is now possible to run any indenter that is available in the global environment via a path entry.
[add] Feature Request ID 1852483 : Indenters written in script languages, like perl, are now also supported, if they have a correct shebang.
[add] Added support for the well known perltidy. The uigui ini file is completed up to the category and including "Line Break Control". Rest needs to be done.
[add] Feature Request ID 1866599 : Adapted the used paths for settings, temporary files and the one containing indenter ini files to be conform with systems that use strict user rights management. Most this concerns Linux, where the binary resides inside a bin dir and user specific settings are stored in his home dir. Short: now supporting multiuser systems and also have a portable mode, where modifications are only on local media.
[add] Feature Request ID 1730360 : Along with real support for multiuser systems, each user can have his own indenter settings. These won't be overwritten by an update, what was the case before.
[add] Feature Request ID 1867628 : Added a button to the toolbar near the indenter selection that opens the indenters online manual.
[add] Feature Request ID 1867660 : Created a simple man page for unix based systems.
[add] The by the qmake projekt file resulting makefile has a directive for install on unix based systems now.
[add] Added example files for most supported programming languages, so each indenter can be tested.
[change] The source code archive is now in a Unix conform format and naming convention.
[change] The used paths have changed. The "data" directory has been renamed to indenters and includes only the uigui ini files and maybe some indenter binaries. Futher a config and a temp directory are used.
[change] In case of an error during calling the indenter, its standard output is appended to the error dialog.
[change] Corrected some misspelling.
[change] Renamed htmltidy to tidy because that is its official name and also the name of the binary in all Linux packages.
[fix] Bug ID 1855460 : The parameter settings of the indenter were only saved, if preview is turned on. Now the settings are always remembered.
[fix] Bug ID 1854156 : The syntax highlighter did not switch to perl if a file with suffix .pl or .pm was loaded.
2007-11-22 Version 0.7.1 Beta
[add] Feature Request ID 1833814 : Added support for building on MacOSX.
[change] Feature Request ID 1836486 : Update to latest version of Uncrustify.
[change] Update to latest version of Artistic Styler.
2007-11-11 Version 0.7.0 Beta
[add] Feature Request ID 1826733 : If the called indenter returns an error message, you can chose to not show the same error again. Helpful for HTMLtidy since it often shows a long, repeating error list.
[add] Feature Request ID 1805974 : Added an option to clear the list of recently opened files.
[add] Feature Request ID 1760997 : Added some code lines to example.cpp to test whether an indenter correctly handles preprocessor defines.
[add] Feature Request ID 1752551 : If the user manually checks for updates a progress/busy dialog will be shown.
[add] Feature Request ID 1736932 : The user gets shown a dialog if he has manually checked for an update and no new one is available.
[change] The update check is now enabled by default.
[change] Slighty changes made to the settings dialog; put texts in front of the changed value.
[fix] Bug ID 1807179 : GNU Indent didn't work properly on Windows system, after the dlls libiconv-2.dll and libintl-2.dll were removed. Readded them.
[fix] Bug ID 1805976 : The HTML export didn't produce any output. Fixed that, but still has not syntax formatting.
[fix] Bug ID 1815023 : Mixed traditional with simplified chinese translation. Now preferring to use english text instead of mixing if no traditional translation is available.
[fix] Bug ID 1815120 : The font of the editor component was wrong (not monospaced), if syntax highlighting was turned off.
2007-06-13 Version 0.6.1 Beta
[add] Feature Request ID 1729433 : Added a recently opened file menu.
[add] Feature Request ID 1704290 : Added possibiltiy to integrate into an IDE, editor or other as external tool. This is donw by creating a batch/shell script which accepts a file as parameter and calls the indenter with the in UniversalIndentGUI made settings.
[add] Feature Request ID 1673659 : The string parameter in the uigui ini files for each indenter can now also be a list of strings divided by "|" sign. As result the parameter name with value will be written to the indenter config file for each of the values.
[add] Feature Request ID 1730180 : UniversalIndentGUI can automatically check on start, whether a new version is available. This setting is disabled by default and can be enabled in the settings.
[add] Added support for HTML Tidy. The executable is contained in the release package.
[add] Feature Request ID 1736432 : The width of the dock widget containing the indenter parameters is now restored on program start.
[change] The about dialog shows now a credits scroller to say thanks to all people, who have helped me somehow.
[fix] Bug ID 1733499 : UniversalIndentGui crashed if inside of an indenter ini file the category number of one parameter was higher than the available categories.
[fix] Bug ID 1735586 : Some dialogs had untranslated buttons. For example yes, no, cancel were not translated.
2007-06-03 Version 0.6.0 Beta
[add] Feature Request ID 1700557 : Added a settings dialog for handling more possible settings with better usabiltiy.
[add] Feature Request ID 1700556 : Added option to load last file or not on startup.
[add] Feature Request ID 1684011 : Added option to set the width used to display tabs (default is four spaces).
[add] Feature Request ID 1651718 : Added multiple choices, for the indenter configuration, with for the user readable text. Before the text inside of the combo boxes for the indenter parameters was exactly the same text as the command line parameter of the indenter. Now with "ChoicesReadable" a list with the same length as "Choices" can be used to insert readable text into the combo box. If this list is not set, the content of "Choices" will be used.
[add] Partly Japanese translation. Thanks to Nirvash.
[add] The language selection show the countries flag in front of its name to identify the language faster.
[add] Feature Request ID 1657253 : If now configuration ini file for any indenter can be found, a warning will be displayed.
[change] Feature Request ID 1723228 : The default font for all syntax highlighters is now mono spaced, Courier.
[change] Along with the settings dialog cleaned up the user interface. Moved some not that often needed settings away to the settings dialog.
[change] The full text of the GPL in the about dialog did slow down the program startup and translation. Now only a hint and link to the GPL is given in the about dialog.
[fix] Bug ID 1692511 : UniversalIndentGui crashed, if a by the syntax highlighter unsupported file extension was opened.
[fix] Bug ID 1727538 : The setting for syntax highlighting was allways enabled on startup, even if disabled on closing.
[fix] Bug ID 1729026 : The highlighting style was not correct when changed to another highlighter than the current. Only after toggling preview for example the style was correct.
[fix] The editors column showing the line numbers did not adapt its width to the maximum line number.
2007-03-19 Version 0.5.1 Beta
[add] Supporting syntax highlightning for the programming language D.
[change] The live typing and indenting feature was not adapted to QScintilla. Now works again (depending on the used indenter).
[fix] Bug ID 1678783 : Files other encoded than ascii were not displayed correctly. Now allways displaying files using UTF-8 encoding.
[fix] Bug ID 1678783 : The new syntax highlighter selection menu was not translated.
[fix] When file was reloaded with other encoding the file was allways set to be modified even if it wasn't.
2007-03-14 Version 0.5.0 Beta
[add/change] Using QScintilla as editing component, which is by far more mighty than the before uses QTextEdit. Have a look inside the development area for details.
[add] Because of QScintilla, added syntax highlightning for bash, batch, cpp, csharp, css, diff, html, idl, java, javascript, lua, makefile, perl, pov, ini, python, ruby, sql and tex.
[add] Also added code folding for previously mentioned languages.
[add] Added support for the indenter "phpCB" phpCodeBeatufier. (Thanks to Nelson Tai) The executable is not included in the UiGui release, because I am not sure about the license of phpCB right now.
[add] The output of an indenter can now be read from stdout, by setting "stdout" for "outputFileParameter".
[add] Feature Request ID 1673549 : The order of the indenter call parameters for input file, output file and options[file] is now selectable in three states: pio, ipo, iop.
[add] Feature Request ID 1675503 : The last set encoding is being remembered and used on loading last file.
[add] Feature Request ID 1669822 : The last window position, size and maximized state is stored in the settings and restored.
[add] Feature Request ID 1673670 : Made it possible to switch between visible and invisible white space characters, like spaces and tabs.
[change] The "personal" configuration files of each indenter (like gc.cfg) are no longer included in a release, so these settings can be loaded into UiGui after updating.
[fix] Bug ID 1678783: If the current opened file had no save name yet, only the path was written to the settings file, causing an error on next start.
2007-02-25 Version 0.4.2 Beta
[add] Support for the indenter CSSTidy has been added.
[add] Support for new language: Taiwan (Chinese).
[change] For easier translation the about dialog has been redesigned a bit.
2007-02-11 Version 0.4.1 Beta
[add] Support for the indenter Uncrustify has been added.
[add] Feature Request ID 1651719: A binary release for Linux AMD64 is now available.
[add] Feature Request ID 1657251: If only a win32 executable exists under Linux, wine will be used to call it. Now a test will be mad if wine is installed and an error message will show up if not installed.
[change] Some changes mad to the Artistic Styler ini file as suggested by its author Jim Pattee.
[change] Put the file open button at first position in the toolbar, because normally this is the first step one would do, if he tries to find the optimal indenter and settings for himself.
[change] The background in the about dialog has been changed to look equal on all systems.
[change] The error message dialogs had small optical enhancements to be more readable.
[fix] Bug ID 1657255: If an error occurred during the try to call the indenter, a message box is being shown, but the mouse cursor still indicated that the application is being busy.
[fix] Bug ID 1651071: Changing the file encoding did not affect the code sent to the indenter, so the code while preview turned on, had wrong encoding (still seems to have some encoding problems under Linux).
[fix] Bug ID 1650222: On Windows systems there were two DLLs missing to run GNU Indent ("libiconv-2.dll" and "libintl-2.dll")
[fix] Bug ID 1649918: The indenter was not called after first program start, so preview updated first after changing a setting or the code.
2007-02-01 Version 0.4 Beta
[add] All parameters of GNU Indent have been added.
[add] From now on the indenter BCPP is included.
[add] The loaded source file encoding is now convertable by the menu entry "Reopen File with other Encoding". This way chinese encoding etc. is possible to load. (Suggest for this submitted by Nelson, Bug ID 1643541)
[add] A subdirectory "doc" has been added, containing the file "iniFileFormat.html" with info how to write ini files for new indenters.
[change] Updated the astyle executable and the ini file to version 1.20.1
[change] Restructured the gui design a little bit. Using a moveable dock widget for the indenter settings now. Using a toolbar that can also be placed at the bottom.
[change] Made it possible to change the language without the need to restart the application.
[change] Line numbers are now geyed out, because this is more decent and selecting the numbers is no longer possible.
[change] The link to the homepage in the about dialog now really opens the website.
[change] The linux version is now statically linked against Qt so there should be no problems with wrong Qt versions installed or even no Qt libraries installed.
[fix] Bug ID 1553601: If no uigui ini file was found the application stopped with an exception.
2006-09-04 Version 0.3.1 Beta
[add] Language selector and german translation added.
2006-08-25 Version 0.3 Beta
[add] A message box will show up at opening a source file or program exit, if the source code has been changed, and ask whether to save the file or not.
[add] The symbol "*" will be shown in the window title in front of the source file name if the source code has been changed.
[add] By a settings menu entry the tool tips for the indenter parameter settings can be en/disabled because they can be annoying.
[add] A settings file is from now on used to remember the last selected indenter and last opened source code file.
[add] The source code can now be exported as a PDF or HTML document.
[add] Some commands are now faster available by keyboard shortcuts.
[fix] The calling name in the indenter ini file for GreatCode was written lower case while the real file name was upper case, which resulted in a program calling error.
[fix] Corrected the tab order for the gui elements.
[change] Optimized speed when switching between the available indenters. If the indenters ini file is large, this still takes some time.
2006-08-11 Version 0.2.5 Alpha
[add] when loading or saving either a source code or config file the load/save dialog will open in the files directory and not allways in the UniversalIndentGUI dir
[add] currently made settings for the indenter can be saved to any file
[add] the menue entries for loading and saving the indenter config file have now icons
[add] the currently opened source code file name and path will be shown in the window title bar
[add] a error dialog that will be shown once if the indenter executable for the selected indenter does not exist
[fix] turning syntax highlight on/off did first take effect after toggle of preview
[fix] the image in the about dialog box was not allways visible
2006-08-03 Version 0.2.4 Alpha
[change] the windows version does no longer need any dlls due to static linking and removing bind to mingwm10.dll
[change] the windows version of the GNU Indent is replaced by a DJGPP compiled GNU Indent version, that needs no further DLLs
[add] possibility to save the shown/indented source code
[fix] the file extension used to call the selected indenter. It is now equal to the loaded source file extension so the indenter recognizes the source code language
[fix] unnecessary calls of the indenter removed
[fix] indenter was not called if preview was activated and indenter changed
[fix] under linux the file mask for the open source file dialog did not work correctly
2006-07-16 Version 0.2.3 Alpha
[add] possibility to edit the source code while preview is active and see how it is formatted. So that is real live ;-)
2006-07-14 Version 0.2.2 Alpha
[add] ini file for GNU Indent with some first settings (if any one wants to write more in it let me know)
[add] a menu bar for more pleasent and common use of the program (some not yet used menu items are disabled)
[add] an about dialog
[add] some icons for better look and feel (can you feel it ;-) )
[fix] a bug under linux which caused an endless loop if text was edited
2006-07-07 Version 0.2.1.1 Alpha (win32 only)
- previously compiled using Visual Studio 2005 Express, whereby an additional installation of a redistributable package was needed to run UniversalIndentGUI. To avoid this and not force the user to install anything, now using mingw to compile.
2006-07-04 Version 0.2.1 Alpha
[add] function to load config file (not the uigui ini file) of every indenter (and reenabled load config file button)
[add] use of a default value when loading a indenter config file and not all parameters are set.
[add] all documented default parameters of GreatCode and Astyle to their ini files.
[fix] loading of file mask for source code file after changing indenter
[fix] call of indenter failed under win32 if a linux binary exists.
2006-06-30 Version 0.2.0 Alpha
[add] missing parameters for flexible indenter ini file format
[add] complete Astyle ini file
[add] multiple choice combobox for parameters
[add] checkbox in front of numeric and string parameters to enable/disable them. If disabled indenters default value is used
2006-06-28
[add] working ini file for Astyle (right now only few boolean parameters)
[change] ini file format for booleans to reach the planned flexibility
2006-06-23
[add] combobox in the upper left showing available indenters (found by searching for uigui_*.ini file). at the moment only GreatCode and testwise Astyle
[add] more detailed info if the indenter call results in an error
[add] icon for executable
[change] style/format of the ini file. Still not all planned features implemented
- some bugfixes, as you can say this in a preAlpha
2006-06-07
[change] unnecessary gui menu removed
[fix] corrected ini file for great code (only in executable release)
[add] made call of windows version of GreatCode under Linux possible by using wine

@ -0,0 +1,12 @@
How to install UniversalIndentGUI
---------------------------------
Well, there is no need to install this application at all. While you are reading this file,
you obviously already have unpacked the archive and thats all you need to do. You can start
the program by calling its executable. On Windows thats "UniversalIndentGUI.exe" and on any
other system it is "UniversalIndentGUI".
No additional libraries are needed.
For information about how to build UniversalIndentGUI from source, have a look into the
file readme.html.

@ -0,0 +1,347 @@
You may use, distribute and copy the UniversalIndentGUI under the terms of
GNU General Public License version 2, which is displayed below.
-------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
-------------------------------------------------------------------------

@ -0,0 +1,201 @@
TEMPLATE = app
QT += network
QT += script
unix:TARGET = universalindentgui
win32:TARGET = UniversalIndentGUI
macx:TARGET = UniversalIndentGUI
DEPENDPATH += resources \
src \
debug \
release
INCLUDEPATH += src
CONFIG += debug_and_release
macx {
# If using as framework qscintilla needs to be build with:
# qmake -spec macx-g++ CONFIG+=sdk CONFIG+=x86_64 CONFIG+=x86 CONFIG+=lib_bundle qscintilla.pro && make && sudo make install
#LIBS += -framework qscintilla2
LIBS += -lqscintilla2
ICON = resources/UniversalIndentGUI.icns
}
else {
LIBS += -lqscintilla2_qt4
}
CONFIG(release, debug|release) {
win32:pipe2nul = ">NUL"
unix:pipe2nul = "&> /dev/null"
macx:pipe2nul = "&> /dev/null"
# Language file processing
##########################
message(Updating language files)
lupdate = lupdate
unix:lupdate = lupdate-qt4
macx:lupdate = lupdate
lrelease = lrelease
unix:lrelease = lrelease-qt4
macx:lrelease = lrelease
# Update translation files
message ( Updating universalindent.ts )
system($${lupdate} src -ts ./translations/universalindent.ts -silent)
message ( Updating universalindent_de.ts )
system($${lupdate} src -ts ./translations/universalindent_de.ts -silent)
message ( Updating universalindent_fr.ts )
system($${lupdate} src -ts ./translations/universalindent_fr.ts -silent)
message ( Updating universalindent_ja.ts )
system($${lupdate} src -ts ./translations/universalindent_ja.ts -silent)
message ( Updating universalindent_ru.ts )
system($${lupdate} src -ts ./translations/universalindent_ru.ts -silent)
message ( Updating universalindent_uk.ts )
system($${lupdate} src -ts ./translations/universalindent_uk.ts -silent)
message ( Updating universalindent_zh_TW.ts )
system($${lupdate} src -ts ./translations/universalindent_zh_TW.ts -silent)
# Create translation binaries
message ( Creating translation binaries )
system($${lrelease} ./translations/universalindent_de.ts -qm ./translations/universalindent_de.qm -silent)
system($${lrelease} ./translations/universalindent_fr.ts -qm ./translations/universalindent_fr.qm -silent)
system($${lrelease} ./translations/universalindent_ja.ts -qm ./translations/universalindent_ja.qm -silent)
system($${lrelease} ./translations/universalindent_ru.ts -qm ./translations/universalindent_ru.qm -silent)
system($${lrelease} ./translations/universalindent_uk.ts -qm ./translations/universalindent_uk.qm -silent)
system($${lrelease} ./translations/universalindent_zh_TW.ts -qm ./translations/universalindent_zh_TW.qm -silent)
# Copy Qts own translation files to the local translation directory
message ( Copy Qts own translation files to the local translation directory )
qtTranslationInstallDir = $$[QT_INSTALL_TRANSLATIONS]
win32:qtTranslationInstallDir = $$replace(qtTranslationInstallDir, /, \\)
unix:system(cp $${qtTranslationInstallDir}/qt_de.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_fr.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_ja.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_ru.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_uk.qm ./translations/ $$pipe2nul)
unix:system(cp $${qtTranslationInstallDir}/qt_zh_TW.qm ./translations/ $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_de.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_fr.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_ja.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_ru.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_uk.qm .\\translations\\ /Y $$pipe2nul)
win32:system(copy $${qtTranslationInstallDir}\\qt_zh_TW.qm .\\translations\\ /Y $$pipe2nul)
# Defining files that shall be installed when calling "make install"
####################################################################
# Create and install man page
exists( ./doc/universalindentgui.1* ) {
unix:system(rm ./doc/universalindentgui.1*)
}
unix:system(cp ./doc/universalindentgui.man ./doc/universalindentgui.1)
unix:system(gzip -9 ./doc/universalindentgui.1)
unix:documentation.path = /usr/share/man/man1
unix:documentation.files = doc/universalindentgui.1.gz
# Install indenter ini files, examples and some indenters
unix:indenters.path = /usr/share/universalindentgui/indenters
unix:indenters.files = indenters/uigui_*.ini
unix:indenters.files += indenters/example.*
unix:indenters.files += indenters/JsDecoder.js
unix:indenters.files += indenters/phpStylist.php
unix:indenters.files += indenters/phpStylist.txt
unix:indenters.files += indenters/pindent.py
unix:indenters.files += indenters/pindent.txt
unix:indenters.files += indenters/rbeautify.rb
unix:indenters.files += indenters/ruby_formatter.rb
unix:indenters.files += indenters/shellindent.awk
# Install translation files
unix:translation.path = /usr/share/universalindentgui/translations
unix:translation.files = translations/*.qm
# Install highlighter default config
unix:highlighterconfig.path = /usr/share/universalindentgui/config
unix:highlighterconfig.files = config/UiGuiSyntaxHighlightConfig.ini
# Install binary
unix:target.path = /usr/bin
# Set everything that shall be installed
unix:INSTALLS += target \
highlighterconfig \
indenters \
translation \
documentation
}
CONFIG(debug, debug|release) {
DESTDIR = ./debug
DEFINES += _DEBUG DEBUG
} else {
DESTDIR = ./release
}
MOC_DIR = $${DESTDIR}/moc
UI_DIR = $${DESTDIR}/uic
OBJECTS_DIR = $${DESTDIR}/obj
RCC_DIR = $${DESTDIR}/qrc
#message ( destdir is $${DESTDIR}. uic is $${UI_DIR}. moc is $${MOC_DIR})
# Input
HEADERS += src/AboutDialog.h \
src/AboutDialogGraphicsView.h \
src/IndentHandler.h \
src/MainWindow.h \
src/SettingsPaths.h \
src/TemplateBatchScript.h \
src/UiGuiErrorMessage.h \
src/UiGuiHighlighter.h \
src/UiGuiIndentServer.h \
src/UiGuiIniFileParser.h \
src/UiGuiSettings.h \
src/UiGuiSettingsDialog.h \
src/UiGuiSystemInfo.h \
src/UiGuiVersion.h \
src/UpdateCheckDialog.h \
src/debugging/TSLogger.h
FORMS += src/MainWindow.ui \
src/ToolBarWidget.ui \
src/UiGuiSettingsDialog.ui \
src/AboutDialog.ui \
src/UpdateCheckDialog.ui \
src/debugging/TSLoggerDialog.ui
SOURCES += src/AboutDialog.cpp \
src/AboutDialogGraphicsView.cpp \
src/IndentHandler.cpp \
src/main.cpp \
src/MainWindow.cpp \
src/SettingsPaths.cpp \
src/TemplateBatchScript.cpp \
src/UiGuiErrorMessage.cpp \
src/UiGuiHighlighter.cpp \
src/UiGuiIndentServer.cpp \
src/UiGuiIniFileParser.cpp \
src/UiGuiSettings.cpp \
src/UiGuiSettingsDialog.cpp \
src/UiGuiSystemInfo.cpp \
src/UiGuiVersion.cpp \
src/UpdateCheckDialog.cpp \
src/debugging/TSLogger.cpp
RESOURCES += resources/Icons.qrc
RC_FILE = resources/programicon.rc
#message(Creating symbolic links within target dir for debugging)
#macx:system(ln -s $$PWD/config ./debug/config)
#macx:system(ln -s $$PWD/indenters ./debug/indenters)
#macx:system(ln -s $$PWD/translations ./debug/translations)
#macx:system(ln -s $$PWD/config ./release/config)
#macx:system(ln -s $$PWD/indenters ./release/indenters)
#macx:system(ln -s $$PWD/translations ./release/translations)

@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalIndentGUI", "src\UniversalIndentGUI.vcproj", "{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalIndentGUI_NPP", "src\UniversalIndentGUI_NPP\UniversalIndentGUI_NPP.vcproj", "{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UiGUI_Server_Test_Client", "src\UiGUI_Server_Test_Client\UiGUI_Server_Test_Client.vcproj", "{DE19ED58-2330-4B86-AFD1-18A4A037E488}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}.Debug|Win32.ActiveCfg = Debug|Win32
{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}.Debug|Win32.Build.0 = Debug|Win32
{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}.Release|Win32.ActiveCfg = Release|Win32
{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}.Release|Win32.Build.0 = Release|Win32
{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}.Debug|Win32.ActiveCfg = Debug|Win32
{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}.Debug|Win32.Build.0 = Debug|Win32
{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}.Release|Win32.ActiveCfg = Release|Win32
{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}.Release|Win32.Build.0 = Release|Win32
{DE19ED58-2330-4B86-AFD1-18A4A037E488}.Debug|Win32.ActiveCfg = Debug|Win32
{DE19ED58-2330-4B86-AFD1-18A4A037E488}.Debug|Win32.Build.0 = Debug|Win32
{DE19ED58-2330-4B86-AFD1-18A4A037E488}.Release|Win32.ActiveCfg = Release|Win32
{DE19ED58-2330-4B86-AFD1-18A4A037E488}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -0,0 +1,741 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
033FA4A2951F6995E4B52E75 /* moc_AboutDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */; settings = {ATTRIBUTES = (); }; };
07182A1FDE8301C8D9EAF7F5 /* UiGuiSettingsDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */; settings = {ATTRIBUTES = (); }; };
0794A9D3A24B32A06CD8CA37 /* TSLogger.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 5EEB118D3C499097B07CA6DC /* TSLogger.cpp */; settings = {ATTRIBUTES = (); }; };
10D0CC7BD2D2E5A3A90EEF25 /* moc_UiGuiHighlighter.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */; settings = {ATTRIBUTES = (); }; };
1446C37D55222BE8281C2D84 /* moc_MainWindow.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */; settings = {ATTRIBUTES = (); }; };
157D8322CB15EB4B4B698465 /* AboutDialogGraphicsView.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */; settings = {ATTRIBUTES = (); }; };
204EDFAF3269B294371D7373 /* QtCore in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = FC65490F7BEA4427C242848C /* QtCore */; };
2B7F90DE44210DB9F5D23F0C /* AboutDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */; settings = {ATTRIBUTES = (); }; };
2CE072BF0886F682F0FE8266 /* moc_UiGuiSettingsDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */; settings = {ATTRIBUTES = (); }; };
2E0B7B483AE3DAFB774883DC /* UiGuiErrorMessage.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */; settings = {ATTRIBUTES = (); }; };
32D9B1CB3877EF0A567B997D /* QtScript in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 9EF9FEB32A7980D519425A9E /* QtScript */; };
358CDAA858B633E7AD0B6646 /* UniversalIndentGUI.icns in Bundle Resources */ = {isa = PBXBuildFile; fileRef = A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */; settings = {ATTRIBUTES = (); }; };
3B7E26C095F17917F557F0BB /* QtGui in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 6988CE9D964BC66484DA49D5 /* QtGui */; };
4393711A82B0A27E8301FEB8 /* moc_UiGuiErrorMessage.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */; settings = {ATTRIBUTES = (); }; };
447799AD66EF47D36B5A72E3 /* moc_IndentHandler.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */; settings = {ATTRIBUTES = (); }; };
45FD613422A15DDFF65F07EB /* TemplateBatchScript.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */; settings = {ATTRIBUTES = (); }; };
4DAB46634D6A37252BC2E3D4 /* qrc_Icons.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 1BB748495103B59368976F44 /* qrc_Icons.cpp */; settings = {ATTRIBUTES = (); }; };
54824FDC5DD27B6216E263F5 /* moc_UpdateCheckDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */; settings = {ATTRIBUTES = (); }; };
64CDA74634FD0C1F9265CF5F /* SettingsPaths.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */; settings = {ATTRIBUTES = (); }; };
83EFC8071DE20B90AE46E0A1 /* UiGuiIndentServer.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */; settings = {ATTRIBUTES = (); }; };
86D03C28F9A095696FA4C465 /* moc_AboutDialogGraphicsView.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */; settings = {ATTRIBUTES = (); }; };
8DCA76267BA4834F731C5BAB /* moc_UiGuiIndentServer.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */; settings = {ATTRIBUTES = (); }; };
8DFAEC14C5621835B85BDBBB /* UiGuiSettings.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */; settings = {ATTRIBUTES = (); }; };
9892D98357F2D175D03F6488 /* moc_UiGuiSettings.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */; settings = {ATTRIBUTES = (); }; };
A56B320001BC86C5B01B08D0 /* UiGuiSystemInfo.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */; settings = {ATTRIBUTES = (); }; };
A87876F3A24FCE545FEAFB05 /* UiGuiVersion.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = D038693E47A07F84995184E5 /* UiGuiVersion.cpp */; settings = {ATTRIBUTES = (); }; };
AAC1168526D0C37A3F415917 /* MainWindow.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 1C0B64226A129D35F02DC004 /* MainWindow.cpp */; settings = {ATTRIBUTES = (); }; };
B3D97A9EF6FD086AC8AA1400 /* QtNetwork in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B235A8A774654CA992F5A861 /* QtNetwork */; };
C61FC1CBE0E603A32A3D1D8E /* moc_TSLogger.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */; settings = {ATTRIBUTES = (); }; };
CE0306F2BD402BE1CC71BA98 /* IndentHandler.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 7B749332F0EE106BAF891CBB /* IndentHandler.cpp */; settings = {ATTRIBUTES = (); }; };
D05E9C8E00DF8978FAD6C45F /* UiGuiIniFileParser.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */; settings = {ATTRIBUTES = (); }; };
E938E42F14AC74220066EAA2 /* UniversalIndentGUI.app in Project Copy */ = {isa = PBXBuildFile; fileRef = E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */; };
ED461CD43406DFA44318404B /* UiGuiHighlighter.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */; settings = {ATTRIBUTES = (); }; };
F42AF6C1FF5FF9F82C3E049D /* UpdateCheckDialog.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */; settings = {ATTRIBUTES = (); }; };
FD1638E377D97C82BDB438FB /* main.cpp in Build Sources */ = {isa = PBXBuildFile; fileRef = 7EC3C68A81EFFF79B6CA22AC /* main.cpp */; settings = {ATTRIBUTES = (); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release;
dstSubfolderSpec = 0;
files = (
E938E42F14AC74220066EAA2 /* UniversalIndentGUI.app in Project Copy */,
);
name = "Project Copy";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
01A925071F5E8C4DEAA029A7 /* UiGuiIniFileParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiIniFileParser.h; path = src/UiGuiIniFileParser.h; sourceTree = "<group>"; };
0405CDFCAFF3A176EB7C5B2B /* SettingsPaths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SettingsPaths.h; path = src/SettingsPaths.h; sourceTree = "<group>"; };
04EC27988BE80C166C06D386 /* ui_AboutDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_AboutDialog.h; path = release/uic/ui_AboutDialog.h; sourceTree = "<group>"; };
0501473B7E166B9D10974B09 /* AboutDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AboutDialog.h; path = src/AboutDialog.h; sourceTree = "<group>"; };
0D2093D6D7971F9434E27A2D /* UiGuiHighlighter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiHighlighter.h; path = src/UiGuiHighlighter.h; sourceTree = "<group>"; };
19D832A234461F61E597073E /* UiGuiErrorMessage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiErrorMessage.h; path = src/UiGuiErrorMessage.h; sourceTree = "<group>"; };
1BB748495103B59368976F44 /* qrc_Icons.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = qrc_Icons.cpp; path = release/qrc/qrc_Icons.cpp; sourceTree = "<group>"; };
1C0B64226A129D35F02DC004 /* MainWindow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MainWindow.cpp; path = src/MainWindow.cpp; sourceTree = "<group>"; };
234F1B047D06A4E84A3BA652 /* UiGuiIndentServer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiIndentServer.h; path = src/UiGuiIndentServer.h; sourceTree = "<group>"; };
2365565B0E8281A9A554DE48 /* IndentHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IndentHandler.h; path = src/IndentHandler.h; sourceTree = "<group>"; };
240575E52D89C74CAFF8C83F /* UpdateCheckDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UpdateCheckDialog.h; path = src/UpdateCheckDialog.h; sourceTree = "<group>"; };
26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSettingsDialog.cpp; path = src/UiGuiSettingsDialog.cpp; sourceTree = "<group>"; };
290E702759265E2A11910569 /* UpdateCheckDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = UpdateCheckDialog.ui; path = src/UpdateCheckDialog.ui; sourceTree = "<group>"; };
3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSettingsDialog.h; path = src/UiGuiSettingsDialog.h; sourceTree = "<group>"; };
3E78CB522F65C3B2CD054660 /* AboutDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = AboutDialog.ui; path = src/AboutDialog.ui; sourceTree = "<group>"; };
4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_TSLogger.cpp; path = release/moc/moc_TSLogger.cpp; sourceTree = "<group>"; };
4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UpdateCheckDialog.cpp; path = src/UpdateCheckDialog.cpp; sourceTree = "<group>"; };
59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_MainWindow.cpp; path = release/moc/moc_MainWindow.cpp; sourceTree = "<group>"; };
5EEB118D3C499097B07CA6DC /* TSLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TSLogger.cpp; path = src/debugging/TSLogger.cpp; sourceTree = "<group>"; };
5FDBC0A18FE03C4893ABD97E /* UiGuiSystemInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSystemInfo.h; path = src/UiGuiSystemInfo.h; sourceTree = "<group>"; };
6988CE9D964BC66484DA49D5 /* QtGui */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtGui; path = /opt/local/lib/libQtGui.4.7.4.dylib; sourceTree = "<absolute>"; };
705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiHighlighter.cpp; path = release/moc/moc_UiGuiHighlighter.cpp; sourceTree = "<group>"; };
71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_AboutDialog.cpp; path = release/moc/moc_AboutDialog.cpp; sourceTree = "<group>"; };
7B749332F0EE106BAF891CBB /* IndentHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = IndentHandler.cpp; path = src/IndentHandler.cpp; sourceTree = "<group>"; };
7DBF76AABA74FE9F8ACD5DB5 /* Icons.qrc */ = {isa = PBXFileReference; lastKnownFileType = text; name = Icons.qrc; path = resources/Icons.qrc; sourceTree = "<group>"; };
7EC3C68A81EFFF79B6CA22AC /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = "<group>"; };
836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiIndentServer.cpp; path = release/moc/moc_UiGuiIndentServer.cpp; sourceTree = "<group>"; };
8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AboutDialog.cpp; path = src/AboutDialog.cpp; sourceTree = "<group>"; };
8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSystemInfo.cpp; path = src/UiGuiSystemInfo.cpp; sourceTree = "<group>"; };
944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiSettings.cpp; path = src/UiGuiSettings.cpp; sourceTree = "<group>"; };
957A01A17EA639CF3AC8D438 /* ui_TSLoggerDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_TSLoggerDialog.h; path = release/uic/ui_TSLoggerDialog.h; sourceTree = "<group>"; };
95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiHighlighter.cpp; path = src/UiGuiHighlighter.cpp; sourceTree = "<group>"; };
97D35E3EB9A27948A62C0C38 /* ui_MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_MainWindow.h; path = release/uic/ui_MainWindow.h; sourceTree = "<group>"; };
9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiIndentServer.cpp; path = src/UiGuiIndentServer.cpp; sourceTree = "<group>"; };
998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiErrorMessage.cpp; path = release/moc/moc_UiGuiErrorMessage.cpp; sourceTree = "<group>"; };
9B1A8589DE3DB63FE9FEADAD /* AboutDialogGraphicsView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AboutDialogGraphicsView.h; path = src/AboutDialogGraphicsView.h; sourceTree = "<group>"; };
9EF9FEB32A7980D519425A9E /* QtScript */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtScript; path = /opt/local/lib/libQtScript.4.7.4.dylib; sourceTree = "<absolute>"; };
9FAD1502AC6B577554578224 /* TSLoggerDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = TSLoggerDialog.ui; path = src/debugging/TSLoggerDialog.ui; sourceTree = "<group>"; };
A1FD7528F1BA6EC4A87E142A /* ui_ToolBarWidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_ToolBarWidget.h; path = release/uic/ui_ToolBarWidget.h; sourceTree = "<group>"; };
A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = UniversalIndentGUI.icns; path = resources/UniversalIndentGUI.icns; sourceTree = "<group>"; };
A77AB8EA63A1F08C970A0DB1 /* TemplateBatchScript.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TemplateBatchScript.h; path = src/TemplateBatchScript.h; sourceTree = "<group>"; };
A7CBECAE098937E7541F811C /* MainWindow.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = MainWindow.ui; path = src/MainWindow.ui; sourceTree = "<group>"; };
A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiSettingsDialog.cpp; path = release/moc/moc_UiGuiSettingsDialog.cpp; sourceTree = "<group>"; };
AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SettingsPaths.cpp; path = src/SettingsPaths.cpp; sourceTree = "<group>"; };
AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiSettings.h; path = src/UiGuiSettings.h; sourceTree = "<group>"; };
B235A8A774654CA992F5A861 /* QtNetwork */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtNetwork; path = /opt/local/lib/libQtNetwork.4.7.4.dylib; sourceTree = "<absolute>"; };
B3201EB1AA113D49631A1BC2 /* UiGuiSettingsDialog.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = UiGuiSettingsDialog.ui; path = src/UiGuiSettingsDialog.ui; sourceTree = "<group>"; };
B3E50F5A6CE91D794A9AE2AA /* ToolBarWidget.ui */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = ToolBarWidget.ui; path = src/ToolBarWidget.ui; sourceTree = "<group>"; };
BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiIniFileParser.cpp; path = src/UiGuiIniFileParser.cpp; sourceTree = "<group>"; };
C2D745F51D062CD6409FA16C /* ui_UpdateCheckDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_UpdateCheckDialog.h; path = release/uic/ui_UpdateCheckDialog.h; sourceTree = "<group>"; };
D038693E47A07F84995184E5 /* UiGuiVersion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiVersion.cpp; path = src/UiGuiVersion.cpp; sourceTree = "<group>"; };
D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AboutDialogGraphicsView.cpp; path = src/AboutDialogGraphicsView.cpp; sourceTree = "<group>"; };
D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UpdateCheckDialog.cpp; path = release/moc/moc_UpdateCheckDialog.cpp; sourceTree = "<group>"; };
D807F0DE3110F0AD45593FA7 /* MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainWindow.h; path = src/MainWindow.h; sourceTree = "<group>"; };
DCEF1F98F703B62597F530A9 /* ui_UiGuiSettingsDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_UiGuiSettingsDialog.h; path = release/uic/ui_UiGuiSettingsDialog.h; sourceTree = "<group>"; };
DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_IndentHandler.cpp; path = release/moc/moc_IndentHandler.cpp; sourceTree = "<group>"; };
E457C7C0F6FE92258C9ABDE6 /* UniversalIndentGUI.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = UniversalIndentGUI.pro; sourceTree = "<group>"; };
E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UniversalIndentGUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TemplateBatchScript.cpp; path = src/TemplateBatchScript.cpp; sourceTree = "<group>"; };
EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UiGuiErrorMessage.cpp; path = src/UiGuiErrorMessage.cpp; sourceTree = "<group>"; };
F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UiGuiVersion.h; path = src/UiGuiVersion.h; sourceTree = "<group>"; };
F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_UiGuiSettings.cpp; path = release/moc/moc_UiGuiSettings.cpp; sourceTree = "<group>"; };
F5BD042A2B240A02A39C20AC /* TSLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TSLogger.h; path = src/debugging/TSLogger.h; sourceTree = "<group>"; };
F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_AboutDialogGraphicsView.cpp; path = release/moc/moc_AboutDialogGraphicsView.cpp; sourceTree = "<group>"; };
FC65490F7BEA4427C242848C /* QtCore */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = QtCore; path = /opt/local/lib/libQtCore.4.7.4.dylib; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2A1043669E6E5A7426EA502A /* Frameworks & Libraries */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32D9B1CB3877EF0A567B997D /* QtScript in Frameworks & Libraries */,
3B7E26C095F17917F557F0BB /* QtGui in Frameworks & Libraries */,
B3D97A9EF6FD086AC8AA1400 /* QtNetwork in Frameworks & Libraries */,
204EDFAF3269B294371D7373 /* QtCore in Frameworks & Libraries */,
);
name = "Frameworks & Libraries";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
05596AB53D8D521C69802C27 /* UniversalIndentGUI */ = {
isa = PBXGroup;
children = (
FB61758D0F0FDA4BA867C3D5 /* Sources */,
46E892BBB6BB6952967E0561 /* Temporary Sources */,
883D7615C4D2DE3FA1218F12 /* Headers */,
7CABE3C80E79AD2B307756D2 /* Sources [qmake] */,
52C235EBF1C9B07808119459 /* Sources [RCC] */,
EEC299C65D5017EB9DD513B0 /* Sources [UIC] */,
ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */,
E938E42D14AC74220066EAA2 /* Products */,
);
name = UniversalIndentGUI;
sourceTree = "<group>";
};
06674E1DE8D3EB6E763DFFDA /* src */ = {
isa = PBXGroup;
children = (
8B5B29CE11F2EFCD1C93EB6C /* AboutDialog.cpp */,
D3A96D6E7DF8830490467C04 /* AboutDialogGraphicsView.cpp */,
7B749332F0EE106BAF891CBB /* IndentHandler.cpp */,
7EC3C68A81EFFF79B6CA22AC /* main.cpp */,
1C0B64226A129D35F02DC004 /* MainWindow.cpp */,
AAFD01B4A071D73CD002C7FD /* SettingsPaths.cpp */,
E9B6F1DAFB4C5CD5E9C4C02C /* TemplateBatchScript.cpp */,
EB9AF2B1C20FF4B1225EA3FB /* UiGuiErrorMessage.cpp */,
95C394A7DB7625A6018F145F /* UiGuiHighlighter.cpp */,
9840C47AE913CA84966C04AE /* UiGuiIndentServer.cpp */,
BAC68B56402ED1C21C4A4561 /* UiGuiIniFileParser.cpp */,
944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */,
26383A497B0CC65909DA431D /* UiGuiSettingsDialog.cpp */,
8CE031E032D58BFFADB163E3 /* UiGuiSystemInfo.cpp */,
D038693E47A07F84995184E5 /* UiGuiVersion.cpp */,
4B2D11C739E037330FF187DB /* UpdateCheckDialog.cpp */,
682C39EDA1B6CDF80B0D9214 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
16A82DA2701971900CCC9274 /* resources */ = {
isa = PBXGroup;
children = (
7DBF76AABA74FE9F8ACD5DB5 /* Icons.qrc */,
);
name = resources;
sourceTree = "<group>";
};
17088D39164D72415814D3CE /* moc */ = {
isa = PBXGroup;
children = (
71D24B3D256D9E9FC90EEDF7 /* moc_AboutDialog.cpp */,
F84894CE7D4FF11845C5DEC1 /* moc_AboutDialogGraphicsView.cpp */,
DEDA4624B80C4136C3D118C2 /* moc_IndentHandler.cpp */,
59F78802D4802B940EA308A0 /* moc_MainWindow.cpp */,
998C921BBFDF579B258C28EA /* moc_UiGuiErrorMessage.cpp */,
705CF7C739E81ED3345C9F41 /* moc_UiGuiHighlighter.cpp */,
836D42CF391C82A0B70687F3 /* moc_UiGuiIndentServer.cpp */,
F4DF9DB04F138672E3CB95D5 /* moc_UiGuiSettings.cpp */,
A7DD7C62D24BBDB386C3840D /* moc_UiGuiSettingsDialog.cpp */,
D4515A4B9864E652FE65CBDE /* moc_UpdateCheckDialog.cpp */,
4082D6E68F89F86822C28CAE /* moc_TSLogger.cpp */,
);
name = moc;
sourceTree = "<group>";
};
46E892BBB6BB6952967E0561 /* Temporary Sources */ = {
isa = PBXGroup;
children = (
BC7AF8B1E3D64E5DB82A180B /* release */,
);
name = "Temporary Sources";
sourceTree = "<group>";
};
52C235EBF1C9B07808119459 /* Sources [RCC] */ = {
isa = PBXGroup;
children = (
16A82DA2701971900CCC9274 /* resources */,
);
name = "Sources [RCC]";
sourceTree = "<group>";
};
682C39EDA1B6CDF80B0D9214 /* debugging */ = {
isa = PBXGroup;
children = (
5EEB118D3C499097B07CA6DC /* TSLogger.cpp */,
);
name = debugging;
sourceTree = "<group>";
};
7CABE3C80E79AD2B307756D2 /* Sources [qmake] */ = {
isa = PBXGroup;
children = (
E457C7C0F6FE92258C9ABDE6 /* UniversalIndentGUI.pro */,
);
name = "Sources [qmake]";
sourceTree = "<group>";
};
8161BBD1CA4ABAD2BDCD1290 /* debugging */ = {
isa = PBXGroup;
children = (
9FAD1502AC6B577554578224 /* TSLoggerDialog.ui */,
);
name = debugging;
sourceTree = "<group>";
};
883D7615C4D2DE3FA1218F12 /* Headers */ = {
isa = PBXGroup;
children = (
F4AF6147B42623F6B3284738 /* src */,
);
name = Headers;
sourceTree = "<group>";
};
A1B6D1488110DA0868414A40 /* src */ = {
isa = PBXGroup;
children = (
A7CBECAE098937E7541F811C /* MainWindow.ui */,
B3E50F5A6CE91D794A9AE2AA /* ToolBarWidget.ui */,
B3201EB1AA113D49631A1BC2 /* UiGuiSettingsDialog.ui */,
3E78CB522F65C3B2CD054660 /* AboutDialog.ui */,
290E702759265E2A11910569 /* UpdateCheckDialog.ui */,
8161BBD1CA4ABAD2BDCD1290 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
A742563A513C5350203403C2 /* uic */ = {
isa = PBXGroup;
children = (
97D35E3EB9A27948A62C0C38 /* ui_MainWindow.h */,
A1FD7528F1BA6EC4A87E142A /* ui_ToolBarWidget.h */,
DCEF1F98F703B62597F530A9 /* ui_UiGuiSettingsDialog.h */,
04EC27988BE80C166C06D386 /* ui_AboutDialog.h */,
C2D745F51D062CD6409FA16C /* ui_UpdateCheckDialog.h */,
957A01A17EA639CF3AC8D438 /* ui_TSLoggerDialog.h */,
);
name = uic;
sourceTree = "<group>";
};
B06B937E4E5DB1B571475081 /* resources */ = {
isa = PBXGroup;
children = (
A6C4B7ADC28FF6F9840A9319 /* UniversalIndentGUI.icns */,
);
name = resources;
sourceTree = "<group>";
};
BC7AF8B1E3D64E5DB82A180B /* release */ = {
isa = PBXGroup;
children = (
17088D39164D72415814D3CE /* moc */,
E60B3FBF3190558138C79865 /* qrc */,
A742563A513C5350203403C2 /* uic */,
);
name = release;
sourceTree = "<group>";
};
CAC892C702EF9F77734C8010 /* debugging */ = {
isa = PBXGroup;
children = (
F5BD042A2B240A02A39C20AC /* TSLogger.h */,
);
name = debugging;
sourceTree = "<group>";
};
E60B3FBF3190558138C79865 /* qrc */ = {
isa = PBXGroup;
children = (
1BB748495103B59368976F44 /* qrc_Icons.cpp */,
);
name = qrc;
sourceTree = "<group>";
};
E938E42D14AC74220066EAA2 /* Products */ = {
isa = PBXGroup;
children = (
E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */,
);
name = Products;
sourceTree = "<group>";
};
ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
9EF9FEB32A7980D519425A9E /* QtScript */,
6988CE9D964BC66484DA49D5 /* QtGui */,
B235A8A774654CA992F5A861 /* QtNetwork */,
FC65490F7BEA4427C242848C /* QtCore */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
EEC299C65D5017EB9DD513B0 /* Sources [UIC] */ = {
isa = PBXGroup;
children = (
A1B6D1488110DA0868414A40 /* src */,
);
name = "Sources [UIC]";
sourceTree = "<group>";
};
F4AF6147B42623F6B3284738 /* src */ = {
isa = PBXGroup;
children = (
0501473B7E166B9D10974B09 /* AboutDialog.h */,
9B1A8589DE3DB63FE9FEADAD /* AboutDialogGraphicsView.h */,
2365565B0E8281A9A554DE48 /* IndentHandler.h */,
D807F0DE3110F0AD45593FA7 /* MainWindow.h */,
0405CDFCAFF3A176EB7C5B2B /* SettingsPaths.h */,
A77AB8EA63A1F08C970A0DB1 /* TemplateBatchScript.h */,
19D832A234461F61E597073E /* UiGuiErrorMessage.h */,
0D2093D6D7971F9434E27A2D /* UiGuiHighlighter.h */,
234F1B047D06A4E84A3BA652 /* UiGuiIndentServer.h */,
01A925071F5E8C4DEAA029A7 /* UiGuiIniFileParser.h */,
AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */,
3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */,
5FDBC0A18FE03C4893ABD97E /* UiGuiSystemInfo.h */,
F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */,
240575E52D89C74CAFF8C83F /* UpdateCheckDialog.h */,
CAC892C702EF9F77734C8010 /* debugging */,
);
name = src;
sourceTree = "<group>";
};
FB61758D0F0FDA4BA867C3D5 /* Sources */ = {
isa = PBXGroup;
children = (
06674E1DE8D3EB6E763DFFDA /* src */,
B06B937E4E5DB1B571475081 /* resources */,
);
name = Sources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */ = {
isa = PBXNativeTarget;
buildConfigurationList = E938E43C14AC74310066EAA2 /* Build configuration list for PBXNativeTarget "UniversalIndentGUI" */;
buildPhases = (
D7BA7D76DAB5DD13389D6332 /* Qt Qmake */,
A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */,
F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */,
C29B8785722055ED95EF7B57 /* Build Sources */,
2A1043669E6E5A7426EA502A /* Frameworks & Libraries */,
3787F99312C85FF0073FD7BA /* Bundle Resources */,
);
buildRules = (
);
dependencies = (
);
name = UniversalIndentGUI;
productInstallPath = release/;
productName = UniversalIndentGUI;
productReference = E938E42C14AC74220066EAA2 /* UniversalIndentGUI.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
91B15E841AA80083484172DE /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "UniversalIndentGUI" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 05596AB53D8D521C69802C27 /* UniversalIndentGUI */;
productRefGroup = E938E42D14AC74220066EAA2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
3787F99312C85FF0073FD7BA /* Bundle Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
358CDAA858B633E7AD0B6646 /* UniversalIndentGUI.icns in Bundle Resources */,
);
name = "Bundle Resources";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "Qt Preprocessors";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -C /Volumes/SHARED/Programming/uigui/universalindent/trunk -f 'UniversalIndentGUI.xcodeproj/qt_preprocess.mak'";
};
D7BA7D76DAB5DD13389D6332 /* Qt Qmake */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "Qt Qmake";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -C /Volumes/SHARED/Programming/uigui/universalindent/trunk -f 'UniversalIndentGUI.xcodeproj/qt_makeqmake.mak'";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C29B8785722055ED95EF7B57 /* Build Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2B7F90DE44210DB9F5D23F0C /* AboutDialog.cpp in Build Sources */,
157D8322CB15EB4B4B698465 /* AboutDialogGraphicsView.cpp in Build Sources */,
CE0306F2BD402BE1CC71BA98 /* IndentHandler.cpp in Build Sources */,
FD1638E377D97C82BDB438FB /* main.cpp in Build Sources */,
AAC1168526D0C37A3F415917 /* MainWindow.cpp in Build Sources */,
64CDA74634FD0C1F9265CF5F /* SettingsPaths.cpp in Build Sources */,
45FD613422A15DDFF65F07EB /* TemplateBatchScript.cpp in Build Sources */,
2E0B7B483AE3DAFB774883DC /* UiGuiErrorMessage.cpp in Build Sources */,
ED461CD43406DFA44318404B /* UiGuiHighlighter.cpp in Build Sources */,
83EFC8071DE20B90AE46E0A1 /* UiGuiIndentServer.cpp in Build Sources */,
D05E9C8E00DF8978FAD6C45F /* UiGuiIniFileParser.cpp in Build Sources */,
8DFAEC14C5621835B85BDBBB /* UiGuiSettings.cpp in Build Sources */,
07182A1FDE8301C8D9EAF7F5 /* UiGuiSettingsDialog.cpp in Build Sources */,
A56B320001BC86C5B01B08D0 /* UiGuiSystemInfo.cpp in Build Sources */,
A87876F3A24FCE545FEAFB05 /* UiGuiVersion.cpp in Build Sources */,
F42AF6C1FF5FF9F82C3E049D /* UpdateCheckDialog.cpp in Build Sources */,
0794A9D3A24B32A06CD8CA37 /* TSLogger.cpp in Build Sources */,
033FA4A2951F6995E4B52E75 /* moc_AboutDialog.cpp in Build Sources */,
86D03C28F9A095696FA4C465 /* moc_AboutDialogGraphicsView.cpp in Build Sources */,
447799AD66EF47D36B5A72E3 /* moc_IndentHandler.cpp in Build Sources */,
1446C37D55222BE8281C2D84 /* moc_MainWindow.cpp in Build Sources */,
4393711A82B0A27E8301FEB8 /* moc_UiGuiErrorMessage.cpp in Build Sources */,
10D0CC7BD2D2E5A3A90EEF25 /* moc_UiGuiHighlighter.cpp in Build Sources */,
8DCA76267BA4834F731C5BAB /* moc_UiGuiIndentServer.cpp in Build Sources */,
9892D98357F2D175D03F6488 /* moc_UiGuiSettings.cpp in Build Sources */,
2CE072BF0886F682F0FE8266 /* moc_UiGuiSettingsDialog.cpp in Build Sources */,
54824FDC5DD27B6216E263F5 /* moc_UpdateCheckDialog.cpp in Build Sources */,
C61FC1CBE0E603A32A3D1D8E /* moc_TSLogger.cpp in Build Sources */,
4DAB46634D6A37252BC2E3D4 /* qrc_Icons.cpp in Build Sources */,
);
name = "Build Sources";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
8DB1DD96F65B1BF1FFC506E0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
};
name = Debug;
};
95E1EB2E5DDD587BE5B3E548 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
};
name = Release;
};
E938E43414AC74230066EAA2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Debug;
};
E938E43514AC74230066EAA2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
COPY_PHASE_STRIP = YES;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Release;
};
E938E43614AC74230066EAA2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
BUILD_ROOT = /Volumes/SHARED/Programming/uigui/universalindent/trunk;
DYLIB_COMPATIBILITY_VERSION = 1.0;
DYLIB_CURRENT_VERSION = 1.0.0;
HEADER_SEARCH_PATHS = (
release/moc,
src,
/opt/local/include/QtScript,
/opt/local/include/QtGui,
/opt/local/include/QtNetwork,
/opt/local/include/QtCore,
/opt/local/include,
release/uic,
/usr/local/include,
/System/Library/Frameworks/CarbonCore.framework/Headers,
"/opt/local/share/qt4/mkspecs/macx-xcode",
);
INFOPLIST_FILE = Info.plist;
INSTALL_DIR = /Volumes/SHARED/Programming/uigui/universalindent/trunk/release/;
LEXFLAGS = "";
LIBRARY_SEARCH_PATHS = /opt/local/lib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OBJROOT = release/obj/;
OTHER_CFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_CPLUSPLUSFLAGS = (
"-pipe",
"-O2",
"-Wall",
"-W",
"-DQT_NO_DEBUG",
"-DQT_SCRIPT_LIB",
"-DQT_GUI_LIB",
"-DQT_NETWORK_LIB",
"-DQT_CORE_LIB",
"-DQT_SHARED",
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
"-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = UniversalIndentGUI;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "";
YACCFLAGS = "-d";
};
name = Default;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "UniversalIndentGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8DB1DD96F65B1BF1FFC506E0 /* Debug */,
95E1EB2E5DDD587BE5B3E548 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E938E43C14AC74310066EAA2 /* Build configuration list for PBXNativeTarget "UniversalIndentGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E938E43414AC74230066EAA2 /* Debug */,
E938E43514AC74230066EAA2 /* Release */,
E938E43614AC74230066EAA2 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
/* End XCConfigurationList section */
};
rootObject = 91B15E841AA80083484172DE /* Project object */;
}

@ -0,0 +1,73 @@
#############################################################################
# Makefile for building: release/UniversalIndentGUI.app/Contents/MacOS/UniversalIndentGUI
# Generated by qmake (2.01a) (Qt 4.7.4) on: Do. Dez 29 11:10:32 2011
# Project: UniversalIndentGUI.pro
# Template: app
# Command: /opt/local/bin/qmake -spec /opt/local/share/qt4/mkspecs/macx-xcode -o UniversalIndentGUI.xcodeproj/project.pbxproj UniversalIndentGUI.pro
#############################################################################
QMAKE = /opt/local/bin/qmake
UniversalIndentGUI.xcodeproj/project.pbxproj: UniversalIndentGUI.pro /opt/local/share/qt4/mkspecs/macx-xcode/qmake.conf /opt/local/share/qt4/mkspecs/common/unix.conf \
/opt/local/share/qt4/mkspecs/common/mac.conf \
/opt/local/share/qt4/mkspecs/common/mac-g++.conf \
/opt/local/share/qt4/mkspecs/qconfig.pri \
/opt/local/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/opt/local/share/qt4/mkspecs/features/qt_functions.prf \
/opt/local/share/qt4/mkspecs/features/qt_config.prf \
/opt/local/share/qt4/mkspecs/features/exclusive_builds.prf \
/opt/local/share/qt4/mkspecs/features/default_pre.prf \
/opt/local/share/qt4/mkspecs/features/mac/default_pre.prf \
/opt/local/share/qt4/mkspecs/features/release.prf \
/opt/local/share/qt4/mkspecs/features/debug_and_release.prf \
/opt/local/share/qt4/mkspecs/features/default_post.prf \
/opt/local/share/qt4/mkspecs/features/mac/default_post.prf \
/opt/local/share/qt4/mkspecs/features/mac/x86_64.prf \
/opt/local/share/qt4/mkspecs/features/mac/objective_c.prf \
/opt/local/share/qt4/mkspecs/features/warn_on.prf \
/opt/local/share/qt4/mkspecs/features/qt.prf \
/opt/local/share/qt4/mkspecs/features/unix/thread.prf \
/opt/local/share/qt4/mkspecs/features/moc.prf \
/opt/local/share/qt4/mkspecs/features/mac/rez.prf \
/opt/local/share/qt4/mkspecs/features/mac/sdk.prf \
/opt/local/share/qt4/mkspecs/features/resources.prf \
/opt/local/share/qt4/mkspecs/features/uic.prf \
/opt/local/share/qt4/mkspecs/features/yacc.prf \
/opt/local/share/qt4/mkspecs/features/lex.prf \
/opt/local/lib/libQtScript.prl \
/opt/local/lib/libQtCore.prl \
/opt/local/lib/libQtGui.prl \
/opt/local/lib/libQtNetwork.prl
$(QMAKE) -spec /opt/local/share/qt4/mkspecs/macx-xcode -o UniversalIndentGUI.xcodeproj/project.pbxproj UniversalIndentGUI.pro
/opt/local/share/qt4/mkspecs/common/unix.conf:
/opt/local/share/qt4/mkspecs/common/mac.conf:
/opt/local/share/qt4/mkspecs/common/mac-g++.conf:
/opt/local/share/qt4/mkspecs/qconfig.pri:
/opt/local/share/qt4/mkspecs/modules/qt_webkit_version.pri:
/opt/local/share/qt4/mkspecs/features/qt_functions.prf:
/opt/local/share/qt4/mkspecs/features/qt_config.prf:
/opt/local/share/qt4/mkspecs/features/exclusive_builds.prf:
/opt/local/share/qt4/mkspecs/features/default_pre.prf:
/opt/local/share/qt4/mkspecs/features/mac/default_pre.prf:
/opt/local/share/qt4/mkspecs/features/release.prf:
/opt/local/share/qt4/mkspecs/features/debug_and_release.prf:
/opt/local/share/qt4/mkspecs/features/default_post.prf:
/opt/local/share/qt4/mkspecs/features/mac/default_post.prf:
/opt/local/share/qt4/mkspecs/features/mac/x86_64.prf:
/opt/local/share/qt4/mkspecs/features/mac/objective_c.prf:
/opt/local/share/qt4/mkspecs/features/warn_on.prf:
/opt/local/share/qt4/mkspecs/features/qt.prf:
/opt/local/share/qt4/mkspecs/features/unix/thread.prf:
/opt/local/share/qt4/mkspecs/features/moc.prf:
/opt/local/share/qt4/mkspecs/features/mac/rez.prf:
/opt/local/share/qt4/mkspecs/features/mac/sdk.prf:
/opt/local/share/qt4/mkspecs/features/resources.prf:
/opt/local/share/qt4/mkspecs/features/uic.prf:
/opt/local/share/qt4/mkspecs/features/yacc.prf:
/opt/local/share/qt4/mkspecs/features/lex.prf:
/opt/local/lib/libQtScript.prl:
/opt/local/lib/libQtCore.prl:
/opt/local/lib/libQtGui.prl:
/opt/local/lib/libQtNetwork.prl:
qmake: FORCE
@$(QMAKE) -spec /opt/local/share/qt4/mkspecs/macx-xcode -o UniversalIndentGUI.xcodeproj/project.pbxproj UniversalIndentGUI.pro

@ -0,0 +1,116 @@
#############################################################################
# Makefile for building: release/UniversalIndentGUI.app/Contents/MacOS/UniversalIndentGUI
# Generated by qmake (2.01a) (Qt 4.7.4) on: Do. Dez 29 11:10:32 2011
# Project: UniversalIndentGUI.pro
# Template: app
# Command: /opt/local/bin/qmake -spec /opt/local/share/qt4/mkspecs/macx-xcode -o UniversalIndentGUI.xcodeproj/project.pbxproj UniversalIndentGUI.pro
#############################################################################
MOC = /opt/local/bin/moc
UIC = /opt/local/bin/uic
LEX = flex
LEXFLAGS =
YACC = yacc
YACCFLAGS = -d
DEFINES = -DQT_NO_DEBUG -DQT_SCRIPT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
INCPATH = -I/opt/local/share/qt4/mkspecs/macx-xcode -I. -Irelease/moc -Isrc -I/opt/local/include/QtScript -I/opt/local/include/QtGui -I/opt/local/include/QtNetwork -I/opt/local/include/QtCore -I/opt/local/include -Irelease/uic -I/usr/local/include -I/System/Library/Frameworks/CarbonCore.framework/Headers
DEL_FILE = rm -f
MOVE = mv -f
IMAGES =
PARSERS =
preprocess: $(PARSERS) compilers
clean preprocess_clean: parser_clean compiler_clean
parser_clean:
check: first
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compilers: ./release/moc/moc_AboutDialog.cpp ./release/moc/moc_AboutDialogGraphicsView.cpp ./release/moc/moc_IndentHandler.cpp\
./release/moc/moc_MainWindow.cpp ./release/moc/moc_UiGuiErrorMessage.cpp ./release/moc/moc_UiGuiHighlighter.cpp\
./release/moc/moc_UiGuiIndentServer.cpp ./release/moc/moc_UiGuiSettings.cpp ./release/moc/moc_UiGuiSettingsDialog.cpp\
./release/moc/moc_UpdateCheckDialog.cpp ./release/moc/moc_TSLogger.cpp ./release/qrc/qrc_Icons.cpp ./release/uic/ui_MainWindow.h ./release/uic/ui_ToolBarWidget.h ./release/uic/ui_UiGuiSettingsDialog.h\
./release/uic/ui_AboutDialog.h ./release/uic/ui_UpdateCheckDialog.h ./release/uic/ui_TSLoggerDialog.h
compiler_objective_c_make_all:
compiler_objective_c_clean:
compiler_moc_header_make_all: release/moc/moc_AboutDialog.cpp release/moc/moc_AboutDialogGraphicsView.cpp release/moc/moc_IndentHandler.cpp release/moc/moc_MainWindow.cpp release/moc/moc_UiGuiErrorMessage.cpp release/moc/moc_UiGuiHighlighter.cpp release/moc/moc_UiGuiIndentServer.cpp release/moc/moc_UiGuiSettings.cpp release/moc/moc_UiGuiSettingsDialog.cpp release/moc/moc_UpdateCheckDialog.cpp release/moc/moc_TSLogger.cpp
compiler_moc_header_clean:
-$(DEL_FILE) release/moc/moc_AboutDialog.cpp release/moc/moc_AboutDialogGraphicsView.cpp release/moc/moc_IndentHandler.cpp release/moc/moc_MainWindow.cpp release/moc/moc_UiGuiErrorMessage.cpp release/moc/moc_UiGuiHighlighter.cpp release/moc/moc_UiGuiIndentServer.cpp release/moc/moc_UiGuiSettings.cpp release/moc/moc_UiGuiSettingsDialog.cpp release/moc/moc_UpdateCheckDialog.cpp release/moc/moc_TSLogger.cpp
release/moc/moc_AboutDialog.cpp: src/AboutDialog.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/AboutDialog.h -o release/moc/moc_AboutDialog.cpp
release/moc/moc_AboutDialogGraphicsView.cpp: src/AboutDialogGraphicsView.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/AboutDialogGraphicsView.h -o release/moc/moc_AboutDialogGraphicsView.cpp
release/moc/moc_IndentHandler.cpp: src/IndentHandler.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/IndentHandler.h -o release/moc/moc_IndentHandler.cpp
release/moc/moc_MainWindow.cpp: src/MainWindow.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/MainWindow.h -o release/moc/moc_MainWindow.cpp
release/moc/moc_UiGuiErrorMessage.cpp: src/UiGuiErrorMessage.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UiGuiErrorMessage.h -o release/moc/moc_UiGuiErrorMessage.cpp
release/moc/moc_UiGuiHighlighter.cpp: src/UiGuiHighlighter.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UiGuiHighlighter.h -o release/moc/moc_UiGuiHighlighter.cpp
release/moc/moc_UiGuiIndentServer.cpp: src/UiGuiIndentServer.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UiGuiIndentServer.h -o release/moc/moc_UiGuiIndentServer.cpp
release/moc/moc_UiGuiSettings.cpp: src/UiGuiSettings.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UiGuiSettings.h -o release/moc/moc_UiGuiSettings.cpp
release/moc/moc_UiGuiSettingsDialog.cpp: src/UiGuiSettingsDialog.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UiGuiSettingsDialog.h -o release/moc/moc_UiGuiSettingsDialog.cpp
release/moc/moc_UpdateCheckDialog.cpp: src/UpdateCheckDialog.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/UpdateCheckDialog.h -o release/moc/moc_UpdateCheckDialog.cpp
release/moc/moc_TSLogger.cpp: src/debugging/TSLogger.h
/opt/local/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ src/debugging/TSLogger.h -o release/moc/moc_TSLogger.cpp
compiler_rcc_make_all: release/qrc/qrc_Icons.cpp
compiler_rcc_clean:
-$(DEL_FILE) release/qrc/qrc_Icons.cpp
release/qrc/qrc_Icons.cpp: resources/Icons.qrc
/opt/local/bin/rcc -name Icons resources/Icons.qrc -o release/qrc/qrc_Icons.cpp
compiler_image_collection_make_all: release/uic/qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) release/uic/qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_rez_source_make_all:
compiler_rez_source_clean:
compiler_uic_make_all: release/uic/ui_MainWindow.h release/uic/ui_ToolBarWidget.h release/uic/ui_UiGuiSettingsDialog.h release/uic/ui_AboutDialog.h release/uic/ui_UpdateCheckDialog.h release/uic/ui_TSLoggerDialog.h
compiler_uic_clean:
-$(DEL_FILE) release/uic/ui_MainWindow.h release/uic/ui_ToolBarWidget.h release/uic/ui_UiGuiSettingsDialog.h release/uic/ui_AboutDialog.h release/uic/ui_UpdateCheckDialog.h release/uic/ui_TSLoggerDialog.h
release/uic/ui_MainWindow.h: src/MainWindow.ui
/opt/local/bin/uic src/MainWindow.ui -o release/uic/ui_MainWindow.h
release/uic/ui_ToolBarWidget.h: src/ToolBarWidget.ui
/opt/local/bin/uic src/ToolBarWidget.ui -o release/uic/ui_ToolBarWidget.h
release/uic/ui_UiGuiSettingsDialog.h: src/UiGuiSettingsDialog.ui
/opt/local/bin/uic src/UiGuiSettingsDialog.ui -o release/uic/ui_UiGuiSettingsDialog.h
release/uic/ui_AboutDialog.h: src/AboutDialog.ui
/opt/local/bin/uic src/AboutDialog.ui -o release/uic/ui_AboutDialog.h
release/uic/ui_UpdateCheckDialog.h: src/UpdateCheckDialog.ui
/opt/local/bin/uic src/UpdateCheckDialog.ui -o release/uic/ui_UpdateCheckDialog.h
release/uic/ui_TSLoggerDialog.h: src/debugging/TSLoggerDialog.ui
/opt/local/bin/uic src/debugging/TSLoggerDialog.ui -o release/uic/ui_TSLoggerDialog.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_uic_clean

@ -0,0 +1,433 @@
// !$*UTF8*$!
{
1C0B64226A129D35F02DC004 /* MainWindow.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 18980}}";
sepNavSelRange = "{3643, 0}";
sepNavVisRange = "{3137, 827}";
};
};
3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 702}}";
sepNavSelRange = "{1518, 0}";
sepNavVisRange = "{1431, 541}";
};
};
5EEB118D3C499097B07CA6DC /* TSLogger.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 3419}}";
sepNavSelRange = "{3754, 9}";
sepNavVisRange = "{3868, 1309}";
};
};
7B749332F0EE106BAF891CBB /* IndentHandler.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1475, 23205}}";
sepNavSelRange = "{79164, 0}";
sepNavVisRange = "{78562, 741}";
};
};
7EC3C68A81EFFF79B6CA22AC /* main.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1055, 3458}}";
sepNavSelRange = "{9296, 0}";
sepNavVisRange = "{8787, 1089}";
};
};
91B15E841AA80083484172DE /* Project object */ = {
activeBuildConfigurationName = Release;
activeExecutable = E938E42E14AC74220066EAA2 /* UniversalIndentGUI */;
activeTarget = A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */;
breakpoints = (
E938E45B14AC75750066EAA2 /* MainWindow.cpp:101 */,
E938E46114AC75930066EAA2 /* MainWindow.cpp:104 */,
E938E46914AC760C0066EAA2 /* UiGuiSettings.cpp:65 */,
E938E46B14AC76120066EAA2 /* UiGuiSettings.cpp:81 */,
);
codeSenseManager = E938E40714AC700F0066EAA2 /* Code sense */;
executables = (
E938E42E14AC74220066EAA2 /* UniversalIndentGUI */,
);
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
PBXFileTableDataSourceColumnWidthsKey = (
22,
300,
750,
);
PBXFileTableDataSourceColumnsKey = (
PBXExecutablesDataSource_ActiveFlagID,
PBXExecutablesDataSource_NameID,
PBXExecutablesDataSource_CommentsID,
);
};
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
862,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
822,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 346855027;
PBXWorkspaceStateSaveDate = 346855027;
};
perUserProjectItems = {
E938E46314AC75960066EAA2 /* PBXTextBookmark */ = E938E46314AC75960066EAA2 /* PBXTextBookmark */;
E938E48114AC77A80066EAA2 /* PBXTextBookmark */ = E938E48114AC77A80066EAA2 /* PBXTextBookmark */;
E938E4B314AC7A360066EAA2 /* PBXTextBookmark */ = E938E4B314AC7A360066EAA2 /* PBXTextBookmark */;
E938E4B714AC7A360066EAA2 /* PBXTextBookmark */ = E938E4B714AC7A360066EAA2 /* PBXTextBookmark */;
E938E4C714AC7B520066EAA2 /* PBXTextBookmark */ = E938E4C714AC7B520066EAA2 /* PBXTextBookmark */;
E938E4CD14AC7B650066EAA2 /* PBXTextBookmark */ = E938E4CD14AC7B650066EAA2 /* PBXTextBookmark */;
E938E4D314AC7D730066EAA2 /* PBXTextBookmark */ = E938E4D314AC7D730066EAA2 /* PBXTextBookmark */;
E938E4D414AC7D730066EAA2 /* PBXTextBookmark */ = E938E4D414AC7D730066EAA2 /* PBXTextBookmark */;
E938E4D514AC7D730066EAA2 /* PBXTextBookmark */ = E938E4D514AC7D730066EAA2 /* PBXTextBookmark */;
E938E4D614AC7D730066EAA2 /* PBXTextBookmark */ = E938E4D614AC7D730066EAA2 /* PBXTextBookmark */;
E938E4E714ACB49E0066EAA2 /* PBXTextBookmark */ = E938E4E714ACB49E0066EAA2 /* PBXTextBookmark */;
E938E4E814ACB49E0066EAA2 /* PBXTextBookmark */ = E938E4E814ACB49E0066EAA2 /* PBXTextBookmark */;
E938E4E914ACB49E0066EAA2 /* PBXTextBookmark */ = E938E4E914ACB49E0066EAA2 /* PBXTextBookmark */;
};
sourceControlManager = E938E40614AC700F0066EAA2 /* Source Control */;
userBuildSettings = {
};
};
944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 9126}}";
sepNavSelRange = "{2691, 0}";
sepNavVisRange = "{2803, 1071}";
};
};
A630BEF242261A8F9F0C2E16 /* UniversalIndentGUI */ = {
activeExec = 0;
executables = (
E938E42E14AC74220066EAA2 /* UniversalIndentGUI */,
);
};
AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 1118}}";
sepNavSelRange = "{1440, 0}";
sepNavVisRange = "{463, 1236}";
};
};
D807F0DE3110F0AD45593FA7 /* MainWindow.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1247, 1924}}";
sepNavSelRange = "{4885, 0}";
sepNavVisRange = "{1496, 850}";
};
};
E938E40614AC700F0066EAA2 /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
};
E938E40714AC700F0066EAA2 /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
E938E42E14AC74220066EAA2 /* UniversalIndentGUI */ = {
isa = PBXExecutable;
activeArgIndices = (
);
argumentStrings = (
);
autoAttachOnCrash = 1;
breakpointsEnabled = 1;
configStateDict = {
};
customDataFormattersEnabled = 1;
dataTipCustomDataFormattersEnabled = 1;
dataTipShowTypeColumn = 1;
dataTipSortType = 0;
debuggerPlugin = GDBDebugging;
disassemblyDisplayState = 0;
dylibVariantSuffix = "";
enableDebugStr = 1;
environmentEntries = (
);
executableSystemSymbolLevel = 0;
executableUserSymbolLevel = 0;
libgmallocEnabled = 0;
name = UniversalIndentGUI;
savedGlobals = {
};
showTypeColumn = 0;
sourceDirectories = (
);
variableFormatDictionary = {
};
};
E938E45B14AC75750066EAA2 /* MainWindow.cpp:101 */ = {
isa = PBXFileBreakpoint;
actions = (
);
breakpointStyle = 0;
continueAfterActions = 0;
countType = 0;
delayBeforeContinue = 0;
fileReference = 1C0B64226A129D35F02DC004 /* MainWindow.cpp */;
functionName = "MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent)";
hitCount = 1;
ignoreCount = 0;
lineNumber = 101;
location = UniversalIndentGUI;
modificationTime = 346848101.622124;
originalNumberOfMultipleMatches = 1;
state = 0;
};
E938E46114AC75930066EAA2 /* MainWindow.cpp:104 */ = {
isa = PBXFileBreakpoint;
actions = (
);
breakpointStyle = 0;
continueAfterActions = 0;
countType = 0;
delayBeforeContinue = 0;
fileReference = 1C0B64226A129D35F02DC004 /* MainWindow.cpp */;
functionName = "MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent)";
hitCount = 1;
ignoreCount = 0;
lineNumber = 104;
location = UniversalIndentGUI;
modificationTime = 346848114.812431;
originalNumberOfMultipleMatches = 1;
state = 1;
};
E938E46314AC75960066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 7EC3C68A81EFFF79B6CA22AC /* main.cpp */;
name = "main.cpp: 248";
rLen = 0;
rLoc = 9296;
rType = 0;
vrLen = 1089;
vrLoc = 8787;
};
E938E46514AC75960066EAA2 /* qsharedpointer_impl.h */ = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = qsharedpointer_impl.h;
path = /opt/local/include/QtCore/qsharedpointer_impl.h;
sourceTree = "<absolute>";
};
E938E46914AC760C0066EAA2 /* UiGuiSettings.cpp:65 */ = {
isa = PBXFileBreakpoint;
actions = (
);
breakpointStyle = 0;
continueAfterActions = 0;
countType = 0;
delayBeforeContinue = 0;
fileReference = 944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */;
functionName = "UiGuiSettings::getInstance()";
hitCount = 2;
ignoreCount = 0;
lineNumber = 65;
location = UniversalIndentGUI;
modificationTime = 346848115.5478889;
originalNumberOfMultipleMatches = 1;
state = 1;
};
E938E46B14AC76120066EAA2 /* UiGuiSettings.cpp:81 */ = {
isa = PBXFileBreakpoint;
actions = (
);
breakpointStyle = 0;
continueAfterActions = 0;
countType = 0;
delayBeforeContinue = 0;
fileReference = 944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */;
functionName = "UiGuiSettings::~UiGuiSettings()";
hitCount = 1;
ignoreCount = 0;
lineNumber = 81;
location = UniversalIndentGUI;
modificationTime = 346848140.41869;
originalNumberOfMultipleMatches = 1;
state = 1;
};
E938E48114AC77A80066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = E938E48214AC77A80066EAA2 /* qstringlist.h */;
name = "qstringlist.h: 68";
rLen = 0;
rLoc = 2245;
rType = 0;
vrLen = 636;
vrLoc = 1852;
};
E938E48214AC77A80066EAA2 /* qstringlist.h */ = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = qstringlist.h;
path = /opt/local/include/QtCore/qstringlist.h;
sourceTree = "<absolute>";
};
E938E4B314AC7A360066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = E938E46514AC75960066EAA2 /* qsharedpointer_impl.h */;
name = "qsharedpointer_impl.h: 339";
rLen = 0;
rLoc = 11920;
rType = 0;
vrLen = 867;
vrLoc = 11651;
};
E938E4B714AC7A360066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = AC4AC748C3685570D9D8B977 /* UiGuiSettings.h */;
name = "UiGuiSettings.h: 22";
rLen = 0;
rLoc = 1440;
rType = 0;
vrLen = 1236;
vrLoc = 463;
};
E938E4C714AC7B520066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 3194C2F269DA07FBC8FB120D /* UiGuiSettingsDialog.h */;
name = "UiGuiSettingsDialog.h: 28";
rLen = 0;
rLoc = 1518;
rType = 0;
vrLen = 541;
vrLoc = 1431;
};
E938E4CD14AC7B650066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 7B749332F0EE106BAF891CBB /* IndentHandler.cpp */;
name = "IndentHandler.cpp: 1728";
rLen = 0;
rLoc = 79164;
rType = 0;
vrLen = 741;
vrLoc = 78562;
};
E938E4D314AC7D730066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = D807F0DE3110F0AD45593FA7 /* MainWindow.h */;
name = "MainWindow.h: 53";
rLen = 0;
rLoc = 1961;
rType = 0;
vrLen = 722;
vrLoc = 1743;
};
E938E4D414AC7D730066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 1C0B64226A129D35F02DC004 /* MainWindow.cpp */;
name = "MainWindow.cpp: 104";
rLen = 0;
rLoc = 3643;
rType = 0;
vrLen = 827;
vrLoc = 3137;
};
E938E4D514AC7D730066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 944A1A0B82857EC61410FC06 /* UiGuiSettings.cpp */;
name = "UiGuiSettings.cpp: 65";
rLen = 0;
rLoc = 2691;
rType = 0;
vrLen = 1071;
vrLoc = 2803;
};
E938E4D614AC7D730066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = E938E4D714AC7D730066EAA2 /* qglobal.h */;
name = "qglobal.h: 1749";
rLen = 0;
rLoc = 53149;
rType = 0;
vrLen = 1090;
vrLoc = 52596;
};
E938E4D714AC7D730066EAA2 /* qglobal.h */ = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = qglobal.h;
path = /opt/local/include/QtCore/qglobal.h;
sourceTree = "<absolute>";
};
E938E4E714ACB49E0066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5EEB118D3C499097B07CA6DC /* TSLogger.cpp */;
name = "TSLogger.cpp: 102";
rLen = 9;
rLoc = 3754;
rType = 0;
vrLen = 1309;
vrLoc = 3868;
};
E938E4E814ACB49E0066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */;
rLen = 5;
rLoc = 1582;
rType = 0;
};
E938E4E914ACB49E0066EAA2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */;
name = "UiGuiVersion.h: 29";
rLen = 0;
rLoc = 1699;
rType = 0;
vrLen = 1100;
vrLoc = 780;
};
F45A82FFD3FBFC99A2A0B897 /* UiGuiVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1040, 520}}";
sepNavSelRange = "{1699, 0}";
sepNavVisRange = "{780, 1100}";
};
};
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="Qt-Rules"
Version="8,00"
>
<Rules>
<CustomBuildRule
Name="UIC"
DisplayName="UIC"
CommandLine="uic.exe &quot;$(InputDir)$(InputName).ui&quot; -o &quot;$(OutDir)\tmp\uic\ui_$(InputName).h&quot;"
Outputs="$(OutDir)\tmp\uic\ui_$(InputName).h"
FileExtensions="*.ui"
ExecutionDescription="UICing $(InputName).h..."
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="MOC"
DisplayName="MOC"
CommandLine="moc.exe &quot;$(InputDir)$(InputName).h&quot; -o &quot;$(OutDir)\tmp\moc\moc_$(InputName).cpp&quot;"
Outputs="$(OutDir)\tmp\moc\moc_$(InputName).cpp"
FileExtensions="*.h"
ExecutionDescription="MOCing $(InputName).h..."
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="QRC"
DisplayName="QRC"
CommandLine="rcc.exe -name $(InputName) &quot;$(InputDir)$(InputName).qrc&quot; -o &quot;$(OutDir)\tmp\qrc\qrc_$(InputName).cpp&quot;"
Outputs="$(OutDir)\tmp\qrc\qrc_$(InputName).cpp"
FileExtensions="*.qrc"
ExecutionDescription="QRCing $(InputName).h..."
>
<Properties>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>

File diff suppressed because it is too large Load Diff

88
debian/changelog vendored

@ -0,0 +1,88 @@
universalindentgui (1.2.0-1.1) unstable; urgency=medium
* Non-maintainer upload.
* Update for new qscintilla2 library names (Closes: #885647)
-- Scott Kitterman <scott@kitterman.com> Thu, 04 Jan 2018 07:06:09 -0500
universalindentgui (1.2.0-1) unstable; urgency=low
* New upstream release.
* Drop 02_fix_gcc_4.5_build.patch - merged upstream.
* Update debian/contol:
- bump debhelper to 9.
- bump Standards-Version to 3.9.3 (no changes needed).
-- Fathi Boudra <fabo@debian.org> Tue, 22 May 2012 08:49:27 +0300
universalindentgui (1.1.0-2) unstable; urgency=low
* Add 02_fix_gcc_4.5_build.patch (Closes: #565043)
-- Fathi Boudra <fabo@debian.org> Mon, 21 Feb 2011 12:21:21 +0200
universalindentgui (1.1.0-1) unstable; urgency=low
* New upstream release.
* Update debian/control:
- Bump quilt and debhelper build-dependency versions.
- Bump Standards-Version to 3.8.3 (no changes needed).
* Convert debian/rules to dh usage.
* Rename debian/universalindentgui.lintian to
debian/universalindentgui.lintian-overrides for dh_lintian usage.
* Add debian/README.source file.
-- Fathi Boudra <fabo@debian.org> Thu, 20 Aug 2009 13:41:45 +0200
universalindentgui (1.0.2-1) unstable; urgency=low
* New upstream release:
- The default editor font type is now Monospace instead of Courier.
(Closes: #483873)
* Add 01_disable_check_for_update.diff patch:
Automatic check for update is disabled by default. (Closes: #514999)
* Bump debian/compat to 7.
* Update debian/control:
- Set Thomas Schweitzer as maintainer and myself as uploader.
(Closes: #483068)
- Bump debhelper build-dependency to 7.
- Bump Standards-Version to 3.8.1. No changes needed.
- Update recommended beautifier list.
- Update description to list all supported beautifiers.
* Update debian/copyright:
- Add PerlTidy.pm and JsDecoder.js missing copyrights.
* Cleanup debian/rules.
-- Fathi Boudra <fabo@debian.org> Wed, 29 Apr 2009 10:50:58 +0200
universalindentgui (0.8.1-1.2) unstable; urgency=low
* Non-maintainer upload.
* Avoid symlink attacks by using mkdtemp (Closes: 504726)
-- Eddy Petrișor <eddy.petrisor@gmail.com> Wed, 12 Nov 2008 01:34:23 +0200
universalindentgui (0.8.1-1.1) unstable; urgency=high
* Non-maintainer upload.
* urgency high since universalindentgui is actually useless by default
(can be hacked to work by setting TMPDIR='/tmp/a')
* fixed temporary path asamblation so indents can work
(Closes: 486577)
-- Eddy Petrișor <eddy.petrisor@gmail.com> Wed, 05 Nov 2008 03:51:48 +0200
universalindentgui (0.8.1-1) unstable; urgency=low
* New upstream release
* debian/rules: Do not delete perltidy as it's no longer shipped
* debian/rules: Cleanup extended
-- Sebastian Pipping <webmaster@hartwork.org> Wed, 02 April 2008 04:45:00 +0100
universalindentgui (0.8.0-1) unstable; urgency=low
* Initial release (Closes: #459671)
* Add man page missing in release archive (svn revision 603 plus fixes)
-- Sebastian Pipping <webmaster@hartwork.org> Tue, 08 Jan 2008 15:13:53 +0100

1
debian/compat vendored

@ -0,0 +1 @@
9

50
debian/control vendored

@ -0,0 +1,50 @@
Source: universalindentgui
Section: devel
Priority: optional
Maintainer: Thomas Schweitzer <thomas-schweitzer@arcor.de>
Uploaders: Fathi Boudra <fabo@debian.org>
Build-Depends: debhelper (>= 9), libqscintilla2-qt4-dev, libqt4-dev
Standards-Version: 3.9.3
Homepage: http://universalindent.sourceforge.net
Package: universalindentgui
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Recommends: astyle,
bcpp,
csstidy,
hindent,
indent,
perltidy,
tidy,
uncrustify,
xmlindent
Description: GUI frontend for several code beautifiers
UniversalIndentGui is a GUI fontend for several code beautifiers, currently
supporting:
* Artistic Styler
* BCPP
* Cobol Beautify
* CSSTidy
* Fortran 90 PPR
* GNU Indent
* GreatCode
* hindent
* HTB
* Javascript Decoder
* JSPPP
* Perl Tidy
* PHP_Beautifier
* PHP Code Beautifier
* PHP Stylist
* pindent
* Ruby Beautify
* Ruby Formatter
* Shell Indent
* (HTML) Tidy
* Uncrustify
* XML Indent
.
UniversalIndentGui allows you to tune a beautifier's configuration and see
how the changes affects a source example live. It is especially useful to
compare different C/C++ beautifiers when you have to choose one of them.

59
debian/copyright vendored

@ -0,0 +1,59 @@
This package was debianized by:
Fathi Boudra <fabo@debian.org> on Wed, 29 Apr 2009 10:50:58 +0200
It was downloaded from:
http://universalindent.sourceforge.net
Upstream Author:
Thomas Schweitzer <thomas-schweitzer@arcor.de>
Copyright:
Copyright (C) 2006-2012 Thomas Schweitzer
Copyright for indenters/PerlTidyLib.pm file:
Copyright (C) 2000-2007 Steve Hancock
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Copyright for indenters/JsDecoder.js file:
Copyright (C) 2004-2006 Cezary Tomczak
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UniversalIndentGUI license:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'
and the GPL version 3 can be found in `/usr/share/common-licenses/GPL-3'.
The Debian packaging is:
Copyright (C) 2009 Fathi Boudra <fabo@debian.org>
and is licensed under the GPL version 2,
see `/usr/share/common-licenses/GPL-2'.

2
debian/docs vendored

@ -0,0 +1,2 @@
CHANGELOG.txt
readme.html

5
debian/menu vendored

@ -0,0 +1,5 @@
?package(universalindentgui): \
needs="X11" \
section="Applications/Programming" \
title="UniversalIndentgui" \
command="/usr/bin/universalindentgui"

@ -0,0 +1,15 @@
---
src/UiGuiSettings.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/UiGuiSettings.cpp
+++ b/src/UiGuiSettings.cpp
@@ -181,7 +181,7 @@ bool UiGuiSettings::initSettings()
_qsettings->setValue( "UniversalIndentGUI/language", _availableTranslations.indexOf( _qsettings->value("UniversalIndentGUI/language", "").toString() ) );
// Read the update check settings from the settings file.
- _qsettings->setValue( "UniversalIndentGUI/CheckForUpdate", _qsettings->value("UniversalIndentGUI/CheckForUpdate", true) );
+ _qsettings->setValue( "UniversalIndentGUI/CheckForUpdate", _qsettings->value("UniversalIndentGUI/CheckForUpdate", false) );
_qsettings->setValue( "UniversalIndentGUI/LastUpdateCheck", _qsettings->value("UniversalIndentGUI/LastUpdateCheck", QDate(1900,1,1)) );
// Read the main window state.

@ -0,0 +1,40 @@
--- universalindentgui-1.2.0.orig/UniversalIndentGUI.pro
+++ universalindentgui-1.2.0/UniversalIndentGUI.pro
@@ -23,7 +23,7 @@ macx {
ICON = resources/UniversalIndentGUI.icns
}
else {
- LIBS += -lqscintilla2
+ LIBS += -lqscintilla2_qt4
}
CONFIG(release, debug|release) {
--- universalindentgui-1.2.0.orig/UniversalIndentGUI.xcodeproj/project.pbxproj
+++ universalindentgui-1.2.0/UniversalIndentGUI.xcodeproj/project.pbxproj
@@ -571,7 +571,7 @@
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
- "-lqscintilla2",
+ "-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
@@ -637,7 +637,7 @@
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
- "-lqscintilla2",
+ "-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";
@@ -701,7 +701,7 @@
);
OTHER_LDFLAGS = (
"-headerpad_max_install_names",
- "-lqscintilla2",
+ "-lqscintilla2_qt4",
"-L/opt/local/lib",
);
OTHER_REZFLAGS = "";

@ -0,0 +1,2 @@
disable_check_for_update.patch
qsci_rename.patch

19
debian/rules vendored

@ -0,0 +1,19 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@ --parallel --buildsystem=qmake_qt4
override_dh_auto_install:
dh_auto_install
# Remove shellindent
rm -f debian/universalindentgui/usr/share/universalindentgui/indenters/example.sh
rm -f debian/universalindentgui/usr/share/universalindentgui/indenters/shellindent.awk
rm -f debian/universalindentgui/usr/share/universalindentgui/indenters/uigui_shellindent.ini
# Fix lintian warnings/errors
find debian/universalindentgui/usr/share/universalindentgui -type f -exec chmod a-x '{}' \;
find debian/universalindentgui/usr/share/universalindentgui -type f -name '*.rb' | xargs chmod a+x

@ -0,0 +1 @@
3.0 (quilt)

@ -0,0 +1,4 @@
# intended behavior. We don't want to depends on ruby.
ruby-script-but-no-ruby-dep usr/share/universalindentgui/indenters/example.rb
ruby-script-but-no-ruby-dep usr/share/universalindentgui/indenters/rbeautify.rb
ruby-script-but-no-ruby-dep usr/share/universalindentgui/indenters/ruby_formatter.rb

@ -0,0 +1,157 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iniFileFormat</title>
</head>
<body>
<p>
Fileformat of the UniversalIndentGUI indent description ini files<br />
=================================================================<br />
<br />
1. General<br />
----------<br />
The ini file has equal base format as common used ini files. It contains groups, which are written in brackets []. These groups can contain keys, to which a value can be assigned by the equal sign =.<br />
<br />
2. Ini file header<br />
------------------<br />
At the beginning of the ini file the header is located. It is named [header]. In the following a ini file header is shown:<br />
</p>
<pre>
[header]
categories=Predefined Style|Tab and Bracket|Indentation|Formatting
cfgFileParameterEnding=cr
configFilename=.astylerc
fileTypes=*.cpp|*.c|*.h|*.hpp|*.cs|*.java
indenterFileName=astyle
indenterName=Artistic Style
inputFileName=indentinput
inputFileParameter=
manual=&quot;http://website.of.onlinemanual&quot;
outputFileName=indentinput
outputFileParameter=none
parameterOrder=ipo
stringparaminquotes=false
useCfgFileParameter=&quot;--options=&quot;
version=1.21
</pre>
<p>
&quot;categories&quot; defines the categories, where each parameter can be assigned to. It is a list of strings, with each category name divied by a &quot;|&quot; from the other.<br />
<br />
&quot;cfgFileParameterEnding&quot; defines how each parameter setting in the indenters config file is seperated from the other. Possible values are &quot;cr&quot; for CarriageReturn or any other string (also space signs, which are normally used if parameters are only set via commandline).<br />
<br />
&quot;configFilename&quot; is the filename of the indenters default config file. It is used when the indenter is being called and might be explicit handed over as argument by setting the parameter &quot;useCfgFileParameter&quot;. If &quot;configFilename&quot; is left empty, all parameters are set with the commandline call of the indenter. (As needed for csstidy and phpCB for example.)<br />
<br />
&quot;fileTypes&quot; is a list of fileendings used for the selection in the &quot;open source file&quot; file dialog.<br />
<br />
&quot;indenterFileName&quot; is the name of the indenters executable without any extension. Under linux it is tested, whether only a file with the extension &quot;.exe&quot; exists. If so, wine will be used to call the indenter.<br />
<br />
&quot;indenterName&quot; is the name of the indenter as it will be shown in UniversalIndentGUIs indenters selection. Theoretic it can be any string.<br />
<br />
&quot;inputFileName&quot; defines the file used as input file for the called indenter. It is a copy of the previous opened source code file.<br />
<br />
&quot;inputFileParameter&quot; sets the eventually needed parameter in front of &quot;inputFileName&quot; to tell the indenter and the command line call that the following string is the input file. If set to &quot;none&quot; no special output file will be set.
If set to &quot;&lt;&quot; or &quot;stdin&quot; the to be formatted source code will be sent to the indenter using the standard input stdin.<br />
<br />
&quot;manual&quot; is a string that points to a website that hosts the indenters online manual.<br />
<br />
&quot;outputFileName&quot; the file name where the indenter writes its formatted source code to. Also the file UniversalIndentGUI reads after the indenter call to show it in the preview. Some times an indenter overwrites the content of the inputfile by default and creates a backup (as AStyle does). In this case &quot;outputFileName&quot; is equal to &quot;inputFileName&quot; but the parameter &quot;outputFileParameter&quot; has to be set to &quot;none&quot;. No output file name will be selected for the indenter but UniversalIndentGUI knows where the output was written to.<br />
<br />
&quot;outputFileParameter&quot; same as for &quot;inputFileParameter&quot; with respect to the special case mentioned for &quot;inputFileParameter&quot; if the input file will be overwritten. If the indenter only writes to standard output (stdout) this value has to be set to &quot;stdout&quot; (see uigui_phpCB.ini). In that case &quot;outputFileName&quot; can be left empty. It will be ignored anyway.<br />
<br />
&quot;parameterOrder&quot; Some indenters need a strict order of the command line parameters for input file, output file and eventually indent settings. &quot;parameterOrder&quot; can be set to &quot;iop&quot;, &quot;ipo&quot; and &quot;pio&quot; to define the order of input, ouput and paramters at the commandline call.<br />
<br />
&quot;stringparaminquotes&quot; tells UniversalIndentGUI that all string values should be written to the indenter config file in quotes.<br />
<br />
&quot;useCfgFileParameter&quot; is the parameter for the indenter used to tell the indenter where to find the config file, set in &quot;configFilename&quot;, that it should use. If this parameter is left empty you should read the indenters manual where it searches by default for the config file.<br />
<br />
&quot;version&quot; is not evaluated by UiGUI, but by this it is easier to see for which version of the indenter the configuration file has been written for.<br />
<br />
3. The indenters parameters<br />
---------------------------<br />
After the header definition the paramters used by the indenter are defined. Each paramter name is written in brackets [] again, but the name is only descriptive and not functional. Each parameter consists of keys with values (same as in header). There are four types of parameters: boolean, numeric, string and multiple. All have the following keys in common:<br />
&quot;Category&quot; defines to which category they belong and are corresponding only shown there in the GUI.<br />
<br />
&quot;Description&quot; holds a text describing the parameter and it options. It is formatted as html, so source code examples can be embedded via &lt;pre&gt;&lt;/pre&gt; for example. This text is shown as tool tip for each parameter.<br />
<br />
&quot;EditorType&quot; defines whether the parameter is boolean, numeric, string or multiple.<br />
<br />
&quot;ValueDefault&quot; is the default value that is normally used by the indenter if this parameter is not defined. It is needed if the config file of an indenter is loaded but this parameter value is not defined there. For boolean 0 is equal to false and 1 is equal to true. In case of multiple the number defines which of the multiple choice parameters is selected, starting with 0.<br />
<br />
&quot;Enabled&quot; is not used for boolean but for all other parameters. Defines whether the value should be written to the indenters config file or not. If it is disabled it will not be written and the indenter uses its default value.<br />
<br />
<br />
3.1. Boolean parameters<br />
<br />
Example:<br />
</p>
<pre>
[ANSI style formatting]
Category=0
Description=&quot;&lt;html&gt;ANSI style formatting/indenting.&lt;/html&gt;&quot;
EditorType=boolean
TrueFalse=&quot;--style=ansi|&quot;
Value=0
ValueDefault=0
</pre>
<p>
The only special here is the key &quot;TrueFalse&quot;. The string is a parameter list always consists of two parameters devided by a &quot;|&quot; sign, where the first one defines the true case and the second the false case. Some indenters like GreatCode have a parameter for true and false, some other like AStyle in this example only have a parameter for the false case, so the second parameter is empty.<br />
<br />
<br />
3.2. Numeric parameters<br />
</p>
<pre>
[Indent spaces]
CallName=&quot;--indent=spaces=&quot;
Category=1
Description=&quot;&lt;html&gt;Indent using # spaces per indent&lt;/html&gt;&quot;
EditorType=numeric
Enabled=false
MaxVal=20
MinVal=2
Value=4
ValueDefault=4
</pre>
<p>
Numeric parameters have defined a maximum value &quot;MaxVal&quot; and a minimum value &quot;MinVal&quot; which can/should not be exceeded. The &quot;CallName&quot; is the parameter as string as it will be written to the indenters config file. At its ending &quot;Value&quot; will be appended.<br />
<br />
<br />
3.3. String parameters<br />
</p>
<pre>
[Comment separation char]
CallName=-cmt_sep_char_4-
Category=5
Description=&quot;&lt;html&gt;Set the special character to fill automatic comments.&lt;/html&gt;&quot;
EditorType=string
Enabled=true
Value=*
ValueDefault=*
</pre>
<p>
The &quot;CallName&quot; is the parameter as string as it will be written to the indenters config file. At its ending &quot;Value&quot; will be appended. Value can also be a list of strings separated by the &quot;|&quot; sign. By this the parameter is written to the config file with each value in the list. <br />
In the upper example value could be &quot;C|c|K&quot;. The result in the ouput file would be:<br />
-cmt_sep_char_4-C
-cmt_sep_char_4-c
-cmt_sep_char_4-K
<br />
<br />
<br />
3.4. Multiple parameters<br />
</p>
<pre>
[Bracket style]
Category=1
Choices=&quot;--brackets=break|--brackets=attach|--brackets=linux|--brackets=break-closing-headers&quot;
ChoicesReadable=&quot;Break brackets|Attach brackets|Break brackets Linux like|Break closing headers&quot;
Description=&quot;&lt;html&gt;Sets the bracket style.&lt;/html&gt;&quot;
EditorType=multiple
Enabled=false
Value=1
ValueDefault=-1
</pre>
<p>
Multiple parameters can have exactly one parameter out of a list selected. &quot;Choices&quot; is a parameter list consisting of parameters devided by a &quot;|&quot; sign. Each parameter in the list will be exactly written to the indenters config file as defined here. The list &quot;ChoicesReadable&quot; can be used to show more readable text in the combo box, instead of the &quot;Choices&quot; text. &quot;ChoicesReadable&quot; must have as many entries as &quot;Choices&quot;.<br />
</p>
</body>
</html>

@ -0,0 +1,21 @@
.TH universalindentgui 1 "2012-01-01" "1.2.0" "UniversalIndentGUI"
.SH NAME
universalindentgui \- GUI frontend for several code beautifiers
.SH SYNOPSIS
.B universalindentgui
.RI [ FILE ]
.br
Optional the as parameter given
.IR FILE
can be opened at start.
.SH DESCRIPTION
\fBUniversalIndentGUI\fP is a GUI frontend for nearly any code beautifier. It allows you to comfortably change each parameter of a beautifier and directly see how the source code is affected done by a live preview. Many free available code beautifier, formatter and indenter are currently supported, like GNU Indent, Uncrustify, Artistic Styler, PHP Stylist, Ruby Beautify, HTML Tidy and many other (look at features for complete list). Currently not supported indenters can be easily added by creating a configuration file for them.
.SH BUGS
Currently known bugs can be browsed on http://sf.net/tracker2/?func=browse&group_id=167482&atid=843127
.SH AUTHOR
Thomas\ Schweitzer <thomas_-_s@users.sourceforge.net>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,59 @@
000000* An example illustrating the use of a programmer defined paragraphs
* and perform-thru
identification division.
program-id. level88.
author. kik.
environment division.
configuration section.
special-names.
console is crt
decimal-point is comma.
data division.
working-storage section.
77 transaction-kode pic 99.
88 valid-kode value 4, 8 thru 15.
88 create value 10.
88 destroy value 15.
procedure division.
main section.
*
* Some code leading to "transacion-kode" getting a value
*
move 10 to transaction-kode.
*
* Testing the conditions
*
if valid-kode then
if create then
perform p-create thru p-create-end
else
if destroy then
perform p-destroy thru p-destroy-end
else
perform ordinary-transaction
thru ordinary-transaction-end.
*
p-create.
* some creation code
p-create-end.
exit.
p-destroy.
* some destruction code
p-destroy-end.
exit.
ordinary-transaction.
* some ordinary data processing code
ord-trns-1.
ord-trns-2.
ordinary-transaction-end.
exit.

@ -0,0 +1,349 @@
#include <a.h>
#include <a.h>
#include <a.h>
using namespace a.b.c a;
PREPROCESSOR()
BEGIN_MESSAGE_MAP()
ON_COMMAND()
END_MESSAGE_MAP()
extern struct x y;
static const class Example :
Int1, Int2, Int3
{
public:
Example::~Example() :
S1(),
S2(),
S3() {
// if statements with empty braces
if( x ) { }
else if( x ) { }
else { }
// if statements with exactly one braced statement
if( x ) {
statement;
}
else if( x ) {
statement;
}
else {
statement;
}
// special 'if' cases
if( x ) {
statement;
}
else {
statement;
}
if( x ) {
statement;
statement;
}
else {
statement;
statement;
}
// if statements with a single implicit substatement
if( x )
statement;
else if( x )
statement;
else
statement;
// if statements with multiple statements
if( x ) {
statement;
statement;
}
else if( x ) {
statement;
statement;
}
else {
statement;
statement;
}
// while statements with a single implicit substatement
while( x )
statement;
// while statements with a single implicit 'if' substatement
while( x )
if( x )
statement;
// while with multiple statements
while( x ) {
statement;
statement;
}
// labeled statement
label:
statement;
// for statements with a single braced statement
for ( x; x; x ) {
statement;
}
// do statements with a single braced substatement
do {
statement;
} while ( false );
// do statement with an empty block
do { } while ( x );
// local blocks
{
statement;
}
/* Switch blocks:
*
* You can have case substatements be aligned by giving an example like:
*
* case 1: statement;
*
* statement;
*
* statement;
*
* etc...
*/
switch( c ) {
case 1:
case 2:
case 3:
statement;
statement;
statement;
case 4:
break; // case with exactly one substatement
default:
break;
}
}
void method( const myClass<item> &x, int [][][] c, ... ) {
// try-catch-finally with empty bodies
try { }
catch(Throwable e) { }
finally { }
// try-catch-finally with exactly one statement
try {
statement;
}
catch( Throwable t ) {
statement;
}
finally {
statement;
}
// try-catch-finally with multiple statements
try {
statement;
statement;
}
catch( Throwable e ) {
statement;
statement;
}
finally {
statement;
statement;
statement;
}
}
};
// enum statement
static typedef enum x
{
x,
y,
z,
};
// simple typedef
typedef interface static short int x;
namespace x
{
// template header
template <class T>
x y z v() const;
// pure virtual function, using c-style formal parameters with double parens
void v(()) = 0;
// function with one single line statement and c-style formal parameters
void v(( int i )) {
statement;
};
// function with no statements
myClass<myType>::method() { }
};
template <T> class x
{
public:
// operator declarations
int operator +();
int operator []();
// template method
static void A<x>::method() [][][] {
asm
{
- Assembler statements -
The outside braces are formatted but the asm code is passed through
unchanged.
}
asm Single line assembler statements are also just passed through
}
extern void oldStyleFunction()
int a;
int b;
int c; {
// various simple statements
long int a, b, c;
long double [] i;
goto x;
delete [] x;
delete [][][] x;
return x;
continue label;
throw e;
// c-style function calls with double parens
b((a, b, c));
a(());
// expressions
new Object()->field.method();
s = "string"
"split across lines";
method(a, B::C, 'd');
z = j[0][0][0] || k * 3 >> ++i + "0" > i++ & (i) == !j;
int *v;
int &v;
x = x * *x;
(int *)x;
int (*functionPointer)( x, y, z );
h[0] += a ? b : ((int)c).d;
new Handler();
}
} a, b, c; // struct instances
class Class2
{
/* Array creation with multiple non-array elements.
*
* If you give this example with the elements on the same line, then
* Polystyle will automatically vertically align them into a grid when it
* fits your code to the page. An alternate style is to have each
* element on its own line, like this:
* {
* x,
* y
* z
* }
*/
boolean *bools1 =
{
x, y, z
};
// array creation with a single element
boolean bools2 = { x };
// array creation with no elements
boolean bools3 = { };
// multidimensional array creation
const int *** array =
{
{ 1, 2, 3 },
{ 1, 2, 3 },
{ 1, 2, 3 },
};
};
#if x
#define x
#elif a
#define x
#else
#define x
#define x
#define x
#endif
// see if multi line macros are safely handled:
#define multilinemacro do { x= x+5; } while (0); \
printf("a multilinemacro"); \
printf("a multilinemacro2");

@ -0,0 +1,272 @@
/* General
/*******************************/
body
{
font-size: Small;
margin: 30px 0 20px 0;
background: url(images/background.jpg);
}
span
{
font-family: Tahoma,serif;
}
/* Page
/*******************************/
#page
{
width: 808px;
margin: 0 auto;
position: relative;
}
/* Links general
/*******************************/
a
{
color: #36b;
}
a:link { text-decoration:none; }
a:visited { text-decoration:none; }
a:active { text-decoration:none; }
a:focus { text-decoration:none; }
a:hover { text-decoration:underline; }
/* Links external
/*******************************/
a.external
{
background: url("images/externallinks.png") center right no-repeat;
padding-right: 13px;
}
/* Header
/*******************************/
#header
{
float: left;
width: 800px;
height: 171px;
background-image: url(images/banner.jpg);
background-repeat: no-repeat;
background-position: left bottom;
padding-left: 20px;
}
/* Tabs
/*******************************/
#tabs
{
}
#tabs ul
{
list-style: none;
display: inline;
}
#tabs li
{
width: 125px;
float: left;
background-image: url(images/tab3.jpg);
background-repeat: no-repeat;
background-position: center top;
text-align: center;
}
#tabs li a
{
font-family: sans-serif;
font-size: 100%;
font-weight: normal;
color: black;
height: 28px;
padding: 21px 0 0 0;
display: block;
}
#tabs li a:link { text-decoration:none; }
#tabs li a:visited { text-decoration:none; }
#tabs li a:active { text-decoration:none; }
#tabs li a:focus { text-decoration:none; }
#tabs li a:hover
{
width: 125px;
float: left;
background-image: url(images/tab3hover.jpg);
background-repeat: no-repeat;
background-position: center top;
text-align: center;
}
#tabs #current
{
background-image: url(images/tab3_selected.jpg);
background-repeat: no-repeat;
background-position: center top;
margin-top: -5px;
}
#tabs #current a
{
background-image: url(images/tab3_selected.jpg);
background-repeat: no-repeat;
background-position: center top;
padding: 27px 0;
height: 17px;
font-weight: bold;
}
/* Main
*******************************/
#main
{
background-image: url(images/page_middle.png);
background-repeat: repeat-y;
float: left;
}
/* Content
/*******************************/
#content
{
padding: 22px;
margin: 0;
width: 541px;
float: left;
}
#content h1, h2, h3, h4, h5, h6, h7, #content h2 a
{
font-family: Tahoma,serif;
margin-bottom: 10px;
margin-top: 10px;
}
#content h1
{
font-size: x-large;
}
#content h2
{
font-size: large;
}
#content p, #content ul, #content a, #content ol
{
margin-top: 10px;
font-family: verdana, sans-serif;
}
/* Progress
/*******************************/
.progressframe
{
border: 1px black solid;
width: 100%;
}
.progress
{
font-family: Tahoma,serif;
font-weight: bold;
/*padding-left: 10px;*/
background-color: red;
color: white;
}
.p0 { width: 0%; color: black; background-color: white; }
.p5 { width: 5%; background-color: rgb(240,16,0); }
.p10 { width: 10%; background-color: rgb(240,32,0); }
.p15 { width: 15%; background-color: rgb(240,48,0); }
.p20 { width: 20%; background-color: rgb(240,64,0); }
.p25 { width: 25%; background-color: rgb(240,80,0); }
.p30 { width: 30%; background-color: rgb(240,80,0); }
.p35 { width: 35%; background-color: rgb(240,96,0); }
.p40 { width: 40%; background-color: rgb(240,96,0); }
.p45 { width: 45%; background-color: rgb(240,112,0); }
.p50 { width: 50%; background-color: rgb(240,112,0); }
.p55 { width: 55%; background-color: rgb(224,128,0); }
.p60 { width: 60%; background-color: rgb(208,144,0); }
.p65 { width: 65%; background-color: rgb(192,160,0); }
.p70 { width: 70%; background-color: rgb(176,176,0); }
.p75 { width: 75%; background-color: rgb(176,176,0); }
.p80 { width: 80%; background-color: rgb(160,192,0); }
.p85 { width: 85%; background-color: rgb(160,192,0); }
.p90 { width: 90%; background-color: rgb(144,208,0); }
.p95 { width: 95%; background-color: rgb(144,208,0); }
.p100 { width: 100%; background-color: green; }
/* Sidebar
/*******************************/
#sidebar
{
margin: 0;
padding: 10px;
width: 195px;
font-family: verdana, sans-serif;
float: right;
}
#sidebar a
{
border : none;
}
#sidebar a:link { text-decoration:none; }
#sidebar a:visited { text-decoration:none; }
#sidebar a:active { text-decoration:none; }
#sidebar a:focus { text-decoration:none; }
#sidebar a:hover { text-decoration:underline; }
#sidebar a img
{
border : none;
}
#sidebar h1
{
font-size: 10pt;
font-weight: bold;
margin-bottom: 0;
}
#sidebar ul
{
vertical-align: middle;
}
#sidebar li
{
list-style-image: url(images/icon_page.gif);
}
/* Footer
/*******************************/
#footer
{
font-family: verdana, sans-serif;
background: url(images/page_bottom.png);
font-size: x-small;
font-weight: bold;
color: #CCCCCC;
height: 44px;
width: 800px;
clear: both;
}
#footer p
{
padding: 0px 0 0 20px;
}
#footer a
{
color: #CCE0F5;
}

@ -0,0 +1,33 @@
module module1
! Identity of a utility
! ____________________________________________________________________
character (len=*), parameter :: xyz = &
"I am just a more or less long string."
character (len=*), parameter :: zhlp = '( &
&"This program is free software; you can redistribute it and/or modify"/&
&"____________________________________________________________________")'
integer:: n
contains
recursive subroutine sub1(x)
integer,intent(inout):: x
integer:: y
y=0
if (x<n) then
x= x + 1
y =x**2
print *, 'x = ', x,', y = ', y
call sub1(x)
print *, 'x = ', x,', y = ', y
end if
end subroutine sub1
end module module1
program main
use module1
integer:: x = 0
print *, 'Enter number of repeats'
read (*,*) n
call sub1(x)
end program main

File diff suppressed because it is too large Load Diff

@ -0,0 +1,12 @@
function decode() {
var jsdecoder = new JsDecoder();var jscolorizer = new JsColorizer();var code;
jsdecoder.s = document.getElementById("a1").value;
code = jsdecoder.decode();
if (document.all) { document.getElementById("a2").innerText = code; }
else {
code = code.replace(/&/g, "&amp;"); code = code.replace(/</g, "&lt;");
code = code.replace(/>/g, "&gt;"); jscolorizer.s = code;
code = jscolorizer.colorize(); document.getElementById("a2").innerHTML = code;
}
}

@ -0,0 +1,4 @@
<?php
if($code == BAD){$action = REWRITE;}else{$action = KEEP;}
for($i=0; $i<10;$i++){while($j>0){$j++;doCall($i+$j);if($k){$k/=10;}}}
?>

@ -0,0 +1,55 @@
print "Help Desk -- What Editor do you use?";
chomp($editor = <STDIN>);
if ($editor =~ /emacs/i) {
print "Why aren't you using vi?\n";
} elsif ($editor =~ /vi/i) {
print "Why aren't you using emacs?\n";
} else {
print "I think that's the problem\n";
}
{
L9140:
if ($msccom::obj==$msccom::food) {
goto L8142;
}
if ($msccom::obj==$msccom::bird||$msccom::obj==$msccom::snake||$msccom::obj==$msccom::clam||$msccom::obj==$msccom::oyster||$msccom::obj==$msccom::dwarf||$msccom::obj==$msccom::dragon||$msccom::obj==$msccom::troll||$msccom::obj==$msccom::bear) {
$msccom::spk=71;
}
goto L2011;
#
# DRINK. IF NO OBJECT, ASSUME WATER AND LOOK FOR IT HERE. IF WATER IS
# THE BOTTLE, DRINK THAT, ELSE MUST BE AT A WATER LOC, SO DRINK STREAM.
#
L9150:
if ($msccom::obj==0&&$liqloc->($placom::loc)!=$msccom::water&&($liq->(0)!=$msccom::water||!$here->($msccom::bottle))) {
goto L8000;
}
if ($msccom::obj!=0&&$msccom::obj!=$msccom::water) {
$msccom::spk=110;
}
if ($msccom::spk==110||$liq->(0)!=$msccom::water||!$here->($msccom::bottle)) {
goto L2011;
}
$placom::prop->($msccom::bottle)=1;
$placom::place->($msccom::water)=0;
$msccom::spk=74;
goto L2011;
#
# RUB. YIELDS VARIOUS SNIDE REMARKS.
#
L9160:
if ($msccom::obj!=$placom::lamp) {
$msccom::spk=76;
}
goto L2011;
#
# THROW. SAME AS DISCARD UNLESS AXE. THEN SAME AS ATTACK EXCEPT IGNOR
# AND IF DWARF IS PRESENT THEN ONE MIGHT BE KILLED. (ONLY WAY TO DO SO
# AXE ALSO SPECIAL FOR DRAGON, BEAR, AND TROLL. TREASURES SPECIAL FOR
#
L9170:
if ($toting->($msccom::rod2)&&$msccom::obj==$msccom::rod&&!$toting->($msccom::rod)) {
$msccom::obj=$msccom::rod2;
}
}

@ -0,0 +1,23 @@
#! /usr/bin/env python
"Replace CRLF with LF in argument files. Print names of changed files."
import sys, os
def main():
for filename in sys.argv[1:]:
if os.path.isdir(filename):
print filename, "Directory!"
continue
data = open(filename, "rb").read()
if '\0' in data:
print filename, "Binary!"
continue
newdata = data.replace("\r\n", "\n")
if newdata != data:
print filename
f = open(filename, "wb")
f.write(newdata)
f.close()
if __name__ == '__main__':
main()

@ -0,0 +1,224 @@
#!/usr/bin/env ruby
#odd assignments
BEGIN {
puts "a block i have never seen used"
}
entry = Post.update(params["id"],{:title => params["title"],:post => params['post'],:context => params["context"],:creator => session[:creator]})
definition = "moo"
puts moo
moo = case 3
when 2
"unless proceeding to 3"
when 3
"right"
when 4
"one to many"
when 5
"three sir"
end
puts moo
def pointless_call
if false
"Sdf"
elsif true
"df"
end
end
puts pointless_call
if true
puts "moo"
end
i = 5
def title
doc = load_page
title = doc.search("h1").first.inner_html
clean_html_tags(title)
clean_9_0(title)
title
end
if i
if true
puts "moo"
elsif i < 3 * 23
"sdf"
else
"df"
end
end
class Tested
def sadf
"asdf"
end
end
module Moo
def t434t
"352"
end#comments at the end
end #comments again debug_if
=begin
block comments
should have no formatting done
ever
=end
#java formatter test parts
ping(argument) {|block|
}
if (moo)
cow;
else
dog;
end
x = 5
x = 5
x = 5
x = 5
IN_OUTS_RX = /^(def|class|module|begin|case|if|unless|loop|while|until|for)/
#end java formatter test parts
here_doc = <<-EOX
This should not
loose its formatting
EOX
dsfffffffff=[2, 3, 4, 5]
print <<-STRING1, <<-STRING2
Concat
STRING1
enate
STRING2
unless false
"4"
else
"5"
end
x = 2
while x > 0
x -= 1
if x == 1
"p"
else
"3"
end
end
x = 2
until x < 0
x -= 1
end
a = 3
a *= 2 while a < 100
a -= 10 until a < 100
print "Hello\n" while false
print "Goodbye\n" while false
3.times do
print "Ho! "
end
0.upto(9) do | x|
print x, " "
end
0.step(12, 3) {|x | print x, " " }
x = 0
loop {
if x == 5
break
end
x += 1
}
(1..4).each {|x|
puts x
}
(1..4).each do | x|
puts x
end
for i in (1..4)
puts i
end
i = 0
loop do
i += 1
next if i < 3
print i
break if i > 4
end
string = "x+1"
begin
eval string
rescue SyntaxError, NameError => boom
print "String doesn't compile: " + boom
rescue StandardError => bang
print "Error running script: " + bang
ensure
print "thank you pick axe"
end
a = "Fats ' ' \\\" do Waller"
a =~ /\/a/
if true then print "a" end
x = 3
unless true then print "a" end
x = 3
begin raise "cow"
rescue Exception => e
end
x = 3
puts i += 1 while i < 3 # ruby
x = 3
klass = Fixnum
#its like a do while loop
begin
print klass
klass = klass.superclass
print " < " if klass
end while klass
puts
p Fixnum.ancestors
boom = %q / this is a spinal tap/
boom = %q - string-
boom =%q(a (nested) string)
x = "done with string"
puts "In parent,term = #{ENV['TERM']}"
cow = if true
"moot"
else
"woot"
end
fork do
puts "Start of child 1,term=#{ENV['TERM']}"
ENV['TERM'] = "ansi"
fork do
puts "Start of child 2, term=#{ENV['TERM']}"
begin
if moo < 3
p "asdf4"
elsif 9 * 0
p "asde"
else
puts cow
end
end while x > 3
end
Process.wait
puts "End of child 1, term=#{ENV['TERM']}"
end
Process.wait
puts "Back in parent, term=#{ENV['TERM']}"
OPENOFFICE = true # do Openoffice - Spreadsheet Tests?
EXCEL = true # do Excel Tests?
GOOGLE = true # do Google - Spreadsheet Tests?
OPENOFFICEWRITE = false # experimental:
END{
puts "another block i have never seen"
}

@ -0,0 +1,27 @@
#!/bin/sh
string="Hallo Welt"
# if else test
if [ -n "$string" ]; then
echo "The string is \"$string\"!"
else
echo "The string is empty!"
fi
# for test
array="Text1 Text2 Text3 Text4"
for i in $array
do
echo "The string \"$i\" is in the array!"
done
count=0
while [ $count -le 10 ]
do
echo "We've counted up to $count."
count=$[$count+1] #increment counter by one.
done
echo "Passed everything!"
#read -p "press any key to continue"

@ -0,0 +1,37 @@
CREATE PACKAGE BODY b IS
PROCEDURE proc1 IS
BEGIN
IF 7 <> 5 THEN
FOR rec IN (SELECT * FROM dual
WHERE g = 5) LOOP
NULL;
END LOOP;
END IF;
END;
PROCEDURE recurse IS
b number:=5;
d456 number:=456;
BEGIN
recurse;
proc1;
a := (a + 1
+4
+ 5
+ 8);
c := f + 4 + 34;
total := earth +sky;
--this is comment
uk:=h;
g:=l;
exception
when no_data then
hello;
END;
BEGIN
NULL;
END;

@ -0,0 +1,50 @@
Dim docRoot As New ChilkatXml
Dim success As Long
docRoot.Tag = "myDoc"
' To zip compress the content, set this flag to 1
Dim zipContent As Long
zipContent = 0
' To 128-bit AES encrypt the content, set this flag to 1
Dim encryptContent As Long
encryptContent = 0
Dim encryptPassword As String
encryptPassword = ""
Dim pdfNode As ChilkatXml
Set pdfNode = docRoot.NewChild("pdf","")
' Embed a PDF into XML
success = pdfNode.SetBinaryContentFromFile("sample.pdf",zipContent,encryptContent,encryptPassword)
If (success <> 1) Then
MsgBox pdfNode.LastErrorText
Exit Sub
End If
MsgBox pdfNode.LastErrorText
' Display the entire XML document:
Text1.Text = Text1.Text & docRoot.GetXml() & vbCrLf
' Get the Base64-encoded content and display it:
Text1.Text = Text1.Text & pdfNode.Content & vbCrLf
' Extract the binary content from XML:
Dim unzipContent As Long
unzipContent = 0
Dim decryptContent As Long
decryptContent = 0
Dim decryptPassword As String
decryptPassword = ""
success = pdfNode.SaveBinaryContent("out.pdf",unzipContent,decryptContent,decryptPassword)
If (success <> 1) Then
MsgBox pdfNode.LastErrorText
Exit Sub
End If
MsgBox "Success!"

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<verzeichnis>
<titel>Wikipedia Städteverzeichnis</titel>
<eintrag>
<stichwort>Genf</stichwort>
<eintragstext>Genf ist der Sitz von ...</eintragstext>
</eintrag>
<eintrag>
<stichwort>Köln</stichwort>
<eintragstext>Köln ist eine Stadt, die ...</eintragstext>
</eintrag>
</verzeichnis>

@ -0,0 +1,294 @@
#!/usr/bin/perl
#
# hindent 1.1.2
#
# Properly indent HTML code and convert tags to uppercase like the Gods intended.
# Understands all nesting tags defined under the HTML 3.2 standard.
#
# by Paul Balyoz <pab@domtools.com>
#
# Usage:
# hindent [-fslcv] [-i num] [file ...] > newfile
#
# Options:
# -f Flow - just prints tags _without_args_, for visual checking.
# NOTE: This option DAMAGES the HTML code. The output is for
# human debugging use ONLY. Keep your original file!!
# -s Strict - prints 1 tag per line with proper indenting.
# Helpful for deciphering HTML code that's all on one line.
# NOTE: This slightly DAMAGES the HTML code because it introduces
# whitespace around tags that had none before, which will mess up
# formatting somewhat on the page (links will have extra spaces, etc).
# -i num Set indentation to this many characters.
# -l List all the tags we recognize and exit.
# -c Lowercase HTML tags. (Uppercase is default)
# -v Print version of hindent and exit.
#
# Copyright (C) 1993-1999 Paul A. Balyoz <pab@domtools.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# How many spaces to indent per level?
# (sets of 8-spaces will be automatically converted to tabs intelligently).
# You can use any value here, some recommendations: 8, 4, 3, or 2
$spacesperlevel = 2;
# How many spaces does a "tab" occupy on your screen?
# Unix generally uses 8-space-tabs, but it's user-configurable in most editors.
# If tabs are not turned off (-t0) then we output 1 tab character for every
# $tabstop spaces we need to output.
$tabstop = 8;
# Tags that require their own end tag <TAG>...</TAG> we will nest them
# properly: (WARNING, you must use lower-case here)
# All other tags (not on this list) will be ignored for indenting purposes.
%nesttag = (
'html' => 1,
'head' => 1,
'body' => 1,
'title' => 1,
'a' => 1,
'table' => 1,
'tr' => 1,
'th' => 1,
'td' => 1,
'form' => 1,
'select' => 1,
'textarea' => 1,
# 'p' => 1, Don't do this one because many people use <P> but not </P>
'ul' => 1,
'ol' => 1,
'dl' => 1,
'blockquote' => 1,
'center' => 1,
'div' => 1,
'font' => 1,
'pre' => 1,
'tt' => 1,
'i' => 1,
'b' => 1,
'u' => 1,
'strike' => 1,
'big' => 1,
'small' => 1,
'sub' => 1,
'sup' => 1,
'em' => 1,
'strong' => 1,
'dfn' => 1,
'code' => 1,
'samp' => 1,
'kbd' => 1,
'var' => 1,
'cite' => 1,
'h1' => 1,
'h2' => 1,
'h3' => 1,
'h4' => 1,
'h5' => 1,
'h6' => 1,
'applet' => 1,
'map' => 1,
'frameset' => 1,
'noframes' => 1,
);
#-------------------\
# END CONFIGURATIONS ===================================================================
#-------------------/
use Getopt::Std;
#
# Parse args
#
sub usageexit {
print STDERR "usage: hindent [-fslcv] [-i num] [-t num] [file ...] > newfile\n";
exit 1;
}
getopts('fsi:lvt:c') || &usageexit;
if (defined $opt_i) {
if ($opt_i < 0 || $opt_i > 10) {
print STDERR "$0: error: indentation factor '$opt_i' not in range 0..10.\n";
&usageexit;
} else {
$spacesperlevel = $opt_i;
}
}
if (defined $opt_t) {
if ($opt_t < 0 || $opt_t > 12) {
print STDERR "$0: error: indentation factor '$opt_i' not in range 0..12.\n";
&usageexit;
} else {
$tabstop = $opt_t;
}
}
#
# If -l option, just list tags and exit.
#
if ($opt_l) {
print "hindent recognizes these HTML tags:\n";
for $tag (sort(keys(%nesttag))) {
$tag =~ tr/a-z/A-Z/;
print "$tag\n";
}
exit 0;
}
#
# If -v option, just print version and exit.
#
if ($opt_v) {
print "hindent version 1.1.2\n";
exit 0;
}
#
# Main HTML parsing code
#
$level = 0; # indentation level
$changelevel = 0; # change in indentation level (delta)
$out = ""; # accumulated output string
while (<>) {
chomp; # some HTML has no newline on last line, chop mangles it.
s/^\s+//; # remove ALL preceding whitespace, we rebuild it ourselves
$line++;
$end = -1;
$start = $len = 0;
while (/<(.*?)>/g) {
$end = $start+$len-1; # of previous values
$start = length($`);
$len = 1 + length($1) + 1;
($tag,$arg) = split(/\s+/,$1,2);
if (!$opt_f) {
$out .= substr($_, $end+1, $start-($end+1)); # print stuff from last tag to here
}
if ($opt_c) {
$tag =~ tr/A-Z/a-z/;
} else {
$tag =~ tr/a-z/A-Z/;
}
if ($arg && !$opt_f) {
$out .= "<$tag $arg>";
} else {
$out .= "<$tag>";
}
# if regular tag, push it on stack; if end-tag, pop it off stack.
# but don't do any of this if it's not a special "nesting" tag!
if ($tag !~ m,^/,) {
if ($nesttag{lc($tag)}) {
push @tagstack,$tag;
$changelevel++; # remember how much for later
}
} else {
$tag =~ s,^/,,; # convert this end-tag to a begin-tag
$tag = lc($tag);
if ($nesttag{lc($tag)}) {
# throw away tags until we find a match
if ($#tagstack > -1) {
while ($tag ne lc(pop @tagstack)) {
$changelevel--; # we threw away extra tags
last if $#tagstack <= 0;
}
$changelevel--; # we threw away extra tags
if ($level+$changelevel < 0) {
print STDERR "line $line: saw more end tags than begin ones!\n";
$changelevel = -$level;
}
}
}
}
&printout if $opt_s; # -s -> print every tag on new line
}
#
# Print rest of line after the last match, and newline.
# (not part of Flow)
#
if (!$opt_f) {
$end = $start+$len-1;
$out .= substr($_,$end+1,length($_)-($end+1));
}
&printout;
}
# Any tags left on the stack?
if ($level > 0) {
print STDERR "WARNING: level=$level, ", $#tagstack+1," tags left on stack after done parsing! Specifically:\n";
while ($tag = pop @tagstack) {
print STDERR "\t$tag";
}
}
exit 0;
#
# Print this line of data indented properly.
#
sub printout {
my($numtabs) = 0;
#
# To OUTdent, do that BEFORE printing.
#
if ($changelevel < 0) {
$level += $changelevel;
$changelevel = 0;
}
#
# Print indents and this line of output
#
$spaces = " " x ($level * $spacesperlevel);
$numtabs = int(length($spaces)/$tabstop) if $tabstop;
print "\t" x $numtabs; # print the tabs
print " " x (length($spaces)-$numtabs*$tabstop); # print the spaces
print "$out\n";
$out = "";
#
# To INdent, do that AFTER printing.
#
if ($changelevel > 0) {
$level += $changelevel;
$changelevel = 0;
}
}

@ -0,0 +1,156 @@
<!-- manual page source format generated by PolyglotMan v3.2, -->
<!-- available at http://polyglotman.sourceforge.net/ -->
<html>
<head>
<title>HINDENT(1) manual page</title>
</head>
<body bgcolor='white'>
<a href='#toc'>Table of Contents</a><p>
<h2><a name='sect0' href='#toc0'>Name</a></h2>
hindent - HTML reformatting/nesting utility
<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
<b>hindent</b> [-fslcv]
[-i <i>num</i>] [-t <i>num</i>] [file ...]
<h2><a name='sect2' href='#toc2'>Description</a></h2>
This utility takes one or more HTML
files and reformats them by properly indenting them for greater human readability.
The new HTML code is written to standard output, any errors go to standard
error. If no file is specified, <b>hindent</b> reads from standard input. If more
than one file is specified, each is taken in turn and all output is concatenated
(with no way to distinguish when one output ends and the next begins). <p>
Without
any options, <b>hindent</b> simply varies the amount of whitespace at the beginning
of each line of input - no lines are added or subtracted from the HTML code.
This means that it generates output that should draw the same on all browsers
as the input HTML. If the <b>-s</b> or <b>-f</b> options are used, the resulting HTML may
not draw exactly the same any more. It is important that you keep your
original HTML data around, just in case! <p>
This version of <b>hindent</b> understands
all container tags defined in the HTML 3.2 standard.
<h2><a name='sect3' href='#toc3'>Options</a></h2>
<dl>
<dt><b>-c</b> </dt>
<dd>Case. Forces
all tags to lowercase. By default, <b>hindent</b> forces all tags to uppercase.
</dd>
<dt><b>-f</b> </dt>
<dd>Flow. Prints just tags without any data between the tags. Damages the
HTML in a big way, so save a copy of your original HTML. This option helps
you follow the HTML code flow visually. </dd>
<dt><b>-i <i>num</i></b> </dt>
<dd>Indent level. Set indentation
to this many character spaces per code nesting level. If set to 0, no indentation
is done (all output is left-justified). </dd>
<dt><b>-l</b> </dt>
<dd>List tags. Causes <b>hindent</b> to print
a complete list of tags that it recognizes to stdout, and exits. </dd>
<dt><b>-s</b> </dt>
<dd>Strict.
Multiple tags per line are broken out onto separate lines. Can damage the
HTML in minor ways by drawing an extra space character in certain parts
of the web page, so save a copy of your original HTML. This option helps
you follow the HTML code flow visually, especially with computer-generated
HTML that comes out all on one line. </dd>
<dt><b>-t <i>num</i></b> </dt>
<dd>Tab stop. Set the number of spaces
that a tab character occupies on your system. Defaults to 8, but some people
prefer expanding tabs to 4 spaces instead. If set to 0, no tabs are output
(spaces used to indent lines). </dd>
<dt><b>-v</b> </dt>
<dd>Version. Prints <b>hindent</b>&rsquo;s version number
to stdout and exits immediately. </dd>
</dl>
<p>
The <b>-s</b> option is the most useful, it would
be the default if it didn&rsquo;t damage the HTML code. <p>
Any combination of these
options may be used.
<p>
<h2><a name='sect4' href='#toc4'>Examples</a></h2>
<p>
Example 1. Download a web page, reformat it,
view it: <br>
<pre>
</pre><p>
<dl>
<dt>CRlynx -source <a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'>http://www.domtools.com/~pab</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
| hindent | moreExample 2. View
only the structure, one tag per line: </dt>
<dd><br>
<pre>
</pre></dd>
</dl>
<p>
<dl>
<dt>CRlynx -source <a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'><a href='http://www.domtools.com/~pab'>http://www.domtools.com/~pab</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
</a>
| hindent -s -f | moreExample 3. Reformat
my home page non-damagingly with 4-space tabs, keeping a backup copy: </dt>
<dd><br>
<pre>
</pre></dd>
</dl>
<h2><a name='sect5' href='#toc5'>CRcd $HOME/public_htmlmv index.html index.html.oldhindent -i4 index.html.old
&gt; index.htmlSite</a></h2>
The master web page for this tool is:
<dl>
<dt><a href='http://www.domtools.com/unix/hindent.shtml'>http://www.domtools.com/unix/hindent.shtml</a>
</dt>
<dd></dd>
</dl>
<h2><a name='sect6' href='#toc6'>Version</a></h2>
<b>Hindent</b> version 1.1.2
<h2><a name='sect7' href='#toc7'>Author</a></h2>
Paul Balyoz &lt;pab@domtools.com&gt; <p>
<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Options</a></li>
<li><a name='toc4' href='#sect4'>Examples</a></li>
<li><a name='toc5' href='#sect5'>CRcd $HOME/public_htmlmv index.html index.html.oldhindent -i4 index.html.old > index.htmlSite</a></li>
<li><a name='toc6' href='#sect6'>Version</a></li>
<li><a name='toc7' href='#sect7'>Author</a></li>
</ul>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,161 @@
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* @product: phpStylist
* @author: Mr. Milk (aka Marcelo Leite)
* @email: mrmilk@anysoft.com.br
* @version: 1.0
* @date: 2007-11-22
*
*****************************************************************************/
CONTENTS
--------
Below you will find instructions on how to use phpStylist:
- Web Server Usage
- Command Line Mode
- PSPad Integration
- Command Line Options
==============================================================================
WEB SERVER USAGE
----------------
phpStylist runs as a single file on you web server. You don't need any special
module or library. It has been tested with php from 4.4.2 to 5.2.2.
Save phpStylist.php to your web server folder and start it from the browser.
For example, http://localhost/phpStylist.php.
On the left menu, you will see more than 30 options that you can use to adjust
the application to your coding style. All options are sticky based on cookies.
Select one of your files or click on the button "Use Sample" and try each
option to see what it is all about.
If you want to type in or paste code directly into the app, first click on the
option "SHOW EDITABLE TEXT BOX". The right panel will then become editable.
COMMAND LINE MODE
-----------------
You can also use phpStylist through the command line to automatically format
local files. You will still need php installed.
First, find the exact location of you php.exe and the exact location where you
placed phpStylist. Let's say they are in
"C:\Program Files\PHP\php.exe" and "C:\Program Files\Apache\htdocs\phpStylist.php"
You then must run php passing phpStylist.php along with the -f argument. At
this point the command line would be like this:
"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Apache\htdocs\phpStylist.php"
But that's not all. You also need to add the full path of the source file you
want to format and the options you want to be used. For each of those 34 options
you see on the web server usage, there will be an option on the command line.
You can use the "--help" option to see a list of options.
Use the --help switch to see all options (full list at the end of this file):
"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Apache\htdocs\phpStylist.php" --help
The first phpStylist paramenter MUST be the source file name you want to
format. After the file name, you can add as many options as you want, in any
order. It can get pretty big, but it works. Another example:
"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Apache\htdocs\phpStylist.php"
"C:\Program Files\Apache\htdocs\source_file_to_format.php" --space_after_if
--indent_case --indent_size 4 --space_after_comma --line_before_function
Output will be to STDOUT, so if you want to send it to a file, append "> filename"
at the end of the command line. In our above example:
"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Apache\htdocs\phpStylist.php"
"C:\Program Files\Apache\htdocs\source_file_to_format.php" --space_after_if
--indent_case --indent_size 4 --line_before_comment_multi --vertical_array
--line_before_function > "C:\Code Library\Formatted Code\destination_file.php"
Don't forget the quotes around long file names.
PSPAD INTEGRATION
-----------------
PSPad is a popular, powerful and free code editor. It can be extended through
scripting. I have also created a script that will automatically format php code
from inside the editor. In fact, the script runs phpStylist in command line
mode, sending the current editor file name. It then get the results and replace
the code in the editor.
Save the file phpStylist.js to your PSPad javascript folder, usually
C:\Program Files\PSPad\Script\JScript.
Open the phpStylist.js file and edit the first two variables:
php_path = "C:\\Program Files\\xampp\\php\\php.exe";
stylist_path = "C:\\Program Files\\xampp\\htdocs\\phpStylist.php";
Replace the paths with the appropriate for your system. Don't forget to double
backslashes.
You will also see all the options, some are commented out, some are active (the
current setup is the one I use). Simply comment out or uncomment the options
you want to use and save the file. Restart PSPad or use the the option Scripts,
Recompile Scripts.
Now, just open a php file on the editor and select phpStylist from the menu.
That's all. You can also select some block of code before using the option so
you can reformat only that portion. Of course, try to select a full block such
as a function.
If you don't use PSPad or don't want the integration you don't need the file
phpStylist.js.
FULL LIST OF OPTIONS
--------------------
Indentation and General Formatting:
--indent_size n n characters per indentation level
--indent_with_tabs Indent with tabs instead of spaces
--keep_redundant_lines Keep redundant lines
--space_inside_parentheses Space inside parentheses
--space_outside_parentheses Space outside parentheses
--space_after_comma Space after comma
Operators:
--space_around_assignment Space around = .= += -= *= /= <<<
--align_var_assignment Align block +3 assigned variables
--space_around_comparison Space around == === != !== > >= < <=
--space_around_arithmetic Space around - + * / %
--space_around_logical Space around && || AND OR XOR << >>
--space_around_colon_question Space around ? :
Functions, Classes and Objects:
--line_before_function Blank line before keyword
--line_before_curly_function Opening bracket on next line
--line_after_curly_function Blank line below opening bracket
--space_around_obj_operator Space around ->
--space_around_double_colon Space around ::
Control Structures:
--space_after_if Space between keyword and opening parentheses
--else_along_curly Keep else/elseif along with bracket
--line_before_curly Opening bracket on next line
--add_missing_braces Add missing brackets to single line structs
--line_after_break Blank line after case "break"
--space_inside_for Space between "for" elements
--indent_case Extra indent for "Case" and "Default"
Arrays and Concatenation:
--line_before_array Opening array parentheses on next line
--vertical_array Non-empty arrays as vertical block
--align_array_assignment Align block +3 assigned array elements
--space_around_double_arrow Space around double arrow
--vertical_concat Concatenation as vertical block
--space_around_concat Space around concat elements
Comments:
--line_before_comment_multi Blank line before multi-line comment (/*)
--line_after_comment_multi Blank line after multi-line comment (/*)
--line_before_comment Blank line before single line comments (//)
--line_after_comment Blank line after single line comments (//)

@ -0,0 +1,543 @@
#! /usr/bin/python
# This file contains a class and a main program that perform three
# related (though complimentary) formatting operations on Python
# programs. When called as "pindent -c", it takes a valid Python
# program as input and outputs a version augmented with block-closing
# comments. When called as "pindent -d", it assumes its input is a
# Python program with block-closing comments and outputs a commentless
# version. When called as "pindent -r" it assumes its input is a
# Python program with block-closing comments but with its indentation
# messed up, and outputs a properly indented version.
# A "block-closing comment" is a comment of the form '# end <keyword>'
# where <keyword> is the keyword that opened the block. If the
# opening keyword is 'def' or 'class', the function or class name may
# be repeated in the block-closing comment as well. Here is an
# example of a program fully augmented with block-closing comments:
# def foobar(a, b):
# if a == b:
# a = a+1
# elif a < b:
# b = b-1
# if b > a: a = a-1
# # end if
# else:
# print 'oops!'
# # end if
# # end def foobar
# Note that only the last part of an if...elif...else... block needs a
# block-closing comment; the same is true for other compound
# statements (e.g. try...except). Also note that "short-form" blocks
# like the second 'if' in the example must be closed as well;
# otherwise the 'else' in the example would be ambiguous (remember
# that indentation is not significant when interpreting block-closing
# comments).
# The operations are idempotent (i.e. applied to their own output
# they yield an identical result). Running first "pindent -c" and
# then "pindent -r" on a valid Python program produces a program that
# is semantically identical to the input (though its indentation may
# be different). Running "pindent -e" on that output produces a
# program that only differs from the original in indentation.
# Other options:
# -s stepsize: set the indentation step size (default 8)
# -t tabsize : set the number of spaces a tab character is worth (default 8)
# -e : expand TABs into spaces
# file ... : input file(s) (default standard input)
# The results always go to standard output
# Caveats:
# - comments ending in a backslash will be mistaken for continued lines
# - continuations using backslash are always left unchanged
# - continuations inside parentheses are not extra indented by -r
# but must be indented for -c to work correctly (this breaks
# idempotency!)
# - continued lines inside triple-quoted strings are totally garbled
# Secret feature:
# - On input, a block may also be closed with an "end statement" --
# this is a block-closing comment without the '#' sign.
# Possible improvements:
# - check syntax based on transitions in 'next' table
# - better error reporting
# - better error recovery
# - check identifier after class/def
# The following wishes need a more complete tokenization of the source:
# - Don't get fooled by comments ending in backslash
# - reindent continuation lines indicated by backslash
# - handle continuation lines inside parentheses/braces/brackets
# - handle triple quoted strings spanning lines
# - realign comments
# - optionally do much more thorough reformatting, a la C indent
# Defaults
STEPSIZE = 8
TABSIZE = 8
EXPANDTABS = 0
import os
import re
import sys
next = {}
next['if'] = next['elif'] = 'elif', 'else', 'end'
next['while'] = next['for'] = 'else', 'end'
next['try'] = 'except', 'finally'
next['except'] = 'except', 'else', 'end'
next['else'] = next['finally'] = next['def'] = next['class'] = 'end'
next['end'] = ()
start = 'if', 'while', 'for', 'try', 'def', 'class'
class PythonIndenter:
def __init__(self, fpi = sys.stdin, fpo = sys.stdout,
indentsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
self.fpi = fpi
self.fpo = fpo
self.indentsize = indentsize
self.tabsize = tabsize
self.lineno = 0
self.expandtabs = expandtabs
self._write = fpo.write
self.kwprog = re.compile(
r'^\s*(?P<kw>[a-z]+)'
r'(\s+(?P<id>[a-zA-Z_]\w*))?'
r'[^\w]')
self.endprog = re.compile(
r'^\s*#?\s*end\s+(?P<kw>[a-z]+)'
r'(\s+(?P<id>[a-zA-Z_]\w*))?'
r'[^\w]')
self.wsprog = re.compile(r'^[ \t]*')
# end def __init__
def write(self, line):
if self.expandtabs:
self._write(line.expandtabs(self.tabsize))
else:
self._write(line)
# end if
# end def write
def readline(self):
line = self.fpi.readline()
if line: self.lineno = self.lineno + 1
# end if
return line
# end def readline
def error(self, fmt, *args):
if args: fmt = fmt % args
# end if
sys.stderr.write('Error at line %d: %s\n' % (self.lineno, fmt))
self.write('### %s ###\n' % fmt)
# end def error
def getline(self):
line = self.readline()
while line[-2:] == '\\\n':
line2 = self.readline()
if not line2: break
# end if
line = line + line2
# end while
return line
# end def getline
def putline(self, line, indent = None):
if indent is None:
self.write(line)
return
# end if
tabs, spaces = divmod(indent*self.indentsize, self.tabsize)
i = 0
m = self.wsprog.match(line)
if m: i = m.end()
# end if
self.write('\t'*tabs + ' '*spaces + line[i:])
# end def putline
def reformat(self):
stack = []
while 1:
line = self.getline()
if not line: break # EOF
# end if
m = self.endprog.match(line)
if m:
kw = 'end'
kw2 = m.group('kw')
if not stack:
self.error('unexpected end')
elif stack[-1][0] != kw2:
self.error('unmatched end')
# end if
del stack[-1:]
self.putline(line, len(stack))
continue
# end if
m = self.kwprog.match(line)
if m:
kw = m.group('kw')
if kw in start:
self.putline(line, len(stack))
stack.append((kw, kw))
continue
# end if
if next.has_key(kw) and stack:
self.putline(line, len(stack)-1)
kwa, kwb = stack[-1]
stack[-1] = kwa, kw
continue
# end if
# end if
self.putline(line, len(stack))
# end while
if stack:
self.error('unterminated keywords')
for kwa, kwb in stack:
self.write('\t%s\n' % kwa)
# end for
# end if
# end def reformat
def delete(self):
begin_counter = 0
end_counter = 0
while 1:
line = self.getline()
if not line: break # EOF
# end if
m = self.endprog.match(line)
if m:
end_counter = end_counter + 1
continue
# end if
m = self.kwprog.match(line)
if m:
kw = m.group('kw')
if kw in start:
begin_counter = begin_counter + 1
# end if
# end if
self.putline(line)
# end while
if begin_counter - end_counter < 0:
sys.stderr.write('Warning: input contained more end tags than expected\n')
elif begin_counter - end_counter > 0:
sys.stderr.write('Warning: input contained less end tags than expected\n')
# end if
# end def delete
def complete(self):
self.indentsize = 1
stack = []
todo = []
thisid = ''
current, firstkw, lastkw, topid = 0, '', '', ''
while 1:
line = self.getline()
i = 0
m = self.wsprog.match(line)
if m: i = m.end()
# end if
m = self.endprog.match(line)
if m:
thiskw = 'end'
endkw = m.group('kw')
thisid = m.group('id')
else:
m = self.kwprog.match(line)
if m:
thiskw = m.group('kw')
if not next.has_key(thiskw):
thiskw = ''
# end if
if thiskw in ('def', 'class'):
thisid = m.group('id')
else:
thisid = ''
# end if
elif line[i:i+1] in ('\n', '#'):
todo.append(line)
continue
else:
thiskw = ''
# end if
# end if
indent = len(line[:i].expandtabs(self.tabsize))
while indent < current:
if firstkw:
if topid:
s = '# end %s %s\n' % (
firstkw, topid)
else:
s = '# end %s\n' % firstkw
# end if
self.putline(s, current)
firstkw = lastkw = ''
# end if
current, firstkw, lastkw, topid = stack[-1]
del stack[-1]
# end while
if indent == current and firstkw:
if thiskw == 'end':
if endkw != firstkw:
self.error('mismatched end')
# end if
firstkw = lastkw = ''
elif not thiskw or thiskw in start:
if topid:
s = '# end %s %s\n' % (
firstkw, topid)
else:
s = '# end %s\n' % firstkw
# end if
self.putline(s, current)
firstkw = lastkw = topid = ''
# end if
# end if
if indent > current:
stack.append((current, firstkw, lastkw, topid))
if thiskw and thiskw not in start:
# error
thiskw = ''
# end if
current, firstkw, lastkw, topid = \
indent, thiskw, thiskw, thisid
# end if
if thiskw:
if thiskw in start:
firstkw = lastkw = thiskw
topid = thisid
else:
lastkw = thiskw
# end if
# end if
for l in todo: self.write(l)
# end for
todo = []
if not line: break
# end if
self.write(line)
# end while
# end def complete
# end class PythonIndenter
# Simplified user interface
# - xxx_filter(input, output): read and write file objects
# - xxx_string(s): take and return string object
# - xxx_file(filename): process file in place, return true iff changed
def complete_filter(input = sys.stdin, output = sys.stdout,
stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.complete()
# end def complete_filter
def delete_filter(input= sys.stdin, output = sys.stdout,
stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.delete()
# end def delete_filter
def reformat_filter(input = sys.stdin, output = sys.stdout,
stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.reformat()
# end def reformat_filter
class StringReader:
def __init__(self, buf):
self.buf = buf
self.pos = 0
self.len = len(self.buf)
# end def __init__
def read(self, n = 0):
if n <= 0:
n = self.len - self.pos
else:
n = min(n, self.len - self.pos)
# end if
r = self.buf[self.pos : self.pos + n]
self.pos = self.pos + n
return r
# end def read
def readline(self):
i = self.buf.find('\n', self.pos)
return self.read(i + 1 - self.pos)
# end def readline
def readlines(self):
lines = []
line = self.readline()
while line:
lines.append(line)
line = self.readline()
# end while
return lines
# end def readlines
# seek/tell etc. are left as an exercise for the reader
# end class StringReader
class StringWriter:
def __init__(self):
self.buf = ''
# end def __init__
def write(self, s):
self.buf = self.buf + s
# end def write
def getvalue(self):
return self.buf
# end def getvalue
# end class StringWriter
def complete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
input = StringReader(source)
output = StringWriter()
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.complete()
return output.getvalue()
# end def complete_string
def delete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
input = StringReader(source)
output = StringWriter()
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.delete()
return output.getvalue()
# end def delete_string
def reformat_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
input = StringReader(source)
output = StringWriter()
pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
pi.reformat()
return output.getvalue()
# end def reformat_string
def complete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
source = open(filename, 'r').read()
result = complete_string(source, stepsize, tabsize, expandtabs)
if source == result: return 0
# end if
import os
try: os.rename(filename, filename + '~')
except os.error: pass
# end try
f = open(filename, 'w')
f.write(result)
f.close()
return 1
# end def complete_file
def delete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
source = open(filename, 'r').read()
result = delete_string(source, stepsize, tabsize, expandtabs)
if source == result: return 0
# end if
import os
try: os.rename(filename, filename + '~')
except os.error: pass
# end try
f = open(filename, 'w')
f.write(result)
f.close()
return 1
# end def delete_file
def reformat_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
source = open(filename, 'r').read()
result = reformat_string(source, stepsize, tabsize, expandtabs)
if source == result: return 0
# end if
import os
try: os.rename(filename, filename + '~')
except os.error: pass
# end try
f = open(filename, 'w')
f.write(result)
f.close()
return 1
# end def reformat_file
# Test program when called as a script
usage = """
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c : complete a correctly indented program (add #end directives)
-d : delete #end directives
-r : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e : expand TABs into spaces (defailt OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
""" % vars()
def error_both(op1, op2):
sys.stderr.write('Error: You can not specify both '+op1+' and -'+op2[0]+' at the same time\n')
sys.stderr.write(usage)
sys.exit(2)
# end def error_both
def test():
import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'cdrs:t:e')
except getopt.error, msg:
sys.stderr.write('Error: %s\n' % msg)
sys.stderr.write(usage)
sys.exit(2)
# end try
action = None
stepsize = STEPSIZE
tabsize = TABSIZE
expandtabs = EXPANDTABS
for o, a in opts:
if o == '-c':
if action: error_both(o, action)
# end if
action = 'complete'
elif o == '-d':
if action: error_both(o, action)
# end if
action = 'delete'
elif o == '-r':
if action: error_both(o, action)
# end if
action = 'reformat'
elif o == '-s':
stepsize = int(a)
elif o == '-t':
tabsize = int(a)
elif o == '-e':
expandtabs = 1
# end if
# end for
if not action:
sys.stderr.write(
'You must specify -c(omplete), -d(elete) or -r(eformat)\n')
sys.stderr.write(usage)
sys.exit(2)
# end if
if not args or args == ['-']:
action = eval(action + '_filter')
action(sys.stdin, sys.stdout, stepsize, tabsize, expandtabs)
else:
action = eval(action + '_file')
for filename in args:
action(filename, stepsize, tabsize, expandtabs)
# end for
# end if
# end def test
if __name__ == '__main__':
test()
# end if

@ -0,0 +1,75 @@
# This file contains a class and a main program that perform three
# related (though complimentary) formatting operations on Python
# programs. When called as "pindent -c", it takes a valid Python
# program as input and outputs a version augmented with block-closing
# comments. When called as "pindent -d", it assumes its input is a
# Python program with block-closing comments and outputs a commentless
# version. When called as "pindent -r" it assumes its input is a
# Python program with block-closing comments but with its indentation
# messed up, and outputs a properly indented version.
# A "block-closing comment" is a comment of the form '# end <keyword>'
# where <keyword> is the keyword that opened the block. If the
# opening keyword is 'def' or 'class', the function or class name may
# be repeated in the block-closing comment as well. Here is an
# example of a program fully augmented with block-closing comments:
# def foobar(a, b):
# if a == b:
# a = a+1
# elif a < b:
# b = b-1
# if b > a: a = a-1
# # end if
# else:
# print 'oops!'
# # end if
# # end def foobar
# Note that only the last part of an if...elif...else... block needs a
# block-closing comment; the same is true for other compound
# statements (e.g. try...except). Also note that "short-form" blocks
# like the second 'if' in the example must be closed as well;
# otherwise the 'else' in the example would be ambiguous (remember
# that indentation is not significant when interpreting block-closing
# comments).
# The operations are idempotent (i.e. applied to their own output
# they yield an identical result). Running first "pindent -c" and
# then "pindent -r" on a valid Python program produces a program that
# is semantically identical to the input (though its indentation may
# be different). Running "pindent -e" on that output produces a
# program that only differs from the original in indentation.
# Other options:
# -s stepsize: set the indentation step size (default 8)
# -t tabsize : set the number of spaces a tab character is worth (default 8)
# -e : expand TABs into spaces
# file ... : input file(s) (default standard input)
# The results always go to standard output
# Caveats:
# - comments ending in a backslash will be mistaken for continued lines
# - continuations using backslash are always left unchanged
# - continuations inside parentheses are not extra indented by -r
# but must be indented for -c to work correctly (this breaks
# idempotency!)
# - continued lines inside triple-quoted strings are totally garbled
# Secret feature:
# - On input, a block may also be closed with an "end statement" --
# this is a block-closing comment without the '#' sign.
# Possible improvements:
# - check syntax based on transitions in 'next' table
# - better error reporting
# - better error recovery
# - check identifier after class/def
# The following wishes need a more complete tokenization of the source:
# - Don't get fooled by comments ending in backslash
# - reindent continuation lines indicated by backslash
# - handle continuation lines inside parentheses/braces/brackets
# - handle triple quoted strings spanning lines
# - realign comments
# - optionally do much more thorough reformatting, a la C indent

@ -0,0 +1,222 @@
#!/usr/bin/ruby -w
=begin
/***************************************************************************
* Copyright (C) 2008, Paul Lutus *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
=end
PVERSION = "Version 2.9, 10/24/2008"
module RBeautify
# user-customizable values
RBeautify::TabStr = " "
RBeautify::TabSize = 3
# indent regexp tests
IndentExp = [
/^module\b/,
/^class\b/,
/^if\b/,
/(=\s*|^)until\b/,
/(=\s*|^)for\b/,
/^unless\b/,
/(=\s*|^)while\b/,
/(=\s*|^)begin\b/,
/(^| )case\b/,
/\bthen\b/,
/^rescue\b/,
/^def\b/,
/\bdo\b/,
/^else\b/,
/^elsif\b/,
/^ensure\b/,
/\bwhen\b/,
/\{[^\}]*$/,
/\[[^\]]*$/
]
# outdent regexp tests
OutdentExp = [
/^rescue\b/,
/^ensure\b/,
/^elsif\b/,
/^end\b/,
/^else\b/,
/\bwhen\b/,
/^[^\{]*\}/,
/^[^\[]*\]/
]
def RBeautify.rb_make_tab(tab)
return (tab < 0)?"":TabStr * TabSize * tab
end
def RBeautify.rb_add_line(line,tab)
line.strip!
line = rb_make_tab(tab) + line if line.length > 0
return line
end
def RBeautify.beautify_string(source, path = "")
comment_block = false
in_here_doc = false
here_doc_term = ""
program_end = false
multiLine_array = []
multiLine_str = ""
tab = 0
output = []
source.each do |line|
line.chomp!
if(!program_end)
# detect program end mark
if(line =~ /^__END__$/)
program_end = true
else
# combine continuing lines
if(!(line =~ /^\s*#/) && line =~ /[^\\]\\\s*$/)
multiLine_array.push line
multiLine_str += line.sub(/^(.*)\\\s*$/,"\\1")
next
end
# add final line
if(multiLine_str.length > 0)
multiLine_array.push line
multiLine_str += line.sub(/^(.*)\\\s*$/,"\\1")
end
tline = ((multiLine_str.length > 0)?multiLine_str:line).strip
if(tline =~ /^=begin/)
comment_block = true
end
if(in_here_doc)
in_here_doc = false if tline =~ %r{\s*#{here_doc_term}\s*}
else # not in here_doc
if tline =~ %r{=\s*<<}
here_doc_term = tline.sub(%r{.*=\s*<<-?\s*([_|\w]+).*},"\\1")
in_here_doc = here_doc_term.size > 0
end
end
end
end
if(comment_block || program_end || in_here_doc)
# add the line unchanged
output << line
else
comment_line = (tline =~ /^#/)
if(!comment_line)
# throw out sequences that will
# only sow confusion
while tline.gsub!(/\{[^\{]*?\}/,"")
end
while tline.gsub!(/\[[^\[]*?\]/,"")
end
while tline.gsub!(/'.*?'/,"")
end
while tline.gsub!(/".*?"/,"")
end
while tline.gsub!(/\`.*?\`/,"")
end
while tline.gsub!(/\([^\(]*?\)/,"")
end
while tline.gsub!(/\/.*?\//,"")
end
while tline.gsub!(/%r(.).*?\1/,"")
end
# delete end-of-line comments
tline.sub!(/#[^\"]+$/,"")
# convert quotes
tline.gsub!(/\\\"/,"'")
OutdentExp.each do |re|
if(tline =~ re)
tab -= 1
break
end
end
end
if (multiLine_array.length > 0)
multiLine_array.each do |ml|
output << rb_add_line(ml,tab)
end
multiLine_array.clear
multiLine_str = ""
else
output << rb_add_line(line,tab)
end
if(!comment_line)
IndentExp.each do |re|
if(tline =~ re && !(tline =~ /\s+end\s*$/))
tab += 1
break
end
end
end
end
if(tline =~ /^=end/)
comment_block = false
end
end
error = (tab != 0)
STDERR.puts "Error: indent/outdent mismatch: #{tab}." if error
return output.join("\n") + "\n",error
end # beautify_string
def RBeautify.beautify_file(path)
error = false
if(path == '-') # stdin source
source = STDIN.read
dest,error = beautify_string(source,"stdin")
print dest
else # named file source
source = File.read(path)
dest,error = beautify_string(source,path)
if(source != dest)
# make a backup copy
File.open(path + "~","w") { |f| f.write(source) }
# overwrite the original
File.open(path,"w") { |f| f.write(dest) }
end
end
return error
end # beautify_file
def RBeautify.main
error = false
if(!ARGV[0])
STDERR.puts "usage: Ruby filenames or \"-\" for stdin."
exit 0
end
ARGV.each do |path|
error = (beautify_file(path))?true:error
end
error = (error)?1:0
exit error
end # main
end # module RBeautify
# if launched as a standalone program, not loaded as a module
if __FILE__ == $0
RBeautify.main
end

@ -0,0 +1,283 @@
#!/usr/bin/ruby -w
#
# == Synopsis
#
# Simple Ruby Formatter
#
# Created by: Stephen Becker IV
# Contributions: Andrew Nutter-Upham
# Contact: sbeckeriv@gmail.com
# SVN: http://svn.stephenbeckeriv.com/code/ruby_formatter/
#
# Its been done before RadRails did,
# http://vim.sourceforge.net/tips/tip.php?tip_id = 1368 that guy did it, but I did
# not look for a ruby formatter until i was done.
#
# It is called simple formatting because it is. I have the concept of 3 differnt
# indent actions In, Out and Both. I have mixed the concept of indenting and
# outdenting. Out means you have added white space and in means you remove a layer
# of white space.
#
# Basic logic
# Decrease current depth if
# ((the it is not a one line if unless statment
# (need to lookfor more oneline blocks) and it ends with end
# or if the } count is larger then {)
# or
# the first word is in the both list)
#
# and
# depth is larger then zero
#
# Increase current depth if
# It is not a one liner
# and
# (the word is in the out list
# or
# the word is in the both list
# or
# it looks like a start block)
# and
# temp_depth is nil (used for = comment blocks)
#
#
# Sure there are some regx's and a crap load of gsubs, but it still simple. Its
# not like its a pychecker (http://www.metaslash.com/brochure/ipc10.html)
#
# == Usage
#
# ruby [options] filelist
#
# options:
# -s # will change the indent to a space count of # per level
# by default we space with 1 tab per level
# -b # create a backup file
#
# examples:
# ruby simple_formatter.rb -s 3 -b /moo/cluck/cow.rb
# runs with the indent of 3 spaces,creates a backup file, and formats moo/cluck/cow.rb
#
#
# Tested with random files off of koders.com
#
#
::DEBUG_ME = false
require 'getoptlong'
require "fileutils"
require "pp"
$escape_strings = {:regex=>"EsCaPedReGex",:string=>"EsCaPeDStRiNg"}
begin
require 'rdoc/usage'
rescue Exception => e
#eat the no load of rdocs?
end
opts = GetoptLong.new(
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
[ '--spaces', '-s', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
[ '--backup', '-b', GetoptLong::NO_ARGUMENT ]
)
space_count = nil
backup = false
files = []
opts.each do | opt, arg|
case opt
when '--help'
begin
RDoc::usage
rescue Exception =>e
puts "If you want to use rdocs you need to install it"
exit(-1)
end
when '--spaces'
space_count = arg.to_i
when '--backup'
backup = true
when '--debug'
::DEBUG_ME = true
end
end
require "profile" if ::DEBUG_ME
if ARGV.length < 1
puts "Missing filelist argument (try --help)"
exit 0
end
array_loc = ARGV
#find if the string is a start block
#return true if it is
#rules
# does not include end at the end
# and ( { out number the } or it includes do
DO_RX = /\sdo\s*$/
def start_block?(string)
return true if string.gsub(/\|.*\|/, "").match(DO_RX) || (string.scan(/\{/).size > string.scan(/\}/).size)
false
end
#is this an end block?
#rules
#its not a one liner
#and it ends with end
#or } out number {
CHECK_ENDS_RX = /end$|end\s+while/
def check_ends?(string)
#check for one liners end and }
#string = just_the_string_please(string)
return true if (string.scan(/\{/).size < string.scan(/\}/).size) || string.match(CHECK_ENDS_RX)
false
end
IN_OUTS_RX = /^(def|class|module|begin|case|if|unless|loop|while|until|for)/
#look at first work does it start with one of the out works
def in_outs?(string)
string.sub!(/\(.*\)/, "")
return true if string.lstrip.match(IN_OUTS_RX) && string.strip.size == $1.strip.size
false
end
IN_BOTH_RX = /^(elsif|else|when|rescue|ensure)/
#look at first work does it start with one of the both words?
def in_both?(string)
return true if string.lstrip.match(IN_BOTH_RX) && string.strip.size == $1.strip.size
false
end
#extra formatting for the line
#we wrap = with spaces
#JUST_STRING_PLEASE_RX = /^#.*|\/.*\/|"([^"])*"|'([^'])*'/
LINE_CLEAN_UP_RX = /[a-zA-Z\]\'\"{\d]+=[a-zA-Z\[\'\"{\d]+/
def line_clean_up(x)
#this formatts strings and regexs remove and add in replacement works
x.gsub!(/\\\//,$escape_strings[:regex])
strings = x.scan(/#.*|["'\/].*?["'\/]/)
strings.each { | str |
x.sub!(str, $escape_strings[:string])
}
#lofted code from java formatter #{add in link}
# replace "){" with ") {"
x.sub!(/\)\s*\{/, ") {")
# replace "return(" with "return ("
# replace "if(" with "if ("
# replace "while(" with "while ("
# replace "switch(" with "switch (" ruby does not have a switch
# replace "catch(" with "catch ("
x.sub!(/\b(return|if|elsif|while|case|catch)\s*\(/, '\1 (')
# replace " ;" with ";"
# replace " ," with ","
x.gsub!(/\s+([\;\,])/, '\1')
#replace ",abc" with ", abc"
x.gsub!(/\,(\w+)/, ', \1')
x.gsub!(/(\)|"|\w)\s*([\+\-\*\/\&\|\^\%]|\&\&|\|\||[\>\<]|\>\=|\<\=|\=\=|\!\=|\<\<|\>\>|\>\>\>)\s*(?=(\w | "))/, '\1 \2 ')
# a space before and after AssignmentOperator
x.gsub!(/(\w)\s*(\+\=|\-\=|\*\=|\/\=|\&\=|\|\=|\^\=|\%\=|\<\<\=|\>\>\=|\>\>\>\=)\s*(?=(\w))/, '\1 \2 ')
# do not trim spaces
x.gsub!(/(\w)\=\s*(?=(\w|"))/, '\1 = ')
x.gsub!(/(\w)\s*\=(?=(\w|"))/, '\1 = ')
#becker format
#not complete list but alot of the common ones.
x.sub!(/(\.each|\.collect[!]*|\.map[!]*|\.delete_if|\.sort[!]*|\.each_[pair|key|value|byte|with_index|line|option]|\.reject[!]*|\.reverse_each|\.detect|\.find[_all]*|\.select|\.module_eval|\.all_waits|loop|proc|lambda|fork|at_exit)\s*\{/, '\1 {')
x.sub!(/def\s(\w*)?(\(.*?\))/, 'def \1\2') if x.match(/def\s+?(\w*)?\(.*?\)/)
x.sub!(/^for\s+(\w*)?\s+in\s+?(.*)$/, 'for \1 in \2') if x.match(/^for\s+(\w*)?\s*?in\s*?(.*)$/)
x.gsub!(/(\w)\=>\s*(?=(\w|"|:))/, '\1 => ')
x.gsub!(/(\w)\s*\=>(?=(\w|"|:))/, '\1 => ')
x.strip!
x.gsub!($escape_strings[:string]) {
strings.shift
}
x.gsub!($escape_strings[:regex], "\\\/")
return x
end
JUST_STRING_PLEASE_RX = /\/.*\/|"([^"])*" | '([^']) * '|#.*/
def just_the_string_please(org_string)
string = String.new(org_string)
#remove escaped chars
string.gsub!(/\\\/|\\"|\\'/, "")
string.gsub!(JUST_STRING_PLEASE_RX, "")
string = string.strip
string.sub!(/\b(return|if|while|case|catch)\s*\(/, '\1 (')
puts "clean string: #{string}" if ::DEBUG_ME
string
end
ONE_LINER_RX = /(unless|if).*(then).*end|(begin).*(rescue|ensure|else).*end/
def one_liner?(string)
return true if string.match(ONE_LINER_RX)
false
end
array_loc.each {|file_loc|
f = File.open(file_loc, "r")
text = f.read
f.close
if File.expand_path(file_loc) == File.expand_path($0)
$escape_strings = {:regex=>"EsCaPedReGex#{rand(200)}",:string=>"EsCaPeDStRiNg#{rand(200)}"}
end
new_text = ""
current_depth = 0
spaces = " " * space_count if space_count
here_doc_ending = nil
indenter = spaces || "\t"
temp_depth = nil
line_count = 1
text.split("\n").each { |x|
#comments
#The first idea was to leave them alone.
#after running a few test i did not like the way it looked
if temp_depth
puts "In temp_depth #{x} line ♯ #{line_count} here:#{here_doc_ending}" if ::DEBUG_ME
new_text << x << "\n"
#block comments, its going to get ugly
if !x.lstrip.scan(/^\=end/).empty? || (here_doc_ending && x.strip == here_doc_ending.strip)
#swap and set
puts "swap and set #{x} line # #{line_count}" if ::DEBUG_ME
current_depth = temp_depth
temp_depth = nil
here_doc_ending = nil
end
line_count += 1
next
end
#block will always be 0 depth
#block comments, its going to get ugly
unless x.lstrip.scan(/^\=begin/).empty?
#swap and set
puts "Looking for begin #{x} #{line_count}" if ::DEBUG_ME
temp_depth = current_depth
current_depth = 0
end
#here docs have same type of logic for block comments
unless x.lstrip.scan(/<<-/).empty?
#swap and set
here_doc_ending = x.lstrip.split(/<<-/).last.strip
temp_depth = current_depth
end
#whats the first word?
text_node = x.split.first || ""
just_string = just_the_string_please(x)
in_both = in_both?(text_node)
one_liner = one_liner?(just_string)
#check if its in end or both and that the current_depth is >0
#maybe i should raise if it goes negative ?
puts "minus one #{line_count} #{x} statement:#{(check_ends?(just_string) || in_both) && current_depth > 0} check_ends:#{check_ends?(just_string)} in_both:#{in_both} current_depth:#{ current_depth }" if ::DEBUG_ME
if (check_ends?(just_string) || in_both) && !one_liner
puts "We have a Negative depth count. This was caused around line:#{line_count}\nCheck for if( it should be if (" if current_depth == 0
current_depth -= 1 unless current_depth == 0
end
clean_string = line_clean_up(x)
current_indent = clean_string.size>0 ? indenter*current_depth : ""
new_text << current_indent << clean_string << "\n"
#we want to kick the indent out one
# x.match(/(unless|if).*(then).*end/): we use this match one liners for if statements not one-line blocks
# in_outs? returns true if the first work is in the out array
# in_both? does the same for the both array
# start_block looks for to not have an end at the end and {.count > }.count and if the word do is in there
# temp_depth is used when we hit the = comments should be nil unless you are in a comment
puts "plus one match:#{line_count} #{x} not a one liner:#{!(one_liner)} or statements:#{(in_outs?(text_node) || in_both?(text_node) || start_block?(x))} in_outs#{in_outs?(text_node)} in_both:#{ in_both?(text_node)} start_block:#{ start_block?(x)} temp_depth:#{temp_depth}" if ::DEBUG_ME
current_depth += 1 if ((in_outs?(text_node) || start_block?(just_string) || in_both || x.lstrip.slice(/\w*\s=\s(unless|if|case)/)) && !one_liner && !temp_depth)
line_count += 1
}
FileUtils.cp("#{file_loc}","#{file_loc}.bk.#{Time.now.to_s.gsub(/\s|:/,"_")}") if backup
f = File.open("#{file_loc}","w+")
f.puts new_text
f.close
puts "Done!"
}

@ -0,0 +1,46 @@
#!/usr/bin/awk -f
# SOLARIS USERS: Change "awk" to "nawk", above!!!
# This is part of Phil's AWK tutorial at http://www.bolthole.com/AWK.html
# This program adjusts the indentation level based on which keywords are
# found in each line it encounters.
#
# THIS IS A (relatively) COMPLEX PROGRAM. If you're an AWK rookie,
# go back and read the tutorial before trying to understand this program!
# This program shows off awk functions, variables, and its ability to
# perform multiple actions for the same line
function doindent(){
tmpindent=indent;
if(indent<0){
print "ERROR; indent level == " indent
}
while(tmpindent >0){
printf(" ");
tmpindent-=1;
}
}
$1 == "done" { indent -=1; }
$1 == "fi" { indent -=1; }
$0 ~ /}/ { if(indent!=0) indent-=1; }
# This is the 'default' action, that actually prints a line out.
# This gets called AS WELL AS any other matching clause, in the
# order they appear in this program.
# An "if" match is run AFTER we run this clause.
# A "done" match is run BEFORE we run this clause.
{
doindent();
print $0;
}
$0 ~ /if.*;[ ]*then/ { indent+=1; }
$0 ~ /for.*;[ ]*do/ { indent+=1; }
$0 ~ /while.*;[ ]*do/ { indent+=1; }
$1 == "then" { indent+=1; }
$1 == "do" { indent+=1; }
$0 ~ /{$/ { indent+=1; }

@ -0,0 +1,543 @@
[header]
categories="Cobol Beautifier|Renumbering|Generic Reporting|Cobol Dialects|Extra Features|Copy Libraries|Parser Messages|Length and Offset|PrettyPrint Basics|PrettyPrint Indentation|Output Comments|Line Identification"
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.cbl|*.cob
indenterFileName=cbl-beau.exe
indenterName=Cobol Beautifier (Cobol)
inputFileName=indentinput
inputFileParameter=" "
manual=http://www.siber.com/sct/tools/cbl-beau.html
outputFileName=indentoutput
outputFileParameter="-gen-file="
parameterOrder=ipo
showHelpParameter="-help"
stringparaminquotes=false
useCfgFileParameter=
version=1.0
[Add value clause]
Category=0
Description="<html>Add VALUE clauses to WS data items that have no VALUE clause</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-add-value-clause|"
[Norm dd levels]
Category=0
Description="<html>Normalize data item level numbers</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-norm-dd-levels|"
[Add end stmts]
Category=0
Description="<html>Add END-IF, END-SEARCH, END-EVALUATE, END-PERFORM closing statements</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-add-end-stmts|"
[Section name fmt]
CallName="-section-name-fmt="
Category=1
Description="<html>Section name format, smth like T1%dT2%sT3</html>"
EditorType=string
Enabled=false
ValueDefault="T1%dT2%sT3"
[Section name start]
CallName="-section-name-start="
Category=1
Description="<html>Start value for number in section name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Section name step]
CallName="-section-name-step="
Category=1
Description="<html>Step for number in section name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Para name fmt]
CallName="-para-name-fmt="
Category=1
Description="<html>Paragraph name format, smth like T1%dT2%sT3</html>"
EditorType=string
Enabled=false
ValueDefault="T1%dT2%sT3"
[Para name start]
CallName="-para-name-start="
Category=1
Description="<html>Start value for counter in paragraph name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Para name step]
CallName="-para-name-step="
Category=1
Description="<html>Step for counter in paragraph name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Data name fmt]
CallName="-data-name-fmt="
Category=1
Description="<html>Data name format, smth like T1%dT2%sT3</html>"
EditorType=string
Enabled=false
ValueDefault="T1%dT2%sT3"
[Data name start]
CallName="-data-name-start="
Category=1
Description="<html>Start value for number in data name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Data name step]
CallName="-data-name-step="
Category=1
Description="<html>Step for number in data name</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=1
[Conv warn]
Category=2
Description="<html>Warn about transformation problems</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-conv-warn|-no-conv-warn"
[Conv info]
Category=2
Description="<html>Inform about every transformation performed</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-conv-info|-no-conv-info"
[Conv list]
Category=2
Description="<html>List all transformations applied</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-conv-list|-no-conv-list"
[Find only]
Category=2
Description="<html>Only list potential transformations, do not execute them</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-find-only|-no-find-only"
[Silent]
Category=2
Description="<html>Do not print short summary of the conversion</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-silent|-no-silent"
[Primary Cobol dialect]
Category=3
Description="<html>Set the primary Cobol dialect</html>"
ValueDefault=1
Enabled=false
EditorType=multiple
Choices="-lang=ansi74|-lang=ansi85|-lang=osvs|-lang=vsii|-lang=saa|-lang=xopen|-lang=mf|-lang=ms|-lang=rm|-lang=rm85|-lang=dosvs|-lang=univac|-lang=wang|-lang=fsc|-lang=net|-lang=fscnet|-lang=icobol|-lang=acu|-lang=dml|-lang=idms"
ChoicesReadable="Ansi 74|Ansi 85|OSVS|VSII|SAA|XOpen|MF|MS|RM|RM 85|DOSVS|UniVAC|Wang|FSC|Net|FSCnet|iCobol|ACU|DML|IDMS"
[Secondary Cobol dialect]
Category=3
Description="<html>Set the secondary Cobol dialect</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-lang2=ansi74|-lang2=ansi85|-lang2=osvs|-lang2=vsii|-lang2=saa|-lang2=xopen|-lang2=mf|-lang2=ms|-lang2=rm|-lang2=rm85|-lang2=dosvs|-lang2=univac|-lang2=wang|-lang2=fsc|-lang2=net|-lang2=fscnet|-lang2=icobol|-lang2=acu|-lang2=dml|-lang2=idms"
ChoicesReadable="Ansi 74|Ansi 85|OSVS|VSII|SAA|XOpen|MF|MS|RM|RM 85|DOSVS|UniVAC|Wang|FSC|Net|FSCnet|iCobol|ACU|DML|IDMS"
[Line format]
Category=3
Description="<html>Set the secondary Cobol dialect</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-line-format=dial|-line-format=fixed|-line-format=free|-line-format=fsc-free|-line-format=var"
ChoicesReadable="Dial|fixed|free|FSC free|var"
[Progid comments]
Category=3
Description="<html>Allow Program-Id line comments</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-progid-comments|-no-progid-comments"
[Separators follow spaces]
Category=3
Description="<html>Separators must be followed by spaces</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-sep-space-reqd=dial|-sep-space-reqd=no|-sep-space-reqd=yes"
ChoicesReadable="Dial|No|Yes"
[Exclude keywords]
CallName="-exclude-keywords="
Category=3
Description="<html>Excluded keywords (separated by spaces?)</html>"
EditorType=string
Enabled=false
ValueDefault=""
[Set constants]
CallName="-set-constants="
Category=4
Description="<html>78 constant settings, strings: name'value', numbers: name(value)</html>"
EditorType=string
Enabled=false
ValueDefault=""
[Assign external]
Category=4
Description="<html>Assume that undefined data items in ASSIGN TO are external</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-assign-external|-no-assign-external"
[SQL]
Category=4
Description="<html>Parse SQL in EXEC SQL</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-sql|-no-sql"
[CICS]
Category=4
Description="<html>Parse CICS statements embedded in EXEC CICS ... END-EXEC</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-cics|-no-cics"
[CICS EIB]
Category=4
Description="<html>Add CICS EIB data block to LINKAGE SECTION</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-cics-eib=auto|-cics-eib=no|-cics-eib=yes"
ChoicesReadable="Auto|No|Yes"
[Copylib dir]
CallName="-copylib-dir="
Category=5
Description="<html>Copylib directories path</html>"
EditorType=string
Enabled=false
ValueDefault="."
[Copylib suffix]
CallName="-copylib-sfx="
Category=5
Description="<html>Copylib files default suffix(es)</html>"
EditorType=string
Enabled=false
ValueDefault=".cpy"
[Copylib names]
Category=5
Description="<html>Add CICS EIB data block to LINKAGE SECTION</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-copynames-case=exact|-copynames-case=lower|-copynames-case=upper"
ChoicesReadable="Exact|Lower|Upper"
[Copylib old]
Category=5
Description="<html>Allow old 1968 Copy statements</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-old-copy|-no-old-copy"
[Copylib irreversibly]
Category=5
Description="<html>Inline copybooks irreversibly</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-irrev-inline|-no-irrev-inline"
[Warnings]
Category=6
Description="<html>Display Warnings</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-warnings|-no-warnings"
[Muli undef errors]
Category=6
Description="<html>Error message for every (OFF: only first) use of undefined name</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-multi-undefd-errs|-no-multi-undefd-errs"
[Same para data name]
Category=6
Description="<html>One name can be used both as paragraph-name and data-name</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-same-para-data-name=dial|-same-para-data-name=no|-same-para-data-name=yes"
ChoicesReadable="Dial|No|Yes"
[Lengths and offsets]
Category=7
Description="<html>Compute data item lengths and offsets</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-leng-offs|-no-leng-offs"
[Storage mode]
Category=7
Description="<html>Is Numeric Sign a Trailing Separate Character</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-lo-stor-mode=dial|-lo-stor-mode=no|-lo-stor-mode=yes"
ChoicesReadable="Dial|No|Yes"
[Numeric sign trailing separate]
Category=7
Description="<html>Is Numeric Sign a Trailing Separate Character</html>"
ValueDefault=0
Enabled=false
EditorType=multiple
Choices="-num-sign-trail-sep=dial|-num-sign-trail-sep=no|-num-sign-trail-sep=yes"
ChoicesReadable="Dial|No|Yes"
[Num sign EBCDIC]
Category=7
Description="<html>Is Numeric Sign an EBCDIC character</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-num-sign-ebcdic|-no-num-sign-ebcdic"
[Lo pointer size]
CallName="-lo-pointer-size="
Category=7
Description="<html>Memory model: Pointer size</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=4
[Lo proc pointer size]
CallName="-lo-proc-pointer-size="
Category=7
Description="<html>Memory model: Procedure-Pointer size</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=4
[Lo index size]
CallName="-lo-index-size="
Category=7
Description="<html>Memory model: Index size</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=4
[Lo unfold flex arrays]
Category=7
Description="<html>Compute length of table with OCCURS DEPENDING ON based on upper bounds</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-lo-unfold-flex-arrays|-no-lo-unfold-flex-arrays"
[Progress]
Category=7
Description="<html>Display Parsing Progress Indicator</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-progress|-no-progress"
[Bailout level]
Category=7
Description="<html>Level of parser messages that cause bailout</html>"
ValueDefault=2
Enabled=false
EditorType=multiple
Choices="-bailout-level=warnings|-bailout-level=errors|-bailout-level=severe"
ChoicesReadable="Warnings|Errors|Severe"
[Stats]
Category=7
Description="<html>Print short source program statistics</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-stat|-no-stat"
[Genereate SourcePrint]
Category=8
Description="<html>Generate Cobol in SourcePrint (ON) / PrettyPrint(OFF) mode</html>"
ValueDefault=0
Enabled=false
EditorType=boolean
TrueFalse="-gen-src|-no-gen-src"
[Copybook dir]
CallName="-gen-copy-dir="
Category=8
Description="<html>Write copybooks to this directory</html>"
EditorType=string
Enabled=false
ValueDefault=""
[Indent size]
CallName="-gen-indent-step="
Category=9
Description="<html>Indentation step</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=2
[Indent max]
CallName="-gen-max-indent="
Category=9
Description="<html>Maximum starting position for indented text</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=40
[Tabs]
CallName="-gen-tabs="
Category=9
Description="<html>Tabulation Positions</html>"
EditorType=string
Enabled=false
ValueDefault="12,24,32,42,44,54"
[Line format]
Category=9
Description="<html>Generated line format</html>"
ValueDefault=1
Enabled=false
EditorType=multiple
Choices="-gen-line-format=na|-gen-line-format=fixed|-gen-line-format=free|-gen-line-format=fsc-free|-gen-line-format=var"
ChoicesReadable="Na|Fixed|Free|FSC-free|Var"
[Observe rules]
Category=9
Description="<html>Observe Area A/B rules in generated code</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-gen-observe-ab-rules |-no-gen-observe-ab-rules "
[Preserve comments]
Category=10
Description="<html>Preserve comments</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-gen-print-comments |-no-gen-print-comments "
[Enter Exit comments]
Category=10
Description="<html>Generate Enter/Exit comments around inlined copybooks</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-gen-enter-exit-copy-comments|-no-gen-enter-exit-copy-comments"
[Preserve line IDs]
Category=11
Description="<html>Preserve original Line IDs (cols 1-6, 73-80)</html>"
ValueDefault=1
Enabled=true
EditorType=boolean
TrueFalse="-gen-line-id-comments|-no-gen-line-id-comments"
[Put text 73-80]
CallName="-gen-73to80-fmt="
Category=11
Description="<html>Put text of this format into columns 73 to 80</html>"
EditorType=string
Enabled=false
ValueDefault=""
[Start number 73-80]
CallName="-gen-73to80-start="
Category=11
Description="<html>Start value for number put into columns 73 to 80</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=1
[Step number 73-80]
CallName="-gen-73to80-step="
Category=11
Description="<html>Step for number put into columns 73 to 80</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=1
ValueDefault=1
[Convert comments]
CallName="-gen-mark-conv="
Category=11
Description="<html>Add comment in columns 73 and up that show that line was changed or generated</html>"
EditorType=string
Enabled=false
ValueDefault=""

@ -0,0 +1,321 @@
[header]
categories=Predefined Style|Tab and Bracket|Indentation|Padding|Formatting|Other
cfgFileParameterEnding=cr
configFilename=.astylerc
fileTypes=*.cpp|*.c|*.cu|*.h|*.hpp|*.inl|*.hh|*.cs|*.java
indenterFileName=astyle
indenterName=Artistic Style (C, C++, C#, JAVA)
inputFileName=indentinput
inputFileParameter=
manual=http://astyle.sourceforge.net/astyle.html
outputFileName=indentinput
outputFileParameter=none
parameterOrder=ipo
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter="--options="
version=2.02.1
[predefined style]
Category=0
Choices="-A1|-A2|-A3|-A4|-A5|-A6|-A7|-A8|-A9|-A10|-A11|-A12"
ChoicesReadable="Allman/Ansi/BSD/break style|Java/attach style|Kernighan & Ritchie style|Stroustrup style|Whitesmith style|Banner style|GNU style|Linux style|Horstmann style|One True Brace Style|Pico style|Lisp/Python style"
Description=<html>Sets the general style.</html>
EditorType=multiple
Enabled=false
ValueDefault=2
[indent spaces]
CallName="--indent=spaces="
Category=1
Description=<html>Indent using # spaces per indent</html>
EditorType=numeric
Enabled=false
MaxVal=20
MinVal=2
ValueDefault=4
[indent tab]
CallName="--indent=tab="
Category=1
Description=<html>Indent using tab characters. Treat each tab as # spaces</html>
EditorType=numeric
Enabled=false
MaxVal=20
MinVal=2
ValueDefault=4
[force indent tab]
CallName="--indent=force-tab="
Category=1
Description="<html>Indent using tab characters. Treat each tab as # spaces. Uses tabs as indents where --indent=tab prefers to use spaces such as inside multi-line statements. </html>"
EditorType=numeric
Enabled=false
MaxVal=20
MinVal=2
ValueDefault=4
[bracket style]
Category=1
Choices="--brackets=break|--brackets=attach|--brackets=linux|--brackets=stroustrup|--brackets=horstmann"
ChoicesReadable=Break brackets|Attach brackets|Break brackets Linux like
Description=<html>Sets the bracket style.</html>
EditorType=multiple
Enabled=false
ValueDefault=0
[indent classes]
Category=2
Description=<html>Indent 'class' and 'struct' blocks so that the blocks 'public:', 'protected:' and 'private:' are indented. The struct blocks are indented only if an access modifier is declared somewhere in the struct. The entire block is indented. This option is effective for C++ files only.</html>
EditorType=boolean
TrueFalse=--indent-classes|
ValueDefault=0
[indent switches]
Category=2
Description=<html>Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block. The entire case block is indented.</html>
EditorType=boolean
TrueFalse=--indent-switches|
ValueDefault=0
[indent cases]
Category=2
Description=<html>Indent 'case X:' blocks from the 'case X:' headers. Case statements not enclosed in blocks are NOT indented.</html>
EditorType=boolean
TrueFalse=--indent-cases|
ValueDefault=0
[indent brackets]
Category=2
Description=<html>Add extra indentation to brackets. This is the option used for Whitesmith and Banner style formatting/indenting. If both indentbrackets and indentblocks are used the result will be indentblocks. This option will be ignored if used with a predefined style.</html>
EditorType=boolean
TrueFalse=--indent-brackets|
ValueDefault=0
[indent blocks]
Category=2
Description=<html>Add extra indentation to blocks within a function. The opening bracket for namespaces, classes, and functions is not indented. This is the option used for GNU style formatting/indenting. This option will be ignored if used with a predefined style.</html>
EditorType=boolean
TrueFalse=--indent-blocks|
ValueDefault=0
[indent namespaces]
Category=2
Description=<html>Add extra indentation to namespaces.</html>
EditorType=boolean
TrueFalse=--indent-namespaces|
ValueDefault=0
[indent labels]
Category=2
Description=<html>Add extra indentation to labels so they appear 1 indent less than the current indentation, rather than being flushed to the left (the default).</html>
EditorType=boolean
TrueFalse=--indent-labels|
ValueDefault=0
[indent preprocessor]
Category=2
Description=<html>Indent multi-line preprocessor definitions. Should be used with --convert-tabs for proper results. Does a pretty good job but can not perform miracles in obfuscated preprocessor definitions. Without this option the preprocessor statements remain unchanged.</html>
EditorType=boolean
TrueFalse=--indent-preprocessor|
ValueDefault=0
[indent comments]
Category=2
Description=<html>Indent C++ comments beginning in column one. By default C++ comments beginning in column one are not indented. This option will allow the comments to be indented with the code. </html>
EditorType=boolean
TrueFalse=--indent-col1-comments|
ValueDefault=0
[max-instatement-indent]
CallName="--max-instatement-indent="
Category=2
Description=<html>Indent a maximum of # spaces in a continuous statement, relative to the previous line (e.g. maxinstatementindent=40). # must be less than 80. If no # is set, the default value of 40 will be used. A maximum of less than two indent lengths will be ignored.</html>
EditorType=numeric
Enabled=false
MaxVal=79
MinVal=0
ValueDefault=40
[min-conditional-indent]
CallName="--min-conditional-indent="
Category=2
Description=<html>Set the minimal indent that is added when a header is built of multiple-lines. This indent makes helps to easily separate the header from the command statements that follow. The value for # must be less than 40. The default setting for this option is twice the current indent (e.g. --min-conditional-indent=8).</html>
EditorType=numeric
Enabled=false
MaxVal=39
MinVal=0
ValueDefault=8
[break-blocks]
Category=3
Description=<html>Pad empty lines around header blocks (e.g. 'if' 'while'...). Be sure to read the Supplemental Documentation before using this option.</html>
EditorType=boolean
TrueFalse=--break-blocks|
ValueDefault=0
[break-blocks-all]
Category=3
Description=<html>Pad empty lines around header blocks (e.g. 'if' 'while'...). Treat closing header blocks (e.g. 'else' 'catch') as stand-alone blocks. Be sure to read the Supplemental Documentation before using this option.</html>
EditorType=boolean
TrueFalse="--break-blocks=all|"
ValueDefault=0
[pad-oper]
Category=3
Description=<html>Insert space padding around operators. Operators inside brackets [] are not padded. Note that there is no option to unpad. Once padded they stay padded.</html>
EditorType=boolean
TrueFalse="--pad-oper|"
ValueDefault=0
[pad-paren]
Category=3
Description=<html>Insert space padding around parenthesis on both the outside and the inside. Any end of line comments will remain in the original column, if possible.</html>
EditorType=boolean
TrueFalse="--pad-paren|"
ValueDefault=0
[pad-paren-out]
Category=3
Description=<html>Insert space padding around parenthesis on the outside only. Any end of line comments will remain in the original column, if possible. This can be used with unpad-paren below to remove unwanted spaces.</html>
EditorType=boolean
TrueFalse="--pad-paren-out|"
ValueDefault=0
[pad-paren-in]
Category=3
Description="<html>Insert space padding around parenthesis on the inside only. Any end of line comments will remain in the original column, if possible. This can be used with unpad-paren below to remove unwanted spaces.</html>"
EditorType=boolean
TrueFalse="--pad-paren-in|"
ValueDefault=0
[pad-header]
Category=3
Description=<html>Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...). Any end of line comments will remain in the original column, if possible. This can be used with unpad-paren to remove unwanted spaces.</html>
EditorType=boolean
TrueFalse=--pad-header|
ValueDefault=0
[unpad-paren]
Category=3
Description="<html>Remove extra space padding around parenthesis on the inside and outside. Any end of line comments will remain in the original column, if possible. This option can be used in combination with the paren padding options padparen, padparenout, padparenin, and padheader above. Only padding that has not been requested by other options will be removed.</html>"
EditorType=boolean
TrueFalse="--unpad-paren|"
ValueDefault=0
[delete-empty-lines]
Category=3
Description=<html>Delete empty lines within a function or method. Empty lines outside of functions or methods are NOT deleted. If used with break-blocks or break-blocks=all it will delete all lines EXCEPT the lines added by the break-blocks options.</html>
EditorType=boolean
TrueFalse=--delete-empty-lines|
ValueDefault=0
[fill-empty-lines]
Category=3
Description=<html>Fill empty lines with the white space of the previous line</html>
EditorType=boolean
TrueFalse=--fill-empty-lines|
ValueDefault=0
[brackets-break-closing]
Category=4
Description=<html>When used with --brackets=attach, --brackets=linux, or --brackets=stroustrup, this breaks closing headers (e.g. 'else', 'catch', ...) from their immediately preceding closing brackets. Closing header brackets are always broken with broken brackets, horstmann brackets, indented blocks, and indented brackets.</html>
EditorType=boolean
TrueFalse="-y|"
ValueDefault=0
[break-elseifs]
Category=4
Description=<html>Break "else if" header combinations into separate lines. This option has no effect if keep-one-line-statements is used, the "else if" statements will remain as they are. If this option is NOT used, "else if" header combinations will be placed on a single line.</html>
EditorType=boolean
TrueFalse=--break-elseifs|
ValueDefault=0
[add-brackets]
Category=4
Description=<html>Add brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...). The statement must be on a single line. The brackets will be added according to the currently requested predefined style or bracket type. If no style or bracket type is requested the brackets will be attached. If --add-one-line-brackets is also used the result will be one line brackets.</html>
EditorType=boolean
TrueFalse=--add-brackets|
ValueDefault=0
[add-one-line-brackets]
Category=4
Description=<html>Add one line brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...). The statement must be on a single line. The option implies --keep-one-line-blocks and will not break the one line blocks.</html>
EditorType=boolean
TrueFalse=--add-one-line-brackets|
ValueDefault=0
[one-line-keep-blocks]
Category=4
Description=<html>Don't break one-line blocks</html>
EditorType=boolean
TrueFalse="--keep-one-line-blocks|"
ValueDefault=0
[one-line-keep-statements]
Category=4
Description=<html>Dont break complex statements and multiple statements residing on a single line.</html>
EditorType=boolean
TrueFalse="--keep-one-line-statements|"
ValueDefault=0
[convert-tabs]
Category=4
Description=<html>Converts tabs into spaces in the non-indentation part of the line. The number of spaces inserted will maintain the spacing of the tab. The current setting for spaces per tab is used. It may not produce the expected results if convert-tabs is used when changing spaces per tab. Tabs are not replaced in quotes.</html>
EditorType=boolean
TrueFalse=--convert-tabs|
ValueDefault=0
[align-pointer]
Category=4
Choices="--align-pointer=type|--align-pointer=middle|--align-pointer=name"
Description=<html>Attach a pointer or reference operator (* or &) to either the variable type (left) or variable name (right), or place it between the type and name. The spacing between the type and name will be preserved, if possible. This option is effective for C/C++ files only.</html>
EditorType=multiple
Enabled=false
ValueDefault=0
[align-reference]
Category=4
Choices="--align-reference=type|--align-reference=middle|--align-reference=name"
Description=<html>This option will align references separate from pointers. Pointers are not changed by this option. If pointers and references are to be aligned the same, use the previous align-pointer option. The option align-reference=none will not change the reference alignment. The other options are the same as for align-pointer. In the case of a reference to a pointer (*&) with conflicting alignments, the align-pointer value will be used.</html>
EditorType=multiple
Enabled=false
ValueDefault=0
[override-language]
Category=4
Choices="--mode=c|--mode=java|--mode=cs"
Description=<html>Indent a C or C++ or Java or CSharp file. The option is set from the file extension for each file. You can override the setting with this entry. It allows the formatter to identify language specific syntax such as C classes and C templates.</html>
EditorType=multiple
Enabled=false
ValueDefault=0
[nosuffix]
Category=5
Description=<html>Do not retain a backup of the original file. The original file is purged after it is formatted.</html>
EditorType=boolean
TrueFalse=--suffix=none|
ValueDefault=0
[errors-to-stdout]
Category=5
Description=<html>Print errors to standard-output rather than to standard-error.
This option should be helpful for systems/shells that do not have this option, such as in Windows95.</html>
EditorType=boolean
TrueFalse=--errors-to-stdout|
ValueDefault=0
[preserve-date]
Category=5
Description=<html>Preserve the original file's date and time modified. The date and time modified will not be changed in the formatted file. This option is not effective if redirection is used to rename the input file.</html>
EditorType=boolean
TrueFalse=--preserve-date|
ValueDefault=0
[lineend]
Category=5
Choices="--lineend=windows|--lineend=linux|--lineend=macold"
Description=<html>orce use of the specified line end style. Valid options are windows (CRLF), linux (LF), and macold (CR). MacOld style is the format for OS 9 and earlier. Mac OS X uses the Linux style. If one of these options is not used the line ends will be determined automatically from the input file.</html>
EditorType=multiple
Enabled=false
ValueDefault=0

@ -0,0 +1,144 @@
[header]
categories=Indentation|Comments|General
cfgFileParameterEnding=cr
configFilename=bcpp.cfg
fileTypes=*.cpp|*.c|*.h|*.hpp
indenterFileName=bcpp
indenterName=BCPP (C, C++)
inputFileName=indentinput
inputFileParameter="-fi "
manual=http://universalindent.sf.net/indentermanuals/bcpp.txt
outputFileName=indentoutput
outputFileParameter="-fo "
parameterOrder=ipo
showHelpParameter=qxyz
stringparaminquotes=false
useCfgFileParameter="-fnc "
version=2009-06-30
[Ascii_Chars_Only]
Category=2
Description=<html>Setting this parameter to yes will strip any non-printable non-ASCII characters from the input file. Any non-printable characters that lie within quotes will be transformed into octal/character notation if NonAscii_Quotes_To_Octal is set to True. Comment out this parameter if you are using Leave_Graphic_Chars parameter as this parameter will override it.</html>
EditorType=boolean
TrueFalse="ascii_chars_only=yes|ascii_chars_only=no"
ValueDefault=1
[Backup_File]
Category=2
Description=<html>This option will backup the input file to a file with the extension .bac and overwrite the input file with the reformatted version.</html>
EditorType=boolean
TrueFalse="backup_file=yes|backup_file=no"
ValueDefault=0
[Comments_With_Code]
CallName="comments_with_code="
Category=1
Description=<html>Defines the column in which comments that appear after code on a line will be placed.</html>
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=50
[Comments_With_Nocode]
CallName="comments_with_nocode="
Category=1
Description=<html>Defines the column in which comments that appear in a line will be placed.</html>
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=0
[Function_Spacing]
CallName="function_spacing="
Category=0
Description=<html>This parameter specifies how many lines separate two functions.</html>
EditorType=numeric
Enabled=false
MaxVal=99
MinVal=0
ValueDefault=2
[Indent_Exec_Sql]
Category=0
Description=<html>If true bcpp looks for embedded SQL statements (e.g. EXEC SQL) and formats them specially.</html>
EditorType=boolean
TrueFalse="indent_exec_sql=yes|indent_exec_sql=no"
ValueDefault=0
[Indent_Preprocessor]
Category=0
Description=<html>If true bcpp will indent preprocessor lines to the indention of the C(++) code. If false preprocessor lines will be in the first column. Unrecognized (i.e. nonstandard) preprocessor lines are always put into the first column.</html>
EditorType=boolean
TrueFalse="indent_preprocessor=yes|indent_preprocessor=no"
ValueDefault=0
[Indent_Spacing]
CallName="indent_spacing="
Category=0
Description=<html>Specifies how many spaces to indent. This parameter also sets the width of tabs. Bcpp considers the width of a tab to be the same as the width of an indent.</html>
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=4
[Keep_Comments_With_Code]
Category=1
Description=<html>This option overrides the "Comments_With_Code" option. Setting this option On will make comments which do not fit as inline comments append to the code anyway. </html>
EditorType=boolean
TrueFalse="keep_comments_with_code=yes|keep_comments_with_code=no"
ValueDefault=0
[Leave_Comments_NoCode]
Category=1
Description=<html>This options overrides the Comments_With_Nocodeoption. Setting this option On will indent comments that do not occur on the same line as code to the same indention as code. </html>
EditorType=boolean
TrueFalse="leave_comments_nocode=yes|leave_comments_nocode=no"
ValueDefault=0
[Leave_Graphic_Chars]
Category=2
Description=<html>Setting this parameter to yes will strip non-printable characters from the source file but leave any characters that are IBM graphics alone. Any non-printable characters that lie within quotes will be transformed into octal/character notation if NonAscii_Quotes_To_Octal parameter is set to True.</html>
EditorType=boolean
TrueFalse="leave_graphic_chars=yes|leave_graphic_chars=no"
ValueDefault=1
[NonAscii_Quotes_To_Octal]
Category=2
Description=<html>se this option to change non-ASCII (non-printable) chars to octal notation if they lie within quotes. This parameter doesn't take effect unless either the Ascii_Chars_Only or Leave_Graphic_Chars parameters have been set.</html>
EditorType=boolean
TrueFalse="nonascii_quotes_to_octal=yes|nonascii_quotes_to_octal=no"
ValueDefault=0
[Place_Brace_On_New_Line]
Category=0
Description=<html>When set to 'on' bcpp will place opening braces on new lines (Pascalstyle C coding) when set to 'off' bcpp will use K&Rstyle C coding.</html>
EditorType=boolean
TrueFalse="place_brace_on_new_line=yes|place_brace_on_new_line=no"
ValueDefault=1
[Program_Output]
Category=2
Description=<html>This parameter will stop output from the program corrupting output that may exit from the program via the standard output. If this parameter is set to off/no then no output is generated from the program unless an error is encountered. The standard error is used to display any errors encountered while processing.</html>
EditorType=boolean
TrueFalse="program_output=yes|program_output=no"
ValueDefault=0
[Queue_Buffer]
CallName="queue_buffer="
Category=2
Description=<html>Specifies what the internal memory requires will be in size of the line processing buffer. This is used for open brace relocation in Kernighan/Ritchie style. Extending this buffer to large amounts of memory will slow processing on small machines.</html>
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=2
[Use_Tabs]
Category=0
Description=<html>Specifies whether to use tabs in indenting code.</html>
EditorType=boolean
TrueFalse="use_tabs=yes|use_tabs=no"
ValueDefault=0

@ -0,0 +1,119 @@
[header]
categories=General
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.css
indenterFileName=csstidy
indenterName=CSSTidy (CSS)
inputFileName=indentinput
inputFileParameter=
manual=http://csstidy.sourceforge.net/usage.php
outputFileName=indentoutput
outputFileParameter=
parameterOrder=ipo
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=1.3
[Add Timestamp]
Category=0
Description=<html>Add Timestamp.</html>
EditorType=boolean
TrueFalse="--timestamp=true|--timestamp=false"
ValueDefault=0
[Allow HTML in templates]
Category=0
Description=<html>Allow HTML in templates.</html>
EditorType=boolean
TrueFalse="--allow_html_in_templates=true|--allow_html_in_templates=false"
ValueDefault=1
[Case for properties]
Category=0
Choices="--case_properties=0|--case_properties=1|--case_properties=2"
Description=<html><pre> 0 - None.<br> 1 - Lowercase.<br> 2 - Uppercase.</pre></html>
EditorType=multiple
Enabled=false
ValueDefault=1
[Compress colors]
Category=0
Description=<html>Compress colors.</html>
EditorType=boolean
TrueFalse="--compress_colors=true|--compress_colors=false"
ValueDefault=1
[Compress font-weight]
Category=0
Description=<html>Compress font weight.</html>
EditorType=boolean
TrueFalse="--compress_font=true|--compress_font=false"
ValueDefault=1
[Lowercase selectors]
Category=0
Description=<html>Lowercase selectors names needed for XHTML.</html>
EditorType=boolean
TrueFalse="--lowercase_s=true|--lowercase_s=false"
ValueDefault=0
[Optimise shorthands]
Category=0
Choices="--optimise_shorthands=0|--optimise_shorthands=1|--optimise_shorthands=2"
Description=<html><pre> 0 - Do not optimise.<br> 1 - Safe optimisations.<br> 2 - All optimisations.</pre></html>
EditorType=multiple
Enabled=false
ValueDefault=1
[Preserve CSS]
Category=0
Description="<html>Save comments, hacks, etc.<br>Most optimisations can NOT be applied if this is enabled.</html>"
EditorType=boolean
TrueFalse="--preserve_css=true|--preserve_css=false"
ValueDefault=0
[Regroup selectors]
Category=0
Choices="--merge_selectors=0|--merge_selectors=1|--merge_selectors=2"
Description="<html><pre> 0 - Do not change anything<br> 1 - Only seperate selectors (split at , )<br> 2 - Merge selectors with the same properties (fast)</pre></html>"
EditorType=multiple
Enabled=false
ValueDefault=2
[Remove last semikolon]
Category=0
Description="<html>Remove last ;</html>"
EditorType=boolean
TrueFalse="--remove_last_;=true|--remove_last_;=false"
ValueDefault=0
[Remove unnecessary backslashes]
Category=0
Description=<html>Remove backslashes.</html>
EditorType=boolean
TrueFalse="--remove_bslash=true|--remove_bslash=false"
ValueDefault=1
[Sort properties]
Category=0
Description=<html>Sort properties.</html>
EditorType=boolean
TrueFalse="--sort_properties=true|--sort_properties=false"
ValueDefault=0
[Sort selectors %28caution%29]
Category=0
Description=<html><strong>Attention:</strong> This may change the behavior of your CSS code!</html>
EditorType=boolean
TrueFalse="--sort_selectors=true|--sort_selectors=false"
ValueDefault=0
[Template]
Category=0
Choices="--template=highest|--template=high|--template=default|--template=low"
Description="<html><pre> Highest - No readability, smallest size.<br> High - Moderate readability, smaller size.<br> Default - balance between readability and size.<br> Low - Higher readability.</pre></html>"
EditorType=multiple
Enabled=false
ValueDefault=2

@ -0,0 +1,17 @@
[header]
categories=
cfgFileParameterEnding=
configFilename=
fileTypes=*.f90
indenterFileName=f90ppr.exe
indenterName=Fortran 90 PPR (Fortran)
inputFileName=indentinput
inputFileParameter="< "
manual=ftp://ftp.ifremer.fr/ifremer/fortran90
outputFileName=
outputFileParameter=stdout
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=1.3

@ -0,0 +1,527 @@
[header]
categories=General|Blank lines|Comments|Statements|Declarations|Indentation|Breaking long lines
cfgFileParameterEnding=cr
configFilename=.indent.pro
fileTypes=*.c|*.h
indenterFileName=indent
indenterName=GNU Indent (C)
inputFileName=indentinput
inputFileParameter=
manual=http://universalindent.sf.net/indentermanuals/indent.html
outputFileName=indentoutput
outputFileParameter="-o "
parameterOrder=ipo
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter=none
version=2.2.9
[ANSI style formatting]
Category=0
Description=<html>original Berkeley indent</html>
EditorType=boolean
TrueFalse=-orig|
ValueDefault=0
[GNU style formatting]
Category=0
Description=<html>GNU style formatting/indenting.</html>
EditorType=boolean
TrueFalse=-gnu|
ValueDefault=0
[KR style formatting]
Category=0
Description=<html>Kernighan&Ritchie style formatting/indenting.</html>
EditorType=boolean
TrueFalse=-kr|
ValueDefault=0
[blank-before-sizeof]
Category=3
Description=<html>Put a space between sizeof and its argument.</html>
EditorType=boolean
TrueFalse=-bs|
ValueDefault=0
[blank-lines-after-commas]
Category=4
Description=<html>Force newline after comma in declaration.</html>
EditorType=boolean
TrueFalse=-bc|
ValueDefault=0
[blank-lines-after-declarations]
Category=1
Description=<html>The -bad option forces a blank line after every block of declarations.</html>
EditorType=boolean
TrueFalse=-bad|
ValueDefault=0
[blank-lines-after-procedures]
Category=1
Description=<html>The -bap option forces a blank line after every procedure body.</html>
EditorType=boolean
TrueFalse=-bap|
ValueDefault=0
[blank-lines-before-block-comments]
Category=1
Description=<html>Force blank lines before block comments.</html>
EditorType=boolean
TrueFalse=-bbb|
ValueDefault=0
[brace-indentn]
CallName=-bli
Category=3
Description=<html>Indent braces n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=3
[braces-after-if-line]
Category=3
Description="<html>Put braces on line after if, etc.</html>"
EditorType=boolean
TrueFalse=-bl|
ValueDefault=0
[braces-after-struct-decl-line]
Category=4
Description=<html>Put braces on the line after struct declaration lines.</html>
EditorType=boolean
TrueFalse=-bls|
ValueDefault=0
[braces-on-if-line]
Category=3
Description="<html>Put braces on line with if, etc.</html>"
EditorType=boolean
TrueFalse=-br|
ValueDefault=0
[braces-on-struct-decl-line]
Category=4
Description=<html>Put braces on struct declaration line.</html>
EditorType=boolean
TrueFalse=-brs|
ValueDefault=0
[break-after-boolean-operator]
Category=6
Description=<html>Do not prefer to break long lines before boolean operators.</html>
EditorType=boolean
TrueFalse=-nbbo|
ValueDefault=0
[break-before-boolean-operator]
Category=6
Description=<html>Prefer to break long lines before boolean operators.</html>
EditorType=boolean
TrueFalse=-bbo|
ValueDefault=0
[break-function-decl-args]
Category=4
Description=<html>Break the line after the last argument in a declaration.</html>
EditorType=boolean
TrueFalse=-bfde|
ValueDefault=0
[case-brace-indentationn]
CallName=-cbi
Category=3
Description=<html>Indent braces after a case label N spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[case-indentationn]
CallName=-cli
Category=3
Description=<html>Case label indent of n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[comment-delimiters-on-blank-lines]
Category=2
Description=<html>Put comment delimiters on blank lines.</html>
EditorType=boolean
TrueFalse=-cdb|
ValueDefault=0
[comment-indentationn]
CallName=-c
Category=2
Description=<html>Put comments to the right of code in column n.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=33
[comment-line-lengthn]
CallName=-lc
Category=2
Description=<html>Set maximum line length for comment formatting to n.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=1
ValueDefault=78
[continuation-indentationn]
CallName=-ci
Category=3
Description=<html>Continuation indent of n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[continue-at-parentheses]
Category=5
Description=<html>Line up continued lines at parentheses.</html>
EditorType=boolean
TrueFalse=-lp|
ValueDefault=0
[cuddle-do-while]
Category=2
Description="<html>Cuddle while of do {} while; and preceeding `}'.</html>"
EditorType=boolean
TrueFalse=-cdw|
ValueDefault=0
[cuddle-else]
Category=2
Description=<html>Cuddle else and preceeding `}'.</html>
EditorType=boolean
TrueFalse=-ce|
ValueDefault=0
[declaration-comment-columnn]
CallName=-cd
Category=2
Description=<html>Put comments to the right of the declarations in column n.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=33
[declaration-indentationn]
CallName=-di
Category=4
Description=<html>Put variables in column n.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[dont-break-function-decl-args]
Category=4
Description=<html>Don't put each argument in a function declaration on a seperate line.</html>
EditorType=boolean
TrueFalse=-nbfda|
ValueDefault=0
[dont-break-procedure-type]
Category=4
Description=<html>Put the type of a procedure on the same line as its name.</html>
EditorType=boolean
TrueFalse=-npsl|
ValueDefault=0
[dont-cuddle-do-while]
Category=3
Description="<html>Do not cuddle } and the while of a do {} while;.</html>"
EditorType=boolean
TrueFalse=-ncdw|
ValueDefault=0
[dont-cuddle-else]
Category=3
Description=<html>Do not cuddle } and else.</html>
EditorType=boolean
TrueFalse=-nce|
ValueDefault=0
[dont-line-up-parentheses]
Category=3
Description=<html>Do not line up parentheses.</html>
EditorType=boolean
TrueFalse=-nlp|
ValueDefault=0
[dont-space-special-semicolon]
Category=3
Description=<html>Do not force a space before the semicolon after certain statements. Disables `-ss'.</html>
EditorType=boolean
TrueFalse=-nss|
ValueDefault=0
[else-endif-columnn]
CallName=-cp
Category=2
Description=<html>Put comments to the right of #else and #endif statements in column n.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=33
[format-all-comments]
Category=2
Description=<html>Do not disable all formatting of comments.</html>
EditorType=boolean
TrueFalse=-fca|
ValueDefault=0
[format-first-column-comments]
Category=2
Description=<html>Format comments in the first column.</html>
EditorType=boolean
TrueFalse=-fc1|
ValueDefault=0
[honour-newlines]
Category=6
Description=<html>Prefer to break long lines at the position of newlines in the input.</html>
EditorType=boolean
TrueFalse=-hnl|
ValueDefault=0
[ignore-newlines]
Category=6
Description=<html>Do not prefer to break long lines at the position of newlines in the input.</html>
EditorType=boolean
TrueFalse=-nhnl|
ValueDefault=0
[indent-leveln]
CallName=-i
Category=5
Description=<html>Set indentation level to n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[leave-preprocessor-space]
Category=5
Description=<html>Leave space between `#' and preprocessor directive.</html>
EditorType=boolean
TrueFalse=-lps|
ValueDefault=0
[line-comments-indentationn]
CallName=-d
Category=2
Description=<html>Set indentation of comments not to the right of code to n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=33
[line-lengthn]
CallName=-l
Category=6
Description=<html>Set maximum line length for non-comment lines to n.</html>
EditorType=numeric
Enabled=false
MaxVal=220
MinVal=1
ValueDefault=120
[no-blank-lines-after-commas]
Category=4
Description=<html>Do not force newlines after commas in declarations.</html>
EditorType=boolean
TrueFalse=-nbc|
ValueDefault=0
[no-parameter-indentation]
Category=5
Description=<html>Zero width indentation for parameters.</html>
EditorType=boolean
TrueFalse=-nip|
ValueDefault=0
[no-space-after-casts]
Category=3
Description=<html>Do not put a space after cast operators.</html>
EditorType=boolean
TrueFalse=-ncs|
ValueDefault=0
[no-space-after-for]
Category=3
Description=<html>Do not put a space after every for.</html>
EditorType=boolean
TrueFalse=-nsaf|
ValueDefault=0
[no-space-after-function-call-names]
Category=3
Description=<html>Do not put space after the function in function calls.</html>
EditorType=boolean
TrueFalse=-npcs|
ValueDefault=0
[no-space-after-if]
Category=3
Description=<html>Do not put a space after every if.</html>
EditorType=boolean
TrueFalse=-nsai|
ValueDefault=0
[no-space-after-parentheses]
Category=3
Description=<html>Do not put a space after every '(' and before every ')'.</html>
EditorType=boolean
TrueFalse=-nprs|
ValueDefault=0
[no-space-after-while]
Category=3
Description=<html>Do not put a space after every while.</html>
EditorType=boolean
TrueFalse=-nsaw|
ValueDefault=0
[no-tabs]
Category=5
Description=<html>Use spaces instead of tabs.</html>
EditorType=boolean
TrueFalse=-nut|
ValueDefault=1
[parameter-indentationn]
CallName=-ip
Category=5
Description=<html>Indent parameter types in old-style function definitions by n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[paren-indentationn]
CallName=-pi
Category=3
Description=<html>Specify the extra indentation per open parentheses '(' when a statement is broken.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[procnames-start-lines]
Category=4
Description=<html>Put the type of a procedure on the line before its name.</html>
EditorType=boolean
TrueFalse=-psl|
ValueDefault=0
[space-after-cast]
Category=3
Description=<html>Put a space after a cast operator.</html>
EditorType=boolean
TrueFalse=-cs|
ValueDefault=0
[space-after-for]
Category=3
Description=<html>Put a space after each for.</html>
EditorType=boolean
TrueFalse=-saf|
ValueDefault=0
[space-after-if]
Category=3
Description=<html>Put a space after each if.</html>
EditorType=boolean
TrueFalse=-sai|
ValueDefault=0
[space-after-parentheses]
Category=3
Description=<html>Put a space after every '(' and before every ')'.</html>
EditorType=boolean
TrueFalse=-prs|
ValueDefault=0
[space-after-procedure-calls]
Category=3
Description=<html>Insert a space between the name of the procedure being called and the `('.</html>
EditorType=boolean
TrueFalse=-pcs|
ValueDefault=0
[space-after-while]
Category=3
Description=<html>Put a space after each while.</html>
EditorType=boolean
TrueFalse=-saw|
ValueDefault=0
[space-special-semicolon]
Category=3
Description="<html>On one-line for and while statements, force a blank before the semicolon.</html>"
EditorType=boolean
TrueFalse=-ss|
ValueDefault=0
[start-left-side-of-comments]
Category=2
Description=<html>Put the `*' character at the left of comments.</html>
EditorType=boolean
TrueFalse=-sc|
ValueDefault=0
[struct-brace-indentationn]
CallName=-sbi
Category=3
Description="<html>Indent braces of a struct, union or enum N spaces.</html>"
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[swallow-optional-blank-lines]
Category=1
Description=<html>The -sob option causes indent to swallow optional blank lines.</html>
EditorType=boolean
TrueFalse=-sob|
ValueDefault=0
[tab-sizen]
CallName=-ts
Category=5
Description=<html>Set tab size to n spaces.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[use-tabs]
Category=5
Description=<html>Use tabs.</html>
EditorType=boolean
TrueFalse=-ut|
ValueDefault=0

File diff suppressed because it is too large Load Diff

@ -0,0 +1,66 @@
[header]
categories=Basic Options
cfgFileParameterEnding=cr
configFilename=
fileTypes=*.htm|*.html|*.xhtml
indenterFileName=hindent
indenterName=hindent (HTML)
inputFileName=indentinput
inputFileParameter=
manual=http://www.linuxdriver.co.il/man/1/H/hindent
outputFileName=
outputFileParameter=stdout
parameterOrder=pio
showHelpParameter=-v
stringparaminquotes=false
useCfgFileParameter=
version=1.1.2-7
[Case]
Category=0
Description="<html>Forces all tags to lowercase. By default, hindent forces all tags to uppercase.</html>"
EditorType=boolean
TrueFalse=-c|
ValueDefault=0
[Flow]
Category=0
Description="<html>Prints just tags without any data between the tags. Damages the HTML in a big way, so save a copy of your original HTML. This option helps you follow the HTML code flow visually.</html>"
EditorType=boolean
TrueFalse=-f|
ValueDefault=0
[Indent level]
CallName="-i "
Category=0
Description="<html>Set indentation to this many character spaces per code nesting level. If set to 0, no indentation is done (all output is left-justified).</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=4
[List tags]
Category=0
Description="<html>Causes hindent to print a complete list of tags that it recognizes to stdout, and exits.</html>"
EditorType=boolean
TrueFalse=-l|
ValueDefault=0
[Strict]
Category=0
Description="<html>Multiple tags per line are broken out onto separate lines. Can damage the HTML in minor ways by drawing an extra space character in certain parts of the web page, so save a copy of your original HTML. This option helps you follow the HTML code flow visually, especially with computer-generated HTML that comes out all on one line.</html>"
EditorType=boolean
TrueFalse=-s|
ValueDefault=0
[Tab stop]
CallName="-t "
Category=0
Description="<html>Set the number of spaces that a tab character occupies on your system. Defaults to 8, but some people prefer expanding tabs to 4 spaces instead. If set to 0, no tabs are output (spaces used to indent lines).</html>"
EditorType=numeric
Enabled=false
MaxVal=9999
MinVal=0
ValueDefault=8

@ -0,0 +1,147 @@
[header]
categories=Basic Options
cfgFileParameterEnding=cr
configFilename=
fileTypes=*.htm|*.html|*.xhtml|*.xml|*.xlst
indenterFileName=htb
indenterName=HTB (HTML, XML, XSL)
inputFileName=indentinput
inputFileParameter=
manual=http://www.digital-mines.com/htb/htb_docs.html
outputFileName=indentoutput
outputFileParameter=
parameterOrder=pio
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter=
version=2.0
[Multi-Attribute Tag Break]
Category=0
Description="<html><p>The -a command-line option causes all tags containing more that one attribute to be broken over multiple lines, each with a single attribute. The attributes are aligned vertically with the first attribute. A similar attribute break will occur by default, but only on tags exceeding the column 80 limit, and each line may contain more than one attribute.<br><br> <b>Before:</b><pre>&lt;BODY BGCOLOR="#FFFFFF" MARGINWIDTH="0" MARGINHEIGHT="0" LINK="#666666" VLINK="#666666" ALINK="#000000"&gt;\n&lt;TABLE WIDTH="800" BORDER="0" CELLPADDING="0" CELLSPACING="0"&gt;\n&lt;TR&gt;\n&lt;TD COLSPAN="2" WIDTH="196" BGCOLOR="cccccc" VALIGN="top"&gt;&lt;IMG SRC="/images/homepage/rev/logo_06.gif" WIDTH="196" HEIGHT="63"&gt;&lt;/TD&gt;\n&lt;TD BGCOLOR="cccccc" WIDTH="600" VALIGN="top"&gt;\n&lt;TABLE WIDTH="600" BORDER="0" CELLPADDING="0" CELLSPACING="0" VALIGN="top"&gt;\n&lt;TR&gt;\n&lt;TD VALIGN="top" HEIGHT="17" BGCOLOR="#CCCCCC"&gt;&lt;IMG SRC="/images/homepage/rev/comp8_07.gif" WIDTH="600" HEIGHT="17"&gt;&lt;/TD&gt;\n&lt;/TR&gt;</pre><b>After:</b> <pre>&lt;BODY ALINK="#000000"\n BGCOLOR="#FFFFFF"\n LINK="#666666"\n MARGINHEIGHT="0"\n MARGINWIDTH="0"\n VLINK="#666666"&gt;\n&lt;TABLE BORDER="0"\n CELLPADDING="0"\n CELLSPACING="0"\n WIDTH="800"&gt;\n &lt;TR&gt;\n &lt;TD BGCOLOR="cccccc"\n COLSPAN="2"\n VALIGN="top"\n WIDTH="196"&gt;&lt;IMG HEIGHT="63"\n SRC="/images/homepage/rev/logo_06.gif"\n WIDTH="196"&gt;&lt;/TD&gt;\n &lt;TD BGCOLOR="cccccc"\n VALIGN="top"\n WIDTH="600"&gt; \n &lt;TABLE BORDER="0"\n CELLPADDING="0"\n CELLSPACING="0"\n VALIGN="top"\n WIDTH="600"&gt;\n &lt;TR&gt;\n &lt;TD BGCOLOR="#CCCCCC"\n HEIGHT="17"\n VALIGN="top"&gt;&lt;IMG HEIGHT="17"\n SRC="/images/homepage/rev/comp8_07.gif"\n WIDTH="600"&gt;&lt;/TD&gt;\n &lt;/TR&gt;</pre></html>"
EditorType=boolean
TrueFalse=-a|
ValueDefault=0
[All Attribute Tag Break]
Category=0
Description="<html><p>The -b command-line option causes all tag attributes to be broken on succeeding lines. The attributes are aligned vertically with the last character in the tag name.<br><br> <b>Before:</b><pre>&lt;BODY BGCOLOR="#FFFFFF" MARGINWIDTH="0" MARGINHEIGHT="0" LINK="#666666" VLINK="#666666" ALINK="#000000"&gt;\n&lt;TABLE WIDTH="800" BORDER="0" CELLPADDING="0" CELLSPACING="0"&gt;\n&lt;TR&gt;\n&lt;TD COLSPAN="2" WIDTH="196" BGCOLOR="cccccc" VALIGN="top"&gt;&lt;IMG SRC="/images/homepage/rev/logo_06.gif" WIDTH="196" HEIGHT="63"&gt;&lt;/TD&gt;\n&lt;TD BGCOLOR="cccccc" WIDTH="600" VALIGN="top"&gt;\n&lt;TABLE WIDTH="600" BORDER="0" CELLPADDING="0" CELLSPACING="0" VALIGN="top"&gt;\n&lt;TR&gt;\n&lt;TD VALIGN="top" HEIGHT="17" BGCOLOR="#CCCCCC"&gt;&lt;IMG SRC="/images/homepage/rev/comp8_07.gif" WIDTH="600" HEIGHT="17"&gt;&lt;/TD&gt;\n&lt;/TR&gt;</pre><b>After:</b><pre>&lt;BODY\n ALINK="#000000"\n BGCOLOR="#FFFFFF"\n BOTMARGIN="0"\n MARGINHEIGHT="0"\n MARGINWIDTH="0"\n LEFTMARGIN="0"\n LINK="#666666"\n TOPMARGIN="0"\n VLINK="#666666"&gt;\n&lt;TABLE\n BORDER="0"\n CELLPADDING="0"\n CELLSPACING="0"\n WIDTH="800"&gt;\n &lt;TR&gt;\n &lt;TD\n BGCOLOR="cccccc"\n COLSPAN="2"\n VALIGN="top"\n WIDTH="196"&gt;&lt;IMG\n HEIGHT="63"\n SRC="/images/homepage/rev/logo_06.gif"\n WIDTH="196"&gt;&lt;/TD&gt;\n &lt;TD\n BGCOLOR="cccccc"\n VALIGN="top"\n WIDTH="600"&gt; \n &lt;TABLE\n BORDER="0"\n VALIGN="top"\n CELLPADDING="0"\n CELLSPACING="0"\n WIDTH="600"&gt;\n &lt;TR&gt;\n &lt;TD\n BGCOLOR="#CCCCCC"\n HEIGHT="17"\n VALIGN="top"&gt;&lt;IMG\n HEIGHT="17"\n SRC="/images/homepage/rev/comp8_07.gif"\n WIDTH="600"&gt;&lt;/TD&gt;\n &lt;/TR&gt;\n</pre></html>"
EditorType=boolean
TrueFalse=-b|
ValueDefault=0
[Add Carriage Returns]
Category=0
Description="<html>The -c command-line option adds an extra carriage return character to each output line of reformatted data. This allows Unix versions of HTB to create a DOS/Windows compatible text files directly.</html>"
EditorType=boolean
TrueFalse=-c|
ValueDefault=0
[Omit Carriage Returns]
Category=0
Description="<html>The -d command-line option inhibits extra carriage return character output even if present in the source data. This allows the Windows version of HTB to create a Unix compatible text file directly. This is the default behavior and correctly creates a natively compatible format whether Unix or Windows.</html>"
EditorType=boolean
TrueFalse=-d|
ValueDefault=0
[Escaped Tag Conversion]
Category=0
Description="<html>The -e command-line option replaces the special markup characters '<', '>', and '&' with escape strings '&lt;', '&gt;', and '&amp;' respectively. Also, the tag sequence '<HTML><BODY><PRE>' is added to the beginning of the output data and the sequence '</PRE></BODY></HTML>' is appended to the end of the data. This creates an entirely new HTML document, which when viewed with a Web Browser, will appear as source instead of normal rendering. This is useful in creating markup tag documentation and is the mechanism used to create the examples in this document. Use in combination with the -k option to do the conversion without applying other reformatting options.</html>"
EditorType=boolean
TrueFalse=-e|
ValueDefault=0
[Join Lines - Compress Output]
Category=0
Description="<html>The -j command-line option removes all unnecessary whitespace & comments and joins the output lines together whenever possible. The result is totally 'unbeautified' output, but the size will be reduced from 10-40% for quicker transfer over the network. Use this option whenever performance is more important than readability.</html>"
EditorType=boolean
TrueFalse=-j|
ValueDefault=0
[Keep Layout - Case Changes Only]
Category=0
Description="<html><p>When the current indenting and appearance of your tagged document is acceptable, the -k command-line option may be used to change only the case of the tag names and attributes with no other changes applied.<br><br> <b>Example:</b><br><br>- Keep the current layout of an HTML document, but change the tag attribute names to lower case (<a href="#option_m">-m option</a>, opposite of tag name case which by default is upper)...<br><br><center><code>htb -km myfile.html</code></center><br> <b>Before:</b><pre>&lt;FORM ENCTYPE="multipart/form-data" NAME="coreform" METHOD="POST"&gt;\n&lt;INPUT TYPE="submit" VALUE="Submit Request"&gt; \n&lt;INPUT NAME="cgi" TYPE="button" VALUE="cgi2xml"&gt;cgi2xml \n&lt;TABLE BORDER="5" CELLPADDING="5"&gt;\n &lt;TR&gt;\n &lt;TD&gt; &lt;FONT COLOR="purple"&gt; \n &lt;H4&gt;Output formatting:&lt;/H4&gt; &lt;/FONT&gt;Debug: \n &lt;INPUT NAME="debug"&gt;&lt;BR&gt; \n &lt;BR&gt; Filter: \n &lt;INPUT NAME="filter"&gt;&lt;BR&gt; Output: \n &lt;INPUT NAME="output"&gt;&lt;BR&gt; \n &lt;BR&gt; Pagestart: \n &lt;INPUT SIZE="4" NAME="pagestart"&gt;&lt;BR&gt; Pagesize: \n &lt;INPUT SIZE="4" NAME="pagesize"&gt;&lt;BR&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;/FORM&gt;</pre><b>After:</b><pre>&lt;FORM enctype="multipart/form-data" name="coreform" method="POST"&gt;\n&lt;INPUT type="submit" value="Submit Request"&gt; \n&lt;INPUT name="cgi" type="button" value="cgi2xml"&gt;cgi2xml \n&lt;TABLE border="5" cellpadding="5"&gt;\n &lt;TR&gt;\n &lt;TD&gt; &lt;FONT color="purple"&gt; \n &lt;H4&gt;Output formatting:&lt;/H4&gt; &lt;/FONT&gt;Debug: \n &lt;INPUT name="debug"&gt;&lt;BR&gt; \n &lt;BR&gt; Filter: \n &lt;INPUT name="filter"&gt;&lt;BR&gt; Output: \n &lt;INPUT name="output"&gt;&lt;BR&gt; \n &lt;BR&gt; Pagestart: \n &lt;INPUT size="4" name="pagestart"&gt;&lt;BR&gt; Pagesize: \n &lt;INPUT size="4" name="pagesize"&gt;&lt;BR&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;/FORM&gt;</pre></html>"
EditorType=boolean
TrueFalse=-k|
ValueDefault=0
[Tag Names Lower Case]
Category=0
Description="<html><p>The -l command-line option changes all HTML tag names and their attributes to lower case. Combine with the <a href="#option_m">-m (mixed case) option</a> to keep the tag names lower case, but make the attribute names upper case.<br><br> <b>Before:</b><pre>&lt;FORM ENCTYPE="multipart/form-data" NAME="coreform" METHOD="POST"&gt;\n&lt;INPUT TYPE="submit" VALUE="Submit Request"&gt; \n&lt;INPUT NAME="cgi" TYPE="button" VALUE="cgi2xml"&gt;cgi2xml \n&lt;TABLE BORDER="5" CELLPADDING="5"&gt;\n &lt;TR&gt;\n &lt;TD&gt; &lt;FONT COLOR="purple"&gt; \n &lt;H4&gt;Output formatting:&lt;/H4&gt; &lt;/FONT&gt;Debug: \n &lt;INPUT NAME="debug"&gt;&lt;BR&gt; \n &lt;BR&gt; Filter: \n &lt;INPUT NAME="filter"&gt;&lt;BR&gt; Output: \n &lt;INPUT NAME="output"&gt;&lt;BR&gt; \n &lt;BR&gt; Pagestart: \n &lt;INPUT SIZE="4" NAME="pagestart"&gt;&lt;BR&gt; Pagesize: \n &lt;INPUT SIZE="4" NAME="pagesize"&gt;&lt;BR&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;/FORM&gt;</pre><b>After:</b><pre>&lt;form enctype="multipart/form-data" method="post" name="coreform"&gt;\n&lt;input type="submit" value="Submit Request"&gt; \n&lt;input name="cgi" type="button" value="cgi2xml"&gt;cgi2xml \n&lt;table border="5" cellpadding="5"&gt;\n &lt;tr&gt;\n &lt;td&gt; &lt;font color="purple"&gt; \n &lt;h4&gt;Output formatting:&lt;/h4&gt; &lt;/font&gt;Debug: \n &lt;input name="debug"&gt;&lt;br&gt; \n &lt;br&gt; Filter: \n &lt;input name="filter"&gt;&lt;br&gt; Output: \n &lt;input name="output"&gt;&lt;br&gt; \n &lt;br&gt; Pagestart: \n &lt;input name="pagestart" size="4"&gt;&lt;br&gt; Pagesize: \n &lt;input name="pagesize size="4"&gt;&lt;br&gt; \n &lt;/td&gt;\n &lt;/tr&gt;\n&lt;/table&gt;\n&lt;/form&gt;\n</pre></html>"
EditorType=boolean
TrueFalse=-l|
ValueDefault=0
[Tag Attributes Opposite Case]
Category=0
Description="<html>The -m command-line option makes the tag attribute case the opposite of the tag name. Since the HTB default is to make tag names upper case, the addition of this option will make the tag attributes lower case. If combined with the -l option (lower case) the tag names will be lower case, and the tag attributes will be upper case. See the -k option for an example.</html>"
EditorType=boolean
TrueFalse=-m|
ValueDefault=0
[Never Break Tags Between Lines]
Category=0
Description="<html>The -n command-line option cancels the default behavior of breaking tags which exceed the 80 column limit and keeps tags intact within a single line of output regardless of their length. This is often desirable, especially on XSL files.</html>"
EditorType=boolean
TrueFalse=-n|
ValueDefault=0
[Remove Non-HTML Tags]
Category=0
Description="<html><p>The -r command-line option strips any tag which is not part of the HTML 4.01 specification (and a group of widely recognized, commonly used legacy tags) from the output. Its a convenient way to separate HTML from hybrid files like ASP, JSP, XSL or files containing custom tags. The stripped tags are reported along with any errors to "standard error".<br><br> <b>Example:</b><br><br>- Remove all non-HTML tags from an XSL/XHTML file... <br> <br><center><code>htb -r myfile.xsl</code></center><br> <b>Before:</b><pre>\n &lt;xsl:for-each select="ELEMENT/NODE1"&gt; \n &lt;xsl:variable select="position()-1" name="vpos" /&gt; \n &lt;TR VALIGN="top"&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT SIZE="1" FACE="Helvetica"&gt;&lt;xsl:value-of select="$vpos" /&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;INPUT NAME="ELEM{$vpos}" TYPE="text" VALUE="Element {$vpos}" /&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;INPUT NAME="NUMB{$vpos}" TYPE="text" VALUE="2" /&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;xsl:variable select="count(//NODE1[@id &amp;gt; -1)" name="pcnt" /&gt; \n &lt;xsl:variable name="selsize"&gt; \n &lt;xsl:choose&gt;&lt;xsl:when test="$pcnt &amp;lt; 5"&gt; \n &lt;xsl:value-of select="$pcnt" /&gt; \n &lt;/xsl:when&gt;&lt;xsl:otherwise&gt; \n &lt;xsl:value-of select="'5'" /&gt; \n &lt;/xsl:otherwise&gt;&lt;/xsl:choose&gt; \n &lt;/xsl:variable&gt; \n &lt;SELECT SIZE="{$selsize}" NAME="VALU{$vpos}"&gt;\n &lt;xsl:for-each select="//VALUE[@id &amp;gt; -1]"&gt; \n &lt;OPTION VALUE="{@id}"&gt;\n &lt;xsl:value-of select="NAME" /&gt;&lt;/OPTION&gt; \n &lt;/xsl:for-each&gt; \n &lt;/SELECT&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;\n &lt;/xsl:for-each&gt;</pre><b>After:</b> <pre>\n &lt;TR VALIGN="top"&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica" SIZE="1"&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;INPUT NAME="ELEM{$vpos}" TYPE="text" VALUE="Element {$vpos}" /&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;INPUT NAME="NUMB{$vpos}" TYPE="text" VALUE="2" /&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;TD ALIGN="center"&gt;&lt;FONT FACE="Helvetica"&gt; \n &lt;SELECT NAME="VALU{$vpos}" SIZE="{$selsize}"&gt;\n &lt;OPTION VALUE="{@id}"&gt;&lt;/OPTION&gt;\n &lt;/SELECT&gt;&lt;/FONT&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;</pre></html>"
EditorType=boolean
TrueFalse=-r|
ValueDefault=0
[Remove Tabs from SCRIPTs]
Category=0
Description="<html>HTB automatically removes any tab characters found in the source document during the indenting process, but by default SCRIPTs are kept intact. To completely remove all tabs, specify the -s option and tab characters found within SCRIPT elements will be replaced with sets if of indented spaces. This could make the indented script statements look slightly worse and may require minor editing, but the beautified output is clear of any tab characters.</html>"
EditorType=boolean
TrueFalse=-r|
ValueDefault=0
[Convert to Plain Text]
Category=0
Description="<html>The -t command-line option strips all markup tags, comments and converts the input to plain text. All ASCII and ISO8859-1 HTML escape strings are converted back to the characters they represent. An attempt is made to compress extra whitespace, but in general the text will require additional re-formatting to be made presentable. Use this option to isolate the textual content within tagged documents (not necessarily HTML) for use in other documentation.</html>"
EditorType=boolean
TrueFalse=-t|
ValueDefault=0
[Tag Names Upper Case]
Category=0
Description="<html><p>The -u command-line option changes all HTML tag names and their attributes to upper case. Since this is the default behavior of HTB, it is not required. Use the <a href="#option_m">-m (mixed case) option</a> to keep the tag names upper case, but make the attribute names lower case.<br><br> <b>Before:</b><pre>&lt;form enctype="multipart/form-data" name="coreform" method="POST"&gt;\n&lt;input type="submit" value="Submit Request"&gt; \n&lt;input name="cgi" type="button" value="cgi2xml"&gt;cgi2xml \n&lt;table border="5" cellpadding="5"&gt;\n &lt;tr&gt;\n &lt;td&gt; &lt;font color="purple"&gt; \n &lt;h4&gt;Output formatting:&lt;/h4&gt; &lt;/font&gt;Debug: \n &lt;input name="debug"&gt;&lt;br&gt; \n &lt;br&gt; Filter: \n &lt;input name="filter"&gt;&lt;br&gt; Output: \n &lt;input name="output"&gt;&lt;br&gt; \n &lt;br&gt; Pagestart: \n &lt;input size="4" name="pagestart"&gt;&lt;br&gt; Pagesize: \n &lt;input size="4" name="pagesize"&gt;&lt;br&gt; \n &lt;/td&gt;\n &lt;/tr&gt;\n&lt;/table&gt;\n&lt;/form&gt;</pre><b>After:</b><pre>&lt;FORM ENCTYPE="multipart/form-data" METHOD="POST" NAME="coreform"&gt;\n&lt;INPUT TYPE="submit" VALUE="Submit Request"&gt; \n&lt;INPUT NAME="cgi" TYPE="button" VALUE="cgi2xml"&gt;cgi2xml \n&lt;TABLE BORDER="5" CELLPADDING="5"&gt;\n &lt;TR&gt;\n &lt;TD&gt; &lt;FONT COLOR="purple"&gt; \n &lt;H4&gt;Output formatting:&lt;/H4&gt; &lt;/FONT&gt;Debug: \n &lt;INPUT NAME="debug"&gt;&lt;BR&gt; \n &lt;BR&gt; Filter: \n &lt;INPUT NAME="filter"&gt;&lt;BR&gt; Output: \n &lt;INPUT NAME="output"&gt;&lt;BR&gt; \n &lt;BR&gt; Pagestart: \n &lt;INPUT NAME="pagestart" SIZE="4"&gt;&lt;BR&gt; Pagesize: \n &lt;INPUT NAME="pagesize" SIZE="4"&gt;&lt;BR&gt; \n &lt;/TD&gt;\n &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;/FORM&gt;</pre></html>"
EditorType=boolean
TrueFalse=-u|
ValueDefault=0
[Unknown Tags are XML]
Category=0
Description="<html><p>HTB automatically detects XML compliant files and is able to apply reformatting to unknown tags since they meet the predictable behavior of the XML specification. If the input document is not strictly XML compliant, but does contain custom tagging which may be considered "well-formed" XML, the -x option may be used to apply XML handling on these otherwise ignored tags. If XML is detected, either automatically, or with the -x option, the tag case is NOT changed for these non-HTML tags, since they are often case-sensitive. Also, the attributes of unknown tags will remain in original order instead of being sorted as with HTML attributes. To turn off XML auto-detection and apply case changes and attribute sorting to all tags known and unknown, use the <a href="#option_y">-y option</a>.<br><br> <b>Example:</b><br><br>- Make <a href="#option_l">tag names and attributes lower case</a>, <a href="#option_n">never break tags</a>, and treat unknown tags in an HTML file as well formed XML... <br><br><center><code>htb -lnx myfile.html</code></center><br> <b>Before:</b><pre>&lt;TR&gt;&lt;TD WIDTH=182 ALIGN=left BGCOLOR="#ffffff"&gt;\n&lt;NYT_HEADLINE&gt;\n&lt;A\n\nHREF="/onthisday/20020619.html"&gt;&lt;FONT SIZE="3" FACE="times"&gt;&lt;B&gt;On June 19 ...&lt;BR&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/A&gt;\n&lt;/NYT_HEADLINE&gt;\n&lt;NYT_BYLINE&gt;\n&lt;FONT SIZE="-1"&gt;&lt;/FONT&gt;\n&lt;/NYT_BYLINE&gt;\n&lt;NYT_SUMMARY&gt;\n&lt;FONT SIZE="-1"&gt;\n&lt;B&gt;1964:&lt;/B&gt; The Civil Rights Act of 1964 was approved. (&lt;A \nHREF="/onthisday/big/0619.html"&gt;See this front page.&lt;/A&gt;) &lt;BR&gt;\n&lt;B&gt;1903:&lt;/B&gt; Lou Gehrig was born. &lt;A \nHREF="/onthisday/bday/0619.html"&gt;(Read about his life.)&lt;/A&gt; &lt;BR&gt;\n&lt;B&gt;1886:&lt;/B&gt; Harper's Weekly featured a cartoon about the proposed annexation of Nova Scotia. &lt;A \nHREF="/onthisday/harp/0619.html"&gt;(See the cartoon.)&lt;/A&gt;&lt;/FONT&gt;\n&lt;/TD&gt;&lt;/TR&gt;</pre><b>After:</b><pre>&lt;tr&gt;\n &lt;td align="left" bgcolor="#ffffff" width="182"&gt; \n &lt;NYT_HEADLINE&gt; \n &lt;a href="/onthisday/20020619.html"&gt;&lt;font face="times" size="3"&gt;&lt;b&gt;On June 19 ...&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;/a&gt; \n &lt;/NYT_HEADLINE&gt; \n &lt;NYT_BYLINE&gt; &lt;font size="-1"&gt;&lt;/font&gt; \n &lt;/NYT_BYLINE&gt; \n &lt;NYT_SUMMARY&gt; &lt;font size="-1"&gt; &lt;b&gt;1964:&lt;/b&gt; The Civil Rights Act of 1964 was approved. (&lt;a href="/onthisday/big/0619.html"&gt;See this front page.&lt;/a&gt;) \n &lt;br&gt; &lt;b&gt;1903:&lt;/b&gt; Lou Gehrig was born. \n &lt;a href="/onthisday/bday/0619.html"&gt;(Read about his life.)&lt;/a&gt; \n &lt;br&gt; &lt;b&gt;1886:&lt;/b&gt; Harper's Weekly featured a cartoon about the proposed annexation of Nova Scotia. \n &lt;a href="/onthisday/harp/0619.html"&gt;(See the cartoon.)&lt;/a&gt;&lt;/font&gt; \n &lt;/td&gt;\n&lt;/tr&gt;</pre></html>"
EditorType=boolean
TrueFalse=-x|
ValueDefault=0
[Turn off XML detection]
Category=0
Description="<html><p>HTB automatically detects XML compliant files and treats the unknown tags differently than HTML tags. XML tags are indented as whitespace permits and case changes &amp; attribute sorting are not applied. To turn off this default behavior and apply case changes &amp; sorting to all tags known and unknown, specify the -y option.<br><br> <b>Example:</b><br><br>- <a href="#option_n">Never break tags</a>, <a href="#option_l">make all tags lower case</a> whether HTML or not, and do not change indenting for unknown tags... <br><center><code>htb -lny myfile.html</code></center><br> <b>Before:</b> <pre>&lt;TR&gt;&lt;TD WIDTH=182 ALIGN=left BGCOLOR="#ffffff"&gt;\n&lt;NYT_HEADLINE&gt;\n&lt;A\n\nHREF="/onthisday/20020619.html"&gt;&lt;FONT SIZE="3" FACE="times"&gt;&lt;B&gt;On June 19 ...&lt;BR&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/A&gt;\n&lt;/NYT_HEADLINE&gt;\n&lt;NYT_BYLINE&gt;\n&lt;FONT SIZE="-1"&gt;&lt;/FONT&gt;\n&lt;/NYT_BYLINE&gt;\n&lt;NYT_SUMMARY&gt;\n&lt;FONT SIZE="-1"&gt;\n&lt;B&gt;1964:&lt;/B&gt; The Civil Rights Act of 1964 was approved. (&lt;A \nHREF="/onthisday/big/0619.html"&gt;See this front page.&lt;/A&gt;) &lt;BR&gt;\n&lt;B&gt;1903:&lt;/B&gt; Lou Gehrig was born. &lt;A \nHREF="/onthisday/bday/0619.html"&gt;(Read about his life.)&lt;/A&gt; &lt;BR&gt;\n&lt;B&gt;1886:&lt;/B&gt; Harper's Weekly featured a cartoon about the proposed annexation of Nova Scotia. &lt;A \nHREF="/onthisday/harp/0619.html"&gt;(See the cartoon.)&lt;/A&gt;&lt;/FONT&gt;\n&lt;/TD&gt;&lt;/TR&gt;</pre><b>After:</b><pre>&lt;tr&gt;\n &lt;td align="left" bgcolor="#ffffff" width="182"&gt; \n &lt;nyt_headline&gt; \n &lt;a href="/onthisday/20020619.html"&gt;&lt;font face="times" size="3"&gt;&lt;b&gt;On June 19 ...&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;/a&gt; \n &lt;/nyt_headline&gt; \n &lt;nyt_byline&gt; &lt;font size="-1"&gt;&lt;/font&gt; \n &lt;/nyt_byline&gt; \n &lt;nyt_summary&gt; &lt;font size="-1"&gt; &lt;b&gt;1964:&lt;/b&gt; The Civil Rights Act of 1964 was approved. (&lt;a href="/onthisday/big/0619.html"&gt;See this front page.&lt;/a&gt;) \n &lt;br&gt; &lt;b&gt;1903:&lt;/b&gt; Lou Gehrig was born. \n &lt;a href="/onthisday/bday/0619.html"&gt;(Read about his life.)&lt;/a&gt; \n &lt;br&gt; &lt;b&gt;1886:&lt;/b&gt; Harper's Weekly featured a cartoon about the proposed annexation of Nova Scotia. \n &lt;a href="/onthisday/harp/0619.html"&gt;(See the cartoon.)&lt;/a&gt;&lt;/font&gt; \n &lt;/td&gt;\n&lt;/tr&gt;</pre></html>"
EditorType=boolean
TrueFalse=-y|
ValueDefault=0
[Remove Comments]
Category=0
Description="<html>The -z command-line option removes all stand-alone comments from the input data. This does not include JavaScript comments or comment blocks within APPLET, OBJECT, SCRIPT, and STYLE tags used to hide text from browsers. The revised output should render and function as the original. The -z option is useful in reducing tagged file sizes when the comment blocks are no longer needed, or in removing dead, commented-out sections within documents which tend to collect over time. The stripped comments are not lost, however. These are sent to the 'standard error' stream and may be collected in another file for reference or for use in documentation by 'standard error' redirection ('2>' or '2>>'). If 'standard error' is not redirected, the stripped comments will be seen scrolling by on the screen. Use in combination with the -k option to strip comments without otherwise changing the document layout.</html>"
EditorType=boolean
TrueFalse=-z|
ValueDefault=0
[Spaces for Indenting]
CallName="-"
Category=0
Description="<html>A command-line option from 0 to 9 represents the number of spaces used for increments of indenting. Specifying 0 will cause all indenting to be removed and the tags will shifted to the left. If not specified, the default is to indent by 3.</html>"
EditorType=numeric
Enabled=false
MaxVal=9
MinVal=0
ValueDefault=3

@ -0,0 +1,17 @@
[header]
categories=
cfgFileParameterEnding=cr
configFilename=
fileTypes=*.js
indenterFileName=JsDecoder
indenterName=JsDecoder (JavaScript)
inputFileName=
inputFileParameter=
manual="http://www.gosu.pl/decoder/"
outputFileName=
outputFileParameter=
parameterOrder=
showHelpParameter=
stringparaminquotes=
useCfgFileParameter=
version=1.1.0

@ -0,0 +1,81 @@
[header]
categories=General options
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.jsp|*.html|*.xml
indenterFileName=jsppp
indenterName=JSPPP (JSP)
inputFileName=indentinput
inputFileParameter=
manual=http://jsppp.sourceforge.net/
outputFileName=indentinput
outputFileParameter=none
stringparaminquotes=false
parameterOrder=pio
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter=
version=0.5.2a
[Spaces]
Category=0
Description="<html>If spaces is true, spaces, not tabs, will be used to indent the lines.</html>"
EditorType=boolean
TrueFalse=|--tabs
ValueDefault=1
[Number of spaces]
Category=0
Description="<html>If spaces are used for indenting, NUMSPACES is the number of spaces to use per indent level.</html>"
Enabled=true
EditorType=numeric
CallName="--spaces="
MinVal=0
MaxVal=999
ValueDefault=2
[Line length]
Category=0
Description="<html>The length, in bytes (JSPPP does not yet support Unicode input, no one has asked for it yet) of the soft line length limit. JavaScript, long element names, attributes, etc., that cannot be broken up will end up over the limit if they have already been indented too far.</html>"
Enabled=false
EditorType=numeric
CallName="--length="
MinVal=1
MaxVal=9999
ValueDefault=120
[Tabsize]
Category=0
Description="<html>The default number of spaces per tab is 8. This number is used to determine how much of the line has been used by a tab.</html>"
Enabled=false
EditorType=numeric
CallName="--tab-size="
MinVal=0
MaxVal=999
ValueDefault=8
[Punctuation]
Category=0
Description="<html>PUNCTUATION is a list of characters which should be handled specially after an anchor tag. If there is whitespace after a link tag but before one of these characters then the whitespace is removed. To have no special characters, use the line "PUNCTUATION=".</html>"
Enabled=false
CallName=PUNCTUATION=
EditorType=string
ValueDefault=",.!?"
[Loose or tight spacing]
Category=0
Description="<html>Use loose or tight spacing.</html>"
Enabled=true
EditorType=multiple
Choices="--loose-spacing|--tight-spacing"
ChoicesReadable="Loose spacing|Tight spacing"
ValueDefault=0
[Backup file]
Category=0
Description="<html>Leave a backup file, which will be overwritten on a second run, or leave no backup file at all.</html>"
Enabled=true
EditorType=multiple
Choices="--engage-safety|--disengage-safety"
ChoicesReadable="Leave backup file|Leave NO backup file"
ValueDefault=1

File diff suppressed because it is too large Load Diff

@ -0,0 +1,151 @@
[header]
categories=General
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.php|*.htm|*.html|*.xhtml
indenterFileName=phpCB
indenterName=PHP Code Beautifier (PHP)
inputFileName=indentinput
inputFileParameter=
manual=http://www.waterproof.fr/products/phpCodeBeautifier/manual.php
outputFileName=
outputFileParameter=stdout
parameterOrder=pio
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter=
version=2007-02-21
[Align all assignement statements]
Category=0
Description=<html>Align all assignement statements</html>
EditorType=boolean
TrueFalse=--align-equal-statements|
ValueDefault=1
[Align all assignement statements to a fixed position]
CallName="--align-equal-statements-to-fixed-pos "
Category=0
Description="<html>Align all assignement statements to a fixed position.<hr><table><thead><tr><td width='50%'>Source</td><td width='50%'>With --align-equal-statements-to-fixed-pos 40</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php <br>$noError = true; <br>$feildEmpty = false; <br>$showMessage = false; <br>$showMessage = false; <br>$anotherVariable[0123] = 'bla bla bla'; <br>$showBlaBlaBlaMessage = false; <br>?&gt;</pre></td><td width='50%'><pre>&lt;?php <br>$noError<span> </span> = true; <br>$feildEmpty<span> </span> = false; <br>$showMessage<span> </span> = false; <br>$showMessage<span> </span> = false; <br>$anotherVariable[0123]<span> </span> = 'bla bla bla'; <br>$showBlaBlaBlaMessage<span> </span> = false; <br>?&gt; </pre></td></tr></tbody></table></html>"
EditorType=numeric
Enabled=false
MaxVal=60
MinVal=4
ValueDefault=30
[Allow to insert a space after '(']
Category=0
Description=<html>Allow to insert a space after start bracket '('</html>
EditorType=boolean
TrueFalse=--space-after-start-bracket|
ValueDefault=0
[Allow to insert a space after 'if']
Category=0
Description=<html>Allow to insert a space after 'if' keyword</html>
EditorType=boolean
TrueFalse=--space-after-if|
ValueDefault=1
[Allow to insert a space after 'switch']
Category=0
Description=<html>Allow to insert a space after 'switch' keyword</html>
EditorType=boolean
TrueFalse=--space-after-switch|
ValueDefault=1
[Allow to insert a space after 'while']
Category=0
Description=<html>Allow to insert a space after 'while' keyword</html>
EditorType=boolean
TrueFalse=--space-after-while|
ValueDefault=1
[Allow to insert a space after '}']
Category=0
Description=<html>Allow to insert a space after starting angle bracket '}'</html>
EditorType=boolean
TrueFalse=--space-after-end-angle-bracket|
ValueDefault=1
[Allow to insert a space before ')']
Category=0
Description=<html>Allow to insert a space before end bracket ')'</html>
EditorType=boolean
TrueFalse=--space-before-end-bracket|
ValueDefault=0
[Allow to insert a space before '{']
Category=0
Description=<html>Allow to insert a space before starting angle bracket '{'</html>
EditorType=boolean
TrueFalse=--space-before-start-angle-bracket|
ValueDefault=1
[Change comments]
Category=0
Description="<html>Change '# ...' comments into '// ...' comments<hr><table><thead><tr><td width='33%'>Source</td><td width='33%'>With --change-shell-comment-to-double-slashes-comment</td><td width='33%'>Without --change-shell-comment-to-double-slashes-comment</td></tr></thead><tbody><tr><td width='33%'><pre>&lt;?php<br><br>#comment content<br>//another comment<br>?&gt;</pre></td><td width='33%'><pre>&lt;?php<br><br>// comment content<br>// another comment<br>?&gt;</pre></td><td width='33%'><pre>&lt;?php<br><br># comment content<br>// another comment<br>?&gt;</pre></td></tr></tbody></table></html>"
EditorType=boolean
TrueFalse=--change-shell-comment-to-double-slashes-comment|
ValueDefault=1
[Comment render style]
Category=0
Choices="--comment-rendering-style PEAR|--comment-rendering-style PHPDoc"
ChoicesReadable="PEAR comment rendering style|PHPDoc comment rendering style"
Description="<html>The following style of comment formating are available:<hr><table><thead><tr><td width='50%'><b>--comment-rendering-style</b> PEAR</td><td width='50%'><b>--comment-rendering-style</b> PHPDoc</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php<br><br>/**<br> * bla bla bla<br> *<br> * @access public<br> */<br>?&gt;</pre></td><td width='50%'><pre>&lt;?php<br><br>/**<br>* bla bla bla<br>*<br>* @access public<br>*/<br>?&gt;</pre></td></tr></tbody></table></html>"
EditorType=multiple
Enabled=true
ValueDefault=0
[Force large PHP code tag]
Category=0
Description="<html>Change '&lt;?' and '&lt;%' tokens into '&lt;?php' and '%&gt;' into '?&gt;'</html>"
EditorType=boolean
TrueFalse=--force-large-php-code-tag|
ValueDefault=1
[Glue "&&" to following item]
Category=0
Description="<html>Glue '&' to following item<hr><table><thead><tr><td width='50%'>With --glue-amperscore</td><td width='50%'>Without --glue-amperscore</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php<br>$value = &amp;$objectInstance;<br>?&gt;</pre></td><td width='50%'><pre>&lt;?php<br>$value = &amp; $objectInstance;<br>?&gt;</pre></td><br></tr></tbody></table></html>"
EditorType=boolean
TrueFalse=--glue-amperscore|
ValueDefault=1
[Increase padding before case statements]
Category=0
Description="<html>Increase padding before case statements:<hr><table><thead><tr><td width='50%'>With --extra-padding-for-case-statement</td><td width='50%'>Without --extra-padding-for-case-statement</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php<br><br>switch($condition){<br><span> </span>case 1:<br><span> </span> action1();<br><span> </span> break;<br><span> </span>case 2:<br><span> </span> action2();<br><span> </span> break;<br><span> </span>default:<br><span> </span> defaultaction();<br><span> </span> break;<br>}<br>?&gt;</pre></td><td width='50%'><pre>&lt;?php<br><br>switch($condition){<br>case 1:<br> action1();<br> break;<br>case 2:<br> action2();<br> break;<br>default:<br> defaultaction();<br> break;<br>}<br>?&gt;</pre></td></tr></tbody></table></html>"
EditorType=boolean
TrueFalse=--extra-padding-for-case-statement|
ValueDefault=0
[Indent with TAB]
Category=0
Description="<html>If selected, tabulation (ASCII #9) character is used to indent text, elsewhere space (ASCII #32) character is used</html>"
EditorType=boolean
TrueFalse=--indent-with-tab|
ValueDefault=0
[Lowercase for NULL, TRUE and FALSE constants]
Category=0
Description="<html>Lowercase for NULL, TRUE and FALSE constants as encouraged in PEAR coding standards<hr><table><thead><tr><td width='50%'>With --force-true-false-null-contant-lowercase</td><td width='50%'>Without --force-true-false-null-contant-lowercase</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php<br>if(<strong>true</strong>){<br> if(<strong>false</strong>){<br> $value = <strong>null</strong>;<br> }<br>}<br>?&gt;</pre></td><td width='50%'><pre>&lt;?php<br>if(<strong>TRUE</strong>){<br> if(<strong>FALSE</strong>){<br> $value = <strong>NULL</strong>;<br> }<br>}<br>?&gt;</pre></td></tr></tbody></table></html>"
EditorType=boolean
TrueFalse=--force-true-false-null-contant-lowercase|
ValueDefault=1
[Padding char count]
CallName="--padding-char-count "
Category=0
Description=<html>Indent using # spaces per indent</html>
EditorType=numeric
Enabled=false
MaxVal=8
MinVal=0
ValueDefault=4
[Use "One true brace" formating for functions]
Category=0
Description="<html>Use 'One true brace' formating for functions<hr><table><thead><tr><td width='50%'>With --one-true-brace-function-declaration</td><td width='50%'>Without --one-true-brace-function-declaration</td></tr></thead><tbody><tr><td width='50%'><pre>&lt;?php<br><br>function aFunction($param)<br>{<br> // function content<br>}<br>?&gt;</pre></td><td width='50%'><pre>&lt;?php<br><br>function aFunction($param) {<br> // function content<br>}<br>?&gt;</pre></td></tr></tbody></table></html>"
EditorType=boolean
TrueFalse=--one-true-brace-function-declaration|
ValueDefault=1

@ -0,0 +1,258 @@
[header]
categories="General|Operators|Functions, Classes and Objects|Control Structures|Arrays and Concatenation|Comments"
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.php|*.phpt|*.phps
indenterFileName=phpStylist.php
indenterName=phpStylist (PHP)
inputFileName=indentinput
inputFileParameter=" "
manual=http://sourceforge.net/projects/phpstylist/
outputFileName=
outputFileParameter=stdout
parameterOrder=ipo
showHelpParameter="-- --help"
stringparaminquotes=false
useCfgFileParameter=
version=1.0
[Indent size]
CallName="--indent_size "
Category=0
Description="<html>Indent the code with the set number of spaces.</html>"
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=4
[Indent with tabs]
Category=0
Description="<html>Indent with tabs instead of spaces</html>"
EditorType=boolean
TrueFalse="--indent_with_tabs|"
ValueDefault=0
[Keep redundant lines]
Category=0
Description="<html>Keep redundant lines</html>"
EditorType=boolean
TrueFalse="--keep_redundant_lines|"
ValueDefault=0
[Space inside parentheses]
Category=0
Description="<html>Space inside parentheses</html>"
EditorType=boolean
TrueFalse="--space_inside_parentheses|"
ValueDefault=0
[Space outside parentheses]
Category=0
Description="<html>Space outside parentheses</html>"
EditorType=boolean
TrueFalse="--space_outside_parentheses|"
ValueDefault=0
[Space after comma]
Category=0
Description="<html>Space after comma</html>"
EditorType=boolean
TrueFalse="--space_after_comma|"
ValueDefault=0
[Space around assignment]
Category=1
Description="<html>Space around = .= += -= *= /= <<<</html>"
EditorType=boolean
TrueFalse="--space_around_assignment|"
ValueDefault=0
[Align block +3 assigned variables]
Category=1
Description="<html>Align block +3 assigned variables</html>"
EditorType=boolean
TrueFalse="--align_var_assignment|"
ValueDefault=0
[Space around comparison]
Category=1
Description="<html>Space around == === != !== > >= < <=</html>"
EditorType=boolean
TrueFalse="--space_around_comparison|"
ValueDefault=0
[Space around arithmetic]
Category=1
Description="<html>Space around - + * / %</html>"
EditorType=boolean
TrueFalse="--space_around_arithmetic|"
ValueDefault=0
[Space around logical]
Category=1
Description="<html>Space around && || AND OR XOR << >></html>"
EditorType=boolean
TrueFalse="--space_around_logical|"
ValueDefault=0
[Space around colon and question]
Category=1
Description="<html>Space around ? :</html>"
EditorType=boolean
TrueFalse="--space_around_colon_question|"
ValueDefault=0
[Blank line before keyword]
Category=2
Description="<html>Blank line before keyword</html>"
EditorType=boolean
TrueFalse="--line_before_function|"
ValueDefault=0
[Opening bracket on next line]
Category=2
Description="<html>Opening bracket on next line</html>"
EditorType=boolean
TrueFalse="--line_before_curly_function|"
ValueDefault=0
[Blank line below opening bracket]
Category=2
Description="<html>Blank line below opening bracket</html>"
EditorType=boolean
TrueFalse="--line_after_curly_function|"
ValueDefault=0
[Space around ->]
Category=2
Description="<html>Space around -></html>"
EditorType=boolean
TrueFalse="--space_around_obj_operator|"
ValueDefault=0
[Space around ::]
Category=2
Description="<html>Space around ::</html>"
EditorType=boolean
TrueFalse="--space_around_double_colon|"
ValueDefault=0
[Space before parentheses]
Category=3
Description="<html>Space between keyword and opening parentheses</html>"
EditorType=boolean
TrueFalse="--space_after_if|"
ValueDefault=0
[Keep else/elseif along with bracket]
Category=3
Description="<html>Keep else/elseif along with bracket</html>"
EditorType=boolean
TrueFalse="--else_along_curly|"
ValueDefault=0
[Opening bracket on next line]
Category=3
Description="<html>Opening bracket on next line</html>"
EditorType=boolean
TrueFalse="--line_before_curly|"
ValueDefault=0
[Add missing brackets]
Category=3
Description="<html>Add missing brackets to single line structs</html>"
EditorType=boolean
TrueFalse="--add_missing_braces|"
ValueDefault=0
[Blank line after case "break"]
Category=3
Description="<html>Blank line after case 'break'</html>"
EditorType=boolean
TrueFalse="--line_after_break|"
ValueDefault=0
[Space between "for" elements]
Category=3
Description="<html>Space between 'for' elements</html>"
EditorType=boolean
TrueFalse="--space_inside_for|"
ValueDefault=0
[Extra indent for "Case" and "Default"]
Category=3
Description="<html>Extra indent for 'Case' and 'Default'</html>"
EditorType=boolean
TrueFalse="--indent_case|"
ValueDefault=0
[Opening array parentheses on next line]
Category=4
Description="<html>Opening array parentheses on next line</html>"
EditorType=boolean
TrueFalse="--line_before_array|"
ValueDefault=0
[Non-empty arrays as vertical block]
Category=4
Description="<html>Non-empty arrays as vertical block</html>"
EditorType=boolean
TrueFalse="--vertical_array|"
ValueDefault=0
[Align block +3 assigned array elements]
Category=4
Description="<html>Align block +3 assigned array elements</html>"
EditorType=boolean
TrueFalse="--align_array_assignment|"
ValueDefault=0
[Space around double arrow]
Category=4
Description="<html>Space around double arrow</html>"
EditorType=boolean
TrueFalse="--space_around_double_arrow|"
ValueDefault=0
[Concatenation as vertical block]
Category=4
Description="<html>Concatenation as vertical block</html>"
EditorType=boolean
TrueFalse="--vertical_concat|"
ValueDefault=0
[Space around concat elements]
Category=4
Description="<html>Space around concat elements</html>"
EditorType=boolean
TrueFalse="--space_around_concat|"
ValueDefault=0
[Blank line before multi-line comment]
Category=5
Description="<html>Blank line before multi-line comment (/*)</html>"
EditorType=boolean
TrueFalse="--line_before_comment_multi|"
ValueDefault=0
[Blank line after multi-line comment]
Category=5
Description="<html>Blank line after multi-line comment (/*)</html>"
EditorType=boolean
TrueFalse="--line_after_comment_multi|"
ValueDefault=0
[Blank line before single line comments]
Category=5
Description="<html>Blank line before single line comments (//)</html>"
EditorType=boolean
TrueFalse="--line_before_comment|"
ValueDefault=0
[Blank line after single line comments]
Category=5
Description="<html>Blank line after single line comments (//)</html>"
EditorType=boolean
TrueFalse="--line_after_comment|"
ValueDefault=0

@ -0,0 +1,108 @@
[header]
categories=General
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.php|*.phpt|*.phps
indenterFileName=php_beautifier
indenterName=PHP_Beautifier (PHP)
inputFileName=indentinput
inputFileParameter="-f "
manual=http://beautifyphp.sourceforge.net/docs/PHP_Beautifier/tutorial_PHP_Beautifier.howtouse.commandline.pkg.html
outputFileName=indentoutput
outputFileParameter="-o "
parameterOrder=iop
showHelpParameter=--help
stringparaminquotes=false
useCfgFileParameter=
version=0.1.13
[Indent With Spaces]
CallName="-s"
Category=1
Description=<html>Indent the code with the set number of spaces.</html>
EditorType=numeric
Enabled=true
MaxVal=99
MinVal=0
ValueDefault=4
[Indent With Tabs]
CallName="-t"
Category=1
Description=<html>Indent the code with the set number of tabs.</html>
EditorType=numeric
Enabled=false
MaxVal=99
MinVal=0
ValueDefault=1
[Add Header]
Category=0
Choices="-l \"Pear(add_header=php)\"|-l \"Pear(add_header=bsd)\"|-l \"Pear(add_header=apache)\"|-l \"Pear(add_header=lgpl)\"|-l \"Pear(add_header=pear)\""
ChoicesReadable="PHP|BSD|Apache|LGPL|PEAR"
Description="<html>Adds header information to a file. These can be Php, BSD, Apache, LGPL or Pear license info.</html>"
EditorType=multiple
Enabled=true
ValueDefault=0
[Newline Class]
Category=0
Description=<html>Add a new line after class before opening brace.</html>
EditorType=boolean
TrueFalse="-l \"Pear(newline_class=true)\"|-l \"Pear(newline_class=false)\""
ValueDefault=1
[Newline Function]
Category=0
Description=<html>Add a new line after function before opening brace.</html>
EditorType=boolean
TrueFalse="-l \"Pear(newline_function=true)\"|-l \"Pear(newline_function=false)\""
ValueDefault=1
[New Lines Before]
CallName="-l \"NewLines(before="
Category=0
Description="<html>Add new lines before specific keywords. Keywords are separated by a single colon. Example: if:switch:T_CLASS<br />The string MUST end with a closing brace and an escaped double quote.</html>"
EditorType=string
Enabled=false
ValueDefault="if:switch:T_CLASS)\""
[New Lines After]
CallName="-l \"NewLines(after="
Category=0
Description="<html>Add new lines after specific keywords. Keywords are separated by a single colon. Example: T_COMMENT:function<br />The string MUST end with a closing brace and an escaped double quote.</html>"
EditorType=string
Enabled=false
ValueDefault="T_COMMENT:function)\""
[Arrays Nested]
Category=0
Description=<html></html>
EditorType=boolean
TrueFalse="-l \"ArrayNested()\"|"
ValueDefault=0
[Lowercase]
Category=0
Description=<html>Lowercases all control structures.</html>
EditorType=boolean
TrueFalse="-l \"Lowercase()\"|"
ValueDefault=0
[List Class And Functions]
Category=0
Choices="-l \"ListClassFunction(list_classes=true)\"|-l \"ListClassFunction(list_functions=true)\"|-l \"ListClassFunction()\""
ChoicesReadable="List Classes|List Functions|List Classes And Functions"
Description=<html>Create a list of functions and classes in the script By default, this Filter puts the list at the beggining of the script. If you want it in another position, put a comment like that <pre> // Class and Function List </pre> The script lookup for the string 'Class and Function List' in a comment and replace the entire comment with the list.</html>
EditorType=multiple
Enabled=false
ValueDefault=0
[Indent Styles]
Category=0
Choices="-l \"IndentStyles(style=k&r)\"|-l \"IndentStyles(style=allman)\"|-l \"IndentStyles(style=whitesmiths)\"|-l \"IndentStyles(style=gnu)\""
ChoicesReadable="K&R|Allman|Whitesmiths|GNU"
Description=<html></html>
EditorType=multiple
Enabled=false
ValueDefault=0

@ -0,0 +1,54 @@
[header]
categories=General options
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.py
indenterFileName=pindent.py
indenterName=PIndent (Python)
inputFileName=indentinput
inputFileParameter=
manual=http://coverage.livinglogic.de/Tools/scripts/pindent.py.html
outputFileName=indentinput
outputFileParameter=none
stringparaminquotes=false
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version="from Python 2.5.1 package"
[End directives]
Category=0
Description="<html>Complete takes a valid Python program as input and outputs a version augmented with block-closing comments (add #end directives).<br />Or Delete assumes its input is a Python program with block-closing comments and outputs a commentless version(delete #end directives).<br />Or Reformat assumes its input is a Python program with block-closing comments but with its indentation messed up, and outputs a properly indented version (use #end directives).</html>"
Enabled=true
EditorType=multiple
Choices="-c|-d|-r"
ChoicesReadable="Complete|Delete|Reformat"
ValueDefault=0
[Step size]
Category=0
Description="<html>Sets the indentation step size.</html>"
Enabled=true
EditorType=numeric
CallName="-s "
MinVal=0
MaxVal=999
ValueDefault=8
[Tab size]
Category=0
Description="<html>Sets the number of spaces a tab character is worth.</html>"
Enabled=true
EditorType=numeric
CallName="-t "
MinVal=0
MaxVal=999
ValueDefault=8
[Convert Tabs]
Category=0
Description="<html>Expand TABs into spaces.</html>"
EditorType=boolean
TrueFalse=-e|
ValueDefault=0

@ -0,0 +1,196 @@
[header]
categories=General options|Spaces|Indentation|Alignments
cfgFileParameterEnding=cr
configFilename=psti.cfg
fileTypes=*.sql
indenterFileName=psti.exe
indenterName=Pl/Sql tidy (Pl/Sql)
inputFileName=indentinput
inputFileParameter="-i "
manual=http://psti.equinoxbase.com/manual.html
outputFileName=indentoutput
outputFileParameter="-o "
stringparaminquotes=false
parameterOrder=iop
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter="-ls "
version=1.2
[Disable all switches]
Category=0
Description="<html>Sets all switches to off.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-0|
ValueDefault=0
[Uppercase Keywords]
Category=0
Description="<html>Uppercase Keywords.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-uk+|-uk-
ValueDefault=0
[Capitalized Keywords]
Category=0
Description="<html>Capitalized Keywords.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-ck+|-ck-
ValueDefault=0
[Lowercase Keywords]
Category=0
Description="<html>Lowercase Keywords.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-lk+|-lk-
ValueDefault=0
[Uppercase Identifiers]
Category=0
Description="<html>Uppercase Identifiers.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-ui+|-ui-
ValueDefault=0
[Lowercase Identifiers]
Category=0
Description="<html>Lowercase Identifiers.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-li+|-li-
ValueDefault=0
[Capitalized Identifiers]
Category=0
Description="<html>Capitalized Identifiers.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-ci+|-ci-
ValueDefault=0
[Compactify]
Category=1
Description="<html>Compactify, remove redundant spaces/keep.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-c+|-c-
ValueDefault=0
[Remove Operation Spaces]
Category=1
Description="<html>Remove spaces around operations (+,- etcdo nothing/).</html>"
Enabled=false
EditorType=boolean
TrueFalse=-co+|-co-
ValueDefault=0
[Add Operation Spaces]
Category=1
Description="<html>Add space around operations/do nothing.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-sao+|-sao-
ValueDefault=0
[Remove Space Open Bracket]
Category=1
Description="<html>Remove spaces after opening brackets/keep.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-rsaob+|-rsaob-
ValueDefault=0
[Don't Remove Bracket Space]
Category=1
Description="<html>Don't remove spaces around brackets/do nothing.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-ncb+|-ncb-
ValueDefault=0
[Indent Size]
Category=2
Description="<html>Indent size in spaces or in tabs (generally).</html>"
Enabled=true
EditorType=numeric
CallName="-is "
MinVal=0
MaxVal=1024
ValueDefault=4
[Indent Lines]
Category=2
Description="<html>Whether to indent strings lines.</html>"
Enabled=true
EditorType=boolean
TrueFalse=-in+|-in-
ValueDefault=1
[Keep relative indentation]
Category=2
Description="<html>Keep the relative identation of an allowed sql/do nothing.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-rs+|-rs-
ValueDefault=0
[Indent after exception]
Category=2
Description="<html>Extra indentation after exception when yes/no.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-iaew+|-iaew-
ValueDefault=0
[Indent after case]
Category=2
Description="<html>Extra indentation after case when yes/no.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-iacw+|-iacw-
ValueDefault=0
[Indent after cursor]
Category=2
Description="<html>Extra indentation after cursor yes/no.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-iac+|-iac-
ValueDefault=0
[Indent comments]
Category=2
Description="<html>Indent standalone comments.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-isc+|-isc-
ValueDefault=0
[Indent comments special]
Category=2
Description="<html>Indent standalone comments in some special cases too.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-isc2+|-isc2-
ValueDefault=0
[Indent inside comments]
Category=2
Description="<html>Indent inside comments/do nothing.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-iic+|-iic-
ValueDefault=0
[Column alignment]
Category=3
Description="<html>Column like lists inside brackets.</html>"
Enabled=false
EditorType=boolean
TrueFalse=-clb+|-clb-
ValueDefault=0

@ -0,0 +1,17 @@
[header]
categories=
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.rb
indenterFileName=rbeautify.rb
indenterName=Ruby Script Beautifier (Ruby)
inputFileName=indentinput
inputFileParameter=
manual=http://www.arachnoid.com/ruby/rubyBeautifier.html
outputFileName=indentinput
outputFileParameter=none
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=2.9

@ -0,0 +1,27 @@
[header]
categories=General
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.rb
indenterFileName=ruby_formatter.rb
indenterName=Simple Ruby Formatter (Ruby)
inputFileName=indentinput
inputFileParameter=
manual=http://raa.ruby-lang.org/project/ruby_formatter/
outputFileName=indentinput
outputFileParameter=none
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=Rev 0.6.1
[indent spaces]
CallName="-s "
Category=0
Description=<html>Indent using # spaces per indent</html>
EditorType=numeric
Enabled=false
MaxVal=20
MinVal=2
ValueDefault=4

@ -0,0 +1,17 @@
[header]
categories=
cfgFileParameterEnding=" "
configFilename=
fileTypes=*.sh
indenterFileName=shellindent.awk
indenterName=Shell Code Indent (sh)
inputFileName=indentinput
inputFileParameter=
manual=http://www.bolthole.com/AWK.html
outputFileName=
outputFileParameter=stdout
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=2008-01-10

@ -0,0 +1,612 @@
[header]
categories="HTML, XHTML, XML|Diagnostics|Pretty Print|Character Encoding|Miscellaneous"
cfgFileParameterEnding=cr
configFilename=htmltidy.cfg
fileTypes=*.html|*.htm
indenterFileName=tidy
indenterName=(HTML) Tidy
inputFileName=indentinput
inputFileParameter=
manual=http://tidy.sourceforge.net/docs/tidy_man.html
outputFileName=indentoutput
outputFileParameter="-o "
parameterOrder=poi
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter="-q -config "
version=2007-05-24
[Quiet]
Category=4
Description="<html>This option specifies if Tidy should output the summary of the numbers of errors and warnings, or the welcome or informational messages.</html>"
EditorType=boolean
Enabled=true
TrueFalse=quiet:yes|quiet:no
ValueDefault=1
[Uppercase tags]
Category=0
Description=<html>This option specifies if Tidy should output tag names in upper case. The default is no, which results in lower case tag names, except for XML input, where the original case is preserved.</html>
EditorType=boolean
Enabled=false
TrueFalse=uppercase-tags:yes|uppercase-tags:no
ValueDefault=0
[accessibility-check]
CallName=accessibility-check:
Category=1
Description="<html>This option specifies what level of accessibility checking, if any, that Tidy should do. Level 0 is equivalent to Tidy Classic's accessibility checking. For more information on Tidy's accessibility checking, visit the Adaptive Technology Resource Centre at the University of Toronto.</html>"
EditorType=numeric
Enabled=true
MaxVal=3
MinVal=0
ValueDefault=0
[add-xml-decl]
Category=0
Description="<html>This option specifies if Tidy should add the XML declaration when outputting XML or XHTML. Note that if the input already includes an <?xml ... ?> declaration then this option will be ignored. If the encoding for the output is different from 'ascii', one of the utf encodings or 'raw', the declaration is always added as required by the XML standard.</html>"
EditorType=boolean
Enabled=false
TrueFalse=add-xml-decl:yes|add-xml-decl:no
ValueDefault=0
[add-xml-space]
Category=0
Description="<html>This option specifies if Tidy should add xml:space='preserve' to elements such as <PRE>, <STYLE> and <SCRIPT> when generating XML. This is needed if the whitespace in such elements is to be parsed appropriately without having access to the DTD.</html>"
EditorType=boolean
Enabled=false
TrueFalse=add-xml-space:yes|add-xml-space:no
ValueDefault=0
[alt-text]
CallName=alt-text:
Category=0
Description="<html>-This option specifies the default 'alt=' text Tidy uses for <IMG> attributes. This feature is dangerous as it suppresses further accessibility warnings. You are responsible for making your documents accessible to people who can not see the images!</html>"
EditorType=string
Enabled=false
ValueDefault=
[ascii-chars]
Category=3
Description="<html>Can be used to modify behavior of -c (--clean yes) option. If set to 'yes' when using -c, &emdash;, &rdquo;, and other named character entities are downgraded to their closest ascii equivalents.</html>"
EditorType=boolean
Enabled=false
TrueFalse=ascii-chars:yes|ascii-chars:no
ValueDefault=0
[assume-xml-procins]
Category=0
Description=<html>This option specifies if Tidy should change the parsing of processing instructions to require ?> as the terminator rather than >. This option is automatically set if the input is in XML.</html>
EditorType=boolean
Enabled=false
TrueFalse=assume-xml-procins:yes|assume-xml-procins:no
ValueDefault=0
[bare]
Category=0
Description="<html>This option specifies if Tidy should strip Microsoft specific HTML from Word 2000 documents, and output spaces rather than non-breaking spaces where they exist in the input.</html>"
EditorType=boolean
Enabled=false
TrueFalse=bare:yes|bare:no
ValueDefault=0
[break-before-br]
Category=2
Description=<html>This option specifies if Tidy should output a line break before each <BR> element.</html>
EditorType=boolean
Enabled=false
TrueFalse=break-before-br:yes|break-before-br:no
ValueDefault=0
[char-encoding]
Category=3
Choices=char-encoding:raw|char-encoding:ascii|char-encoding:latin0|char-encoding:latin1|char-encoding:utf8|char-encoding:iso2022|char-encoding:mac|char-encoding:win1252|char-encoding:ibm858|char-encoding:utf16le|char-encoding:utf16be|char-encoding:utf16|char-encoding:big5|char-encoding:shiftjis
Description="<html>This option specifies the character encoding Tidy uses for both the input and output. For ascii, Tidy will accept Latin-1 (ISO-8859-1) character values, but will use entities for all characters whose value > 127. For raw, Tidy will output values above 127 without translating them into entities. For latin1, characters above 255 will be written as entities. For utf8, Tidy assumes that both input and output is encoded as UTF-8. You can use iso2022 for files encoded using the ISO-2022 family of encodings e.g. ISO-2022-JP. For mac and win1252, Tidy will accept vendor specific character values, but will use entities for all characters whose value > 127.</html>"
EditorType=multiple
Enabled=false
ValueDefault=1
[clean]
Category=0
Description=<html>This option specifies if Tidy should strip out surplus presentational tags and attributes replacing them by style rules and structural markup as appropriate. It works well on the HTML saved by Microsoft Office products.</html>
EditorType=boolean
Enabled=false
TrueFalse=clean:yes|clean:no
ValueDefault=0
[css-prefix]
CallName=css-prefix
Category=0
Description="<html>-This option specifies the prefix that Tidy uses for styles rules. By default, 'c' will be used.</html>"
EditorType=string
Enabled=false
ValueDefault=
[decorate-inferred-ul]
Category=0
Description=<html>This option specifies if Tidy should decorate inferred UL elements with some CSS markup to avoid indentation to the right.</html>
EditorType=boolean
Enabled=false
TrueFalse=decorate-inferred-ul:yes|decorate-inferred-ul:no
ValueDefault=0
[doctype]
Category=0
Choices=doctype:omit|doctype:auto|doctype:strict|doctype:transitional|doctype:user
Description=<html>This option specifies the DOCTYPE declaration generated by Tidy. If set to 'omit' the output won't contain a DOCTYPE declaration. If set to 'auto' (the default) Tidy will use an educated guess based upon the contents of the document. If set to 'strict', Tidy will set the DOCTYPE to the strict DTD. If set to 'loose', the DOCTYPE is set to the loose (transitional) DTD. Alternatively, you can supply a string for the formal public identifier (FPI). For example: doctype: '-//ACME//DTD HTML 3.14159//EN' If you specify the FPI for an XHTML document, Tidy will set the system identifier to an empty string. For an HTML document, Tidy adds a system identifier only if one was already present in order to preserve the processing mode of some browsers. Tidy leaves the DOCTYPE for generic XML documents unchanged. --doctype omit implies --numeric-entities yes. This option does not offer a validation of the document conformance.</html>
EditorType=multiple
Enabled=false
ValueDefault=1
[drop-empty-paras]
Category=0
Description=<html>This option specifies if Tidy should discard empty paragraphs.</html>
EditorType=boolean
Enabled=false
TrueFalse=drop-empty-paras:yes|drop-empty-paras:no
ValueDefault=1
[drop-font-tags]
Category=0
Description=<html>This option specifies if Tidy should discard <FONT> and <CENTER> tags without creating the corresponding style rules. This option can be set independently of the clean option.</html>
EditorType=boolean
Enabled=false
TrueFalse=drop-font-tags:yes|drop-font-tags:no
ValueDefault=0
[drop-proprietary-attributes]
Category=0
Description="<html>This option specifies if Tidy should strip out proprietary attributes, such as MS data binding attributes. </html>"
EditorType=boolean
Enabled=false
TrueFalse=drop-proprietary-attributes:yes|drop-proprietary-attributes:no
ValueDefault=0
[enclose-block-text]
Category=0
Description=<html>This option specifies if Tidy should insert a <P> element to enclose any text it finds in any element that allows mixed content for HTML transitional but not HTML strict.</html>
EditorType=boolean
Enabled=false
TrueFalse=enclose-block-text:yes|enclose-block-text:no
ValueDefault=0
[enclose-text]
Category=0
Description=<html>This option specifies if Tidy should enclose any text it finds in the body element within a <P> element. This is useful when you want to take existing HTML and use it with a style sheet.</html>
EditorType=boolean
Enabled=false
TrueFalse=enclose-text:yes|enclose-text:no
ValueDefault=0
[escape-cdata]
Category=0
Description=<html>This option specifies if Tidy should convert <![CDATA[]]> sections to normal text.</html>
EditorType=boolean
Enabled=false
TrueFalse=escape-cdata:yes|escape-cdata:no
ValueDefault=0
[fix-backslash]
Category=0
Description=<html>This option specifies if Tidy should replace backslash characters '' in URLs by forward slashes '/'.</html>
EditorType=boolean
Enabled=false
TrueFalse=fix-backslash:yes|fix-backslash:no
ValueDefault=1
[fix-bad-comments]
Category=0
Description="<html>This option specifies if Tidy should replace unexpected hyphens with '=' characters when it comes across adjacent hyphens. The default is yes. This option is provided for users of Cold Fusion which uses the comment syntax: <!--- ---></html>"
EditorType=boolean
Enabled=false
TrueFalse=fix-bad-comments:yes|fix-bad-comments:no
ValueDefault=1
[fix-uri]
Category=0
Description="<html>This option specifies if Tidy should check attribute values that carry URIs for illegal characters and if such are found, escape them as HTML 4 recommends.</html>"
EditorType=boolean
Enabled=false
TrueFalse=fix-uri:yes|fix-uri:no
ValueDefault=1
[hide-comments]
Category=0
Description=<html>This option specifies if Tidy should print out comments.</html>
EditorType=boolean
Enabled=false
TrueFalse=hide-comments:yes|hide-comments:no
ValueDefault=0
[hide-endtags]
Category=0
Description=<html>This option specifies if Tidy should omit optional end-tags when generating the pretty printed markup. This option is ignored if you are outputting to XML.</html>
EditorType=boolean
Enabled=false
TrueFalse=hide-endtags:yes|hide-endtags:no
ValueDefault=0
[indent]
Category=2
Description="<html>This option specifies if Tidy should indent block-level tags. If set to 'auto', this option causes Tidy to decide whether or not to indent the content of tags such as TITLE, H1-H6, LI, TD, TD, or P depending on whether or not the content includes a block-level element. You are advised to avoid setting indent to yes as this can expose layout bugs in some browsers.</html>"
EditorType=boolean
Enabled=false
TrueFalse=indent:yes|indent:no
ValueDefault=0
[indent-attributes]
Category=2
Description=<html>This option specifies if Tidy should begin each attribute on a new line.</html>
EditorType=boolean
Enabled=false
TrueFalse=indent-attributes:yes|indent-attributes:no
ValueDefault=0
[indent-cdata]
Category=0
Description=<html>This option specifies if Tidy should indent <![CDATA[]]> sections.</html>
EditorType=boolean
Enabled=false
TrueFalse=indent-cdata:yes|indent-cdata:no
ValueDefault=0
[indent-spaces]
CallName=indent-spaces:
Category=2
Description="<html>This option specifies the number of spaces Tidy uses to indent content, when indentation is enabled.</html>"
EditorType=numeric
Enabled=true
MaxVal=5000
MinVal=0
ValueDefault=2
[input-encoding]
Category=3
Choices=input-encoding:raw|input-encoding:ascii|input-encoding:latin0|input-encoding:latin1|input-encoding:utf8|input-encoding:iso2022|input-encoding:mac|input-encoding:win1252|input-encoding:ibm858|input-encoding:utf16le|input-encoding:utf16be|input-encoding:utf16|input-encoding:big5|input-encoding:shiftjis
Description=<html>This option specifies the character encoding Tidy uses for the input. See char-encoding for more info.</html>
EditorType=multiple
Enabled=false
ValueDefault=4
[input-xml]
Category=0
Description=<html>This option specifies if Tidy should use the XML parser rather than the error correcting HTML parser.</html>
EditorType=boolean
Enabled=false
TrueFalse=input-xml:yes|input-xml:no
ValueDefault=0
[join-classes]
Category=0
Description="<html>This option specifies if Tidy should combine class names to generate a single new class name, if multiple class assignments are detected on an element.</html>"
EditorType=boolean
Enabled=false
TrueFalse=join-classes:yes|join-classes:no
ValueDefault=0
[join-styles]
Category=0
Description="<html>This option specifies if Tidy should combine styles to generate a single new style, if multiple style values are detected on an element.</html>"
EditorType=boolean
Enabled=false
TrueFalse=join-styles:yes|join-styles:no
ValueDefault=1
[literal-attributes]
Category=0
Description=<html>This option specifies if Tidy should ensure that whitespace characters within attribute values are passed through unchanged.</html>
EditorType=boolean
Enabled=false
TrueFalse=literal-attributes:yes|literal-attributes:no
ValueDefault=0
[logical-emphasis]
Category=0
Description="<html>This option specifies if Tidy should replace any occurrence of <I> by <EM> and any occurrence of <B> by <STRONG>. In both cases, the attributes are preserved unchanged. This option can be set independently of the clean and drop-font-tags options.</html>"
EditorType=boolean
Enabled=false
TrueFalse=logical-emphasis:yes|logical-emphasis:no
ValueDefault=0
[lower-literals]
Category=0
Description=<html>This option specifies if Tidy should convert the value of an attribute that takes a list of predefined values to lower case. This is required for XHTML documents.</html>
EditorType=boolean
Enabled=false
TrueFalse=lower-literals:yes|lower-literals:no
ValueDefault=1
[markup]
Category=2
Description=<html>This option specifies if Tidy should generate a pretty printed version of the markup. Note that Tidy won't generate a pretty printed version if it finds significant errors (see force-output).</html>
EditorType=boolean
Enabled=false
TrueFalse=markup:yes|markup:no
ValueDefault=1
[merge-divs]
Category=0
Choices=merge-divs:auto|merge-divs:yes|merge-divs:no
ChoicesReadable=Merge Divs Auto|Do Merge Divs|Do Not Merge Divs
Description="<html>Can be used to modify behavior of -c (--clean yes) option. This option specifies if Tidy should merge nested <div> such as '<div><div>...</div></div>'. If set to 'auto', the attributes of the inner <div> are moved to the outer one. As well, nested <div> with ID attributes are not merged. If set to 'yes', the attributes of the inner <div> are discarded with the exception of 'class' and 'style'.</html>"
EditorType=multiple
Enabled=false
ValueDefault=0
[ncr]
Category=0
Description=<html>This option specifies if Tidy should allow numeric character references.</html>
EditorType=boolean
Enabled=false
TrueFalse=ncr:yes|ncr:no
ValueDefault=1
[new-blocklevel-tags]
CallName=new-blocklevel-tags:
Category=0
Description="<html>This option specifies new block-level tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can't change the content model for elements such as <TABLE>, <UL>, <OL> and <DL>. This option is ignored in XML mode.</html>"
EditorType=string
Enabled=false
ValueDefault=
[new-empty-tags]
CallName=new-empty-tags:
Category=0
Description="<html>This option specifies new empty inline tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Remember to also declare empty tags as either inline or blocklevel. This option is ignored in XML mode.</html>"
EditorType=string
Enabled=false
ValueDefault=
[new-inline-tags]
CallName=new-inline-tags:
Category=0
Description="<html>This option specifies new non-empty inline tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. This option is ignored in XML mode.</html>"
EditorType=string
Enabled=false
ValueDefault=
[new-pre-tags]
CallName=new-pre-tags:
Category=0
Description="<html>This option specifies new tags that are to be processed in exactly the same way as HTML's <PRE> element. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can not as yet add new CDATA elements (similar to <SCRIPT>). This option is ignored in XML mode.</html>"
EditorType=string
Enabled=false
ValueDefault=
[newline]
Category=3
Choices=newline:LF|newline:CRLF|newline:CR
Description="<html>The default is appropriate to the current platform: CRLF on PC-DOS, MS-Windows and OS/2, CR on Classic Mac OS, and LF everywhere else (Unix and Linux).</html>"
EditorType=multiple
Enabled=false
ValueDefault=1
[numeric-entities]
Category=0
Description="<html>This option specifies if Tidy should output entities other than the built-in HTML entities (&amp;, &lt;, &gt; and &quot;) in the numeric rather than the named entity form. Only entities compatible with the DOCTYPE declaration generated are used. Entities that can be represented in the output encoding are translated correspondingly.</html>"
EditorType=boolean
Enabled=false
TrueFalse=numeric-entities:yes|numeric-entities:no
ValueDefault=0
[output-bom]
Category=3
Choices=output-bom:auto|output-bom:yes|output-bom:no
Description="<html>This option specifies if Tidy should write a Unicode Byte Order Mark character (BOM; also known as Zero Width No-Break Space; has value of U+FEFF) to the beginning of the output; only for UTF-8 and UTF-16 output encodings. If set to 'auto', this option causes Tidy to write a BOM to the output only if a BOM was present at the beginning of the input. A BOM is always written for XML/XHTML output using UTF-16 output encodings.</html>"
EditorType=multiple
Enabled=false
ValueDefault=0
[output-encoding]
Category=3
Choices=output-encoding:raw|output-encoding:ascii|output-encoding:latin0|output-encoding:latin1|output-encoding:utf8|output-encoding:iso2022|output-encoding:mac|output-encoding:win1252|output-encoding:ibm858|output-encoding:utf16le|output-encoding:utf16be|output-encoding:utf16|output-encoding:big5|output-encoding:shiftjis
Description="<html>This option specifies the character encoding Tidy uses for the output. See char-encoding for more info. May only be different from input-encoding for Latin encodings (ascii, latin0, latin1, mac, win1252, ibm858).</html>"
EditorType=multiple
Enabled=false
ValueDefault=1
[output-html]
Category=0
Description="<html>This option specifies if Tidy should generate pretty printed output, writing it as HTML.</html>"
EditorType=boolean
Enabled=false
TrueFalse=output-html:yes|output-html:no
ValueDefault=0
[output-xhtml]
Category=0
Description="<html>This option specifies if Tidy should generate pretty printed output, writing it as extensible HTML. This option causes Tidy to set the DOCTYPE and default namespace as appropriate to XHTML. If a DOCTYPE or namespace is given they will checked for consistency with the content of the document. In the case of an inconsistency, the corrected values will appear in the output. For XHTML, entities can be written as named or numeric entities according to the setting of the 'numeric-entities' option. The original case of tags and attributes will be preserved, regardless of other options.</html>"
EditorType=boolean
Enabled=false
TrueFalse=output-xhtml:yes|output-xhtml:no
ValueDefault=0
[output-xml]
Category=0
Description="<html>This option specifies if Tidy should pretty print output, writing it as well-formed XML. Any entities not defined in XML 1.0 will be written as numeric entities to allow them to be parsed by a XML parser. The original case of tags and attributes will be preserved, regardless of other options.</html>"
EditorType=boolean
Enabled=false
TrueFalse=output-xml:yes|output-xml:no
ValueDefault=0
[preserve-entities]
Category=0
Description=<html>This option specifies if Tidy should preserve the well-formed entitites as found in the input.</html>
EditorType=boolean
Enabled=false
TrueFalse=preserve-entities:yes|preserve-entities:no
ValueDefault=0
[punctuation-wrap]
Category=2
Description=<html>This option specifies if Tidy should line wrap after some Unicode or Chinese punctuation characters.</html>
EditorType=boolean
Enabled=false
TrueFalse=punctuation-wrap:yes|punctuation-wrap:no
ValueDefault=0
[quote-ampersand]
Category=0
Description="<html>This option specifies if Tidy should output unadorned & characters as &amp;.</html>"
EditorType=boolean
Enabled=false
TrueFalse=quote-ampersand:yes|quote-ampersand:no
ValueDefault=1
[quote-marks]
Category=0
Description="<html>This option specifies if Tidy should output ' characters as &quot; as is preferred by some editing environments. The apostrophe character ' is written out as &#39; since many web browsers don't yet support &apos;.</html>"
EditorType=boolean
Enabled=false
TrueFalse=quote-marks:yes|quote-marks:no
ValueDefault=0
[quote-nbsp]
Category=0
Description="<html>This option specifies if Tidy should output non-breaking space characters as entities, rather than as the Unicode character value 160 (decimal).</html>"
EditorType=boolean
Enabled=false
TrueFalse=quote-nbsp:yes|quote-nbsp:no
ValueDefault=1
[repeated-attributes]
Category=0
Choices=repeated-attributes:keep-first|repeated-attributes:keep-last
Description="<html>This option specifies if Tidy should keep the first or last attribute, if an attribute is repeated, e.g. has two align attributes.</html>"
EditorType=multiple
Enabled=false
ValueDefault=1
[replace-color]
Category=0
Description="<html>This option specifies if Tidy should replace numeric values in color attributes by HTML/XHTML color names where defined, e.g. replace '#ffffff' with 'white'.</html>"
EditorType=boolean
Enabled=false
TrueFalse=replace-color:yes|replace-color:no
ValueDefault=0
[show-body-only]
Category=0
Description=<html>This option specifies if Tidy should print only the contents of the body tag as an HTML fragment. Useful for incorporating existing whole pages as a portion of another page.</html>
EditorType=boolean
Enabled=false
TrueFalse=show-body-only:yes|show-body-only:no
ValueDefault=0
[show-errors]
CallName=show-errors:
Category=1
Description="<html>This option specifies what level of accessibility checking, if any, that Tidy should do. Level 0 is equivalent to Tidy Classic's accessibility checking. For more information on Tidy's accessibility checking, visit the Adaptive Technology Resource Centre at the University of Toronto.</html>"
EditorType=numeric
Enabled=true
MaxVal=5000
MinVal=0
ValueDefault=6
[show-warnings]
Category=1
Description=<html>This option specifies if Tidy should suppress warnings. This can be useful when a few errors are hidden in a flurry of warnings.</html>
EditorType=boolean
Enabled=false
TrueFalse=show-warnings:yes|show-warnings:no
ValueDefault=1
[split]
Category=2
Description=<html>Currently not used. Tidy Classic only.</html>
EditorType=boolean
Enabled=false
TrueFalse=split:yes|split:no
ValueDefault=0
[tab-size]
CallName=tab-size:
Category=2
Description=<html>This option specifies the number of columns that Tidy uses between successive tab stops. It is used to map tabs to spaces when reading the input. Tidy never outputs tabs.</html>
EditorType=numeric
Enabled=true
MaxVal=5000
MinVal=0
ValueDefault=8
[uppercase-attributes]
Category=0
Description="<html>This option specifies if Tidy should output attribute names in upper case. The default is no, which results in lower case attribute names, except for XML input, where the original case is preserved.</html>"
EditorType=boolean
Enabled=false
TrueFalse=uppercase-attributes:yes|uppercase-attributes:no
ValueDefault=0
[vertical-space]
Category=2
Description=<html>This option specifies if Tidy should add some empty lines for readability.</html>
EditorType=boolean
Enabled=false
TrueFalse=vertical-space:yes|vertical-space:no
ValueDefault=0
[word-2000]
Category=0
Description="<html>This option specifies if Tidy should go to great pains to strip out all the surplus stuff Microsoft Word 2000 inserts when you save Word documents as 'Web pages'. Doesn't handle embedded images or VML. You should consider using Word's 'Save As: Web Page, Filtered'.</html>"
EditorType=boolean
Enabled=false
TrueFalse=word-2000:yes|word-2000:no
ValueDefault=0
[wrap]
CallName=wrap:
Category=2
Description=<html>This option specifies the right margin Tidy uses for line wrapping. Tidy tries to wrap lines so that they do not exceed this length. Set wrap to zero if you want to disable line wrapping.</html>
EditorType=numeric
Enabled=true
MaxVal=5000
MinVal=0
ValueDefault=68
[wrap-asp]
Category=2
Description="<html>This option specifies if Tidy should line wrap text contained within ASP pseudo elements, which look like: <% ... %>.</html>"
EditorType=boolean
Enabled=false
TrueFalse=wrap-asp:yes|wrap-asp:no
ValueDefault=1
[wrap-attributes]
Category=2
Description="<html>This option specifies if Tidy should line wrap attribute values, for easier editing. This option can be set independently of wrap-script-literals.</html>"
EditorType=boolean
Enabled=false
TrueFalse=wrap-attributes:yes|wrap-attributes:no
ValueDefault=0
[wrap-jste]
Category=2
Description="<html>This option specifies if Tidy should line wrap text contained within JSTE pseudo elements, which look like: <# ... #>.</html>"
EditorType=boolean
Enabled=false
TrueFalse=wrap-jste:yes|wrap-jste:no
ValueDefault=1
[wrap-php]
Category=2
Description="<html>This option specifies if Tidy should line wrap text contained within PHP pseudo elements, which look like: <?php ... ?>.</html>"
EditorType=boolean
Enabled=false
TrueFalse=wrap-php:yes|wrap-php:no
ValueDefault=1
[wrap-script-literals]
Category=2
Description=<html>This option specifies if Tidy should line wrap string literals that appear in script attributes. Tidy wraps long script string literals by inserting a backslash character before the line break.</html>
EditorType=boolean
Enabled=false
TrueFalse=wrap-script-literals:yes|wrap-script-literals:no
ValueDefault=0
[wrap-sections]
Category=2
Description=<html>This option specifies if Tidy should line wrap text contained within <![ ... ]> section tags.</html>
EditorType=boolean
Enabled=false
TrueFalse=wrap-sections:yes|wrap-sections:no
ValueDefault=0

File diff suppressed because it is too large Load Diff

@ -0,0 +1,45 @@
[header]
categories=General
cfgFileParameterEnding=cr
configFilename=
fileTypes=*.vb
indenterFileName=vbsbeaut.bat
indenterName=VBSBeautifier (VB)
inputFileName=indentinput
inputFileParameter=" "
manual=http://www.daansystems.com/vbsbeaut/
outputFileName=indentinput
outputFileParameter=none
parameterOrder=pio
showHelpParameter=
stringparaminquotes=false
useCfgFileParameter=
version=1.10
[Spaces]
Category=0
Description="<html>Replace tabs by this number of spaces</html>"
Enabled=false
EditorType=numeric
CallName="-s"
MinVal=0
MaxVal=1024
ValueDefault=4
[Keywords]
Category=0
Description="<html>Change keywords</html>"
Enabled=false
EditorType=multiple
Choices="|-u|-l|-n"
ChoicesReadable="Properize keywords|Make keywords uppercase|Make keywords lowercase|Don't change keywords"
ValueDefault=0
[Split Dim]
Category=0
Description="<html>Split Dim statements</html>"
Enabled=false
EditorType=boolean
TrueFalse=|-d
ValueDefault=0

@ -0,0 +1,61 @@
[header]
categories=General
cfgFileParameterEnding=cr
configFilename=
fileTypes=*.xml|*.xslt
indenterFileName=xmlindent
indenterName=XML Indent (XML, XSL)
inputFileName=indentinput
inputFileParameter=
manual=http://universalindent.sf.net/indentermanuals/xmlindent.txt
outputFileName=indentoutput
outputFileParameter="-o "
parameterOrder=poi
showHelpParameter=-h
stringparaminquotes=false
useCfgFileParameter=none
version=0.2.17
[Indent level]
CallName="-i "
Category=0
Description=<html>Indent using n spaces or tabs.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=4
[Use tabs]
Category=0
Description=<html>Use tabs instead of spaces for indent.</html>
EditorType=boolean
TrueFalse=-t|
ValueDefault=0
[Maximum wrap columns]
CallName="-l "
Category=0
Description=<html>Maximum columns for line wrapping.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=80
[Suppress newline at pos]
CallName="-n "
Category=0
Description=<html>Suppress newline at position.</html>
EditorType=numeric
Enabled=false
MaxVal=120
MinVal=0
ValueDefault=80
[Force newline]
Category=0
Description=<html>Force newline on elements without children.</html>
EditorType=boolean
TrueFalse=-f|
ValueDefault=0

@ -0,0 +1,247 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<title>UniversalIndentGUI ReadMe</title>
<style type="text/css">
<!--
/* Links general
/*******************************/
a
{
color: #36b;
}
/* Links external
/*******************************/
a.external
{
background: url("doc/images/externallinks.png") center right no-repeat;
padding-right: 13px;
}
-->
</style>
</head>
<body style="font-family: Tahoma,serif;">
<!--
<h1>UniversalIndentGUI</h1>
-->
<div align="center"><img src="doc/images/banner.jpg" alt="UiGUI Screenshot"></div>
<br clear="all" />
<br />
<p style="margin-left:40pt;">
Ever concerned about how your code looks like?<br />
Ever heard of different indenting styles, for example K&amp;R?<br />
Ever received code from someone else who didn't care about code formatting?<br />
Ever tried to configure a code indenter to convert such code to your coding style?<br />
Ever got bored by that tedious "changing a parameter"-"call the indeter"-"try and error" procedure?<br />
</p>
<p>
Help is close to you. UniversalIndentGUI offers a live preview for setting the parameters of nearly any indenter.
You change the value of a parameter and directly see how your reformatted code will look like. Save your beauty looking
code or create an anywhere usable batch/shell script to reformat whole directories or just one file even out of the
editor of your choice that supports external tool calls.<br />
Many free available code beautifier, formatter and indenter are currently supported, like GNU Indent, Uncrustify,
Artistic Styler, PHP Stylist, Ruby Beautify, HTML Tidy and many other (look at features for complete list).
Currently not supported indenters can be easyly added by creating a configuration file for them.<br />
Thus UniversalIndentGUI is open for nearly any new indenter and programming languages. Give it a try.
Perhaps you'll also find an indenter for your programming language that you even didn't know that it exists.
</p>
<h3>Features</h3>
<p>
<ul>
<li>Live Preview: change an indenter parameter and directly see how your formatted code will look like.</li>
<li>Support for nearly any existing indenter possible. Currently supported are:</li>
<img width="400" align="right" vspace="10" src="doc/images/screenshot8.jpg" alt="UiGUI Screenshot">
<ul>
<li><a class="external" href="http://astyle.sourceforge.net/">Artistic Styler</a></li>
<li><a class="external" href="http://invisible-island.net/bcpp/">BCPP</a></li>
<li><a class="external" href="http://www.siber.com/sct/tools/cbl-beau.html">Cobol Beautify</a></li>
<li><a class="external" href="http://csstidy.sourceforge.net/">CSSTidy</a></li>
<li><a class="external" href="ftp://ftp.ifremer.fr/ifremer/ditigo/fortran90/">Fortran 90 PPR</a></li>
<li><a class="external" href="http://www.gnu.org/software/indent/">GNU Indent</a></li>
<li><a class="external" href="http://sourceforge.net/projects/gcgreatcode/">GreatCode</a></li>
<li><a class="external" href="http://packages.debian.org/de/lenny/hindent">hindent</a></li>
<li><a class="external" href="http://www.digital-mines.com/htb/">HTB</a></li>
<li><a class="external" href="http://code.gosu.pl/">Javascript Decoder</a></li>
<li><a class="external" href="http://jsppp.sourceforge.net/">JSPPP</a></li>
<li><a class="external" href="http://perltidy.sourceforge.net/">Perl Tidy</a></li>
<li><a class="external" href="http://pear.php.net/package/PHP_Beautifier">PHP_Beautifier</a></li>
<li><a class="external" href="http://www.waterproof.fr/products/phpCodeBeautifier/">PHP Code Beautifier</a></li>
<li><a class="external" href="http://sourceforge.net/projects/phpstylist/">PHP Stylist</a></li>
<li><a class="external" href="http://coverage.livinglogic.de/Tools/scripts/pindent.py.html">pindent</a></li>
<li><a class="external" href="http://psti.equinoxbase.com/">Pl/Sql tidy</a></li>
<li><a class="external" href="http://www.arachnoid.com/ruby/rubyBeautifier.html">Ruby Beautify</a></li>
<li><a class="external" href="http://raa.ruby-lang.org/project/ruby_formatter/">Ruby Formatter</a></li>
<li><a class="external" href="http://www.bolthole.com/AWK.html">Shell Indent</a></li>
<li><a class="external" href="http://tidy.sourceforge.net/">(HTML) Tidy</a></li>
<li><a class="external" href="http://uncrustify.sourceforge.net/">Uncrustify</a></li>
<li><a class="external" href="http://www.daansystems.com/vbsbeaut/">VBSBeautifier</a></li>
<li><a class="external" href="http://xmlindent.sourceforge.net/">XML Indent</a></li>
Please note that Cobol Beautify and PHP Code Beautifier can not be distributed with a UiGUI package, because
they are only free available if you register at their homepage.
</ul>
<li>Easy adding of new indenters: just create a parameter definition file for the new indenter.</li>
<li>Load and save different indenter configurations.</li>
<li>Reset to indenters default parameters.</li>
<li>By the above named indenters currently supported programming languages:</li>
<img width="400" align="right" vspace="10" src="doc/images/screenshot6.jpg" alt="UiGUI Screenshot">
<ul>
<li>C, C++</li>
<li>C#</li>
<li>Cobol</li>
<li>CSS</li>
<li>D</li>
<li>Fortran</li>
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>JSP</li>
<li>Objective-C</li>
<li>Pawn</li>
<li>Perl</li>
<li>PHP</li>
<li>Pl/Sql</li>
<li>Python</li>
<li>Ruby</li>
<li>Shellscript</li>
<li>VALA</li>
<li>Visual Basic</li>
<li>XML</li>
<li>XSL</li>
</ul>
<li>Syntax highlighting for all of these languages except for Pawn and VALA</li>
<li>Really easy to handle user interface.</li>
<li>Tooltips for each indenter parameter.</li>
<li>Creation of batch/shell scripts.</li>
<li>HTML and PDF export of your code.</li>
<li>PortableMode and MultiUserMode: In portable mode only uses its own subdirectories for temporary writing.</li>
<li>Multiple languages: English, German, Traditional Chinese, Russian, Ukrainian, partly Japanese.</li>
<li>Drag'n Drop of source code files.</li>
<li>Support for many different file encodings, like Korean KOI8-R or Chinese BIG5.</li>
<li>Possibility to edit your code while live preview is turned on. Yeah, thats really live! (but positions cursor wrong sometimes depending on the used indenter :-( )</li>
<li>Code completion.</li>
<li>Automatic update check. Does check only once a day and can be disabled.</li>
<li>A nice about dialog. Errrmm, ok beneath all the mean stuff this is somehow the programmers playground ;-)</li>
</ul>
</p>
<p>
Also a <a class="external" href="http://notepad-plus.sourceforge.net/">Notepad++</a> plugin version is available.
The programming project for that is currently only available as Visual Studio C++ 2005 project file.
Also this plugin has some problems with its event handling, because it is running as a DLL inside of Notepad++ event loop.
This will be replaced with the upcoming UiGUI server functionality. See future plans for more about that.
</p>
<h3>Supported and tested platforms</h3>
<p>
<ul>
<li>Windows 32 bit</li>
<li>Linux 32 and 64 bit</li>
<li>Mac OS X >= 10.4 (currently Intel only. PPC produced mysterious linker error)</li>
</ul>
</p>
<h3>How to install / build UniversalIndentGUI</h3>
<p>
If you downloaded a complete binary package/archive for your system from SourceForge, you only need to unpack it and
can run it out of the box. Also all free available indenters for your platform are included. Doing it that way,
UiGUI will run in portable mode.
</p>
<p>
But if you'd like to build UiGUI from source, follow these steps:
<ol>
<li>Download, unpack, configure and compile
<a class="external" href="http://www.qtsoftware.com/downloads/opensource/appdev">Qt</a>
>= 4.4.0. Make your QTDIR and QMAKESPEC settings. Or install Qt via a package manager.</li>
<li>Download, unpack, compile and install
<a class="external" href="http://www.riverbankcomputing.com/software/qscintilla/download">QScintilla</a>
>= 2.2.</li>
<li>Checkout UiGUI: svn co https://universalindent.svn.sourceforge.net/svnroot/universalindent/trunk universalindentgui</li>
<li>In the checked out directory run "qmake UniversalIndentGUI.pro".</li>
<li>Run "make release".</li>
<li>Install it</li>
<ol type="a">
<li>
Windows and Mac:<br />
For testing on Windows/Mac download the indenter binary package from sourceforge and extract it into the
directory where you checked out the code (in the upper example that is "universalindentgui").
Then move the file "UniversalIndentGUI.exe" (on Mac the directory "UniversalIndentGUI") from the
"release" directory also to that directory. Starting UiGUI from this directory will run it
in portable mode.
</li>
<li>
Linux:<br />
Run "sudo make install" installs for multi user mode. Install supported indenters via package manager for
example. For portable mode just skip "make install" and move the file "universalindentgui" from the "release"
directory into the directory where you checked out the code (in the upper example that is
"universalindentgui").
</li>
</ol>
</ol>
<b>Indenter binary packages</b> can be downloaded from the project at SourceForge
<a class="external" href="http://sourceforge.net/project/showfiles.php?group_id=167482&package_id=293094">here</a>.
<p>Beneath the possibility to build UiGUI using qmake, also project files for Visual Studio 2005
and XCode are included.</p>
</p>
<h3>Used Qt techniques</h3>
<p>This list shows some selected functionalities that Qt offers and that I use with UiGUI.</p>
<ul>
<li>Translations are done with
<a class="external" href="http://doc.trolltech.com/4.4/qtranslator.html">QTranslator</a>,
<a class="external" href="http://doc.trolltech.com/4.4/qlocale.html">QLocale</a> and Linguist.</li>
<li>File encodings are supported by using
<a class="external" href="http://doc.trolltech.com/4.4/qtextcodec.html">QTextCodec</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qtextstream.html">QTextStream</a>.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qscriptengine.html">QScriptEngine</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qscriptvalue.html">QScriptValue</a>
is included for executing JavaScript files used as indenters.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qgraphicsview.html">QGraphicsView</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qgraphicsproxywidget.html">QGraphicsProxyWidget</a>
for creating an animated 3D about dialog, simulating that is done on the whole desktop by using
the screenshot capability of Qt.</li>
<li>Stylesheet settings give the about dialog a special look. Also gradients are used.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qhttp.html">QHttp</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qurl.html">QUrl</a>
are used for the update check.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qsettings.html">QSettings</a>
is responsible for storing the application and syntax highlighter settings.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qtcpserver.html">QTcpServer</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qtcpsocket.html">QTcpSocket</a>
build the base for the UiGUI Server.</li>
<li>Of course I use the Qt tools qmake, lupdate, lrelease, Designer, Linguist and my very best friend the Assistant.</li>
</ul>
<h3>Future plans</h3>
<ul>
<li>Exchangeable source code view. Mainly adding a "Live Diff View" where you can see the unformatted
code and the formatted one side by side with changes highlighted.</li>
<li>Bring functionality to the UiGUI server so that he can be run anywhere and a client plugin in any editor
like Eclipse or Notepad++ can communicate with it. Thus the client plugin can be written in any language
supporting TCP/IP connections and send to be formatted code to the server. Also some settings might be
made via that conncection. Plans are going on, so stay tuned.</li>
<li>Batch/Multiple file and directory indenting, so that the user can throw a bunch of files or directories
into a list and click on "Do it", so they all will get formatted.</li>
</ul>
<h3>Thanks</h3>
Here I'd like to say "thank you" to all those guys, who helped me improving UiGUI. May it be doing some
translations, creating packages for Linux, letting me know about bugs or ways to improve or just saying
that they found my application helpful and that they like it. So:<br /><br />
<div align="center"><b>Thank you all out there!!</b></div>
<h3>Disclaimer</h3>
You may use this software on your own risk. I am not responsible for any system damage or loss of data.
Respect the GPL! UiGUI is being released under
<a class="external" href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL 2</a>.
You will also find the license in the included file "LICENSE.GPL".
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

@ -0,0 +1,48 @@
<RCC>
<qresource prefix="/aboutDialog">
<file>qt_logo.png</file>
<file>banner.png</file>
</qresource>
<qresource prefix="/language">
<file>language-de.png</file>
<file>language-en.png</file>
<file>language-fr.png</file>
<file>language-ru.png</file>
<file>language-uk.png</file>
<file>language-zh_CN.png</file>
<file>language-zh_TW.png</file>
<file>language-ja.png</file>
</qresource>
<qresource prefix="/mainWindow">
<file>document-properties.png</file>
<file>Icon1.png</file>
<file>universalIndentGUI.svg</file>
<file>document-open.png</file>
<file>document-save-as.png</file>
<file>document-save.png</file>
<file>edit-clear.png</file>
<file>exporthtml.png</file>
<file>exportpdf.png</file>
<file>format-justify-left.png</file>
<file>help.png</file>
<file>icon2.png</file>
<file>icon3.png</file>
<file>info.png</file>
<file>live-preview.png</file>
<file>load_indent_cfg.png</file>
<file>preferences-system.png</file>
<file>save_indent_cfg.png</file>
<file>shell.png</file>
<file>syntax-highlight.png</file>
<file>system-log-out.png</file>
<file>system-software-update.png</file>
<file>tooltip.png</file>
<file>view-refresh.png</file>
</qresource>
<qresource prefix="/settingsDialog">
<file>accessories-text-editor.png</file>
<file>applications-system.png</file>
<file>icon3.png</file>
<file>syntax-highlight.png</file>
</qresource>
</RCC>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,108 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "..\src\UiGuiVersion.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Deutsch (Deutschland) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef UNIVERSALINDENTGUI_NPP_EXPORTS
#define PROGRAM_TITLE "UniversalIndentGUI Notepad++ Plugin"
#define INTERNALNAME "UiGUI NPP Plugin"
#define ORIGINALFILENAME "UniversalIndentGUI_NPP.dll"
#else
#define PROGRAM_TITLE "UniversalIndentGUI"
#define INTERNALNAME "UiGUI"
#define ORIGINALFILENAME "UniversalIndentGUI.exe"
#endif
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION RESOURCE_VERSION
PRODUCTVERSION RESOURCE_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Thomas Schweitzer\0"
VALUE "FileDescription", PROGRAM_TITLE "\0"
VALUE "FileVersion", RESOURCE_VERSION_STRING
VALUE "InternalName", INTERNALNAME "\0"
VALUE "LegalCopyright", "Copyright © Thomas Schweitzer 2012\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", ORIGINALFILENAME "\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", PROGRAM_TITLE "\0"
VALUE "ProductVersion", RESOURCE_VERSION_STRING
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1200
END
END
#endif // !_MAC
#endif // #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "universalIndentGUI.ico"

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="780"
height="780"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docname="universalIndentGUI.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="C:\Dokumente und Einstellungen\ts\Eigene Dateien\Visual Studio 2005\Projects\UiGui\resources\universalIndentGUI_64x64.png"
inkscape:export-xdpi="7.3800001"
inkscape:export-ydpi="7.3800001">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.91214279"
inkscape:cx="340.32318"
inkscape:cy="405.87242"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="968"
inkscape:window-x="1280"
inkscape:window-y="22" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(4.8891506,-18.237072)">
<g
id="g3155"
transform="matrix(0.999285,0,0,0.9826825,-8.6113584e-3,0.3208517)">
<rect
y="18.850748"
x="-4.2754745"
height="792.50806"
width="779.341"
id="rect2425"
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.22735214;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="71.65731"
x="316.38922"
height="89.993835"
width="378.28165"
id="rect2383"
style="fill:#5555ff;fill-opacity:1;stroke:#000000;stroke-width:0.97132629;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="671.63696"
x="316.38922"
height="89.993835"
width="378.28165"
id="rect2398"
style="fill:#5555ff;fill-opacity:1;stroke:#000000;stroke-width:0.97132629;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="271.56451"
x="453.01395"
height="90.175598"
width="241.76047"
id="rect2400"
style="fill:#00d400;fill-opacity:1;stroke:#000000;stroke-width:0.77700001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="471.54807"
x="453.01395"
height="90.175598"
width="241.76047"
id="rect2402"
style="fill:#00d400;fill-opacity:1;stroke:#000000;stroke-width:0.77729917;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccccc"
id="path2445"
d="M 100.70226,141.45325 C 100.91246,277.71283 102.17192,569.71629 100.70226,694.64075 C 127.42166,694.65406 116.64867,694.66351 145.23842,694.64075 C 184.0519,484.75502 337.81109,454.33715 419.67592,418.047 C 331.5138,375.45954 182.79245,348.82008 145.23842,141.45325 C 118.20526,141.54462 124.17093,141.43636 100.70226,141.45325 z"
style="fill:#00d400;fill-opacity:1;stroke:#000000;stroke-width:0.77700001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

@ -0,0 +1,120 @@
/* XPM */
static char * universalIndentGUI_32x32_xpm[] = {
"32 32 85 1",
" c None",
". c #DFDFDF",
"+ c #EEEEEE",
"@ c #DEDEDE",
"# c #F0F0F0",
"$ c #FFFFFF",
"% c #EFEFEF",
"& c #7878E4",
"* c #6565EE",
"= c #9191E7",
"- c #6C6CF0",
"; c #5555FF",
"> c #8888F0",
", c #E9F1E9",
"' c #DEEBDE",
") c #F8FAF8",
"! c #55D655",
"~ c #00D400",
"{ c #ADEAAD",
"] c #8080E5",
"^ c #6F6FEE",
"/ c #9898E8",
"( c #69DF69",
"_ c #24D324",
": c #FEFEFE",
"< c #AEEAAE",
"[ c #32D632",
"} c #FDFEFD",
"| c #84E084",
"1 c #CFF7CF",
"2 c #33DD33",
"3 c #75DE75",
"4 c #03D503",
"5 c #ABE8AB",
"6 c #C3F5C3",
"7 c #05D205",
"8 c #96E796",
"9 c #51D851",
"0 c #DDF4DD",
"a c #C8F2C8",
"b c #20CB20",
"c c #65D165",
"d c #0AD30A",
"e c #68DD68",
"f c #D9F3D9",
"g c #03D303",
"h c #4DD94D",
"i c #B5EBB5",
"j c #FCFDFC",
"k c #22D322",
"l c #83E283",
"m c #EAF6EA",
"n c #01D301",
"o c #44D844",
"p c #B6ECB6",
"q c #2ED52E",
"r c #BEEBBE",
"s c #D3F8D3",
"t c #44DF44",
"u c #80E180",
"v c #67DC67",
"w c #F9FCF9",
"x c #82DF82",
"y c #5CDB5C",
"z c #C4F2C4",
"A c #10C910",
"B c #5BCF5B",
"C c #1AD31A",
"D c #F3FAF3",
"E c #91E691",
"F c #15D215",
"G c #F6FBF6",
"H c #58DC58",
"I c #9DE89D",
"J c #9C9CF5",
"K c #8E8EFF",
"L c #AFAFF5",
"M c #D0F4D0",
"N c #BBF4BB",
"O c #EFFAEF",
"P c #6E6EE3",
"Q c #5A5AEE",
"R c #8989E5",
"S c #EDEDED",
"T c #DCDCDC",
".++++++++++++++++++++++++++++++@",
"#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$$$$$$$$$$&**************=$$%",
"#$$$$$$$$$$$$-;;;;;;;;;;;;;;>$$%",
"#$$$,')$$$$$$-;;;;;;;;;;;;;;>$$%",
"#$$$!~{$$$$$$]^^^^^^^^^^^^^^/$$%",
"#$$$!~($$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~_:$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~~<$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~~[}$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~~~|$$$$$$$$$12222222223$$%",
"#$$$!~~~45$$$$$$$$6~~~~~~~~~!$$%",
"#$$$!~~~~78$$$$$$$6~~~~~~~~~!$$%",
"#$$$!~~~~~~90$$$$$abbbbbbbbbc$$%",
"#$$$!~~~~~~~def$$$$$$$$$$$$$$$$%",
"#$$$!~~~~~~~~~ghij$$$$$$$$$$$$$%",
"#$$$!~~~~~~~~~~klm$$$$$$$$$$$$$%",
"#$$$!~~~~~~~nopj$$$$$$$$$$$$$$$%",
"#$$$!~~~~~~qr$$$$$stttttttttu$$%",
"#$$$!~~~~~vw$$$$$$6~~~~~~~~~!$$%",
"#$$$!~~~~x$$$$$$$$6~~~~~~~~~!$$%",
"#$$$!~~~y$$$$$$$$$zAAAAAAAAAB$$%",
"#$$$!~~CD$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~~E$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~FG$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~H$$$$$$$$$$$$$$$$$$$$$$$$%",
"#$$$!~I$$$$$$JKKKKKKKKKKKKKKL$$%",
"#$$$MNO$$$$$$-;;;;;;;;;;;;;;>$$%",
"#$$$$$$$$$$$$-;;;;;;;;;;;;;;>$$%",
"#$$$$$$$$$$$$PQQQQQQQQQQQQQQR$$%",
"#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%",
"@SSSSSSSSSSSSSSSSSSSSSSSSSSSSSST"};

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -0,0 +1,162 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "AboutDialog.h"
#include "ui_AboutDialog.h"
#include "UiGuiVersion.h"
#include <QUrl>
#include <QDesktopServices>
#include <QScrollBar>
#include <QTimer>
#include <QLocale>
/*!
\class AboutDialog
\brief Displays a dialog window with information about UniversalIndentGUI
*/
/*!
\brief The constructor calls the setup function for the ui created by uic and adds
the GPL text to the text edit.
*/
AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags)
, _dialogForm(NULL)
, _timer(NULL)
{
_dialogForm = new Ui::AboutDialog();
_dialogForm->setupUi(this);
_dialogForm->authorTextBrowser->setOpenExternalLinks( true );
_dialogForm->creditsTextBrowser->setOpenExternalLinks( true );
QString versionString = _dialogForm->versionTextBrowser->toHtml();
versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
_dialogForm->versionTextBrowser->setHtml(versionString);
_dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>"
"<pre> </br></pre>"
"<h3 align='center'>Thanks go out to</h3>"
"<p align='center'><a href=\"http://www.csie.nctu.edu.tw/~chtai/\"><b>Nelson Tai</b></a> for Chinese translation, good ideas and always fast answers.</p></br>"
"<p align='center'><a href=\"http://www.hartwork.org/\"><b>Sebastian Pipping</b></a> for helping me bring UiGUI into the Debian repository and other good ideas.</p></br>"
"<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>"
"<p align='center'><b>Erwan &quot;leg&quot;</b> for French translation and the icon logo.</p></br>"
"<p align='center'>The <a href=\"http://www.scintilla.org/\"><b>Scintilla</b></a> project for their great text editing component.</p></br>"
"<p align='center'><a href=\"http://www.riverbankcomputing.co.uk/software/qscintilla/\"><b>Riverbank</b></a> for their Scintilla Qt wrapper QScintilla.</p></br>"
"<p align='center'>The <a href=\"http://astyle.sourceforge.net/\"><b>Artistic Style</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://invisible-island.net/bcpp/\"><b>BCPP</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.siber.com/sct/tools/cbl-beau.html\"><b>Cobol Beautifier</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://csstidy.sourceforge.net/\"><b>CSSTidy</b></a> project.</p></br>"
"<p align='center'>The <a href=\"ftp://ftp.ifremer.fr/ifremer/ditigo/fortran90/\"><b>Fortran 90 PPR</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.gnu.org/software/indent/\"><b>GNU Indent</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://sourceforge.net/projects/gcgreatcode/\"><b>GreatCode</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://linux.com.hk/penguin/man/1/hindent.html\"><b>hindent</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.digital-mines.com/htb/\"><b>HTB</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://tidy.sourceforge.net/\"><b>HTML Tidy</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://code.gosu.pl/\"><b>JsDecoder</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://jsppp.sourceforge.net/\"><b>JSPPP</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://perltidy.sourceforge.net/\"><b>Perltidy</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://beautifyphp.sourceforge.net/\"><b>PHP_Beautifier</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.waterproof.fr/products/phpCodeBeautifier/\"><b>phpCB</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://sourceforge.net/projects/phpstylist/\"><b>PHP Stylist</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://coverage.livinglogic.de/Tools/scripts/pindent.py.html\"><b>pindent</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://psti.equinoxbase.com/\"><b>Pl/Sql tidy</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.arachnoid.com/ruby/rubyBeautifier.html\"><b>Ruby Beautifier</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://raa.ruby-lang.org/project/ruby_formatter/\"><b>Ruby Formatter</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://www.bolthole.com/AWK.html\"><b>Shell Indent</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://uncrustify.sourceforge.net/\"><b>Uncrustify</b></a> project, specially <b>Ben Gardner</b>.</p></br>"
"<p align='center'>The <a href=\"http://www.daansystems.com/vbsbeaut/\"><b>VBSBeautifier</b></a> project.</p></br>"
"<p align='center'>The <a href=\"http://xmlindent.sourceforge.net/\"><b>XML Indent</b></a> project.</p></br>"
"<p align='center'><b>Nirvash</b> for the initial Japanese translation.</p></br>"
"<p align='center'>The <a href=\"http://tango.freedesktop.org/Tango_Desktop_Project/\"><b>Tango Project</b></a> for their icons.</p></br>"
"<p align='center'><a href=\"http://www.famfamfam.com/\"><b>famfamfam</b></a> for the flag icons.</p></br>"
"<p align='center'><a href=\"http://trolltech.com/\"><b>Trolltech</b></a> for their really great GUI framework <img src=\":/aboutDialog/qt_logo.png\"/>.</p></br>"
"<h3 align='center'>My girlfriend (meanwhile also wife) for putting my head right and not sit all the time in front of my computer ;-)</h3>"
"</body></html>");
_scrollDirection = 1;
_scrollSpeed = 100;
_timer = new QTimer(this);
connect( _timer, SIGNAL(timeout()), this, SLOT(scroll()) );
connect( this, SIGNAL(accepted()), _timer, SLOT(stop()) );
}
/*!
\brief Catches language change events and retranslates all needed widgets.
*/
void AboutDialog::changeEvent(QEvent *event) {
if (event->type() == QEvent::LanguageChange) {
_dialogForm->retranslateUi(this);
QString versionString = _dialogForm->versionTextBrowser->toHtml();
versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
_dialogForm->versionTextBrowser->setHtml(versionString);
}
else {
QWidget::changeEvent(event);
}
}
/*!
\brief Reimplements the dialog execution function to init the credits scroller.
*/
int AboutDialog::exec() {
//creditsTextBrowser->verticalScrollBar()->setValue(0);
_timer->start(_scrollSpeed);
return QDialog::exec();
}
/*!
\brief This slot is called each _timer timeout to scroll the credits textbrowser.
Also changes the scroll direction and speed when reaching the start or end.
*/
void AboutDialog::scroll() {
QScrollBar *scrollBar = _dialogForm->creditsTextBrowser->verticalScrollBar();
scrollBar->setValue( scrollBar->value()+_scrollDirection );
if ( scrollBar->value() == scrollBar->maximum() ) {
// Toggle scroll direction and change scroll speed;
_scrollDirection = -1;
_scrollSpeed = 5;
_timer->stop();
_timer->start(_scrollSpeed);
}
else if ( scrollBar->value() == scrollBar->minimum() ) {
// Toggle scroll direction and change scroll speed;
_scrollDirection = 1;
_scrollSpeed = 100;
_timer->stop();
_timer->start(_scrollSpeed);
}
_dialogForm->creditsTextBrowser->update();
}
/*!
\brief Shows the about dialog and also starts the credits scroller.
*/
void AboutDialog::show() {
_timer->start(_scrollSpeed);
QDialog::show();
}

@ -0,0 +1,53 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget *parent = NULL, Qt::WindowFlags flags = 0);
public slots:
int exec();
void show();
private slots:
void scroll();
private:
void changeEvent(QEvent *event);
Ui::AboutDialog* _dialogForm;
int _scrollDirection;
int _scrollSpeed;
QTimer *_timer;
};
#endif // ABOUTDIALOG_H

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>512</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>588</width>
<height>333</height>
</size>
</property>
<property name="windowTitle">
<string>About UniversalIndentGUI</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/info.png</normaloff>:/mainWindow/info.png</iconset>
</property>
<layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">QFrame#frame { background-color: qlineargradient( x1:0, y1:0, x2:0, y2:1, stop:0 #FFFF60, stop:0.5 #D8C304, stop:1 #FFFF60 ); border: 2px solid #A89C57; border-radius: 4px;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="bannerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>570</width>
<height>87</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>570</width>
<height>87</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources/Icons.qrc">:/aboutDialog/banner.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="versionTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QTextBrowser{background-color:transparent}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-size:large;&quot;&gt;Version %1 rev.%2, %3&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="authorTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QTextBrowser{background-color:transparent}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;... is a cross platform compatible GUI for several code formatter, beautifier and indenter like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on. Main feature is a live preview to directly see how the selected formatting option affects the source code.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;&lt;br /&gt;Written by : &lt;/span&gt;&lt;a href=&quot;http://www.thomas-schweitzer.de&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium; text-decoration: underline; color:#0000ff;&quot;&gt;Thomas Schweitzer&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;Project Homepage : &lt;/span&gt;&lt;a href=&quot;http://universalindent.sourceforge.net&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium; text-decoration: underline; color:#0000ff;&quot;&gt;http://universalindent.sourceforge.net&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;License: UniversalIndentGui is released under the GPL 2. For details read the included file LICENSE.GPL visit &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/licenses/gpl.html&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/gpl.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Trebuchet MS,Helvetica,sans-serif'; font-size:medium;&quot;&gt;Credits:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="creditsTextBrowser">
<property name="styleSheet">
<string notr="true">QTextBrowser#creditsTextBrowser{border:2px solid rgba(0,0,0,10%); background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0,0,0,80%), stop:0.1 rgba(0,0,0,15%), stop:0.9 rgba(0,0,0,15%), stop:1 rgba(0,0,0,80%) )}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okButton">
<property name="styleSheet">
<string notr="true">QPushButton#okButton { background-color: qlineargradient( x1:0, y1:0, x2:0, y2:1, stop:0 #DCB28A, stop:0.5 #B8784B, stop:1 #DCB28A ); border: 2px solid #A89C57; border-radius: 4px;} QPushButton:hover#okButton { background-color: qlineargradient( x1:0, y1:0, x2:0, y2:1, stop:0 #B8784B, stop:0.5 #DCB28A, stop:1 #B8784B ); } QPushButton:pressed#okButton{ border: 2px solid #D8CB75 }</string>
</property>
<property name="text">
<string> OK </string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,206 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "AboutDialogGraphicsView.h"
#include "AboutDialog.h"
#include <QtGui>
#include <QDesktopWidget>
#include <QDate>
#include <QTimeLine>
#include <QSplashScreen>
/*!
\class AboutDialogGraphicsView
\brief A container for the real \a AboutDialog. Makes the 3D animation possible.
The 3D animation shall suggest the user, that he is looking at his desktop, while
this animation is done. Since this is not directly possible, \a AboutDialogGraphicsView
when shown starts in frameless fullscreen mode with a screenshot of the desktop as background.
*/
/*!
\brief The constructor initializes everything needed for the 3D animation.
*/
AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parentWindow) : QGraphicsView(parentWindow)
, _aboutDialog(NULL)
, _graphicsProxyWidget(NULL)
, _parentWindow(NULL)
, _timeLine(NULL)
, _aboutDialogAsSplashScreen(NULL)
{
_parentWindow = parentWindow;
setWindowFlags(Qt::SplashScreen);
#ifdef Q_OS_LINUX
QRect availableGeometry = QApplication::desktop()->availableGeometry();
QRect newGeometry = QRect( availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height() );
#else
QRect newGeometry = QRect( -1,-1, QApplication::desktop()->rect().width()+2, QApplication::desktop()->rect().height()+2 );
#endif
setGeometry( newGeometry );
_aboutDialog = aboutDialog;
_windowTitleBarWidth = 0;
_windowPosOffset = 0;
QGraphicsScene *scene = new QGraphicsScene(this);
setSceneRect( newGeometry );
_aboutDialogAsSplashScreen = new QSplashScreen(this);
_graphicsProxyWidget = scene->addWidget(_aboutDialogAsSplashScreen);
_graphicsProxyWidget->setWindowFlags( Qt::ToolTip );
setScene( scene );
setRenderHint(QPainter::Antialiasing);
setCacheMode(QGraphicsView::CacheBackground);
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
connect(_aboutDialog, SIGNAL(finished(int)), this, SLOT(hide()));
//setWindowOpacity(0.9);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setStyleSheet("AboutDialogGraphicsView { border: 0px; }");
_timeLine = new QTimeLine(1000, this);
_timeLine->setFrameRange(270, 0);
//_timeLine->setUpdateInterval(10);
//_timeLine->setCurveShape(QTimeLine::EaseInCurve);
connect(_timeLine, SIGNAL(frameChanged(int)), this, SLOT(updateStep(int)));
}
AboutDialogGraphicsView::~AboutDialogGraphicsView(void) {
}
/*!
\brief Grabs a screenshot of the full desktop and shows that as background. Above that background the
AboutDialog 3D animation is shown. Also grabs the content of the AboutDialog itself.
*/
void AboutDialogGraphicsView::show() {
// Because on X11 system the window decoration is only available after a widget has been shown once,
// we can detect _windowTitleBarWidth here for the first time.
_windowTitleBarWidth = _parentWindow->geometry().y() - _parentWindow->y();
// If the _windowTitleBarWidth could not be determined, try it a second way. Even the chances are low to get good results.
if ( _windowTitleBarWidth == 0 )
_windowTitleBarWidth = _parentWindow->frameGeometry().height() - _parentWindow->geometry().height();
#ifdef Q_OS_LINUX
if ( _windowTitleBarWidth == 0 ) {
//TODO: 27 pixel is a fix value for the Ubuntu 10.4 default window theme and so just a workaround for that specific case.
_windowPosOffset = 27;
_windowTitleBarWidth = 27;
}
#endif
QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y(), geometry().width(), geometry().height() );
QBrush brush(originalPixmap);
QTransform transform;
transform.translate(0, QApplication::desktop()->availableGeometry().y());
brush.setTransform(transform);
setBackgroundBrush(brush);
_aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(_aboutDialog) );
_graphicsProxyWidget->setGeometry( _aboutDialog->geometry() );
_aboutDialog->hide();
_graphicsProxyWidget->setPos( _parentWindow->geometry().x()+(_parentWindow->geometry().width()-_graphicsProxyWidget->geometry().width()) / 2, _parentWindow->y()+_windowTitleBarWidth-_windowPosOffset);
QRectF r = _graphicsProxyWidget->boundingRect();
_graphicsProxyWidget->setTransform(QTransform()
.translate(r.width() / 2, -_windowTitleBarWidth)
.rotate(270, Qt::XAxis)
//.rotate(90, Qt::YAxis)
//.rotate(5, Qt::ZAxis)
//.scale(1 + 1.5 * step, 1 + 1.5 * step)
.translate(-r.width() / 2, _windowTitleBarWidth));
_graphicsProxyWidget->show();
//_aboutDialogAsSplashScreen->show();
QGraphicsView::show();
connect(_timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
_timeLine->setDirection(QTimeLine::Forward);
_timeLine->start();
}
/*!
\brief Does the next calculation/transformation step.
*/
void AboutDialogGraphicsView::updateStep(int step) {
QRectF r = _graphicsProxyWidget->boundingRect();
_graphicsProxyWidget->setTransform(QTransform()
.translate(r.width() / 2, -_windowTitleBarWidth)
.rotate(step, Qt::XAxis)
//.rotate(step, Qt::YAxis)
//.rotate(step * 5, Qt::ZAxis)
//.scale(1 + 1.5 * step, 1 + 1.5 * step)
.translate(-r.width() / 2, _windowTitleBarWidth));
//update();
}
/*!
\brief Stops the 3D animation, moves the AboutDialog to the correct place and really shows it.
*/
void AboutDialogGraphicsView::showAboutDialog() {
//hide();
disconnect(_timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
_aboutDialog->move( int(_parentWindow->geometry().x()+(_parentWindow->geometry().width()-_graphicsProxyWidget->geometry().width()) / 2), _parentWindow->y()+_windowTitleBarWidth-_windowPosOffset );
_aboutDialog->exec();
}
/*!
\brief Does not directly hide the AboutDialog but instead starts the "fade out" 3D animation.
*/
void AboutDialogGraphicsView::hide() {
_graphicsProxyWidget->setPos( _parentWindow->geometry().x()+(_parentWindow->geometry().width()-_graphicsProxyWidget->geometry().width()) / 2, _parentWindow->y()+_windowTitleBarWidth-_windowPosOffset);
QRectF r = _graphicsProxyWidget->boundingRect();
_graphicsProxyWidget->setTransform(QTransform()
.translate(r.width() / 2, -_windowTitleBarWidth)
.rotate(0, Qt::XAxis)
//.rotate(90, Qt::YAxis)
//.rotate(5, Qt::ZAxis)
//.scale(1 + 1.5 * step, 1 + 1.5 * step)
.translate(-r.width() / 2, _windowTitleBarWidth));
_graphicsProxyWidget->show();
//_aboutDialogAsSplashScreen->show();
QGraphicsView::show();
connect(_timeLine, SIGNAL(finished()), this, SLOT(hideReally()));
_timeLine->setDirection(QTimeLine::Backward);
_timeLine->start();
}
/*!
\brief This slot really hides this AboutDialog container.
*/
void AboutDialogGraphicsView::hideReally() {
disconnect(_timeLine, SIGNAL(finished()), this, SLOT(hideReally()));
QGraphicsView::hide();
_parentWindow->activateWindow();
}

@ -0,0 +1,56 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef ABOUTDIALOGGRAPHICSVIEW_H
#define ABOUTDIALOGGRAPHICSVIEW_H
#include <QGraphicsView>
class AboutDialog;
class QTimeLine;
class QSplashScreen;
class AboutDialogGraphicsView : public QGraphicsView
{
Q_OBJECT
public:
AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parentWindow = NULL);
~AboutDialogGraphicsView(void);
public slots:
void show();
void hide();
private slots:
void updateStep(int step);
void showAboutDialog();
void hideReally();
private:
AboutDialog *_aboutDialog;
QGraphicsProxyWidget *_graphicsProxyWidget;
QWidget *_parentWindow;
QTimeLine *_timeLine;
QSplashScreen *_aboutDialogAsSplashScreen;
int _windowTitleBarWidth;
int _windowPosOffset;
};
#endif // ABOUTDIALOGGRAPHICSVIEW_H

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FindDialog</class>
<widget class="QDialog" name="FindDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>347</width>
<height>227</height>
</rect>
</property>
<property name="windowTitle">
<string>Find</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Find what:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Find options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Match case</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Match whole word</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>Search forward</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Use Regular Expressions</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Find Next</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,183 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef INDENTHANDLER_H
#define INDENTHANDLER_H
#include <QWidget>
class UiGuiErrorMessage;
class UiGuiIniFileParser;
class QMenu;
class QVBoxLayout;
class QLabel;
class QSpinBox;
class QComboBox;
class QCheckBox;
class QLineEdit;
class QToolButton;
class QToolBox;
class IndentHandler : public QWidget
{
Q_OBJECT
public:
IndentHandler(int indenterID, QWidget *mainWindow = NULL, QWidget *parent = NULL);
~IndentHandler();
QString generateShellScript(const QString &configFilename);
QString callIndenter(QString sourceCode, QString inputFileExtension);
bool loadConfigFile(QString filePathName);
void resetToDefaultValues();
QStringList getAvailableIndenters();
QString getPossibleIndenterFileExtensions();
QString getParameterString();
QString getIndenterCfgFile();
QString getManual();
void retranslateUi();
QString getCurrentIndenterName();
QMenu* getIndenterMenu();
QList<QAction*> getIndenterMenuActions();
void contextMenuEvent( QContextMenuEvent *event );
void setParameterChangedCallback( void(*paramChangedCallback)(void) );
void setWindowClosedCallback( void(*winClosedCallback)(void) );
int getIndenterId();
signals:
void indenterSettingsChanged();
void selectedIndenterIndexChanged(int index);
protected:
bool event( QEvent *event );
void closeEvent(QCloseEvent *event);
void wheelEvent( QWheelEvent *event );
private slots:
void setIndenter(int indenterID);
void showIndenterManual();
void openConfigFileDialog();
void saveasIndentCfgFileDialog();
void createIndenterCallShellScript();
void resetIndenterParameter();
void handleChangedIndenterSettings();
void updateDrawing();
private:
QString callExecutableIndenter(QString sourceCode, QString inputFileExtension);
QString callJavaScriptIndenter(QString sourceCode);
void saveConfigFile(QString filePathName, QString parameterString);
void readIndentIniFile(QString iniFilePath);
bool createIndenterCallString();
void initIndenterMenu();
//! Holds a reference to all created pages of the parameter categories toolbox and the pages boxlayout
struct IndenterParameterCategoryPage {
QWidget *widget;
QVBoxLayout *vboxLayout;
};
QVector<IndenterParameterCategoryPage> _indenterParameterCategoryPages;
//! Holds a reference to all checkboxes needed for boolean parameter setting and the parameters name
struct ParamBoolean {
QString paramName;
QString trueString;
QString falseString;
QCheckBox *checkBox;
};
QVector<ParamBoolean> _paramBooleans;
//! Holds a reference to all line edits needed for parameter setting and the parameters name
struct ParamString {
QString paramName;
QString paramCallName;
QCheckBox *valueEnabledChkBox;
QLineEdit *lineEdit;
QLabel *label;
};
QVector<ParamString> _paramStrings;
//! Hold a reference to all spin boxes needed for parameter setting and the parameters name
struct ParamNumeric {
QString paramName;
QString paramCallName;
QCheckBox *valueEnabledChkBox;
QSpinBox *spinBox;
QLabel *label;
};
QVector<ParamNumeric> _paramNumerics;
//! Hold a reference to all combo boxes needed for parameter setting and the parameters name
struct ParamMultiple {
QString paramName;
QString paramCallName;
QCheckBox *valueEnabledChkBox;
QComboBox *comboBox;
QStringList choicesStrings;
QStringList choicesStringsReadable;
};
QVector<ParamMultiple> _paramMultiples;
QComboBox *_indenterSelectionCombobox;
QToolButton *_indenterParameterHelpButton;
//! Vertical layout box, into which the toolbox will be added
QVBoxLayout *_toolBoxContainerLayout;
QToolBox *_indenterParameterCategoriesToolBox;
UiGuiIniFileParser *_indenterSettings;
QStringList _indenterParameters;
//! The indenters name in a descriptive form
QString _indenterName;
//! The indenters file name (w/o extension), that is being called
QString _indenterFileName;
QString _indenterDirctoryStr;
QString _tempDirctoryStr;
QString _settingsDirctoryStr;
QStringList _indenterIniFileList;
QString _parameterOrder;
QString _globalConfigFilename;
QString _cfgFileParameterEnding;
QString _inputFileParameter;
QString _inputFileName;
QString _outputFileParameter;
QString _outputFileName;
QString _fileTypes;
QString _useCfgFileParameter;
QString _indenterShowHelpParameter;
QWidget *_mainWindow;
UiGuiErrorMessage *_errorMessageDialog;
QString _indenterExecutableCallString;
QString _indenterExecutableSuffix;
QMenu *_menuIndenter;
QAction *_actionLoadIndenterConfigFile;
QAction *_actionSaveIndenterConfigFile;
QAction *_actionCreateShellScript;
QAction *_actionResetIndenterParameters;
//! Needed for the NPP plugin.
void(*_parameterChangedCallback)(void);
//! Needed for the NPP plugin.
void(*_windowClosedCallback)(void);
//TODO: This function should go into a string helper/tool class/file.
QString encodeToHTML(const QString &text);
};
#endif // INDENTHANDLER_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,143 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "UiGuiSettings.h"
class UiGuiSettingsDialog;
class AboutDialog;
class AboutDialogGraphicsView;
class UiGuiHighlighter;
class IndentHandler;
class UpdateCheckDialog;
namespace Ui {
class ToolBarWidget;
class MainWindowUi;
}
class QLabel;
class QScrollBar;
class QActionGroup;
class QTranslator;
class QsciScintilla;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
//! Constructor
MainWindow(QString file2OpenOnStart = "", QWidget *parent = NULL);
~MainWindow() {
_settings.clear();
}
protected:
void closeEvent( QCloseEvent *event );
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void openSourceFileDialog(QString fileName = "");
bool saveasSourceFileDialog(QAction *chosenEncodingAction = NULL);
void saveAsOtherEncoding(QAction *chosenEncodingAction);
bool saveSourceFile();
void callIndenter();
void updateSourceView();
void turnHighlightOnOff(bool turnOn);
void setWhiteSpaceVisibility(bool visible);
void sourceCodeChangedHelperSlot();
void sourceCodeChangedSlot();
void indentSettingsChangedSlot();
void previewTurnedOnOff(bool turnOn);
void exportToPDF();
void exportToHTML();
void languageChanged(int languageIndex);
void encodingChanged(QAction *encodingAction);
void numberOfLinesChanged();
void updateRecentlyOpenedList();
void openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction);
void clearRecentlyOpenedList();
void showAboutDialog();
void setStatusBarCursorPosInfo(int line, int column);
private:
Ui::MainWindowUi *_mainWindowForm;
QString loadFile(QString filePath);
QString openFileDialog(QString dialogHeaderStr, QString startPath, QString fileMaskStr);
void updateWindowTitle();
void loadLastOpenedFile();
void saveSettings();
bool maybeSave();
void createEncodingMenu();
void createHighlighterMenu();
bool initApplicationLanguage();
void initMainWindow();
void initToolBar();
void initTextEditor();
void initSyntaxHighlighter();
void initIndenter();
void changeEvent(QEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
QsciScintilla *_qSciSourceCodeEditor;
QSharedPointer<UiGuiSettings> _settings;
QString _currentEncoding;
QString _sourceFileContent;
QString _sourceFormattedContent;
QString _sourceViewContent;
UiGuiHighlighter *_highlighter;
QScrollBar *_textEditVScrollBar;
AboutDialog *_aboutDialog;
AboutDialogGraphicsView *_aboutDialogGraphicsView;
UiGuiSettingsDialog *_settingsDialog;
int _textEditLastScrollPos;
int _currentIndenterID;
bool _loadLastSourceCodeFileOnStartup;
QString _currentSourceFile;
QString _currentSourceFileExtension;
QString _savedSourceContent;
QActionGroup *_encodingActionGroup;
QActionGroup *_saveEncodedActionGroup;
QActionGroup *_highlighterActionGroup;
QTranslator *_uiGuiTranslator;
QTranslator *_qTTranslator;
bool _isFirstRunOfThisVersion;
bool _sourceCodeChanged;
bool _scrollPositionChanged;
bool _indentSettingsChanged;
bool _previewToggled;
QStringList _encodingsList;
Ui::ToolBarWidget *_toolBarWidget;
IndentHandler *_indentHandler;
UpdateCheckDialog *_updateCheckDialog;
QLabel *_textEditLineColumnInfoLabel;
};
#endif // MAINWINDOW_H

@ -0,0 +1,488 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Thomas_-_S</author>
<class>MainWindowUi</class>
<widget class="QMainWindow" name="MainWindowUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>949</width>
<height>633</height>
</rect>
</property>
<property name="windowTitle">
<string>UniversalIndentGUI</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/universalIndentGUI.svg</normaloff>:/mainWindow/universalIndentGUI.svg</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>2</number>
</property>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>949</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuIndenter">
<property name="title">
<string>Indenter</string>
</property>
</widget>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<widget class="QMenu" name="menuExport">
<property name="title">
<string>Export</string>
</property>
<addaction name="actionExportPDF"/>
<addaction name="actionExportHTML"/>
</widget>
<widget class="QMenu" name="menuRecently_Opened_Files">
<property name="title">
<string>Recently Opened Files</string>
</property>
<addaction name="separator"/>
<addaction name="actionClear_Recently_Opened_List"/>
</widget>
<widget class="QMenu" name="encodingMenu">
<property name="title">
<string>Reopen File with other Encoding</string>
</property>
</widget>
<widget class="QMenu" name="saveEncodedMenu">
<property name="title">
<string>Save Source File As with other Encoding</string>
</property>
</widget>
<addaction name="actionOpen_Source_File"/>
<addaction name="menuRecently_Opened_Files"/>
<addaction name="encodingMenu"/>
<addaction name="separator"/>
<addaction name="actionSave_Source_File"/>
<addaction name="actionSave_Source_File_As"/>
<addaction name="saveEncodedMenu"/>
<addaction name="separator"/>
<addaction name="menuExport"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuSettings">
<property name="title">
<string>Settings</string>
</property>
<widget class="QMenu" name="highlighterMenu">
<property name="title">
<string>Set Syntax Highlighter</string>
</property>
</widget>
<addaction name="actionLive_Indent_Preview"/>
<addaction name="enableSyntaxHighlightingAction"/>
<addaction name="whiteSpaceIsVisibleAction"/>
<addaction name="highlighterMenu"/>
<addaction name="indenterParameterTooltipsEnabledAction"/>
<addaction name="loadLastOpenedFileOnStartupAction"/>
<addaction name="actionShowSettings"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionCheck_for_update"/>
<addaction name="actionShowLog"/>
<addaction name="separator"/>
<addaction name="actionAbout_UniversalIndentGUI"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuIndenter"/>
<addaction name="menuSettings"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QDockWidget" name="dockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Indenter Settings</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<property name="windowTitle">
<string>Main Toolbar</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="actionOpen_Source_File">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset>
</property>
<property name="text">
<string>Open Source File</string>
</property>
<property name="statusTip">
<string>Opens a dialog for selecting a source code file.</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionSave_Source_File">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-save.png</normaloff>:/mainWindow/document-save.png</iconset>
</property>
<property name="text">
<string>Save Source File</string>
</property>
<property name="statusTip">
<string>Saves the currently shown source code to the last opened or saved source file.</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionSave_Source_File_As">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-save-as.png</normaloff>:/mainWindow/document-save-as.png</iconset>
</property>
<property name="text">
<string>Save Source File As...</string>
</property>
<property name="iconText">
<string>Save Source File As...</string>
</property>
<property name="toolTip">
<string>Save Source File As...</string>
</property>
<property name="statusTip">
<string>Opens a file dialog to save the currently shown source code.</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="actionAbout_UniversalIndentGUI">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/info.png</normaloff>:/mainWindow/info.png</iconset>
</property>
<property name="text">
<string>About UniversalIndentGUI</string>
</property>
<property name="statusTip">
<string>Shows info about UniversalIndentGUI.</string>
</property>
</action>
<action name="actionExit">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-log-out.png</normaloff>:/mainWindow/system-log-out.png</iconset>
</property>
<property name="text">
<string>Exit</string>
</property>
<property name="statusTip">
<string>Quits the UniversalIndentGUI.</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionExportPDF">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/exportpdf.png</normaloff>:/mainWindow/exportpdf.png</iconset>
</property>
<property name="text">
<string>PDF</string>
</property>
<property name="statusTip">
<string>Export the currently visible source code as PDF document</string>
</property>
</action>
<action name="actionExportHTML">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/exporthtml.png</normaloff>:/mainWindow/exporthtml.png</iconset>
</property>
<property name="text">
<string>HTML</string>
</property>
<property name="statusTip">
<string>Export the currently visible source code as HTML document</string>
</property>
</action>
<action name="indenterParameterTooltipsEnabledAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/tooltip.png</normaloff>:/mainWindow/tooltip.png</iconset>
</property>
<property name="text">
<string>Parameter Tooltips</string>
</property>
<property name="statusTip">
<string>If checked, tool tips will show up if the mouse cursor remains over an indenter parameter for a while.</string>
</property>
<property name="connectedSettingName" stdset="0">
<string>DONOTTRANSLATE:indenterParameterTooltipsEnabled</string>
</property>
</action>
<action name="actionLive_Indent_Preview">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/live-preview.png</normaloff>:/mainWindow/live-preview.png</iconset>
</property>
<property name="text">
<string>Live Indent Preview</string>
</property>
<property name="shortcut">
<string>Ctrl+L</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="enableSyntaxHighlightingAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/syntax-highlight.png</normaloff>:/mainWindow/syntax-highlight.png</iconset>
</property>
<property name="text">
<string>Syntax Highlighting</string>
</property>
<property name="iconText">
<string>Syntax Highlighting</string>
</property>
<property name="toolTip">
<string>Enables or disables syntax highlighting for the source code.</string>
</property>
<property name="statusTip">
<string>By enabling special key words of the source code are highlighted.</string>
</property>
<property name="shortcut">
<string>Ctrl+H</string>
</property>
<property name="connectedSettingName" stdset="0">
<string>DONOTTRANSLATE:SyntaxHighlightingEnabled</string>
</property>
</action>
<action name="whiteSpaceIsVisibleAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>White Space Visible</string>
</property>
<property name="iconText">
<string>White Space Visible</string>
</property>
<property name="toolTip">
<string>Set white space visible</string>
</property>
<property name="statusTip">
<string>Enables or disables diplaying of white space characters in the editor.</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="connectedSettingName" stdset="0">
<string>DONOTTRANSLATE:whiteSpaceIsVisible</string>
</property>
</action>
<action name="loadLastOpenedFileOnStartupAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Auto Open Last File</string>
</property>
<property name="toolTip">
<string>Auto open last source file on startup</string>
</property>
<property name="statusTip">
<string>If selected opens last source code file on startup</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="connectedSettingName" stdset="0">
<string>DONOTTRANSLATE:loadLastSourceCodeFileOnStartup</string>
</property>
</action>
<action name="actionShowSettings">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/preferences-system.png</normaloff>:/mainWindow/preferences-system.png</iconset>
</property>
<property name="text">
<string>Settings</string>
</property>
<property name="iconText">
<string>Settings</string>
</property>
<property name="toolTip">
<string>Opens the settings dialog</string>
</property>
<property name="statusTip">
<string>Opens the settings dialog, to set language etc.</string>
</property>
</action>
<action name="actionCheck_for_update">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-software-update.png</normaloff>:/mainWindow/system-software-update.png</iconset>
</property>
<property name="text">
<string>Check for update</string>
</property>
<property name="toolTip">
<string>Checks online whether a new version of UniversalIndentGUI is available.</string>
</property>
<property name="statusTip">
<string>Checks online whether a new version of UniversalIndentGUI is available.</string>
</property>
</action>
<action name="actionClear_Recently_Opened_List">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/edit-clear.png</normaloff>:/mainWindow/edit-clear.png</iconset>
</property>
<property name="text">
<string>Clear Recently Opened List</string>
</property>
</action>
<action name="actionShowLog">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-properties.png</normaloff>:/mainWindow/document-properties.png</iconset>
</property>
<property name="text">
<string>Show Log</string>
</property>
<property name="toolTip">
<string>Displays logging information.</string>
</property>
<property name="statusTip">
<string>Displays logging info about the currently running UiGUI application.</string>
</property>
</action>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections>
<connection>
<sender>actionExit</sender>
<signal>triggered()</signal>
<receiver>MainWindowUi</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,275 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "SettingsPaths.h"
#include <QCoreApplication>
#include <QFile>
#include <QDir>
#include <QDirIterator>
#include <QStack>
#include <QtDebug>
#include <stdlib.h>
//! \defgroup grp_Settings All concerning applications settings.
/*!
\class SettingsPaths
\ingroup grp_Settings
\brief SettingsPaths is a pure static functions class from which info about the
paths needed for settings can be retrieved.
*/
bool SettingsPaths::_alreadyInitialized = false;
QString SettingsPaths::_applicationBinaryPath = "";
QString SettingsPaths::_settingsPath = "";
QString SettingsPaths::_globalFilesPath = "";
QString SettingsPaths::_indenterPath = "";
QString SettingsPaths::_tempPath = "";
bool SettingsPaths::_portableMode = false;
/*!
\brief Initializes all available information about the paths.
Mainly during this init it is detected whether to start in portable mode or not. This is
done by testing whether the directory "config" is in the same directory as this
applications executable file.
In portable mode all data is ONLY written to subdirectories of the applications executable file.
Means also that the directory "indenters" has to be there.
In not portable mode (multiuser mode) only users home directory is used for writing config data.
*/
void SettingsPaths::init() {
_alreadyInitialized = true;
qDebug() << __LINE__ << " " << __FUNCTION__ << ": Initializing application paths.";
// Get the applications binary path, with respect to MacOSXs use of the .app folder.
_applicationBinaryPath = QCoreApplication::applicationDirPath();
// Remove any trailing slashes
while ( _applicationBinaryPath.right(1) == "/" ) {
_applicationBinaryPath.chop(1);
}
#ifdef UNIVERSALINDENTGUI_NPP_EXPORTS
_applicationBinaryPath += "/plugins/uigui";
#endif
#ifdef Q_OS_MAC
// Because on Mac universal binaries are used, the binary path is not equal
// to the applications (.app) path. So get the .apps path here.
int indexOfDotApp = _applicationBinaryPath.indexOf(".app");
if ( indexOfDotApp != -1 ) {
// Cut off after the dot of ".app".
_applicationBinaryPath = _applicationBinaryPath.left( indexOfDotApp-1 );
// Cut off after the first slash that was in front of ".app" (normally this is the word "UniversalIndentGUI")
_applicationBinaryPath = _applicationBinaryPath.left( _applicationBinaryPath.lastIndexOf("/") );
}
#endif
// If the "config" directory is a subdir of the applications binary path, use this one (portable mode)
_settingsPath = _applicationBinaryPath + "/config";
if ( QFile::exists( _settingsPath ) ) {
_portableMode = true;
QDir dirCreator;
_globalFilesPath = _applicationBinaryPath;
_indenterPath = _applicationBinaryPath + "/indenters";
dirCreator.mkpath( _settingsPath );
_tempPath = _applicationBinaryPath + "/temp";
//TODO: If the portable drive has write protection, use local temp path and clean it up on exit.
dirCreator.mkpath( _tempPath );
}
// ... otherwise use the system specific global application data path.
else {
_portableMode = false;
QDir dirCreator;
#ifdef Q_OS_WIN
// Get the local users application settings directory.
// Remove any trailing slashes.
_settingsPath = QDir::fromNativeSeparators( qgetenv("APPDATA") );
while ( _settingsPath.right(1) == "/" ) {
_settingsPath.chop(1);
}
_settingsPath = _settingsPath + "/UniversalIndentGUI";
// On windows systems the directories "indenters", "translations" are subdirs of the _applicationBinaryPath.
_globalFilesPath = _applicationBinaryPath;
#else
// Remove any trailing slashes.
_settingsPath = QDir::homePath();
while ( _settingsPath.right(1) == "/" ) {
_settingsPath.chop(1);
}
_settingsPath = _settingsPath + "/.universalindentgui";
_globalFilesPath = "/usr/share/universalindentgui";
#endif
dirCreator.mkpath( _settingsPath );
// If a highlighter config file does not exist in the users home config dir
// copy the default config file over there.
if ( !QFile::exists(_settingsPath+"/UiGuiSyntaxHighlightConfig.ini") ) {
QFile::copy( _globalFilesPath+"/config/UiGuiSyntaxHighlightConfig.ini", _settingsPath+"/UiGuiSyntaxHighlightConfig.ini" );
}
_indenterPath = _globalFilesPath + "/indenters";
// On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this.
// Remove any trailing slashes.
_tempPath = QDir::tempPath();
while ( _tempPath.right(1) == "/" ) {
_tempPath.chop(1);
}
_tempPath = _tempPath + "/UniversalIndentGUI";
#if defined(Q_OS_WIN32)
dirCreator.mkpath( _tempPath );
#else
// On Unix based systems create a random temporary directory for security
// reasons. Otherwise an evil human being could create a symbolic link
// to an important existing file which gets overwritten when UiGUI writes
// into this normally temporary but linked file.
char *pathTemplate = new char[_tempPath.length()+8];
QByteArray pathTemplateQBA = QString(_tempPath + "-XXXXXX").toAscii();
delete [] pathTemplate;
pathTemplate = pathTemplateQBA.data();
pathTemplate = mkdtemp( pathTemplate );
_tempPath = pathTemplate;
#endif
}
qDebug() << __LINE__ << " " << __FUNCTION__ << ": Paths are:" \
"<ul><li>_applicationBinaryPath=" << _applicationBinaryPath \
<< "</li><li>_settingsPath=" << _settingsPath \
<< "</li><li>_globalFilesPath=" << _globalFilesPath \
<< "</li><li>_indenterPath=" << _indenterPath \
<< "</li><li>_tempPath=" << _tempPath \
<< "</li><li>Running in portable mode=" << _portableMode << "</li></ul>";
}
/*!
\brief Returns the path of the applications executable.
*/
const QString SettingsPaths::getApplicationBinaryPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _applicationBinaryPath;
}
/*!
\brief Returns the path where all settings are being/should be written to.
*/
const QString SettingsPaths::getSettingsPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _settingsPath;
}
/*!
\brief Returns the path where the files concerning all users reside. For example translations.
*/
const QString SettingsPaths::getGlobalFilesPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _globalFilesPath;
}
/*!
\brief Returns the path where the indenter executables reside.
*/
const QString SettingsPaths::getIndenterPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _indenterPath;
}
/*!
\brief Returns the path where the where all temporary data should be written to.
*/
const QString SettingsPaths::getTempPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _tempPath;
}
/*!
\brief Returns true if portable mode shall be used.
*/
bool SettingsPaths::getPortableMode() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
return _portableMode;
}
/*!
\brief Completely deletes the created temporary directory with all of its content.
*/
void SettingsPaths::cleanAndRemoveTempDir() {
QDirIterator dirIterator(_tempPath, QDirIterator::Subdirectories);
QStack<QString> directoryStack;
bool noErrorsOccurred = true;
while ( dirIterator.hasNext() ) {
QString currentDirOrFile = dirIterator.next();
// If this dummy call isn't done here, calling "dirIterator.fileInfo().isDir()" later somehow fails.
dirIterator.fileInfo();
if ( !currentDirOrFile.isEmpty() && dirIterator.fileName() != "." && dirIterator.fileName() != ".." ) {
// There is a path on the stack but the current path doesn't start with that path.
// So we changed into another parent directory and the one on the stack can be deleted
// since it must be empty.
if ( !directoryStack.isEmpty() && !currentDirOrFile.startsWith(directoryStack.top()) ) {
QString dirToBeRemoved = directoryStack.pop();
bool couldRemoveDir = QDir(dirToBeRemoved).rmdir(dirToBeRemoved);
noErrorsOccurred &= couldRemoveDir;
if ( couldRemoveDir == false )
qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the directory: " << dirToBeRemoved;
//qDebug() << "Removing Dir " << directoryStack.pop();
}
// If the iterator currently points to a directory push it onto the stack.
if ( dirIterator.fileInfo().isDir() ) {
directoryStack.push( currentDirOrFile );
//qDebug() << "Pushing onto Stack " << currentDirOrFile;
}
// otherwise it must be a file, so delete it.
else {
bool couldRemoveFile = QFile::remove( currentDirOrFile );
noErrorsOccurred &= couldRemoveFile;
if ( couldRemoveFile == false )
qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the file: " << currentDirOrFile;
//qDebug() << "Removing File " << currentDirOrFile;
}
}
}
noErrorsOccurred &= QDir(_tempPath).rmdir(_tempPath);
if ( noErrorsOccurred == false )
qWarning() << __LINE__ << " " << __FUNCTION__ << "While cleaning up the temp dir an error occurred.";
}

@ -0,0 +1,50 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef SETTINGSPATHS_H
#define SETTINGSPATHS_H
class QString;
class SettingsPaths
{
public:
static void init();
static const QString getApplicationBinaryPath();
static const QString getSettingsPath();
static const QString getGlobalFilesPath();
static const QString getIndenterPath();
static const QString getTempPath();
static bool getPortableMode();
static void cleanAndRemoveTempDir();
private:
SettingsPaths();
static bool _alreadyInitialized;
static QString _applicationBinaryPath;
static QString _settingsPath;
static QString _globalFilesPath;
static QString _indenterPath;
static QString _tempPath;
static bool _portableMode;
};
#endif // SETTINGSPATHS_H

@ -0,0 +1,171 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "TemplateBatchScript.h"
// Need to include QObject here so that platform specific defines like Q_OS_WIN32 are set.
#include <QObject>
/*!
\brief The only and static function of this class returns a batch or shell script
as string that can be used to call an indenter with the current settings from
the command line.
The returned string contains some placeholders where the indenter name needs to
be filled in. The placeholders are "__INDENTERCALLSTRING1__" that should be replaced
by the indenter call string that indents a complete directory.
"__INDENTERCALLSTRING2__" the call string for indenting only one file.
And "__INDENTERCALLSTRINGSCRIPTNAME__" which is only the shown name of the indenter.
*/
const char* TemplateBatchScript::getTemplateBatchScript() {
static const char* templateBatchScript =
#if defined(Q_OS_WIN32)
"@echo off\n"
"\n"
"IF (%1)==() GOTO error\n"
"dir /b /ad %1 >nul 2>nul && GOTO indentDir\n"
"IF NOT EXIST %1 GOTO error\n"
"goto indentFile\n"
"\n"
":indentDir\n"
"set searchdir=%1\n"
"\n"
"IF (%2)==() GOTO assignDefaultSuffix\n"
"set filesuffix=%2\n"
"\n"
"GOTO run\n"
"\n"
":assignDefaultSuffix\n"
"::echo !!!!DEFAULT SUFFIX!!!\n"
"set filesuffix=*\n"
"\n"
":run\n"
"FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n"
"echo Indenting file \"%%G\"\n"
"__INDENTERCALLSTRING1__\n"
")\n"
"GOTO ende\n"
"\n"
":indentFile\n"
"echo Indenting one file %1\n"
"__INDENTERCALLSTRING2__\n"
"\n"
"GOTO ende\n"
"\n"
":error\n"
"echo .\n"
"echo ERROR: As parameter given directory or file does not exist!\n"
"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n"
"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n"
"echo Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\n"
"echo .\n"
"\n"
":ende\n";
#else
"#!/bin/sh \n"
"\n"
"if [ ! -n \"$1\" ]; then\n"
"echo \"Syntax is: recurse.sh dirname filesuffix\"\n"
"echo \"Syntax is: recurse.sh filename\"\n"
"echo \"Example: recurse.sh temp cpp\"\n"
"exit 1\n"
"fi\n"
"\n"
"if [ -d \"$1\" ]; then\n"
"#echo \"Dir ${1} exists\"\n"
"if [ -n \"$2\" ]; then\n"
"filesuffix=$2\n"
"else\n"
"filesuffix=\"*\"\n"
"fi\n"
"\n"
"#echo \"Filtering files using suffix ${filesuffix}\"\n"
"\n"
"file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n"
"for file2indent in $file_list\n"
"do \n"
"echo \"Indenting file $file2indent\"\n"
"__INDENTERCALLSTRING1__\n"
"done\n"
"else\n"
"if [ -f \"$1\" ]; then\n"
"echo \"Indenting one file $1\"\n"
"__INDENTERCALLSTRING2__\n"
"else\n"
"echo \"ERROR: As parameter given directory or file does not exist!\"\n"
"echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n"
"echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n"
"echo \"Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\"\n"
"exit 1\n"
"fi\n"
"fi\n";
#endif // #if defined(Q_OS_WIN32)
return templateBatchScript;
}
/* Here comes the original batch script without the c++ markup
@echo off
IF (%1)==() GOTO error
dir /b /ad %1 >nul 2>nul && GOTO indentDir
IF NOT EXIST %1 GOTO error
goto indentFile
:indentDir
set searchdir=%1
IF (%2)==() GOTO assignDefaultSuffix
set filesuffix=%2
GOTO run
:assignDefaultSuffix
::echo !!!!DEFAULT SUFFIX!!!
set filesuffix=*
:run
FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
echo Indenting file "%%G"
::call call_CSSTidy.bat "%%G"
"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" "%%G" --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
move /Y indentoutput.css "%%G"
)
GOTO ende
:indentFile
echo Indenting one file %1
"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" %1 --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
move /Y indentoutput.css %1
GOTO ende
:error
echo .
echo ERROR: As parameter given directory or file does not exist!
echo Syntax is: recurse.bat dirname filesuffix
echo Syntax is: recurse.bat filename
echo Example: recurse.bat temp cpp
echo .
:ende
*/

@ -0,0 +1,31 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef TEMPLATEBATCHSCRIPT_H
#define TEMPLATEBATCHSCRIPT_H
class TemplateBatchScript
{
private:
TemplateBatchScript();
public:
static const char* getTemplateBatchScript();
};
#endif // TEMPLATEBATCHSCRIPT_H

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ToolBarWidget</class>
<widget class="QWidget" name="ToolBarWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>773</width>
<height>34</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pbOpen_Source_File">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Opens a dialog for selecting a source code file.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;This file will be used to show what the indent tool changes.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Open Source File </string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbLivePreview">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;&quot;&gt;Turns the preview of the reformatted source code on and off.&lt;/p&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;&quot;&gt;In other words it switches between formatted and nonformatted code. (Ctrl+L)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Live Indent Preview</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/live-preview.png</normaloff>:/mainWindow/live-preview.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+L</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableSyntaxHighlightningCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;&quot;&gt;Enables and disables the highlightning of the source&lt;/p&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;&quot;&gt;code shown below. (Still needs some performance improvements) (Ctrl+H)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Syntax Highlight</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/syntax-highlight.png</normaloff>:/mainWindow/syntax-highlight.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+H</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="connectedSettingName" stdset="0">
<string>DONOTTRANSLATE:SyntaxHighlightingEnabled</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbAbout">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Shows info about UniversalIndentGUI&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>About</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/info.png</normaloff>:/mainWindow/info.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbExit">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Quits the UniversalIndentGUI&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Exit</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-log-out.png</normaloff>:/mainWindow/system-log-out.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections/>
</ui>

@ -0,0 +1,87 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiErrorMessage.h"
#include <QCheckBox>
/*!
\class UiGuiErrorMessage
\ingroup grp_Dialogs
\brief UiGuiErrorMessage is a child of QErrorMessage. But QErrorMessages
"Do not show again" didn't work with my strings, so this is my own, working
implementation of it.
*/
/*!
\brief Initializes the dialog.
Retrieves the object pointer to the \a _showAgainCheckBox check box, sets the dialogs
modality and for a working translation sets the check box text.
*/
UiGuiErrorMessage::UiGuiErrorMessage(QWidget *parent) : QErrorMessage(parent) {
_showAgainCheckBox = findChild<QCheckBox *>();
setWindowModality( Qt::ApplicationModal );
_showAgainCheckBox->setText( tr("Show this message again") );
}
/*!
\brief Just a lazy nothin doin destructive destructor.
*/
UiGuiErrorMessage::~UiGuiErrorMessage(void) {
}
/*!
\brief Shows an error \a message in a dialog box with \a title.
The shown \a message is added to a list, if not already in there. If it is
already in that list and "Show this message again" is not checked, that
message will not be shown.
*/
void UiGuiErrorMessage::showMessage( const QString &title, const QString &message ) {
bool showAgain = true;
if ( _showAgainCheckBox != 0 ) {
showAgain = _showAgainCheckBox->isChecked();
}
setWindowTitle(title);
if ( !_errorMessageList.contains(message) ) {
_errorMessageList << message;
if ( _showAgainCheckBox != 0 ) {
_showAgainCheckBox->setChecked(true);
}
QErrorMessage::showMessage( message );
}
else if ( showAgain ) {
QErrorMessage::showMessage( message );
}
}
/*!
\brief For convinience, for showing a dialog box with the default title "UniversalIndentGUI".
*/
void UiGuiErrorMessage::showMessage( const QString &message ) {
showMessage( "UniversalIndentGUI", message );
}

@ -0,0 +1,43 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIERRORMESSAGE_H
#define UIGUIERRORMESSAGE_H
#include <QErrorMessage>
class QCheckBox;
class UiGuiErrorMessage : public QErrorMessage
{
Q_OBJECT
public:
UiGuiErrorMessage(QWidget *parent = 0);
~UiGuiErrorMessage(void);
void showMessage( const QString &message );
void showMessage( const QString &title, const QString &message );
private:
QCheckBox *_showAgainCheckBox;
QStringList _errorMessageList;
};
#endif // UIGUIERRORMESSAGE_H

@ -0,0 +1,528 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiHighlighter.h"
#include "SettingsPaths.h"
#include <QSettings>
#include <QMenu>
#include <QScrollBar>
#include <QCoreApplication>
#include <Qsci/qsciscintilla.h>
#include <Qsci/qscilexer.h>
#include <Qsci/qscilexerbash.h>
#include <Qsci/qscilexerbatch.h>
#include <Qsci/qscilexercmake.h>
#include <Qsci/qscilexercpp.h>
#include <Qsci/qscilexercsharp.h>
#include <Qsci/qscilexercss.h>
#include <Qsci/qscilexerd.h>
#include <Qsci/qscilexerdiff.h>
#if ( QSCINTILLA_VERSION >= 0x020300 )
#include <Qsci/qscilexerfortran.h>
#include <Qsci/qscilexerfortran77.h>
#endif
#include <Qsci/qscilexerhtml.h>
#include <Qsci/qscilexeridl.h>
#include <Qsci/qscilexerjava.h>
#include <Qsci/qscilexerjavascript.h>
#include <Qsci/qscilexerlua.h>
#include <Qsci/qscilexermakefile.h>
#if ( QSCINTILLA_VERSION >= 0x020300 )
#include <Qsci/qscilexerpascal.h>
#endif
#include <Qsci/qscilexerperl.h>
#if ( QSCINTILLA_VERSION >= 0x020300 )
#include <Qsci/qscilexerpostscript.h>
#endif
#include <Qsci/qscilexerpov.h>
#include <Qsci/qscilexerproperties.h>
#include <Qsci/qscilexerpython.h>
#include <Qsci/qscilexerruby.h>
#if ( QSCINTILLA_VERSION >= 0x020400 )
#include <Qsci/qscilexerspice.h>
#endif
#include <Qsci/qscilexersql.h>
#if ( QSCINTILLA_VERSION >= 0x020300 )
#include <Qsci/qscilexertcl.h>
#endif
#include <Qsci/qscilexertex.h>
#if ( QSCINTILLA_VERSION >= 0x020400 )
#include <Qsci/qscilexerverilog.h>
#endif
#include <Qsci/qscilexervhdl.h>
#if ( QSCINTILLA_VERSION >= 0x020300 )
#include <Qsci/qscilexerxml.h>
#include <Qsci/qscilexeryaml.h>
#endif
//! \defgroup grp_EditorComponent All concerning editor widget.
/*!
\class UiGuiHighlighter
\ingroup grp_EditorComponent
\brief UiGuiHighlighter used for selecting the syntax highlighter/lexer for the QsciScintilla component.
*/
/*!
\brief The constructor initializes some regular expressions and keywords to identify cpp tokens
*/
UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : QObject(parent) {
_qsciEditorParent = parent;
// Create the highlighter _settings object from the UiGuiSyntaxHighlightConfig.ini file.
_settings = new QSettings(SettingsPaths::getSettingsPath() + "/UiGuiSyntaxHighlightConfig.ini", QSettings::IniFormat, this);
_highlightningIsOn = true;
_mapHighlighternameToExtension["Bash"] = QStringList() << "sh";
_mapHighlighternameToExtension["Batch"] = QStringList() << "bat";
_mapHighlighternameToExtension["CMake"] = QStringList() << "cmake";
_mapHighlighternameToExtension["C++"] = QStringList() << "c" << "h" << "cpp" << "hpp" << "cxx" << "hxx";
_mapHighlighternameToExtension["C#"] = QStringList() << "cs";
_mapHighlighternameToExtension["CSS"] = QStringList() << "css";
_mapHighlighternameToExtension["D"] = QStringList() << "d";
_mapHighlighternameToExtension["Diff"] = QStringList() << "diff";
#if ( QSCINTILLA_VERSION >= 0x020300 )
_mapHighlighternameToExtension["Fortran"] = QStringList() << "f" << "for" << "f90";
_mapHighlighternameToExtension["Fortran77"] = QStringList() << "f77";
#endif
_mapHighlighternameToExtension["HTML"] = QStringList() << "html" << "htm";
_mapHighlighternameToExtension["IDL"] = QStringList() << "idl";
_mapHighlighternameToExtension["Java"] = QStringList() << "java";
_mapHighlighternameToExtension["JavaScript"] = QStringList() << "js";
_mapHighlighternameToExtension["LUA"] = QStringList() << "lua";
_mapHighlighternameToExtension["Makefile"] = QStringList() << "makefile";
#if ( QSCINTILLA_VERSION >= 0x020300 )
_mapHighlighternameToExtension["Pascal"] = QStringList() << "pas";
#endif
_mapHighlighternameToExtension["Perl"] = QStringList() << "perl" << "pl" << "pm";
_mapHighlighternameToExtension["PHP"] = QStringList() << "php";
#if ( QSCINTILLA_VERSION >= 0x020300 )
_mapHighlighternameToExtension["PostScript"] = QStringList() << "ps" << "eps" << "pdf" << "ai" << "fh";
#endif
_mapHighlighternameToExtension["POV"] = QStringList() << "pov";
_mapHighlighternameToExtension["Ini"] = QStringList() << "ini";
_mapHighlighternameToExtension["Python"] = QStringList() << "py";
_mapHighlighternameToExtension["Ruby"] = QStringList() << "rub" << "rb";
#if ( QSCINTILLA_VERSION >= 0x020400 )
_mapHighlighternameToExtension["Spice"] = QStringList() << "cir";
#endif
_mapHighlighternameToExtension["SQL"] = QStringList() << "sql";
#if ( QSCINTILLA_VERSION >= 0x020300 )
_mapHighlighternameToExtension["TCL"] = QStringList() << "tcl";
#endif
_mapHighlighternameToExtension["TeX"] = QStringList() << "tex";
#if ( QSCINTILLA_VERSION >= 0x020400 )
_mapHighlighternameToExtension["Verilog"] = QStringList() << "v" << "vh";
#endif
_mapHighlighternameToExtension["VHDL"] = QStringList() << "vhdl";
_mapHighlighternameToExtension["XML"] = QStringList() << "xml";
#if ( QSCINTILLA_VERSION >= 0x020300 )
_mapHighlighternameToExtension["YAML"] = QStringList() << "yaml";
#endif
_lexer = NULL;
// This code is only for testing.
/*
foreach(QStringList extensionList, _mapHighlighternameToExtension.values() ) {
setLexerForExtension( extensionList.at(0) );
}
*/
// Set default highlighter to C++ highlighter.
setLexerForExtension( "cpp" );
}
/*!
\brief Returns the available highlighters as QStringList.
*/
QStringList UiGuiHighlighter::getAvailableHighlighters() {
return _mapHighlighternameToExtension.keys();
}
/*!
\brief This slot handles signals coming from selecting another syntax highlighter.
*/
void UiGuiHighlighter::setHighlighterByAction(QAction* highlighterAction) {
QString highlighterName = highlighterAction->text();
setLexerForExtension( _mapHighlighternameToExtension[highlighterName].first() );
//TODO: This is really no nice way. How do it better?
// Need to do this "text update" to update the syntax highlighting. Otherwise highlighting is wrong.
int scrollPos = _qsciEditorParent->verticalScrollBar()->value();
_qsciEditorParent->setText( _qsciEditorParent->text() );
_qsciEditorParent->verticalScrollBar()->setValue(scrollPos);
}
/*!
\brief Turns the syntax parser on.
*/
void UiGuiHighlighter::turnHighlightOn() {
_highlightningIsOn = true;
_qsciEditorParent->setLexer(_lexer);
readCurrentSettings("");
}
/*!
\brief Turns the syntax parser off.
*/
void UiGuiHighlighter::turnHighlightOff() {
_highlightningIsOn = false;
_qsciEditorParent->setLexer();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
_qsciEditorParent->setFont( QFont("Courier", 10, QFont::Normal) );
_qsciEditorParent->setMarginsFont( QFont("Courier", 10, QFont::Normal) );
#else
_qsciEditorParent->setFont( QFont("Monospace", 10, QFont::Normal) );
_qsciEditorParent->setMarginsFont( QFont("Monospace", 10, QFont::Normal) );
#endif
}
/*!
\brief Read the settings for the current lexer from the settings file.
*/
//TODO: Refactor this function so that the coding style and variable names suit better.
bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) {
bool ok, flag, rc = true;
int num;
QString key;
// Reset lists containing fonts and colors for each style
_fontForStyles.clear();
_colorForStyles.clear();
// Read the styles.
for (int i = 0; i < 128; ++i) {
// Ignore invalid styles.
if ( _lexer->description(i).isEmpty() )
continue;
key.sprintf( "%s/%s/style%d/", prefix, _lexer->language(), i );
key.replace("+", "p");
// Read the foreground color.
ok = _settings->contains(key + "color");
num = _settings->value(key + "color", 0).toInt();
if (ok)
setColor( QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i );
else
rc = false;
// Read the end-of-line fill.
ok = _settings->contains(key + "eolfill");
flag = _settings->value(key + "eolfill", false).toBool();
if (ok)
_lexer->setEolFill( flag, i );
else
rc = false;
// Read the font
QStringList fdesc;
ok = _settings->contains(key + "font");
fdesc = _settings->value(key + "font").toStringList();
if (ok && fdesc.count() == 5) {
QFont f;
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
f.setFamily(fdesc[0]);
#else
if ( fdesc[0].contains("courier", Qt::CaseInsensitive) )
f.setFamily("Monospace");
else
f.setFamily(fdesc[0]);
#endif
f.setPointSize(fdesc[1].toInt());
f.setBold(fdesc[2].toInt());
f.setItalic(fdesc[3].toInt());
f.setUnderline(fdesc[4].toInt());
setFont(f, i);
}
else
rc = false;
// Read the background color.
ok = _settings->contains(key + "paper");
num = _settings->value(key + "paper", 0).toInt();
if (ok)
_lexer->setPaper( QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i );
else
rc = false;
}
// Read the properties.
key.sprintf( "%s/%s/properties/", prefix, _lexer->language() );
_lexer->refreshProperties();
return rc;
}
/*!
\brief Write the settings for the current lexer to the settings file.
*/
void UiGuiHighlighter::writeCurrentSettings( const char *prefix ) {
QString key;
// Write the styles.
for (int i = 0; i < 128; ++i) {
// Ignore invalid styles.
if ( _lexer->description(i).isEmpty() )
continue;
int num;
QColor c;
key.sprintf( "%s/%s/style%d/", prefix, _lexer->language(), i );
key.replace("+", "p");
// Write style name
_settings->setValue( key + "", _lexer->description(i) );
// Write the foreground color.
if ( _colorForStyles.contains(i) ) {
c = _colorForStyles[i];
}
else {
c = _lexer->color(i);
}
num = (c.red() << 16) | (c.green() << 8) | c.blue();
_settings->setValue(key + "color", num);
// Write the end-of-line fill.
_settings->setValue( key + "eolfill", _lexer->eolFill(i) );
// Write the font
QStringList fdesc;
QString fmt("%1");
QFont f;
if ( _fontForStyles.contains(i) ) {
f = _fontForStyles[i];
}
else {
f = _lexer->font(i);
}
fdesc += f.family();
fdesc += fmt.arg( f.pointSize() );
// The casts are for Borland.
fdesc += fmt.arg( (int)f.bold() );
fdesc += fmt.arg( (int)f.italic() );
fdesc += fmt.arg( (int)f.underline() );
_settings->setValue(key + "font", fdesc);
// Write the background color.
c = _lexer->paper(i);
num = (c.red() << 16) | (c.green() << 8) | c.blue();
_settings->setValue(key + "paper", num);
}
}
/*!
\brief Sets the \a color for the given \a style.
*/
void UiGuiHighlighter::setColor(const QColor &color, int style) {
_colorForStyles[style] = color;
_lexer->setColor( color, style );
}
/*!
\brief Sets the \a font for the given \a style.
*/
void UiGuiHighlighter::setFont(const QFont &font, int style) {
_fontForStyles[style] = font;
_lexer->setFont( font, style );
}
/*!
\brief Sets the to be used lexer by giving his name.
*/
void UiGuiHighlighter::setLexerByName( QString lexerName ) {
setLexerForExtension( _mapHighlighternameToExtension[lexerName].first() );
}
/*!
\brief Sets the proper highlighter / lexer for the given file \a extension. Returns the index of the used lexer in the list.
*/
int UiGuiHighlighter::setLexerForExtension( QString extension ) {
int indexOfHighlighter = 0;
extension = extension.toLower();
if ( _lexer != NULL ) {
writeCurrentSettings("");
delete _lexer;
}
if ( extension == "cpp" || extension == "hpp" || extension == "c" || extension == "h" || extension == "cxx" || extension == "hxx" ) {
_lexer = new QsciLexerCPP();
}
else if ( extension == "sh" ) {
_lexer = new QsciLexerBash();
}
else if ( extension == "bat" ) {
_lexer = new QsciLexerBatch();
}
else if ( extension == "cmake" ) {
_lexer = new QsciLexerCMake();
}
else if ( extension == "cs" ) {
_lexer = new QsciLexerCSharp();
}
else if ( extension == "css" ) {
_lexer = new QsciLexerCSS();
}
else if ( extension == "d" ) {
_lexer = new QsciLexerD();
}
else if ( extension == "diff" ) {
_lexer = new QsciLexerDiff();
}
#if ( QSCINTILLA_VERSION >= 0x020300 )
else if ( extension == "f" || extension == "for" || extension == "f90" ) {
_lexer = new QsciLexerFortran();
}
else if ( extension == "f77" ) {
_lexer = new QsciLexerFortran77();
}
#endif
else if ( extension == "html" || extension == "htm" ) {
_lexer = new QsciLexerHTML();
}
else if ( extension == "idl" ) {
_lexer = new QsciLexerIDL();
}
else if ( extension == "java" ) {
_lexer = new QsciLexerJava();
}
else if ( extension == "js" ) {
_lexer = new QsciLexerJavaScript();
}
else if ( extension == "lua" ) {
_lexer = new QsciLexerLua();
}
else if ( extension == "makefile" ) {
_lexer = new QsciLexerMakefile();
}
#if ( QSCINTILLA_VERSION >= 0x020300 )
else if ( extension == "pas" ) {
_lexer = new QsciLexerPascal();
}
#endif
else if ( extension == "perl" || extension == "pl" || extension == "pm" ) {
_lexer = new QsciLexerPerl();
}
else if ( extension == "php" ) {
_lexer = new QsciLexerHTML();
}
#if ( QSCINTILLA_VERSION >= 0x020300 )
else if ( extension == "ps" || extension == "eps" || extension == "pdf" || extension == "ai" || extension == "fh") {
_lexer = new QsciLexerPostScript();
}
#endif
else if ( extension == "pov" ) {
_lexer = new QsciLexerPOV();
}
else if ( extension == "ini" ) {
_lexer = new QsciLexerProperties();
}
else if ( extension == "py" ) {
_lexer = new QsciLexerPython();
}
else if ( extension == "rub" || extension == "rb" ) {
_lexer = new QsciLexerRuby();
}
#if ( QSCINTILLA_VERSION >= 0x020400 )
else if ( extension == "spice?" ) {
_lexer = new QsciLexerSpice();
}
#endif
else if ( extension == "sql" ) {
_lexer = new QsciLexerSQL();
}
#if ( QSCINTILLA_VERSION >= 0x020300 )
else if ( extension == "tcl" ) {
_lexer = new QsciLexerTCL();
}
#endif
else if ( extension == "tex" ) {
_lexer = new QsciLexerTeX();
}
#if ( QSCINTILLA_VERSION >= 0x020400 )
else if ( extension == "vlog?" ) {
_lexer = new QsciLexerVerilog();
}
#endif
else if ( extension == "vhdl" ) {
_lexer = new QsciLexerVHDL();
}
else if ( extension == "xml" ) {
#if ( QSCINTILLA_VERSION >= 0x020300 )
_lexer = new QsciLexerXML();
#else
_lexer = new QsciLexerHTML();
#endif
}
#if ( QSCINTILLA_VERSION >= 0x020300 )
else if ( extension == "yaml" ) {
_lexer = new QsciLexerYAML();
}
#endif
else {
_lexer = new QsciLexerCPP();
extension = "cpp";
}
// Find the index of the selected _lexer.
indexOfHighlighter = 0;
while ( !_mapHighlighternameToExtension.values().at(indexOfHighlighter).contains(extension) ) {
indexOfHighlighter++;
}
// Set the _lexer for the QScintilla widget.
if ( _highlightningIsOn ) {
_qsciEditorParent->setLexer(_lexer);
}
// Read the _settings for the _lexer properties from file.
readCurrentSettings("");
return indexOfHighlighter;
}

@ -0,0 +1,74 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIHIGHLIGHTER_H
#define UIGUIHIGHLIGHTER_H
#include <QObject>
#include <QMap>
#include <QFont>
#include <QColor>
class QAction;
class QSettings;
class QsciScintilla;
class QsciLexer;
class UiGuiHighlighter : public QObject
{
Q_OBJECT
public:
UiGuiHighlighter(QsciScintilla *parent);
void turnHighlightOff();
void turnHighlightOn();
bool readCurrentSettings(const char *prefix);
void writeCurrentSettings(const char *prefix);
QStringList getAvailableHighlighters();
public slots:
//! The foreground color for style number \a style is set to \a color. If
//! \a style is -1 then the color is set for all styles.
void setColor(const QColor &color, int style = -1);
//! The font for style number \a style is set to \a font. If \a style is
//! -1 then the font is set for all styles.
void setFont(const QFont &font, int style = -1);
//! Sets the lexer that is responsible for the given \a extension.
int setLexerForExtension( QString extension );
void setLexerByName( QString lexerName );
void setHighlighterByAction(QAction* highlighterAction);
private:
bool _highlightningIsOn;
QsciScintilla *_qsciEditorParent;
QMap<int, QFont> _fontForStyles;
QMap<int, QColor> _colorForStyles;
QsciLexer* _lexer;
QSettings *_settings;
QMap<QString, QStringList> _mapHighlighternameToExtension;
};
#endif // UIGUIHIGHLIGHTER_H

@ -0,0 +1,156 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiIndentServer.h"
#include <QTcpServer>
#include <QTcpSocket>
#include <QMessageBox>
#include <QtDebug>
//! \defgroup grp_Server All concerning the server component.
/*!
\class UiGuiIndentServer
\ingroup grp_Server
\brief UiGuiIndentServer is in such an early state, that even the communication
protocol isn't completely planned. So this class lacks documentation until
I really know where all this will lead to.
The plan however is to have a server that receives commands for selecting an
indenter and perhaps load some by the user predefined indenter config file. Then
the client can send a text to it and will receive it formatted.
The idea behind that is to make UiGUIs use as plugin or whatever more flexible.
So the plugin is developed for Eclipse for example and it takes the client role,
making it possible to use UiGUI from within Eclipse. Choosing a network protocol
makes everything platform and programming language independent, so it doesn't
matter for which application the plugin/client is developed.
*/
UiGuiIndentServer::UiGuiIndentServer(void) : QObject() {
_tcpServer = NULL;
_currentClientConnection = NULL;
_readyForHandleRequest = false;
}
UiGuiIndentServer::~UiGuiIndentServer(void) {
}
void UiGuiIndentServer::startServer() {
if ( _tcpServer == NULL ) {
_tcpServer = new QTcpServer(this);
}
if ( !_tcpServer->isListening() ) {
if ( !_tcpServer->listen(QHostAddress::Any, quint16(84484)) ) {
QMessageBox::critical( NULL, tr("UiGUI Server"), tr("Unable to start the server: %1.").arg(_tcpServer->errorString()) );
return;
}
}
connect( _tcpServer, SIGNAL(newConnection()), this, SLOT(handleNewConnection()) );
_readyForHandleRequest = true;
_blockSize = 0;
}
void UiGuiIndentServer::stopServer() {
if ( _tcpServer != NULL ) {
_tcpServer->close();
delete _tcpServer;
_tcpServer = NULL;
}
_currentClientConnection = NULL;
_readyForHandleRequest = false;
}
void UiGuiIndentServer::handleNewConnection() {
QTcpSocket *clientConnection = _tcpServer->nextPendingConnection();
connect( clientConnection, SIGNAL(disconnected()), clientConnection, SLOT(deleteLater()) );
connect( clientConnection, SIGNAL(readyRead()), this, SLOT(handleReceivedData()) );
}
void UiGuiIndentServer::handleReceivedData() {
if ( !_readyForHandleRequest ) {
return;
}
_currentClientConnection = qobject_cast<QTcpSocket*>( sender() );
QString receivedData = "";
if ( _currentClientConnection != NULL ) {
QDataStream in(_currentClientConnection);
in.setVersion(QDataStream::Qt_4_0);
if ( _blockSize == 0 ) {
if ( _currentClientConnection->bytesAvailable() < (int)sizeof(quint32) )
return;
in >> _blockSize;
}
if ( _currentClientConnection->bytesAvailable() < _blockSize )
return;
QString receivedMessage;
in >> receivedMessage;
_blockSize = 0;
qDebug() << "receivedMessage: " << receivedMessage;
if ( receivedMessage == "ts" ) {
sendMessage("Toll");
}
else {
sendMessage("irgendwas");
}
}
}
void UiGuiIndentServer::sendMessage( const QString &message ) {
_readyForHandleRequest = false;
_dataToSend = "";
QDataStream out(&_dataToSend, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
out << (quint32)0;
out << message;
out.device()->seek(0);
out << (quint32)(_dataToSend.size() - sizeof(quint32));
connect(_currentClientConnection, SIGNAL(bytesWritten(qint64)), this, SLOT(checkIfReadyForHandleRequest()));
_currentClientConnection->write(_dataToSend);
}
void UiGuiIndentServer::checkIfReadyForHandleRequest() {
if ( _currentClientConnection->bytesToWrite() == 0 ) {
QString dataToSendStr = _dataToSend.right( _dataToSend.size() - sizeof(quint32) );
qDebug() << "checkIfReadyForHandleRequest _dataToSend was: " << dataToSendStr;
disconnect(_currentClientConnection, SIGNAL(bytesWritten(qint64)), this, SLOT(checkIfReadyForHandleRequest()));
_readyForHandleRequest = true;
}
}

@ -0,0 +1,55 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIINDENTSERVER_H
#define UIGUIINDENTSERVER_H
#include <QObject>
class QTcpServer;
class QTcpSocket;
class UiGuiIndentServer : public QObject
{
Q_OBJECT
public:
UiGuiIndentServer(void);
~UiGuiIndentServer(void);
public slots:
void startServer();
void stopServer();
private slots:
void handleNewConnection();
void handleReceivedData();
void sendMessage(const QString &message);
void checkIfReadyForHandleRequest();
private:
QTcpServer *_tcpServer;
QByteArray _dataToSend;
bool _readyForHandleRequest;
QTcpSocket *_currentClientConnection;
quint32 _blockSize;
};
#endif // UIGUIINDENTSERVER_H

@ -0,0 +1,151 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiIniFileParser.h"
#include <QFile>
#include <QStringList>
#include <QVariant>
#include <QTextStream>
//! \defgroup grp_Settings All concerning applications settings.
/*!
\class UiGuiIniFileParser
\ingroup grp_Settings
\brief UiGuiIniFileParser is a simple ini file format parser.
These ini files need to have key-value pairs in the style
"keyname=keyvalue". Groups can be defined by writing the groupname
in the style [groupname] before some key-value pairs.
The reason why I use my own class instead of QSettings is mainly, that
QSettings always internally sorts the groups alphabetically and also
rewrites a settings file sorted. Very annoying for me.
*/
/*!
\brief Init and empty all needed lists and strings.
*/
UiGuiIniFileParser::UiGuiIniFileParser(void) {
init();
}
/*!
\brief Directly loads and parses the file with name \a iniFileName.
*/
UiGuiIniFileParser::UiGuiIniFileParser(const QString &iniFileName) {
init();
_iniFileName = iniFileName;
parseIniFile();
}
void UiGuiIniFileParser::init() {
_sections.clear();
_keyValueMap.clear();
_iniFileName = "";
}
UiGuiIniFileParser::~UiGuiIniFileParser(void) {
}
/*!
\brief Returns the group/section names in the same order as they occurr in the ini file as QStringList.
*/
QStringList UiGuiIniFileParser::childGroups() {
QStringList sectionsStringList;
for( unsigned int i = 0; i < _sections.size(); i++ ) {
sectionsStringList << _sections[i];
}
return sectionsStringList;
}
/*!
\brief Returns the value of the defined \a keyName as QVariant.
The \a keyName is assembled by a section name, a slash and the key name itself.
For example if you wish to access the value of the following setting:
<code>[NiceSection]</br>niceKeyName=2</code> you would have to call
value("NiceSection/niceKeyName").
*/
QVariant UiGuiIniFileParser::value(const QString &keyName, const QString &defaultValue) {
return _keyValueMap.value( keyName, defaultValue );
}
/*!
\brief Parses the ini file and stores the key value pairs in the internal vectors \a keys and \a values.
*/
void UiGuiIniFileParser::parseIniFile() {
QFile iniFile(_iniFileName);
if ( iniFile.open(QFile::ReadOnly) ) {
// Clear the vectors holding the keys and values.
_sections.clear();
_keyValueMap.clear();
QTextStream iniFileStream( &iniFile );
QString line;
QString currentSectionName = "";
QString keyName = "";
QString valueAsString = "";
while ( !iniFileStream.atEnd() ) {
line = iniFileStream.readLine().trimmed();
// Test if the read line is a section name and if so remeber it.
if ( line.startsWith("[") && line.endsWith("]") ) {
currentSectionName = line.remove(0, 1);
currentSectionName.chop(1);
// Store the section name.
_sections.push_back( currentSectionName );
}
// Otherwise test whether the line has a assign char
else if ( line.contains("=") ) {
int indexOfFirstAssign = line.indexOf("=");
keyName = line.left(indexOfFirstAssign);
if ( !keyName.isEmpty() ) {
valueAsString = line.remove(0, indexOfFirstAssign+1);
// Remove any existing double quotes from the value.
if ( valueAsString.startsWith("\"") && valueAsString.endsWith("\"") ) {
valueAsString = valueAsString.remove(0, 1);
valueAsString.chop(1);
}
// Prepend an eventually section name to the key name.
if ( !currentSectionName.isEmpty() ) {
keyName = currentSectionName + "/" + keyName;
}
// Store the key and value in the map.
_keyValueMap.insert(keyName, valueAsString );
}
}
}
}
}

@ -0,0 +1,52 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIINIFILEPARSER_H
#define UIGUIINIFILEPARSER_H
#include <QMap>
#include <QString>
#include <vector>
class QStringList;
class QVariant;
class UiGuiIniFileParser
{
public:
UiGuiIniFileParser(void);
UiGuiIniFileParser(const QString &iniFileName);
~UiGuiIniFileParser(void);
QVariant value(const QString &keyName, const QString &defaultValue = "");
QStringList childGroups();
protected:
void init();
private:
void parseIniFile();
QString _iniFileName;
std::vector<QString> _sections;
QMap<QString, QVariant> _keyValueMap;
};
#endif // UIGUIINIFILEPARSER_H

@ -0,0 +1,688 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiSettings.h"
#include "SettingsPaths.h"
#include <QSettings>
#include <QPoint>
#include <QSize>
#include <QDir>
#include <QDate>
#include <QStringList>
#include <QCoreApplication>
#include <QMetaMethod>
#include <QMetaProperty>
#include <QWidget>
//! \defgroup grp_Settings All concerning the settings.
/*!
\class UiGuiSettings
\ingroup grp_Settings
\brief Handles the settings of the program. Reads them on startup and saves them on exit.
Is a singleton class and can only be accessed via getInstance().
*/
// Inits the single class instance pointer.
QWeakPointer<UiGuiSettings> UiGuiSettings::_instance;
/*!
\brief The constructor for the settings.
*/
UiGuiSettings::UiGuiSettings() : QObject() {
// Create the main application settings object from the UniversalIndentGUI.ini file.
_qsettings = new QSettings(SettingsPaths::getSettingsPath() + "/UniversalIndentGUI.ini", QSettings::IniFormat, this);
_indenterDirctoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters";
readAvailableTranslations();
initSettings();
}
/*!
\brief Returns the instance of the settings class. If no instance exists, ONE will be created.
*/
QSharedPointer<UiGuiSettings> UiGuiSettings::getInstance() {
QSharedPointer<UiGuiSettings> sharedInstance = _instance.toStrongRef();
if ( sharedInstance.isNull() ) {
// Create the settings object, which loads all UiGui settings from a file.
sharedInstance = QSharedPointer<UiGuiSettings>(new UiGuiSettings());
_instance = sharedInstance.toWeakRef();
}
return sharedInstance;
}
/*!
\brief The destructor saves the settings to a file.
*/
UiGuiSettings::~UiGuiSettings() {
// Convert the language setting from an integer index to a string.
int index = _qsettings->value("UniversalIndentGUI/language", 0).toInt();
if ( index < 0 || index >= _availableTranslations.size() )
index = 0;
_qsettings->setValue( "UniversalIndentGUI/language", _availableTranslations.at(index) );
}
/*!
\brief Scans the translations directory for available translation files and
stores them in the QList \a _availableTranslations.
*/
void UiGuiSettings::readAvailableTranslations() {
QString languageShort;
QStringList languageFileList;
// English is the default language. A translation file does not exist but to have a menu entry, added here.
languageFileList << "universalindent_en.qm";
// Find all translation files in the "translations" directory.
QDir translationDirectory = QDir( SettingsPaths::getGlobalFilesPath() + "/translations" );
languageFileList << translationDirectory.entryList( QStringList("universalindent_*.qm") );
// Loop for each found translation file
foreach ( languageShort, languageFileList ) {
// Remove the leading string "universalindent_" from the filename.
languageShort.remove(0,16);
// Remove trailing file extension ".qm".
languageShort.chop(3);
_availableTranslations.append(languageShort);
}
}
/*!
\brief Returns a list of the mnemonics of the available translations.
*/
QStringList UiGuiSettings::getAvailableTranslations() {
return _availableTranslations;
}
/*!
\brief Returns the value of the by \a settingsName defined setting as QVariant.
If the named setting does not exist, 0 is being returned.
*/
QVariant UiGuiSettings::getValueByName(QString settingName) {
return _qsettings->value("UniversalIndentGUI/" + settingName);
}
/*!
\brief Loads the settings for the main application.
Settings are for example last selected indenter, last loaded source code file and so on.
*/
bool UiGuiSettings::initSettings()
{
// Read the version string saved in the settings file.
_qsettings->setValue( "UniversalIndentGUI/version", _qsettings->value("UniversalIndentGUI/version", "") );
// Read windows last size and position from the settings file.
_qsettings->setValue( "UniversalIndentGUI/maximized", _qsettings->value("UniversalIndentGUI/maximized", false) );
_qsettings->setValue( "UniversalIndentGUI/position", _qsettings->value("UniversalIndentGUI/position", QPoint(50, 50)) );
_qsettings->setValue( "UniversalIndentGUI/size", _qsettings->value("UniversalIndentGUI/size", QSize(800, 600)) );
// Read last selected encoding for the opened source code file.
_qsettings->setValue( "UniversalIndentGUI/encoding", _qsettings->value("UniversalIndentGUI/encoding", "UTF-8") );
// Read maximum length of list for recently opened files.
_qsettings->setValue( "UniversalIndentGUI/recentlyOpenedListSize", _qsettings->value("UniversalIndentGUI/recentlyOpenedListSize", 5) );
// Read if last opened source code file should be loaded on startup.
_qsettings->setValue( "UniversalIndentGUI/loadLastSourceCodeFileOnStartup", _qsettings->value("UniversalIndentGUI/loadLastSourceCodeFileOnStartup", true) );
// Read last opened source code file from the settings file.
_qsettings->setValue( "UniversalIndentGUI/lastSourceCodeFile", _qsettings->value("UniversalIndentGUI/lastSourceCodeFile", _indenterDirctoryStr+"/example.cpp") );
// Read last selected indenter from the settings file.
int selectedIndenter = _qsettings->value("UniversalIndentGUI/selectedIndenter", 0).toInt();
if ( selectedIndenter < 0 ) {
selectedIndenter = 0;
}
_qsettings->setValue( "UniversalIndentGUI/selectedIndenter", selectedIndenter );
// Read if syntax highlighting is enabled.
_qsettings->setValue( "UniversalIndentGUI/SyntaxHighlightingEnabled", _qsettings->value("UniversalIndentGUI/SyntaxHighlightingEnabled", true) );
// Read if white space characters should be displayed.
_qsettings->setValue( "UniversalIndentGUI/whiteSpaceIsVisible", _qsettings->value("UniversalIndentGUI/whiteSpaceIsVisible", false) );
// Read if indenter parameter tool tips are enabled.
_qsettings->setValue( "UniversalIndentGUI/indenterParameterTooltipsEnabled", _qsettings->value("UniversalIndentGUI/indenterParameterTooltipsEnabled", true) );
// Read the tab width from the settings file.
_qsettings->setValue( "UniversalIndentGUI/tabWidth", _qsettings->value("UniversalIndentGUI/tabWidth", 4) );
// Read the last selected language and stores the index it has in the list of available translations.
_qsettings->setValue( "UniversalIndentGUI/language", _availableTranslations.indexOf( _qsettings->value("UniversalIndentGUI/language", "").toString() ) );
// Read the update check settings from the settings file.
_qsettings->setValue( "UniversalIndentGUI/CheckForUpdate", _qsettings->value("UniversalIndentGUI/CheckForUpdate", false) );
_qsettings->setValue( "UniversalIndentGUI/LastUpdateCheck", _qsettings->value("UniversalIndentGUI/LastUpdateCheck", QDate(1900,1,1)) );
// Read the main window state.
_qsettings->setValue( "UniversalIndentGUI/MainWindowState", _qsettings->value("UniversalIndentGUI/MainWindowState", QByteArray()) );
return true;
}
/*!
\brief Register the by \a propertyName defined property of \a obj to be connected to the setting defined by \a settingName.
The \a propertyName must be one of those that are listed in the Qt "Properties" documentation section of a Qt Object.
All further needed info is retrieved via the \a obj's MetaObject, like the to the property bound signal.
*/
bool UiGuiSettings::registerObjectProperty( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
bool connectSuccess = false;
// Connect to the objects destroyed signal, so that it will be correctly unregistered.
connectSuccess = connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( connectSuccess && indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// Connect to the property's value changed signal.
if ( mProp.hasNotifySignal() ) {
QMetaMethod signal = mProp.notifySignal();
//QString teststr = qPrintable(SIGNAL() + QString(signal.signature()));
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = connect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
}
if ( connectSuccess ) {
_registeredObjectProperties[obj] = QStringList() << propertyName << settingName;
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
return false;
}
// If setting already exists, set the objects property to the setting value.
if ( _qsettings->contains("UniversalIndentGUI/" + settingName) ) {
mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName));
}
// Otherwise add the setting and set it to the value of the objects property.
else {
_qsettings->setValue("UniversalIndentGUI/" + settingName, mProp.read(obj));
}
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectProperty(QObject*)));
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and registers this property name to that setting name if both were found.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings. If the mentioned setting
name doesn't exist, it will be created.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::registerObjectPropertyRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::registerObjectProperty);
}
/*!
\brief Assigns the by \a settingName defined setting value to the by \a propertyName defined property of \a obj.
Returns true, if the value could be assigned, otherwise returns false, which is the case if settingName doesn't exist
within the settings or if the mentioned propertyName wasn't found for the \a obj.
*/
bool UiGuiSettings::setObjectPropertyToSettingValue( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// If setting already exists, set the objects property to the setting value.
if ( _qsettings->contains("UniversalIndentGUI/" + settingName) ) {
mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName));
}
// The setting didn't exist so return that setting the objects property failed.
else {
//TODO: Write a debug warning to the log.
return false;
}
}
else {
//TODO: Write a debug warning to the log.
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and sets each property to settings value.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::setObjectPropertyToSettingValueRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setObjectPropertyToSettingValue);
}
/*!
\brief Assigns the by \a propertyName defined property's value of \a obj to the by \a settingName defined setting.
If the \a settingName didn't exist yet, it will be created.
Returns true, if the value could be assigned, otherwise returns false, which is the case if the mentioned
propertyName wasn't found for the \a obj.
*/
bool UiGuiSettings::setSettingToObjectPropertyValue( QObject *obj, const QString &propertyName, const QString &settingName )
{
const QMetaObject *metaObject = obj->metaObject();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
setValueByName(settingName, mProp.read(obj));
}
else {
//TODO: Write a debug warning to the log.
return false;
}
return true;
}
/*!
\brief Searches the child QObjects of \a obj for a property name and setting name definition within
their custom properties and sets each setting to the property value.
The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName",
where "connectedPropertyName" is the name of a QObject property as it is documented in the QtDocs, and
"connectedSettingName" is the name of a setting here within UiGuiSettings. If the settingName
didn't exist yet, it will be created.
Returns true, if all found property and setting definitions could be successfully registered.
Returns false, if any of those registrations fails.
*/
bool UiGuiSettings::setSettingToObjectPropertyValueRecursive(QObject *obj) {
return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setSettingToObjectPropertyValue);
}
/*!
\brief Iterates over all \a objs child QObjects and checks whether they have the custom properties
"connectedPropertyName" and "connectedSettingName" set. If both are set, it invokes the \a callBackFunc
with both.
*/
bool UiGuiSettings::checkCustomPropertiesAndCallFunction(QObject *obj, bool (UiGuiSettings::*callBackFunc)(QObject *obj, const QString &propertyName, const QString &settingName)) {
bool success = true;
// Find all widgets that have PropertyName and SettingName defined in their style sheet.
QList<QObject *> allObjects = obj->findChildren<QObject *>();
foreach (QObject *object, allObjects) {
QString propertyName = object->property("connectedPropertyName").toString();
QString settingName = object->property("connectedSettingName").toString();
// If property and setting name were found, register that widget with the settings.
if ( !propertyName.isEmpty() && !settingName.isEmpty() ) {
success &= (this->*callBackFunc)( object, propertyName, settingName );
}
}
return success;
}
/*!
\brief The with a certain property registered \a obj gets unregistered.
*/
void UiGuiSettings::unregisterObjectProperty(QObject *obj) {
if ( _registeredObjectProperties.contains(obj) ) {
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = _registeredObjectProperties[obj].first();
QString settingName = _registeredObjectProperties[obj].last();
bool connectSuccess = false;
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
// Disconnect to the property's value changed signal.
if ( mProp.hasNotifySignal() ) {
QMetaMethod signal = mProp.notifySignal();
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = disconnect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
}
}
_registeredObjectProperties.remove(obj);
}
}
/*!
\brief Registers a slot form the \a obj by its \a slotName to be invoked, if the by \a settingName defined
setting changes.
The registered slot may have no parameters or exactly one. If it accepts one parameter, whenever the setting
\a settingName changes the slot gets tried to be invoked with the settings value as parameter. This only works,
if the slot parameter is of the same type as the setting.
*/
bool UiGuiSettings::registerObjectSlot(QObject *obj, const QString &slotName, const QString &settingName) {
const QMetaObject *metaObject = obj->metaObject();
bool connectSuccess = false;
// Connect to the objects destroyed signal, so that it will be correctly unregistered.
connectSuccess = connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
QString normalizedSlotName = QMetaObject::normalizedSignature( qPrintable(slotName) );
int indexOfMethod = metaObject->indexOfMethod( qPrintable(normalizedSlotName) );
if ( connectSuccess && indexOfMethod > -1 ) {
QMetaMethod mMethod = metaObject->method(indexOfMethod);
//QMetaMethod::Access access = mMethod.access();
//QMetaMethod::MethodType methType = mMethod.methodType();
// Since the method can at maximum be invoked with the setting value as argument,
// only methods taking max one argument are allowed.
if ( mMethod.parameterTypes().size() <= 1 ) {
_registeredObjectSlots.insert(obj, QStringList() << normalizedSlotName << settingName);
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
return false;
}
}
else {
//TODO: Write a debug warning to the log.
disconnect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterObjectSlot(QObject*)));
return false;
}
return true;
}
/*!
\brief If \a obj, \a slotName and \a settingName are given, that certain connection is unregistered.
If only \a obj is given, all to this object registered slot-setting connections are unregistered.
*/
void UiGuiSettings::unregisterObjectSlot(QObject *obj, const QString &slotName, const QString &settingName) {
//const QMetaObject *metaObject = obj->metaObject();
QString normalizedSlotName = QMetaObject::normalizedSignature( qPrintable(slotName) );
QMutableMapIterator<QObject*, QStringList> it(_registeredObjectSlots);
while (it.hasNext()) {
it.next();
if (it.key() == obj && slotName.isEmpty() && settingName.isEmpty())
it.remove();
else if (it.key() == obj && it.value().first() == slotName && it.value().last() == settingName)
it.remove();
}
}
/*!
\brief This private slot gets invoked whenever a registered objects property changes
and distributes the new value to all other to the same settingName registered objects.
*/
void UiGuiSettings::handleObjectPropertyChange() {
QObject *obj = QObject::sender();
QString className = obj->metaObject()->className();
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = _registeredObjectProperties[obj].first();
QString settingName = _registeredObjectProperties[obj].last();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
setValueByName(settingName, mProp.read(obj));
}
}
/*!
\brief Sets the setting defined by \a settingName to \a value.
When setting a changed value, all to this settingName registered objects get
the changed value set too.
If the \a settingName didn't exist yet, it will be created.
*/
void UiGuiSettings::setValueByName(const QString &settingName, const QVariant &value) {
// Do the updating only, if the setting was really changed.
if ( _qsettings->value("UniversalIndentGUI/" + settingName) != value ) {
_qsettings->setValue("UniversalIndentGUI/" + settingName, value);
// Set the new value for all registered object properties for settingName.
for ( QMap<QObject*, QStringList>::ConstIterator it = _registeredObjectProperties.begin(); it != _registeredObjectProperties.end(); ++it ) {
if ( it.value().last() == settingName ) {
QObject *obj = it.key();
const QMetaObject *metaObject = obj->metaObject();
QString propertyName = it.value().first();
int indexOfProp = metaObject->indexOfProperty( qPrintable(propertyName) );
if ( indexOfProp > -1 ) {
QMetaProperty mProp = metaObject->property(indexOfProp);
mProp.write(obj, value);
}
}
}
// Invoke all registered object methods for settingName.
for ( QMap<QObject*, QStringList>::ConstIterator it = _registeredObjectSlots.begin(); it != _registeredObjectSlots.end(); ++it ) {
if ( it.value().last() == settingName ) {
QObject *obj = it.key();
const QMetaObject *metaObject = obj->metaObject();
QString slotName = it.value().first();
int indexOfMethod = metaObject->indexOfMethod( qPrintable(slotName) );
if ( indexOfMethod > -1 ) {
QMetaMethod mMethod = metaObject->method(indexOfMethod);
//QMetaMethod::Access access = mMethod.access();
//QMetaMethod::MethodType methType = mMethod.methodType();
bool success = false;
// Handle registered slots taking one parameter.
if ( mMethod.parameterTypes().size() == 1 ) {
if ( mMethod.parameterTypes().first() == value.typeName() ) {
success = invokeMethodWithValue(obj, mMethod, value);
}
}
// Handle registered slots taking zero parameters.
else {
success = mMethod.invoke( obj, Qt::DirectConnection );
}
if ( success == false ) {
// TODO: Write a warning to the log if no success.
}
}
}
}
}
}
#include <QBitArray>
#include <QBitmap>
#include <QBrush>
#include <QCursor>
#include <QDateTime>
#include <QFont>
#include <QIcon>
#include <QKeySequence>
#include <QLocale>
#include <QPalette>
#include <QPen>
#include <QSizePolicy>
#include <QTextFormat>
#include <QTextLength>
#include <QUrl>
#if QT_VERSION >= 0x040600
#include <QMatrix4x4>
#include <QVector2D>
#endif
bool UiGuiSettings::invokeMethodWithValue( QObject *obj, QMetaMethod mMethod, QVariant value )
{
switch (value.type()) {
case QVariant::BitArray :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBitArray, value.toBitArray()) );
case QVariant::Bitmap :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBitmap, value.value<QBitmap>()) );
case QVariant::Bool :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(bool, value.toBool()) );
case QVariant::Brush :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QBrush, value.value<QBrush>()) );
case QVariant::ByteArray :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QByteArray, value.toByteArray()) );
case QVariant::Char :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QChar, value.toChar()) );
case QVariant::Color :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QColor, value.value<QColor>()) );
case QVariant::Cursor :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QCursor, value.value<QCursor>()) );
case QVariant::Date :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QDate, value.toDate()) );
case QVariant::DateTime :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QDateTime, value.toDateTime()) );
case QVariant::Double :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(double, value.toDouble()) );
case QVariant::Font :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QFont, value.value<QFont>()) );
case QVariant::Hash :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantHash, value.toHash()) );
case QVariant::Icon :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QIcon, value.value<QIcon>()) );
case QVariant::Image :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QImage, value.value<QImage>()) );
case QVariant::Int :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(int, value.toInt()) );
case QVariant::KeySequence :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QKeySequence, value.value<QKeySequence>()) );
case QVariant::Line :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLine, value.toLine()) );
case QVariant::LineF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLineF, value.toLineF()) );
case QVariant::List :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantList, value.toList()) );
case QVariant::Locale :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QLocale, value.toLocale()) );
case QVariant::LongLong :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(qlonglong, value.toLongLong()) );
case QVariant::Map :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVariantMap, value.toMap()) );
case QVariant::Matrix :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QMatrix, value.value<QMatrix>()) );
case QVariant::Transform :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTransform, value.value<QTransform>()) );
#if QT_VERSION >= 0x040600
case QVariant::Matrix4x4 :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QMatrix4x4, value.value<QMatrix4x4>()) );
#endif
case QVariant::Palette :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPalette, value.value<QPalette>()) );
case QVariant::Pen :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPen, value.value<QPen>()) );
case QVariant::Pixmap :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPixmap, value.value<QPixmap>()) );
case QVariant::Point :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPoint, value.toPoint()) );
// case QVariant::PointArray :
// return Q_ARG(QPointArray, value.value<QPointArray>()) );
case QVariant::PointF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPointF, value.toPointF()) );
case QVariant::Polygon :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QPolygon, value.value<QPolygon>()) );
#if QT_VERSION >= 0x040600
case QVariant::Quaternion :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QQuaternion, value.value<QQuaternion>()) );
#endif
case QVariant::Rect :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRect, value.toRect()) );
case QVariant::RectF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRectF, value.toRectF()) );
case QVariant::RegExp :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRegExp, value.toRegExp()) );
case QVariant::Region :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QRegion, value.value<QRegion>()) );
case QVariant::Size :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSize, value.toSize()) );
case QVariant::SizeF :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSizeF, value.toSizeF()) );
case QVariant::SizePolicy :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QSizePolicy, value.value<QSizePolicy>()) );
case QVariant::String :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QString, value.toString()) );
case QVariant::StringList :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QStringList, value.toStringList()) );
case QVariant::TextFormat :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTextFormat, value.value<QTextFormat>()) );
case QVariant::TextLength :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTextLength, value.value<QTextLength>()) );
case QVariant::Time :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QTime, value.toTime()) );
case QVariant::UInt :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(uint, value.toUInt()) );
case QVariant::ULongLong :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(qulonglong, value.toULongLong()) );
case QVariant::Url :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QUrl, value.toUrl()) );
#if QT_VERSION >= 0x040600
case QVariant::Vector2D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector2D, value.value<QVector2D>()) );
case QVariant::Vector3D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector3D, value.value<QVector3D>()) );
case QVariant::Vector4D :
return mMethod.invoke( obj, Qt::DirectConnection, Q_ARG(QVector4D, value.value<QVector4D>()) );
#endif
default:
return false;
}
}

@ -0,0 +1,83 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUISETTINGS_H
#define UIGUISETTINGS_H
#include <QObject>
#include <QStringList>
#include <QMultiMap>
#include <QSharedPointer>
class QSettings;
class UiGuiSettings : public QObject
{
Q_OBJECT
private:
UiGuiSettings();
static QWeakPointer<UiGuiSettings> _instance;
public:
static QSharedPointer<UiGuiSettings> getInstance();
~UiGuiSettings();
bool registerObjectProperty(QObject *obj, const QString &propertyName, const QString &settingName);
bool registerObjectPropertyRecursive(QObject *obj);
bool setObjectPropertyToSettingValue(QObject *obj, const QString &propertyName, const QString &settingName);
bool setObjectPropertyToSettingValueRecursive(QObject *obj);
bool setSettingToObjectPropertyValue(QObject *obj, const QString &propertyName, const QString &settingName);
bool setSettingToObjectPropertyValueRecursive(QObject *obj);
bool registerObjectSlot(QObject *obj, const QString &slotName, const QString &settingName);
QVariant getValueByName(QString settingName);
QStringList getAvailableTranslations();
public slots:
void setValueByName(const QString &settingName, const QVariant &value);
void unregisterObjectProperty(QObject *obj);
void unregisterObjectSlot(QObject *obj, const QString &slotName = "", const QString &settingName = "");
protected:
bool initSettings();
bool invokeMethodWithValue(QObject *obj, QMetaMethod mMethod, QVariant value);
bool checkCustomPropertiesAndCallFunction(QObject *obj, bool (UiGuiSettings::*callBackFunc)(QObject *obj, const QString &propertyName, const QString &settingName));
private slots:
void handleObjectPropertyChange();
private:
void readAvailableTranslations();
//! Stores the mnemonics of the available translations.
QStringList _availableTranslations;
//! The settings file.
QSettings *_qsettings;
//! Maps an QObject to a string list containing the property name and the associated setting name.
QMap<QObject*, QStringList> _registeredObjectProperties;
//! Maps QObjects to a string list containing the method name and the associated setting name.
QMultiMap<QObject*, QStringList> _registeredObjectSlots;
QString _indenterDirctoryStr;
};
#endif // UIGUISETTINGS_H

@ -0,0 +1,169 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiSettingsDialog.h"
#include "ui_UiGuiSettingsDialog.h"
#include "UiGuiSettings.h"
/*!
\class UiGuiSettingsDialog
\ingroup grp_Settings
\brief Displays a dialog window with settings for UniversalIndentGUI
*/
/*!
\brief The constructor calls the setup function for the ui created by uic.
*/
UiGuiSettingsDialog::UiGuiSettingsDialog(QWidget* parent, QSharedPointer<UiGuiSettings> settings) : QDialog(parent) {
// Remember pointer to the UiGuiSettings object.
_settings = settings;
// Init the user interface created by the UIC.
_settingsDialogForm = new Ui::SettingsDialog();
_settingsDialogForm->setupUi(this);
//TODO: This call has to be removed when the properties for the highlighters can be set
// with the settings dialog.
_settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( "(Will be implemented soon)" + _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip() );
// Connect the accepted signal to own function, to write values back to the UiGuiSettings object.
connect(this, SIGNAL(accepted()), this, SLOT(writeWidgetValuesToSettings()) );
// Init the language selection combobox.
initTranslationSelection();
}
/*!
\brief By calling this function the combobox for selecting the application language will
be initialized.
Also the translation itself will be reinitialized.
*/
void UiGuiSettingsDialog::initTranslationSelection() {
// First empty the combo box.
_settingsDialogForm->languageSelectionComboBox->clear();
// Now add an entry into the box for every language short.
foreach (QString languageShort, _settings->getAvailableTranslations() ) {
// Identify the language mnemonic and set the full name.
if ( languageShort == "en" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("English") );
}
else if ( languageShort == "fr" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("French") );
}
else if ( languageShort == "de" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("German") );
}
else if ( languageShort == "zh_TW" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Chinese (Taiwan)") );
}
else if ( languageShort == "ja" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Japanese") );
}
else if ( languageShort == "ru" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Russian") );
}
else if ( languageShort == "uk" ) {
_settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Ukrainian") );
}
else {
_settingsDialogForm->languageSelectionComboBox->addItem( tr("Unknown language mnemonic ") + languageShort );
}
}
}
/*!
\brief Displays the dialog by calling the dialogs exec function.
Before it gets all the values needed from the UiGuiSettings object.
*/
int UiGuiSettingsDialog::showDialog() {
// Init all settings dialog objects with values from settings.
_settings->setObjectPropertyToSettingValueRecursive(this);
// Execute the dialog.
return exec();
}
/*!
\brief This slot is called when the dialog box is closed by pressing the Ok button.
Writes all settings to the UiGuiSettings object.
*/
void UiGuiSettingsDialog::writeWidgetValuesToSettings() {
// Write settings dialog object values to settings.
_settings->setSettingToObjectPropertyValueRecursive(this);
}
/*!
\brief Catches language change events and retranslates all needed widgets.
*/
void UiGuiSettingsDialog::changeEvent(QEvent *event) {
if (event->type() == QEvent::LanguageChange) {
_settingsDialogForm->retranslateUi(this);
// If this is not explicit set here, Qt < 4.3.0 does not translate the buttons.
_settingsDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::NoButton|QDialogButtonBox::Ok);
//TODO: This has to be removed when the properties for the highlighters can be set.
_settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( "(Will be implemented soon)" + _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip() );
QStringList languageShortList = _settings->getAvailableTranslations();
// Now retranslate every entry in the language selection box.
for (int i = 0; i < languageShortList.size(); i++ ) {
QString languageShort = languageShortList.at(i);
// Identify the language mnemonic and set the full name.
if ( languageShort == "en" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("English") );
}
else if ( languageShort == "fr" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("French") );
}
else if ( languageShort == "de" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("German") );
}
else if ( languageShort == "zh_TW" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Chinese (Taiwan)") );
}
else if ( languageShort == "ja" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Japanese") );
}
else if ( languageShort == "ru" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Russian") );
}
else if ( languageShort == "uk" ) {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Ukrainian") );
}
else {
_settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Unknown language mnemonic ") + languageShort );
}
}
}
else {
QWidget::changeEvent(event);
}
}

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUISETTINGSDIALOG_H
#define UIGUISETTINGSDIALOG_H
#include <QDialog>
#include "UiGuiSettings.h"
namespace Ui {
class SettingsDialog;
}
class UiGuiSettingsDialog : public QDialog
{
Q_OBJECT
public:
UiGuiSettingsDialog(QWidget* parent, QSharedPointer<UiGuiSettings> settings);
public slots:
int showDialog();
private slots:
void writeWidgetValuesToSettings();
private:
Ui::SettingsDialog *_settingsDialogForm;
void changeEvent(QEvent *event);
void initTranslationSelection();
QSharedPointer<UiGuiSettings> _settings;
};
#endif // UIGUISETTINGSDIALOG_H

@ -0,0 +1,625 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/preferences-system.png</normaloff>:/mainWindow/preferences-system.png</iconset>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/settingsDialog/applications-system.png</normaloff>:/settingsDialog/applications-system.png</iconset>
</attribute>
<attribute name="title">
<string>Common</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
<string>Displays all available translations for UniversalIndentGui and lets you choose one.</string>
</property>
<property name="text">
<string>Application language</string>
</property>
<property name="buddy">
<cstring>languageSelectionComboBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="languageSelectionComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Displays all available translations for UniversalIndentGui and lets you choose one.</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">language</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">currentIndex</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="loadLastOpenedFileOnStartupComboBox">
<property name="toolTip">
<string>If selected opens the source code file on startup that was opened last time.</string>
</property>
<property name="text">
<string>Automatically open last file on startup</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">loadLastSourceCodeFileOnStartup</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableIndenterParameterTooltipsCheckBox">
<property name="toolTip">
<string>If checked, tool tips will show up if the mouse cursor remains over an indenter parameter for a while.</string>
</property>
<property name="text">
<string>Enable Parameter Tooltips</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">indenterParameterTooltipsEnabled</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="labelRecentlyOpenedListSize">
<property name="toolTip">
<string>Sets how many files should be remembered in the list of recently opened files.</string>
</property>
<property name="text">
<string>Number of files in recently opened list</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="recentlyOpenedListSizeSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Sets how many files should be remembered in the list of recently opened files.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="value">
<number>1</number>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">recentlyOpenedListSize</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">value</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/settingsDialog/accessories-text-editor.png</normaloff>:/settingsDialog/accessories-text-editor.png</iconset>
</attribute>
<attribute name="title">
<string>Editor</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="whiteSpaceIsVisibleCheckBox">
<property name="toolTip">
<string>Enables or disables displaying of white space characters in the editor.</string>
</property>
<property name="text">
<string>Display white space character (tabs, spaces, etc.)</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">whiteSpaceIsVisible</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="labelTabWidth">
<property name="toolTip">
<string>Sets width in single spaces used for tabs</string>
</property>
<property name="statusTip">
<string>Defines how many spaces should be displayed in the editor for one tab.</string>
</property>
<property name="text">
<string>Displayed width of tabs</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="tabWidthSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Defines how many spaces should be displayed in the editor for one tab character.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>1</number>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">tabWidth</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">value</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-software-update.png</normaloff>:/mainWindow/system-software-update.png</iconset>
</attribute>
<attribute name="title">
<string>Network</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkForUpdateCheckBox">
<property name="toolTip">
<string>Checks whether a new version of UniversalIndentGUI exists on program start, but only once a day.</string>
</property>
<property name="text">
<string>Check online for update on program start</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">CheckForUpdate</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="enableProxyCheckBox">
<property name="toolTip">
<string>If checked, the made proxy settings will be applied for all network connections. Type of the used proxy is SOCKS5.</string>
</property>
<property name="text">
<string>Enable proxy</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyEnabled</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Host name:</string>
</property>
<property name="buddy">
<cstring>proxyHostNameLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="proxyHostNameLineEdit">
<property name="toolTip">
<string>Host name of the to be used proxy. E.g.: proxy.example.com</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyHostName</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Port:</string>
</property>
<property name="buddy">
<cstring>proxyPortSpinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="proxyPortSpinBox">
<property name="toolTip">
<string>Port number to connect to the before named proxy.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyPort</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>User name:</string>
</property>
<property name="buddy">
<cstring>proxyUserNameLineEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="proxyUserNameLineEdit">
<property name="toolTip">
<string>If the proxy needs authentification, enter the login name here.</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyUserName</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Password:</string>
</property>
<property name="buddy">
<cstring>proxyPasswordLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="proxyPasswordLineEdit">
<property name="toolTip">
<string>If the proxy needs authentification, enter the password here.</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyPassword</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/settingsDialog/syntax-highlight.png</normaloff>:/settingsDialog/syntax-highlight.png</iconset>
</attribute>
<attribute name="title">
<string>Syntax Highlighting</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="enableSyntaxHighlightningCheckBox">
<property name="toolTip">
<string>By enabling special key words of the source code are highlighted.</string>
</property>
<property name="text">
<string>Enable syntax highlighting</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">SyntaxHighlightingEnabled</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxSyntaxHighlighterProperties">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Lets you make settings for all properties of the available syntax highlighters, like font and color.</string>
</property>
<property name="title">
<string>Highlighter settings</string>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QListWidget" name="listWidget">
<property name="currentRow">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget_2">
<property name="currentRow">
<number>-1</number>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="toolTip">
<string>Set the font for the current selected highlighter property.</string>
</property>
<property name="text">
<string>Set Font</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="toolTip">
<string>Set the color for the current selected highlighter property.</string>
</property>
<property name="text">
<string>Set Color</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>250</x>
<y>316</y>
</hint>
<hint type="destinationlabel">
<x>153</x>
<y>236</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>327</x>
<y>316</y>
</hint>
<hint type="destinationlabel">
<x>282</x>
<y>236</y>
</hint>
</hints>
</connection>
<connection>
<sender>enableProxyCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>widget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>73</x>
<y>68</y>
</hint>
<hint type="destinationlabel">
<x>76</x>
<y>95</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,227 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiSystemInfo.h"
#include <QString>
#include <QSysInfo>
#include <QProcess>
#include <QFile>
UiGuiSystemInfo::UiGuiSystemInfo() {
}
/*!
\brief Returns the operating system UiGUI is currently running on as one string.
The String contains name and version of the os. E.g. Linux Ubuntu 9.04.
*/
QString UiGuiSystemInfo::getOperatingSystem() {
QString operatingSystemString = "";
#if defined(Q_WS_WIN)
switch ( QSysInfo::WindowsVersion ) {
case QSysInfo::WV_32s :
operatingSystemString = "Windows 3.1 with Win 32s";
break;
case QSysInfo::WV_95 :
operatingSystemString = "Windows 95";
break;
case QSysInfo::WV_98 :
operatingSystemString = "Windows 98";
break;
case QSysInfo::WV_Me :
operatingSystemString = "Windows Me";
break;
case QSysInfo::WV_NT :
operatingSystemString = "Windows NT (operating system version 4.0)";
break;
case QSysInfo::WV_2000 :
operatingSystemString = "Windows 2000 (operating system version 5.0)";
break;
case QSysInfo::WV_XP :
operatingSystemString = "Windows XP (operating system version 5.1)";
break;
case QSysInfo::WV_2003 :
operatingSystemString = "Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)";
break;
case QSysInfo::WV_VISTA :
operatingSystemString = "Windows Vista, Windows Server 2008 (operating system version 6.0)";
break;
case QSysInfo::WV_WINDOWS7 :
operatingSystemString = "Windows 7 (operating system version 6.1)";
break;
case QSysInfo::WV_CE :
operatingSystemString = "Windows CE";
break;
case QSysInfo::WV_CENET :
operatingSystemString = "Windows CE .NET";
break;
case QSysInfo::WV_CE_5 :
operatingSystemString = "Windows CE 5.x";
break;
case QSysInfo::WV_CE_6 :
operatingSystemString = "Windows CE 6.x";
break;
default :
operatingSystemString = "Unknown Windows operating system.";
break;
}
#elif defined(Q_WS_MAC)
switch ( QSysInfo::MacintoshVersion ) {
case QSysInfo::MV_9 :
operatingSystemString = "Mac OS 9 (unsupported)";
break;
case QSysInfo::MV_10_0 :
operatingSystemString = "Mac OS X 10.0 Cheetah (unsupported)";
break;
case QSysInfo::MV_10_1 :
operatingSystemString = "Mac OS X 10.1 Puma (unsupported)";
break;
case QSysInfo::MV_10_2 :
operatingSystemString = "Mac OS X 10.2 Jaguar (unsupported)";
break;
case QSysInfo::MV_10_3 :
operatingSystemString = "Mac OS X 10.3 Panther";
break;
case QSysInfo::MV_10_4 :
operatingSystemString = "Mac OS X 10.4 Tiger";
break;
case QSysInfo::MV_10_5 :
operatingSystemString = "Mac OS X 10.5 Leopard";
break;
case QSysInfo::MV_10_6 :
operatingSystemString = "Mac OS X 10.6 Snow Leopard";
break;
case QSysInfo::MV_Unknown :
operatingSystemString = "An unknown and currently unsupported platform";
break;
default :
operatingSystemString = "Unknown Mac operating system.";
break;
}
#else
//TODO: Detect Unix, Linux etc. distro as described on http://www.novell.com/coolsolutions/feature/11251.html
operatingSystemString = "Linux";
QProcess process;
process.start("uname -s");
bool result = process.waitForFinished(1000);
QString os = process.readAllStandardOutput().trimmed();
process.start("uname -r");
result = process.waitForFinished(1000);
QString rev = process.readAllStandardOutput().trimmed();
process.start("uname -m");
result = process.waitForFinished(1000);
QString mach = process.readAllStandardOutput().trimmed();
if ( os == "SunOS" ) {
os = "Solaris";
process.start("uname -p");
result = process.waitForFinished(1000);
QString arch = process.readAllStandardOutput().trimmed();
process.start("uname -v");
result = process.waitForFinished(1000);
QString timestamp = process.readAllStandardOutput().trimmed();
operatingSystemString = os + " " + rev + " (" + arch + " " + timestamp + ")";
}
else if ( os == "AIX" ) {
process.start("oslevel -r");
result = process.waitForFinished(1000);
QString oslevel = process.readAllStandardOutput().trimmed();
operatingSystemString = os + "oslevel " + oslevel;
}
else if ( os == "Linux" ) {
QString dist;
QString pseudoname;
QString kernel = rev;
if ( QFile::exists("/etc/redhat-release") ) {
dist = "RedHat";
process.start("sh -c \"cat /etc/redhat-release | sed s/.*\\(// | sed s/\\)//\"");
result = process.waitForFinished(1000);
pseudoname = process.readAllStandardOutput().trimmed();
process.start("sh -c \"cat /etc/redhat-release | sed s/.*release\\ // | sed s/\\ .*//\"");
result = process.waitForFinished(1000);
rev = process.readAllStandardOutput().trimmed();
}
else if ( QFile::exists("/etc/SUSE-release") ) {
process.start("sh -c \"cat /etc/SUSE-release | tr '\\n' ' '| sed s/VERSION.*//\"");
result = process.waitForFinished(1000);
dist = process.readAllStandardOutput().trimmed();
process.start("sh -c \"cat /etc/SUSE-release | tr '\\n' ' ' | sed s/.*=\\ //\"");
result = process.waitForFinished(1000);
rev = process.readAllStandardOutput().trimmed();
}
else if ( QFile::exists("/etc/mandrake-release") ) {
dist = "Mandrake";
process.start("sh -c \"cat /etc/mandrake-release | sed s/.*\\(// | sed s/\\)//\"");
result = process.waitForFinished(1000);
pseudoname = process.readAllStandardOutput().trimmed();
process.start("sh -c \"cat /etc/mandrake-release | sed s/.*release\\ // | sed s/\\ .*//\"");
result = process.waitForFinished(1000);
rev = process.readAllStandardOutput().trimmed();
}
else if ( QFile::exists("/etc/lsb-release") ) {
dist = "Ubuntu";
QString processCall = "sh -c \"cat /etc/lsb-release | tr '\\n' ' ' | sed s/.*DISTRIB_RELEASE=// | sed s/\\ .*//\"";
process.start( processCall );
result = process.waitForFinished(1000);
rev = process.readAllStandardOutput().trimmed();
QString errorStr = process.readAllStandardError();
process.start("sh -c \"cat /etc/lsb-release | tr '\\n' ' ' | sed s/.*DISTRIB_CODENAME=// | sed s/\\ .*//\"");
result = process.waitForFinished(1000);
pseudoname = process.readAllStandardOutput().trimmed();
}
else if ( QFile::exists("/etc/debian_version") ) {
dist = "Debian";
process.start("cat /etc/debian_version");
result = process.waitForFinished(1000);
dist += process.readAllStandardOutput().trimmed();
rev = "";
}
if ( QFile::exists("/etc/UnitedLinux-release") ) {
process.start("sh -c \"cat /etc/UnitedLinux-release | tr '\\n' ' ' | sed s/VERSION.*//\"");
result = process.waitForFinished(1000);
dist += process.readAllStandardOutput().trimmed();
}
operatingSystemString = os + " " + dist + " " + rev + " (" + pseudoname + " " + kernel + " " + mach + ")";
}
#endif
return operatingSystemString;
}

@ -0,0 +1,35 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUISYSTEMINFO_H
#define UIGUISYSTEMINFO_H
class QString;
class UiGuiSystemInfo
{
public:
static QString getOperatingSystem();
private:
UiGuiSystemInfo();
};
#endif // UIGUISYSTEMINFO_H

@ -0,0 +1,61 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiVersion.h"
#include <QString>
#include <QStringList>
#include <QDate>
namespace UiGuiVersion {
/*!
\brief Returns the build date as a localized string, e.g. "9. Februar 2009". If
there was some kind of error, the returned string is empty.
*/
QString getBuildDate() {
QStringList monthNames;
QString buildDateString = "";
monthNames << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dez";
QStringList buildDateStringList = QString(__DATE__).simplified().split(' '); // __DATE__ returns eg "Feb 4 2009"
if ( buildDateStringList.count() == 3 ) {
QDate buildDate(buildDateStringList.last().toInt(), monthNames.indexOf( buildDateStringList.first() )+1, buildDateStringList.at(1).toInt());
buildDateString = buildDate.toString("d. MMMM yyyy");
}
return buildDateString;
}
/*!
\brief Returns the revision number, that the current build is based on, as string. If
there was some kind of error, the returned string is empty.
*/
QString getBuildRevision() {
QString buildRevision = "";
QStringList buildRevisionStringList = QString(PROGRAM_REVISION).simplified().split(' ');
if ( buildRevisionStringList.count() == 3 ) {
buildRevision = buildRevisionStringList.at(1); // PROGRAM_REVISION is eg "$Revision: 907 $"
}
return buildRevision;
}
} // namespace UiGuiVersion

@ -0,0 +1,39 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIVERSION_H
#define UIGUIVERSION_H
class QString;
// Define the version number here. Update this as the last file before a release.
#define PROGRAM_VERSION 1.2.0
#define PROGRAM_VERSION_STRING "1.2.0"
#define RESOURCE_VERSION 1,2,0,0
#define RESOURCE_VERSION_STRING "1,2,0,0\0"
#define PROGRAM_REVISION "$Revision: 1070 $"
namespace UiGuiVersion {
QString getBuildDate();
QString getBuildRevision();
}
#endif // UIGUIVERSION_H

@ -0,0 +1,549 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="UniversalIndentGUI"
ProjectGUID="{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}"
RootNamespace="UniversalIndentGUI"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
<ToolFile
RelativePath="..\VS8QtRules.rules"
/>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)$(ConfigurationName)\tmp"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="MOC"
/>
<Tool
Name="QRC"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="UIC"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;QT_LARGEFILE_SUPPORT&quot; /D &quot;QT_DLL&quot; /D &quot;QT_GUI_LIB&quot; /D &quot;QT_CORE_LIB&quot; /D &quot;QT_THREAD_SUPPORT&quot;"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(OutDir)\tmp\uic\&quot;;&quot;$(QTDIR)\include\QtNetwork&quot;;&quot;$(QTDIR)\include\QtScript&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;QT_NO_CAST_TO_ASCII"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="false"
UsePrecompiledHeader="0"
ObjectFile="$(IntDir)\obj\"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="qtmaind.lib QtGuid4.lib QtCored4.lib QtNetworkd4.lib QtScriptd4.lib qscintilla2.lib"
LinkIncremental="2"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames="LIBCRMTD.lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)$(ConfigurationName)\tmp"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="MOC"
/>
<Tool
Name="QRC"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="UIC"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(OutDir)\tmp\uic\&quot;;&quot;$(QTDIR)\include\QtScript&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="false"
UsePrecompiledHeader="0"
ObjectFile="$(IntDir)\obj\"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="qtmain.lib QtGui4.lib QtCore4.lib QtNetwork4.lib QtScript4.lib qscintilla2.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
VerboseOutput="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AboutDialog.cpp"
>
</File>
<File
RelativePath=".\AboutDialogGraphicsView.cpp"
>
</File>
<File
RelativePath=".\IndentHandler.cpp"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\MainWindow.cpp"
>
</File>
<File
RelativePath=".\SettingsPaths.cpp"
>
</File>
<File
RelativePath=".\TemplateBatchScript.cpp"
>
</File>
<File
RelativePath=".\UiGuiErrorMessage.cpp"
>
</File>
<File
RelativePath=".\UiGuiHighlighter.cpp"
>
</File>
<File
RelativePath=".\UiGuiIndentServer.cpp"
>
</File>
<File
RelativePath=".\UiGuiIniFileParser.cpp"
>
</File>
<File
RelativePath=".\UiGuiLogger.cpp"
>
</File>
<File
RelativePath=".\UiGuiSettings.cpp"
>
</File>
<File
RelativePath=".\UiGuiSettingsDialog.cpp"
>
</File>
<File
RelativePath=".\UiGuiSystemInfo.cpp"
>
</File>
<File
RelativePath=".\UiGuiVersion.cpp"
>
</File>
<File
RelativePath=".\UpdateCheckDialog.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\AboutDialog.h"
>
</File>
<File
RelativePath=".\AboutDialogGraphicsView.h"
>
</File>
<File
RelativePath=".\IndentHandler.h"
>
</File>
<File
RelativePath=".\MainWindow.h"
>
</File>
<File
RelativePath=".\SettingsPaths.h"
>
</File>
<File
RelativePath=".\TemplateBatchScript.h"
>
</File>
<File
RelativePath=".\UiGuiErrorMessage.h"
>
</File>
<File
RelativePath=".\UiGuiHighlighter.h"
>
</File>
<File
RelativePath=".\UiGuiIndentServer.h"
>
</File>
<File
RelativePath=".\UiGuiIniFileParser.h"
>
</File>
<File
RelativePath=".\UiGuiLogger.h"
>
</File>
<File
RelativePath=".\UiGuiSettings.h"
>
</File>
<File
RelativePath=".\UiGuiSettingsDialog.h"
>
</File>
<File
RelativePath=".\UiGuiSystemInfo.h"
>
</File>
<File
RelativePath=".\UiGuiVersion.h"
>
</File>
<File
RelativePath=".\UpdateCheckDialog.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\resources\Icons.qrc"
>
</File>
<File
RelativePath="..\resources\programicon.rc"
>
</File>
</Filter>
<Filter
Name="Forms (UI)"
>
<File
RelativePath=".\AboutDialog.ui"
>
</File>
<File
RelativePath=".\MainWindow.ui"
>
</File>
<File
RelativePath=".\ToolBarWidget.ui"
>
</File>
<File
RelativePath=".\UiGuiLoggerDialog.ui"
>
</File>
<File
RelativePath=".\UiGuiSettingsDialog.ui"
>
</File>
<File
RelativePath=".\UpdateCheckDialog.ui"
>
</File>
</Filter>
<Filter
Name="Generated"
>
<File
RelativePath="$(OutDir)\tmp\moc\moc_AboutDialog.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_AboutDialogGraphicsView.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_IndentHandler.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_MainWindow.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiErrorMessage.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiHighlighter.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiIndentServer.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiLogger.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiSettings.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UiGuiSettingsDialog.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\moc\moc_UpdateCheckDialog.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\qrc\qrc_Icons.cpp"
>
</File>
<File
RelativePath="$(OutDir)\tmp\uic\ui_AboutDialog.h"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(OutDir)\tmp\uic\ui_MainWindow.h"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(OutDir)\tmp\uic\ui_ToolBarWidget.h"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(OutDir)\tmp\uic\ui_UiGuiSettingsDialog.h"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(OutDir)\tmp\uic\ui_UpdateCheckDialog.h"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MOC"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,322 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UpdateCheckDialog.h"
#include "ui_UpdateCheckDialog.h"
#include "UiGuiSettings.h"
#include "UiGuiVersion.h"
#include <QMessageBox>
#include <QDesktopServices>
#include <QNetworkAccessManager>
#include <QTimer>
#include <QDate>
#include <QUrl>
#include <QRegExpValidator>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkProxy>
/*!
\class UpdateCheckDialog
\ingroup grp_MainWindow
\brief UpdateCheckDialog is a dialog widget that contains functions
for online checking for a new version of UniversalIndentGUI.
*/
/*!
\brief Initializes member variables and stores the version of UiGui and a pointer to the _settings object.
*/
UpdateCheckDialog::UpdateCheckDialog(QSharedPointer<UiGuiSettings> settings, QWidget *parent) : QDialog(parent),
_manualUpdateRequested(false),
_currentNetworkReply(NULL),
_roleOfClickedButton(QDialogButtonBox::InvalidRole)
{
_updateCheckDialogForm = new Ui::UpdateCheckDialog();
_updateCheckDialogForm->setupUi(this);
// Create object for _networkAccessManager request and connect it with the request return handler.
_networkAccessManager = new QNetworkAccessManager(this);
connect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) );
// Create a timer object used for the progress bar.
_updateCheckProgressTimer = new QTimer(this);
_updateCheckProgressTimer->setInterval(5);
connect( _updateCheckProgressTimer, SIGNAL(timeout()), this, SLOT(updateUpdateCheckProgressBar()) );
_updateCheckProgressCounter = 0;
// Connect the dialogs buttonbox with a button click handler.
connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) );
settings->registerObjectSlot(this, "initProxySettings()", "ProxyEnabled");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyHostName");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyPort");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyUserName");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyPassword");
_settings = settings;
initProxySettings();
// This dialog is always modal.
setModal(true);
}
/*!
\brief On destroy cancels any currently running network request.
*/
UpdateCheckDialog::~UpdateCheckDialog() {
disconnect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) );
if (_currentNetworkReply != NULL)
_currentNetworkReply->abort();
}
/*!
\brief This slot should be called, if an update check is manually invoked.
In difference to the automatic update check, during manual update check request
a modal progress indicator dialog will be shown.
*/
void UpdateCheckDialog::checkForUpdateAndShowDialog() {
_manualUpdateRequested = true;
getPadXMLFile();
showCheckingForUpdateDialog();
}
/*!
\brief This slot should be called, if an update check is automatically invoked.
An automatic invoked update check should run in background, so the user
gets not interrupted by a dialog box.
*/
void UpdateCheckDialog::checkForUpdate() {
_manualUpdateRequested = false;
getPadXMLFile();
}
/*!
\brief This function tries to download the UniversalIndentGui pad file from the SourceForge server.
*/
void UpdateCheckDialog::getPadXMLFile() {
//_networkAccessManager->setHost("universalindent.sourceforge.net");
//_networkAccessManager->get("/universalindentgui_pad.xml");
_currentNetworkReply = _networkAccessManager->get(QNetworkRequest(QUrl("http://universalindent.sourceforge.net/universalindentgui_pad.xml")));
}
/*!
\brief This slot is called after the update check has returned, either by successfully
retrieving the pad file, or on any kind of network error.
Shows a message if check was successful or not. Offers the user to go to the
download page if a newer version exists. In case of an error during update
check, a message box with the error will be displayed.
*/
void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile(QNetworkReply *networkReply) {
Q_ASSERT(_currentNetworkReply == networkReply);
// Stop the progress bar timer.
_updateCheckProgressTimer->stop();
if ( networkReply->error() == QNetworkReply::NoError ) {
// Try to find the version string.
QString returnedString = networkReply->readAll();
int leftPosition = returnedString.indexOf("<Program_Version>");
int rightPosition = returnedString.indexOf("</Program_Version>");
// If the version string could be found in the returned string, show an update dialog and set last update check date.
if ( leftPosition != -1 && rightPosition != -1 ) {
// Get the pure version string from returned string.
returnedString = returnedString.mid( leftPosition+17, rightPosition-(leftPosition+17) );
// Create integer values from the version strings.
int versionOnServerInt = convertVersionStringToNumber( returnedString );
int currentVersionInt = convertVersionStringToNumber( PROGRAM_VERSION_STRING );
// Only show update dialog, if the current version number is lower than the one received from the server.
if ( versionOnServerInt > currentVersionInt && currentVersionInt >= 0 && versionOnServerInt >= 0 ) {
// Show message box whether to download the new version.
showNewVersionAvailableDialog(returnedString);
// If yes clicked, open the download url in the default browser.
if ( _roleOfClickedButton == QDialogButtonBox::YesRole ) {
QDesktopServices::openUrl( QUrl("_networkAccessManager://sourceforge.net/project/showfiles.php?group_id=167482") );
}
}
else if ( _manualUpdateRequested ) {
showNoNewVersionAvailableDialog();
}
// Set last update check date.
_settings->setValueByName("LastUpdateCheck", QDate::currentDate());
}
// In the returned string, the version string could not be found.
else {
QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! The retrieved file did not contain expected content.") );
}
}
// If there was some error while trying to retrieve the update info from server and not cancel was pressed.
else if ( _roleOfClickedButton != QDialogButtonBox::RejectRole ) {
QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! Error was : %1").arg(networkReply->errorString()) );
hide();
}
_manualUpdateRequested = false;
networkReply->deleteLater();
_currentNetworkReply = NULL;
}
/*!
\brief Displays the progress bar during update check.
For displaying activity during update check, a timer is started to
updated the progress bar. The user can press a cancel button to
stop the update check.
*/
void UpdateCheckDialog::showCheckingForUpdateDialog() {
// Reset the progress bar.
_updateCheckProgressCounter = 0;
_updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter);
_updateCheckDialogForm->progressBar->setInvertedAppearance( false );
_updateCheckProgressTimer->start();
_updateCheckDialogForm->progressBar->show();
setWindowTitle( tr("Checking for update...") );
_updateCheckDialogForm->label->setText( tr("Checking whether a newer version is available") );
_updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
show();
}
/*!
\brief Displays the dialog with info about the new available version.
*/
void UpdateCheckDialog::showNewVersionAvailableDialog(QString newVersion) {
_updateCheckDialogForm->progressBar->hide();
setWindowTitle( tr("Update available") );
_updateCheckDialogForm->label->setText( tr("A newer version of UniversalIndentGUI is available.\nYour version is %1. New version is %2.\nDo you want to go to the download website?").arg(PROGRAM_VERSION_STRING).arg(newVersion) );
_updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::No|QDialogButtonBox::NoButton|QDialogButtonBox::Yes);
exec();
}
/*!
\brief Displays the dialog, that no new version is available.
*/
void UpdateCheckDialog::showNoNewVersionAvailableDialog() {
_updateCheckDialogForm->progressBar->hide();
setWindowTitle( tr("No new update available") );
_updateCheckDialogForm->label->setText( tr("You already have the latest version of UniversalIndentGUI.") );
_updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Ok);
exec();
}
/*!
\brief This slot is called, when a button in the dialog is clicked.
If the clicked button was the cancel button, the user wants to cancel
the update check. So the _networkAccessManager request is aborted and the timer for the
progress bar animation is stopped.
In any case if a button is clicked, the dialog box will be closed.
*/
void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked(QAbstractButton *clickedButton) {
_roleOfClickedButton = _updateCheckDialogForm->buttonBox->buttonRole(clickedButton);
if ( _roleOfClickedButton == QDialogButtonBox::RejectRole ) {
// Abort the _networkAccessManager request.
_currentNetworkReply->abort();
// Stop the progress bar timer.
_updateCheckProgressTimer->stop();
}
accept();
}
/*!
\brief This slot is responsible for the animation of the update check progress bar.
*/
void UpdateCheckDialog::updateUpdateCheckProgressBar() {
// Depending on the progress bar direction, decrease or increase the progressbar value.
if ( _updateCheckDialogForm->progressBar->invertedAppearance() ) {
_updateCheckProgressCounter--;
}
else {
_updateCheckProgressCounter++;
}
// If the progress bar reaches 0 or 100 as value, swap the animation direction.
if ( _updateCheckProgressCounter == 0 || _updateCheckProgressCounter == 100 ) {
_updateCheckDialogForm->progressBar->setInvertedAppearance( !_updateCheckDialogForm->progressBar->invertedAppearance() );
}
// Update the progress bar value.
_updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter);
}
/*!
\brief Converts the as string given version \a versionString to an integer number.
The \a versionString must have the format x.x.x where each x represents a number
of a maximum of 999. If the input format is wrong, -1 will be returned.The first
number will be multiplied by 1000000 the second by 1000 and then all three will
be summarized.
Thus for example 12.5.170 will result in 12005170.
*/
int UpdateCheckDialog::convertVersionStringToNumber(QString versionString) {
int versionInteger = 0;
int pos = 0;
QRegExp regEx("\\d{1,3}.\\d{1,3}.\\d{1,3}");
QRegExpValidator validator(regEx, NULL);
if ( validator.validate(versionString, pos) == QValidator::Acceptable ) {
QStringList versionNumberStringList = versionString.split(".");
versionInteger = versionNumberStringList.at(0).toInt() * 1000000;
versionInteger += versionNumberStringList.at(1).toInt() * 1000;
versionInteger += versionNumberStringList.at(2).toInt();
}
else {
versionInteger = -1;
}
return versionInteger;
}
void UpdateCheckDialog::initProxySettings()
{
if ( _settings->getValueByName("ProxyEnabled") == true ) {
QString proxyHostName = _settings->getValueByName("ProxyHostName").toString();
int proxyPort = _settings->getValueByName("ProxyPort").toInt();
QString proxyUserName = _settings->getValueByName("ProxyUserName").toString();
QString proxyPassword = _settings->getValueByName("ProxyPassword").toString();
_networkAccessManager->setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyHostName, proxyPort, proxyUserName, proxyPassword));
}
else {
_networkAccessManager->setProxy(QNetworkProxy());
}
}

@ -0,0 +1,73 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UPDATECHECKDIALOG_H
#define UPDATECHECKDIALOG_H
#include <QDialog>
#include <QDialogButtonBox>
class UiGuiSettings;
namespace Ui {
class UpdateCheckDialog;
}
class QTimer;
class QDesktopServices;
class QNetworkAccessManager;
class QNetworkReply;
class UpdateCheckDialog : public QDialog
{
Q_OBJECT
public:
UpdateCheckDialog(QSharedPointer<UiGuiSettings> settings, QWidget *parent = NULL);
~UpdateCheckDialog();
public slots:
void checkForUpdateAndShowDialog();
void checkForUpdate();
private slots:
void checkResultsOfFetchedPadXMLFile(QNetworkReply *networkReply);
void handleUpdateCheckDialogButtonClicked(QAbstractButton *clickedButton);
void updateUpdateCheckProgressBar();
void initProxySettings();
private:
Ui::UpdateCheckDialog *_updateCheckDialogForm;
void getPadXMLFile();
void showCheckingForUpdateDialog();
void showNewVersionAvailableDialog(QString newVersion);
void showNoNewVersionAvailableDialog();
int convertVersionStringToNumber(QString versionString);
QSharedPointer<UiGuiSettings> _settings;
bool _manualUpdateRequested;
QNetworkAccessManager *_networkAccessManager;
QNetworkReply *_currentNetworkReply;
QDialogButtonBox::ButtonRole _roleOfClickedButton;
QTimer *_updateCheckProgressTimer;
int _updateCheckProgressCounter;
};
#endif // UPDATECHECKDIALOG_H

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UpdateCheckDialog</class>
<widget class="QDialog" name="UpdateCheckDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>323</width>
<height>108</height>
</rect>
</property>
<property name="windowTitle">
<string>Checking for update...</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Checking whether a newer version is available</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,7 @@
END
TSLoggerDialog.ui
K 25
svn:wc:ra_dav:version-url
V 76
/svnroot/universalindent/!svn/ver/1031/trunk/src/debugging/TSLoggerDialog.ui
END

@ -0,0 +1,130 @@
10
dir
1074
https://universalindent.svn.sourceforge.net/svnroot/universalindent/trunk/src/debugging
https://universalindent.svn.sourceforge.net/svnroot/universalindent
2012-01-01T15:57:45.041181Z
1072
thomas_-_s
c764a436-2d14-0410-8e4b-8664b97a5d8c
TSLogger.cpp
file
2012-01-01T15:53:22.000000Z
bb8f19f90ef34ed27f3746cce9c0d857
2012-01-01T15:57:45.041181Z
1072
thomas_-_s
9302
TSLogger.h
file
2012-01-01T15:53:20.000000Z
4f6c6d98220006c54c8530fed4ef69a2
2012-01-01T15:57:45.041181Z
1072
thomas_-_s
2317
TSLoggerDialog.ui
file
2011-12-26T15:10:20.000000Z
ca2220682b5c3f228a786bbd43fcc9ed
2010-12-21T23:07:50.799886Z
1031
thomas_-_s
3660

@ -0,0 +1,251 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "TSLogger.h"
#include "ui_TSLoggerDialog.h"
#include "SettingsPaths.h"
#include <QDateTime>
#include <QFile>
#include <QFileInfo>
#include <QUrl>
#include <QTextStream>
#include <QDesktopServices>
#include <QMessageBox>
#include <ctime>
using namespace tschweitzer;
using namespace tschweitzer::debugging;
TSLogger* TSLogger::_instance = NULL;
/*!
\class TSLogger
\brief This class handles any kind of data logging, for debugging and whatever purpose.
Beneath being able of displaying a dialog window containing all log messages of the
current session, a log file in the systems temporary directory is used. Its name
is "UiGUI_log.html".
Setting a verbose level allows to only write messages that have the selected minimum
priority to the log.
*/
/*!
\brief Returns the only existing instance of TSLogger. If the instance doesn't exist, it will be created.
*/
TSLogger* TSLogger::getInstance(int verboseLevel) {
if ( _instance == NULL )
_instance = new TSLogger(verboseLevel);
return _instance;
}
/*!
\brief Returns the only existing instance of TSLogger. If the instance doesn't exist, it will be created.
*/
TSLogger* TSLogger::getInstance() {
#ifdef _DEBUG
return TSLogger::getInstance(QtDebugMsg);
#else
return TSLogger::getInstance(QtWarningMsg);
#endif
}
/*!
\brief Initializes the dialog and sets the path to the log file in the systems temporary directory.
Sets the default verbose level to warning level.
*/
TSLogger::TSLogger(int verboseLevel) : QDialog() {
_TSLoggerDialogForm = new Ui::TSLoggerDialog();
_TSLoggerDialogForm->setupUi(this);
#ifdef _DEBUG
_verboseLevel = QtDebugMsg;
#else
_verboseLevel = QtMsgType(verboseLevel);
#endif
_logFileInitState = NOTINITIALZED;
connect( _TSLoggerDialogForm->openLogFileFolderToolButton, SIGNAL(clicked()), this, SLOT(openLogFileFolder()) );
// Make the main application not to wait for the logging window to close.
setAttribute(Qt::WA_QuitOnClose, false);
}
/*!
\brief Logs all incoming messages \a msg to the dialogs text edit and to the log file.
Only messages whos \a type have a higher priority than the set verbose level are logged.
*/
void TSLogger::messageHandler(QtMsgType type, const char *msg) {
if ( _instance == NULL )
_instance = TSLogger::getInstance();
/*
QMessageBox messageBox;
QString messageBoxText = QString::fromUtf8( msg );
messageBox.setText( messageBoxText );
messageBox.setWindowModality( Qt::ApplicationModal );
messageBox.exec();
*/
// Only log messages that have a higher or equal priority than set with the verbose level.
if ( type < _instance->_verboseLevel )
return;
// Init log message with prepended date and time.
QString message = QDateTime::currentDateTime().toString();
// Depending on the QtMsgType prepend a different colored Debug, Warning, Critical or Fatal.
switch (type) {
case QtDebugMsg :
message += " <span style=\"font-weight:bold; color:black;\">Debug:</span> ";
break;
case QtWarningMsg :
message += " <span style=\"font-weight:bold; color:gold;\">Warning:</span> ";
break;
case QtCriticalMsg :
message += "<span style=\"font-weight:bold; color:red;\">Critical:</span> ";
break;
case QtFatalMsg :
message += " <span style=\"font-weight:bold; color:#D60000;\">Fatal:</span> ";
// This one is no Qt message type, but can be used to send info messages to the log
// by calling TSLogger::messageHandler() directly.
case TSLoggerInfoMsg :
message += " <span style=\"font-weight:bold; color:darkgray;\">Info:</span> ";
break;
}
// Append the to UTF-8 back converted message parameter.
message += QString::fromUtf8( msg ) + "<br/>\n";
// Write the message to the log windows text edit.
_instance->_TSLoggerDialogForm->logTextEdit->append( message );
// Write/append the log message to the log file.
_instance->writeToLogFile( message );
// In case of a fatal error abort the application.
if ( type == QtFatalMsg )
abort();
}
/*!
\brief Calling this the verbose level can be set in a range from 0 to 3
which is equal to debug, warning, critical and fatal priority.
*/
void TSLogger::setVerboseLevel(int level) {
if ( level < 0 )
_verboseLevel = QtDebugMsg;
if ( level > 3 )
_verboseLevel = QtFatalMsg;
else
_verboseLevel = QtMsgType(level);
}
/*!
\brief Deletes the existing _instance of TSLogger.
*/
void TSLogger::deleteInstance() {
if ( _instance != NULL ) {
delete _instance;
_instance = NULL;
}
}
/*!
\brief Opens the folder that contains the created log file with the name "UiGUI_log.html".
*/
void TSLogger::openLogFileFolder() {
QDesktopServices::openUrl( QFileInfo( _logFile ).absolutePath() );
}
/*!
\brief Writes the \a message to the used log file.
*/
void TSLogger::writeToLogFile(const QString &message) {
// If the file where all logging messages should go to isn't initilized yet, do that now.
if ( _logFileInitState == NOTINITIALZED ) {
_logFileInitState = INITIALIZING;
// On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this.
// Remove any trailing slashes.
QString tempPath = QFileInfo( SettingsPaths::getTempPath() ).absolutePath();
while ( tempPath.right(1) == "/" ) {
tempPath.chop(1);
}
// To make the temporary log file invulnerable against file symbolic link hacks
// append the current date and time up to milliseconds to its name and a random character.
QString logFileName = "UiGUI_log_" + QDateTime::currentDateTime().toString("yyyyMMdd");
logFileName += "-" + QDateTime::currentDateTime().toString("hhmmsszzz");
// By random decide whether to append a number or an upper or lower case character.
qsrand( time(NULL) );
unsigned char randomChar;
switch ( qrand() % 3 ) {
// Append a number from 0 to 9.
case 0 :
randomChar = qrand() % 10 + '0';
break;
// Append a upper case characer between A and Z.
case 1 :
randomChar = qrand() % 26 + 'A';
break;
// Append a lower case characer between a and z.
default :
randomChar = qrand() % 26 + 'a';
break;
}
logFileName += "_" + QString(randomChar) + ".html";
_logFile.setFileName( tempPath + "/" + logFileName );
// Set the tooltip of the open log file folder button to show the unique name of the log file.
_TSLoggerDialogForm->openLogFileFolderToolButton->setToolTip( _TSLoggerDialogForm->openLogFileFolderToolButton->toolTip() + " (" + logFileName + ")" );
_logFileInitState = INITIALZED;
}
// Add the message to the message queue.
_messageQueue << message;
// If the logging file is initialzed, write all messages contained in the message queue into the file.
if ( _logFileInitState == INITIALZED ) {
// Write/append the log message to the log file.
if ( _logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append) ) {
QTextStream out(&_logFile);
while ( !_messageQueue.isEmpty() ) {
out << _messageQueue.takeFirst() << "\n";
}
_logFile.close();
}
}
}

@ -0,0 +1,63 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef TSLogger_H
#define TSLogger_H
#include <QDialog>
#include <QFile>
namespace Ui {
class TSLoggerDialog;
}
namespace tschweitzer { namespace debugging {
#define TSLoggerInfoMsg QtMsgType(4)
class TSLogger : public QDialog
{
Q_OBJECT
public:
static TSLogger* getInstance(int verboseLevel);
static TSLogger* getInstance();
static void messageHandler(QtMsgType type, const char *msg);
static void deleteInstance();
void setVerboseLevel(int level);
private slots:
void openLogFileFolder();
private:
Ui::TSLoggerDialog *_TSLoggerDialogForm;
enum LogFileInitState { NOTINITIALZED, INITIALIZING, INITIALZED } _logFileInitState;
TSLogger(int verboseLevel);
void writeToLogFile(const QString &message);
static TSLogger* _instance;
QtMsgType _verboseLevel;
QFile _logFile;
QStringList _messageQueue;
};
}} // namespace tschweitzer::debugging
#endif // TSLogger_H

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TSLoggerDialog</class>
<widget class="QDialog" name="TSLoggerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1030</width>
<height>263</height>
</rect>
</property>
<property name="windowTitle">
<string>Log</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-properties.png</normaloff>:/mainWindow/document-properties.png</iconset>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Logged messages</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="logTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="cleanUpToolButton">
<property name="toolTip">
<string>Clear log</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/edit-clear.png</normaloff>:/mainWindow/edit-clear.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="openLogFileFolderToolButton">
<property name="toolTip">
<string>Open folder containing log file.</string>
</property>
<property name="statusTip">
<string>Open folder containing log file.</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections>
<connection>
<sender>TSLoggerDialog</sender>
<signal>finished(int)</signal>
<receiver>TSLoggerDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>2</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>59</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>clicked(QAbstractButton*)</signal>
<receiver>TSLoggerDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>419</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>477</x>
<y>263</y>
</hint>
</hints>
</connection>
<connection>
<sender>cleanUpToolButton</sender>
<signal>clicked()</signal>
<receiver>logTextEdit</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>27</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>231</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,251 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "TSLogger.h"
#include "ui_TSLoggerDialog.h"
#include "SettingsPaths.h"
#include <QDateTime>
#include <QFile>
#include <QFileInfo>
#include <QUrl>
#include <QTextStream>
#include <QDesktopServices>
#include <QMessageBox>
#include <ctime>
using namespace tschweitzer;
using namespace tschweitzer::debugging;
TSLogger* TSLogger::_instance = NULL;
/*!
\class TSLogger
\brief This class handles any kind of data logging, for debugging and whatever purpose.
Beneath being able of displaying a dialog window containing all log messages of the
current session, a log file in the systems temporary directory is used. Its name
is "UiGUI_log.html".
Setting a verbose level allows to only write messages that have the selected minimum
priority to the log.
*/
/*!
\brief Returns the only existing instance of TSLogger. If the instance doesn't exist, it will be created.
*/
TSLogger* TSLogger::getInstance(int verboseLevel) {
if ( _instance == NULL )
_instance = new TSLogger(verboseLevel);
return _instance;
}
/*!
\brief Returns the only existing instance of TSLogger. If the instance doesn't exist, it will be created.
*/
TSLogger* TSLogger::getInstance() {
#ifdef _DEBUG
return TSLogger::getInstance(QtDebugMsg);
#else
return TSLogger::getInstance(QtWarningMsg);
#endif
}
/*!
\brief Initializes the dialog and sets the path to the log file in the systems temporary directory.
Sets the default verbose level to warning level.
*/
TSLogger::TSLogger(int verboseLevel) : QDialog() {
_TSLoggerDialogForm = new Ui::TSLoggerDialog();
_TSLoggerDialogForm->setupUi(this);
#ifdef _DEBUG
_verboseLevel = QtDebugMsg;
#else
_verboseLevel = QtMsgType(verboseLevel);
#endif
_logFileInitState = NOTINITIALZED;
connect( _TSLoggerDialogForm->openLogFileFolderToolButton, SIGNAL(clicked()), this, SLOT(openLogFileFolder()) );
// Make the main application not to wait for the logging window to close.
setAttribute(Qt::WA_QuitOnClose, false);
}
/*!
\brief Logs all incoming messages \a msg to the dialogs text edit and to the log file.
Only messages whos \a type have a higher priority than the set verbose level are logged.
*/
void TSLogger::messageHandler(QtMsgType type, const char *msg) {
if ( _instance == NULL )
_instance = TSLogger::getInstance();
/*
QMessageBox messageBox;
QString messageBoxText = QString::fromUtf8( msg );
messageBox.setText( messageBoxText );
messageBox.setWindowModality( Qt::ApplicationModal );
messageBox.exec();
*/
// Only log messages that have a higher or equal priority than set with the verbose level.
if ( type < _instance->_verboseLevel )
return;
// Init log message with prepended date and time.
QString message = QDateTime::currentDateTime().toString();
// Depending on the QtMsgType prepend a different colored Debug, Warning, Critical or Fatal.
switch (type) {
case QtDebugMsg :
message += " <span style=\"font-weight:bold; color:black;\">Debug:</span> ";
break;
case QtWarningMsg :
message += " <span style=\"font-weight:bold; color:gold;\">Warning:</span> ";
break;
case QtCriticalMsg :
message += "<span style=\"font-weight:bold; color:red;\">Critical:</span> ";
break;
case QtFatalMsg :
message += " <span style=\"font-weight:bold; color:#D60000;\">Fatal:</span> ";
// This one is no Qt message type, but can be used to send info messages to the log
// by calling TSLogger::messageHandler() directly.
case TSLoggerInfoMsg :
message += " <span style=\"font-weight:bold; color:darkgray;\">Info:</span> ";
break;
}
// Append the to UTF-8 back converted message parameter.
message += QString::fromUtf8( msg ) + "<br/>\n";
// Write the message to the log windows text edit.
_instance->_TSLoggerDialogForm->logTextEdit->append( message );
// Write/append the log message to the log file.
_instance->writeToLogFile( message );
// In case of a fatal error abort the application.
if ( type == QtFatalMsg )
abort();
}
/*!
\brief Calling this the verbose level can be set in a range from 0 to 3
which is equal to debug, warning, critical and fatal priority.
*/
void TSLogger::setVerboseLevel(int level) {
if ( level < 0 )
_verboseLevel = QtDebugMsg;
if ( level > 3 )
_verboseLevel = QtFatalMsg;
else
_verboseLevel = QtMsgType(level);
}
/*!
\brief Deletes the existing _instance of TSLogger.
*/
void TSLogger::deleteInstance() {
if ( _instance != NULL ) {
delete _instance;
_instance = NULL;
}
}
/*!
\brief Opens the folder that contains the created log file with the name "UiGUI_log.html".
*/
void TSLogger::openLogFileFolder() {
QDesktopServices::openUrl( QFileInfo( _logFile ).absolutePath() );
}
/*!
\brief Writes the \a message to the used log file.
*/
void TSLogger::writeToLogFile(const QString &message) {
// If the file where all logging messages should go to isn't initilized yet, do that now.
if ( _logFileInitState == NOTINITIALZED ) {
_logFileInitState = INITIALIZING;
// On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this.
// Remove any trailing slashes.
QString tempPath = QFileInfo( SettingsPaths::getTempPath() ).absolutePath();
while ( tempPath.right(1) == "/" ) {
tempPath.chop(1);
}
// To make the temporary log file invulnerable against file symbolic link hacks
// append the current date and time up to milliseconds to its name and a random character.
QString logFileName = "UiGUI_log_" + QDateTime::currentDateTime().toString("yyyyMMdd");
logFileName += "-" + QDateTime::currentDateTime().toString("hhmmsszzz");
// By random decide whether to append a number or an upper or lower case character.
qsrand( time(NULL) );
unsigned char randomChar;
switch ( qrand() % 3 ) {
// Append a number from 0 to 9.
case 0 :
randomChar = qrand() % 10 + '0';
break;
// Append a upper case characer between A and Z.
case 1 :
randomChar = qrand() % 26 + 'A';
break;
// Append a lower case characer between a and z.
default :
randomChar = qrand() % 26 + 'a';
break;
}
logFileName += "_" + QString(randomChar) + ".html";
_logFile.setFileName( tempPath + "/" + logFileName );
// Set the tooltip of the open log file folder button to show the unique name of the log file.
_TSLoggerDialogForm->openLogFileFolderToolButton->setToolTip( _TSLoggerDialogForm->openLogFileFolderToolButton->toolTip() + " (" + logFileName + ")" );
_logFileInitState = INITIALZED;
}
// Add the message to the message queue.
_messageQueue << message;
// If the logging file is initialzed, write all messages contained in the message queue into the file.
if ( _logFileInitState == INITIALZED ) {
// Write/append the log message to the log file.
if ( _logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append) ) {
QTextStream out(&_logFile);
while ( !_messageQueue.isEmpty() ) {
out << _messageQueue.takeFirst() << "\n";
}
_logFile.close();
}
}
}

@ -0,0 +1,63 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef TSLogger_H
#define TSLogger_H
#include <QDialog>
#include <QFile>
namespace Ui {
class TSLoggerDialog;
}
namespace tschweitzer { namespace debugging {
#define TSLoggerInfoMsg QtMsgType(4)
class TSLogger : public QDialog
{
Q_OBJECT
public:
static TSLogger* getInstance(int verboseLevel);
static TSLogger* getInstance();
static void messageHandler(QtMsgType type, const char *msg);
static void deleteInstance();
void setVerboseLevel(int level);
private slots:
void openLogFileFolder();
private:
Ui::TSLoggerDialog *_TSLoggerDialogForm;
enum LogFileInitState { NOTINITIALZED, INITIALIZING, INITIALZED } _logFileInitState;
TSLogger(int verboseLevel);
void writeToLogFile(const QString &message);
static TSLogger* _instance;
QtMsgType _verboseLevel;
QFile _logFile;
QStringList _messageQueue;
};
}} // namespace tschweitzer::debugging
#endif // TSLogger_H

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TSLoggerDialog</class>
<widget class="QDialog" name="TSLoggerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1030</width>
<height>263</height>
</rect>
</property>
<property name="windowTitle">
<string>Log</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-properties.png</normaloff>:/mainWindow/document-properties.png</iconset>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Logged messages</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="logTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="cleanUpToolButton">
<property name="toolTip">
<string>Clear log</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/edit-clear.png</normaloff>:/mainWindow/edit-clear.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="openLogFileFolderToolButton">
<property name="toolTip">
<string>Open folder containing log file.</string>
</property>
<property name="statusTip">
<string>Open folder containing log file.</string>
</property>
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../resources/Icons.qrc"/>
</resources>
<connections>
<connection>
<sender>TSLoggerDialog</sender>
<signal>finished(int)</signal>
<receiver>TSLoggerDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>2</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>59</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>clicked(QAbstractButton*)</signal>
<receiver>TSLoggerDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>419</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>477</x>
<y>263</y>
</hint>
</hints>
</connection>
<connection>
<sender>cleanUpToolButton</sender>
<signal>clicked()</signal>
<receiver>logTextEdit</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>27</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>231</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,279 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "MainWindow.h"
#include "UiGuiIndentServer.h"
#include "debugging/TSLogger.h"
#include "UiGuiIniFileParser.h"
#include "UiGuiSettings.h"
#include "UiGuiVersion.h"
#include "UiGuiSystemInfo.h"
#include "IndentHandler.h"
#include "SettingsPaths.h"
#include <QApplication>
#include <QTextCodec>
#include <QDebug>
#include <string>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLine.h>
#ifdef _MSC_VER
#include <windows.h>
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <iostream>
#include <fstream>
/**
\brief Calling this function tries to attach to the console of the parent process and
redirect all inputs and outputs from and to this console.
The redirected streams are stdout, stdin, stderr, cout, wcout, cin, wcin, wcerr, cerr, wclog and clog.
Code based on info from http://dslweb.nwnexus.com/~ast/dload/guicon.htm.
*/
bool attachToConsole(/*enum ATTACH_ONLY|TRY_ATTACH_ELSE_CREATE|CREATE_NEW*/)
{
int hConHandle;
long lStdHandle;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
FILE *fp;
// Trying to attach to the console of the parent process.
BOOL successful = AttachConsole(ATTACH_PARENT_PROCESS);
// In case that the parent process has no console return false and do no input/output redirection.
if ( !successful )
return false;
// Set the screen buffer to be big enough to let us scroll text
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
// Set maximum console lines.
coninfo.dwSize.Y = 500;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
// Redirect unbuffered STDOUT to the console.
lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
if ( hConHandle != -1 ) {
fp = _fdopen( hConHandle, "w" );
*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
}
// Redirect unbuffered STDIN to the console.
lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
if ( hConHandle != -1 ) {
fp = _fdopen( hConHandle, "r" );
*stdin = *fp;
setvbuf( stdin, NULL, _IONBF, 0 );
}
// Redirect unbuffered STDERR to the console.
lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
if ( hConHandle != -1 ) {
fp = _fdopen( hConHandle, "w" );
*stderr = *fp;
setvbuf( stderr, NULL, _IONBF, 0 );
}
// Make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well.
std::ios::sync_with_stdio();
return true;
}
#else
bool attachToConsole()
{
return false;
}
#endif
using namespace tschweitzer::debugging;
/*!
/brief Entry point to UniversalIndentGUI application.
Evaluates the following parameters:
No parameters starts without server and full gui.
A string without any parameter prefix will be loaded as file on start.
-p --plugin : Run as plugin. Server will be started with a simplified gui.
-s --server : Run as server only without gui.
If -p and -s are set, -p will be used.
-v --verbose needs a following parameter defining the verbose level as a number from 0 to 3.
*/
int main(int argc, char *argv[]) {
QString file2OpenOnStart = "";
int verboseLevel = 1;
bool startAsPlugin = false;
bool startAsServer = false;
bool tclapExitExceptionThrown = false;
int returnValue = 0;
bool attachedToConsole = false;
attachedToConsole = attachToConsole();
#ifdef __APPLE__
// Filter out -psn_0_118813 and similar parameters.
std::vector<char*> argList;
for ( int i = 0; i < argc; i++ ) {
QString argString(argv[i]);
if ( argString.startsWith("-psn_") == false ) {
argList.push_back(argv[i]);
}
else {
// std::cerr << std::endl << "The parameter "<< i << " is an invalid finder parameter. Parameter was " << argv[i] << std::endl;
}
}
for ( size_t i = 0; i < argList.size(); i++ ) {
argv[i] = argList.at(i);
}
argc = argList.size();
#endif
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object.
TCLAP::CmdLine cmd("If -p and -s are set, -p will be used.\nGiving no parameters starts full gui without server.", ' ', "UiGUI version " PROGRAM_VERSION_STRING " " PROGRAM_REVISION);
cmd.setExceptionHandling(false);
// Define a value argument and add it to the command line.
TCLAP::UnlabeledValueArg<std::string> filenameArg("file", "Opens the by filename defined file on start" , false, "", "filename");
cmd.add( filenameArg );
// Define a switch and add it to the command line.
TCLAP::SwitchArg pluginSwitch("p", "plugin", "Run as plugin. Server will be started with a simplified gui", false);
cmd.add( pluginSwitch );
// Define a switch and add it to the command line.
TCLAP::SwitchArg serverSwitch("s", "server", "Run as server only without gui", false);
cmd.add( serverSwitch );
// Define a value argument and add it to the command line.
TCLAP::ValueArg<int> verboselevelArg("v", "verbose", "Sets how many info is written to the log. 0 means with debug info, 3 means critical messages only" , false, 1, "int");
cmd.add( verboselevelArg );
// Parse the args.
cmd.parse( argc, argv );
// Get the value parsed by each arg.
file2OpenOnStart = filenameArg.getValue().c_str();
startAsPlugin = pluginSwitch.getValue();
startAsServer = serverSwitch.getValue();
verboseLevel = verboselevelArg.getValue();
}
catch (TCLAP::ArgException &e) { // catch arg exceptions
std::cerr << std::endl << "error: " << e.error() << ". " << e.argId() << std::endl;
returnValue = 1;
}
catch (TCLAP::ExitException &e) { // catch exit exceptions
tclapExitExceptionThrown = true;
returnValue = e.getExitStatus();
}
catch (...) { // catch any exceptions
std::cerr << std::endl << "There was an error! Maybe faulty command line arguments set. See --help." << std::endl;
returnValue = 1;
}
if ( returnValue != 0 || tclapExitExceptionThrown ) {
#ifdef _MSC_VER
if ( attachedToConsole ) {
// Workaround for skipped command line prompt: Get the current working directory and print it to console.
char* buffer;
if( (buffer = _getcwd( NULL, 0 )) != NULL ) {
std::cerr << std::endl << buffer << ">";
free(buffer);
}
// Release the connection to the parents console.
FreeConsole();
}
#endif
return returnValue;
}
QApplication app(argc, argv);
UiGuiIndentServer server;
MainWindow *mainWindow = NULL;
IndentHandler *indentHandler = NULL;
// Init and install the logger function.
// Setting UTF-8 as default 8-Bit encoding to ensure that qDebug does no false string conversion.
QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") );
QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") );
// Force creation of an TSLogger instance here, to avoid recursion with SettingsPaths init function.
#ifdef _DEBUG
TSLogger::getInstance(0);
#else
TSLogger::getInstance(verboseLevel);
#endif
qInstallMsgHandler( TSLogger::messageHandler );
TSLogger::messageHandler( TSLoggerInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii() );
TSLogger::messageHandler( TSLoggerInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii() );
// Set default values for all by UniversalIndentGUI used settings objects.
QCoreApplication::setOrganizationName("UniversalIndentGUI");
QCoreApplication::setOrganizationDomain("universalindent.sf.net");
QCoreApplication::setApplicationName("UniversalIndentGUI");
// Start normal with full gui and without server.
if ( !startAsPlugin && !startAsServer ) {
mainWindow = new MainWindow(file2OpenOnStart);
mainWindow->show();
}
// Start as plugin with server.
else if ( startAsPlugin ) {
server.startServer();
indentHandler = new IndentHandler(0);
indentHandler->show();
}
// Start as server only without any gui.
else if ( startAsServer ) {
server.startServer();
}
try {
returnValue = app.exec();
}
catch (std::exception &ex) {
qCritical() << __LINE__ << " " << __FUNCTION__ << ": Something went terribly wrong:" << ex.what();
}
if ( startAsPlugin || startAsServer )
server.stopServer();
delete indentHandler;
delete mainWindow;
SettingsPaths::cleanAndRemoveTempDir();
TSLogger::deleteInstance();
return returnValue;
}

@ -0,0 +1,161 @@
K 25
svn:wc:ra_dav:version-url
V 54
/svnroot/universalindent/!svn/ver/1011/trunk/src/tclap
END
SwitchArg.h
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/SwitchArg.h
END
Makefile.in
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/Makefile.in
END
CmdLineOutput.h
K 25
svn:wc:ra_dav:version-url
V 69
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/CmdLineOutput.h
END
CmdLineInterface.h
K 25
svn:wc:ra_dav:version-url
V 72
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/CmdLineInterface.h
END
Visitor.h
K 25
svn:wc:ra_dav:version-url
V 63
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/Visitor.h
END
ArgTraits.h
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/ArgTraits.h
END
UnlabeledMultiArg.h
K 25
svn:wc:ra_dav:version-url
V 73
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/UnlabeledMultiArg.h
END
IgnoreRestVisitor.h
K 25
svn:wc:ra_dav:version-url
V 73
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/IgnoreRestVisitor.h
END
DocBookOutput.h
K 25
svn:wc:ra_dav:version-url
V 69
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/DocBookOutput.h
END
ValuesConstraint.h
K 25
svn:wc:ra_dav:version-url
V 72
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/ValuesConstraint.h
END
VersionVisitor.h
K 25
svn:wc:ra_dav:version-url
V 70
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/VersionVisitor.h
END
MultiSwitchArg.h
K 25
svn:wc:ra_dav:version-url
V 70
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/MultiSwitchArg.h
END
ValueArg.h
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/ValueArg.h
END
XorHandler.h
K 25
svn:wc:ra_dav:version-url
V 66
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/XorHandler.h
END
HelpVisitor.h
K 25
svn:wc:ra_dav:version-url
V 67
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/HelpVisitor.h
END
Arg.h
K 25
svn:wc:ra_dav:version-url
V 59
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/Arg.h
END
CmdLine.h
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/universalindent/!svn/ver/1011/trunk/src/tclap/CmdLine.h
END
StdOutput.h
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/StdOutput.h
END
OptionalUnlabeledTracker.h
K 25
svn:wc:ra_dav:version-url
V 80
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/OptionalUnlabeledTracker.h
END
ZshCompletionOutput.h
K 25
svn:wc:ra_dav:version-url
V 75
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/ZshCompletionOutput.h
END
UnlabeledValueArg.h
K 25
svn:wc:ra_dav:version-url
V 73
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/UnlabeledValueArg.h
END
Makefile.am
K 25
svn:wc:ra_dav:version-url
V 65
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/Makefile.am
END
MultiArg.h
K 25
svn:wc:ra_dav:version-url
V 64
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/MultiArg.h
END
Constraint.h
K 25
svn:wc:ra_dav:version-url
V 66
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/Constraint.h
END
StandardTraits.h
K 25
svn:wc:ra_dav:version-url
V 70
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/StandardTraits.h
END
ArgException.h
K 25
svn:wc:ra_dav:version-url
V 68
/svnroot/universalindent/!svn/ver/992/trunk/src/tclap/ArgException.h
END

@ -0,0 +1,912 @@
10
dir
1074
https://universalindent.svn.sourceforge.net/svnroot/universalindent/trunk/src/tclap
https://universalindent.svn.sourceforge.net/svnroot/universalindent
2010-09-12T18:15:49.802183Z
1011
thomas_-_s
c764a436-2d14-0410-8e4b-8664b97a5d8c
Arg.h
file
2011-12-26T15:10:20.000000Z
09340efa3f5cc9e93bf4eb26e9d284d0
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
16870
ArgException.h
file
2011-12-26T15:10:20.000000Z
add3605d743e771cd6513d7355f3ba78
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
5044
ArgTraits.h
file
2011-12-26T15:10:20.000000Z
c149e1b3a809bbff8dfda3c4a5f76e4c
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
2491
CmdLine.h
file
2011-12-26T15:10:20.000000Z
e0dddb44d8d6bb2528dc422b6c78c4ad
2010-09-12T18:15:49.802183Z
1011
thomas_-_s
has-props
13470
CmdLineInterface.h
file
2011-12-26T15:10:20.000000Z
0237df8c4d116c7069f32ec4516b770d
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
3627
CmdLineOutput.h
file
2011-12-26T15:10:20.000000Z
5784b4f0dbad77f47328a0ba9dcbf2ce
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1925
Constraint.h
file
2011-12-26T15:10:20.000000Z
e9497994c72ce633bda4ed865cb0f1f6
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1800
DocBookOutput.h
file
2011-12-26T15:10:20.000000Z
fb4a662ffb86c86481753e4a4cce850c
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
8356
HelpVisitor.h
file
2011-12-26T15:10:20.000000Z
f432610edb2ff493b4a20f69dac67409
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1799
IgnoreRestVisitor.h
file
2011-12-26T15:10:20.000000Z
5b27cd9d577831297d19c3383f3f3eec
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1335
Makefile.am
file
2011-12-26T15:10:20.000000Z
f9e6594d9210175e8b4a6cdda7c483db
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
577
Makefile.in
file
2011-12-26T15:10:20.000000Z
a5268723844f898de6231869dda71b18
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
11654
MultiArg.h
file
2011-12-26T15:10:20.000000Z
bacd0ddec8b55cc17e5ab4bf40eb41ba
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
11756
MultiSwitchArg.h
file
2011-12-26T15:10:20.000000Z
7e669d165cb2c6402d7264828948d4f9
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
5627
OptionalUnlabeledTracker.h
file
2011-12-26T15:10:20.000000Z
f9333d5483b7d17e80da895c595aaf9b
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1721
StandardTraits.h
file
2011-12-26T15:10:20.000000Z
1cb176d1d90a53b7a08ffc0b9e663465
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
3975
StdOutput.h
file
2011-12-26T15:10:20.000000Z
08a4119d6d4a2cce997c5f160df1f232
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
8452
SwitchArg.h
file
2011-12-26T15:10:20.000000Z
6d76231f04804a4a435e0794cf0ccc3f
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
6509
UnlabeledMultiArg.h
file
2011-12-26T15:10:20.000000Z
d393b2eb56e557c986d2b8fea90e6160
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
9619
UnlabeledValueArg.h
file
2011-12-26T15:10:20.000000Z
7a6b40bb7dbd6f64ba6a7e6891754cf0
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
11445
ValueArg.h
file
2011-12-26T15:10:20.000000Z
0f7d76772ff882bcd713ad787f88eb92
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
13774
ValuesConstraint.h
file
2011-12-26T15:10:20.000000Z
b5e4d680c9b833a1f25528de649d85f0
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
3184
VersionVisitor.h
file
2011-12-26T15:10:20.000000Z
7a04573b6407dc141dea0e2b4a5f0b28
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1871
Visitor.h
file
2011-12-26T15:10:20.000000Z
ab867636e6271b3476d6a679b2e73d1a
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
1258
XorHandler.h
file
2011-12-26T15:10:20.000000Z
44270ab0432092c3e32618c0cb91b3e2
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
3967
ZshCompletionOutput.h
file
2011-12-26T15:10:20.000000Z
090a702ea2dd93dd4ce47dabdc70335c
2009-12-22T23:07:56.706565Z
992
thomas_-_s
has-props
7931

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,5 @@
K 13
svn:eol-style
V 6
native
END

@ -0,0 +1,672 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: Arg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ARGUMENT_H
#define TCLAP_ARGUMENT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#define HAVE_SSTREAM
#endif
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <cstdio>
#if defined(HAVE_SSTREAM)
#include <sstream>
typedef std::istringstream istringstream;
#elif defined(HAVE_STRSTREAM)
#include <strstream>
typedef std::istrstream istringstream;
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
#include <tclap/ArgException.h>
#include <tclap/Visitor.h>
#include <tclap/CmdLineInterface.h>
#include <tclap/ArgTraits.h>
#include <tclap/StandardTraits.h>
namespace TCLAP {
/**
* A virtual base class that defines the essential data for all arguments.
* This class, or one of its existing children, must be subclassed to do
* anything.
*/
class Arg
{
private:
/**
* Indicates whether the rest of the arguments should be ignored.
*/
static bool& ignoreRestRef() { static bool ign = false; return ign; }
/**
* The delimiter that separates an argument flag/name from the
* value.
*/
static char& delimiterRef() { static char delim = ' '; return delim; }
protected:
/**
* The single char flag used to identify the argument.
* This value (preceded by a dash {-}), can be used to identify
* an argument on the command line. The _flag can be blank,
* in fact this is how unlabeled args work. Unlabeled args must
* override appropriate functions to get correct handling. Note
* that the _flag does NOT include the dash as part of the flag.
*/
std::string _flag;
/**
* A single work namd indentifying the argument.
* This value (preceded by two dashed {--}) can also be used
* to identify an argument on the command line. Note that the
* _name does NOT include the two dashes as part of the _name. The
* _name cannot be blank.
*/
std::string _name;
/**
* Description of the argument.
*/
std::string _description;
/**
* Indicating whether the argument is required.
*/
bool _required;
/**
* Label to be used in usage description. Normally set to
* "required", but can be changed when necessary.
*/
std::string _requireLabel;
/**
* Indicates whether a value is required for the argument.
* Note that the value may be required but the argument/value
* combination may not be, as specified by _required.
*/
bool _valueRequired;
/**
* Indicates whether the argument has been set.
* Indicates that a value on the command line has matched the
* name/flag of this argument and the values have been set accordingly.
*/
bool _alreadySet;
/**
* A pointer to a vistitor object.
* The visitor allows special handling to occur as soon as the
* argument is matched. This defaults to NULL and should not
* be used unless absolutely necessary.
*/
Visitor* _visitor;
/**
* Whether this argument can be ignored, if desired.
*/
bool _ignoreable;
/**
* Indicates that the arg was set as part of an XOR and not on the
* command line.
*/
bool _xorSet;
bool _acceptsMultipleValues;
/**
* Performs the special handling described by the Vistitor.
*/
void _checkWithVisitor() const;
/**
* Primary constructor. YOU (yes you) should NEVER construct an Arg
* directly, this is a base class that is extended by various children
* that are meant to be used. Use SwitchArg, ValueArg, MultiArg,
* UnlabeledValueArg, or UnlabeledMultiArg instead.
*
* \param flag - The flag identifying the argument.
* \param name - The name identifying the argument.
* \param desc - The description of the argument, used in the usage.
* \param req - Whether the argument is required.
* \param valreq - Whether the a value is required for the argument.
* \param v - The visitor checked by the argument. Defaults to NULL.
*/
Arg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
bool valreq,
Visitor* v = NULL );
public:
/**
* Destructor.
*/
virtual ~Arg();
/**
* Adds this to the specified list of Args.
* \param argList - The list to add this to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
/**
* Begin ignoring arguments since the "--" argument was specified.
*/
static void beginIgnoring() { ignoreRestRef() = true; }
/**
* Whether to ignore the rest.
*/
static bool ignoreRest() { return ignoreRestRef(); }
/**
* The delimiter that separates an argument flag/name from the
* value.
*/
static char delimiter() { return delimiterRef(); }
/**
* The char used as a place holder when SwitchArgs are combined.
* Currently set to the bell char (ASCII 7).
*/
static char blankChar() { return (char)7; }
/**
* The char that indicates the beginning of a flag. Currently '-'.
*/
static char flagStartChar() { return '-'; }
/**
* The sting that indicates the beginning of a flag. Currently "-".
* Should be identical to flagStartChar.
*/
static const std::string flagStartString() { return "-"; }
/**
* The sting that indicates the beginning of a name. Currently "--".
* Should be flagStartChar twice.
*/
static const std::string nameStartString() { return "--"; }
/**
* The name used to identify the ignore rest argument.
*/
static const std::string ignoreNameString() { return "ignore_rest"; }
/**
* Sets the delimiter for all arguments.
* \param c - The character that delimits flags/names from values.
*/
static void setDelimiter( char c ) { delimiterRef() = c; }
/**
* Pure virtual method meant to handle the parsing and value assignment
* of the string on the command line.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. What is
* passed in from main.
*/
virtual bool processArg(int *i, std::vector<std::string>& args) = 0;
/**
* Operator ==.
* Equality operator. Must be virtual to handle unlabeled args.
* \param a - The Arg to be compared to this.
*/
virtual bool operator==(const Arg& a) const;
/**
* Returns the argument flag.
*/
const std::string& getFlag() const;
/**
* Returns the argument name.
*/
const std::string& getName() const;
/**
* Returns the argument description.
*/
std::string getDescription() const;
/**
* Indicates whether the argument is required.
*/
virtual bool isRequired() const;
/**
* Sets _required to true. This is used by the XorHandler.
* You really have no reason to ever use it.
*/
void forceRequired();
/**
* Sets the _alreadySet value to true. This is used by the XorHandler.
* You really have no reason to ever use it.
*/
void xorSet();
/**
* Indicates whether a value must be specified for argument.
*/
bool isValueRequired() const;
/**
* Indicates whether the argument has already been set. Only true
* if the arg has been matched on the command line.
*/
bool isSet() const;
/**
* Indicates whether the argument can be ignored, if desired.
*/
bool isIgnoreable() const;
/**
* A method that tests whether a string matches this argument.
* This is generally called by the processArg() method. This
* method could be re-implemented by a child to change how
* arguments are specified on the command line.
* \param s - The string to be compared to the flag/name to determine
* whether the arg matches.
*/
virtual bool argMatches( const std::string& s ) const;
/**
* Returns a simple string representation of the argument.
* Primarily for debugging.
*/
virtual std::string toString() const;
/**
* Returns a short ID for the usage.
* \param valueId - The value used in the id.
*/
virtual std::string shortID( const std::string& valueId = "val" ) const;
/**
* Returns a long ID for the usage.
* \param valueId - The value used in the id.
*/
virtual std::string longID( const std::string& valueId = "val" ) const;
/**
* Trims a value off of the flag.
* \param flag - The string from which the flag and value will be
* trimmed. Contains the flag once the value has been trimmed.
* \param value - Where the value trimmed from the string will
* be stored.
*/
virtual void trimFlag( std::string& flag, std::string& value ) const;
/**
* Checks whether a given string has blank chars, indicating that
* it is a combined SwitchArg. If so, return true, otherwise return
* false.
* \param s - string to be checked.
*/
bool _hasBlanks( const std::string& s ) const;
/**
* Sets the requireLabel. Used by XorHandler. You shouldn't ever
* use this.
* \param s - Set the requireLabel to this value.
*/
void setRequireLabel( const std::string& s );
/**
* Used for MultiArgs and XorHandler to determine whether args
* can still be set.
*/
virtual bool allowMore();
/**
* Use by output classes to determine whether an Arg accepts
* multiple values.
*/
virtual bool acceptsMultipleValues();
/**
* Clears the Arg object and allows it to be reused by new
* command lines.
*/
virtual void reset();
};
/**
* Typedef of an Arg list iterator.
*/
typedef std::list<Arg*>::iterator ArgListIterator;
/**
* Typedef of an Arg vector iterator.
*/
typedef std::vector<Arg*>::iterator ArgVectorIterator;
/**
* Typedef of a Visitor list iterator.
*/
typedef std::list<Visitor*>::iterator VisitorListIterator;
/*
* Extract a value of type T from it's string representation contained
* in strVal. The ValueLike parameter used to select the correct
* specialization of ExtractValue depending on the value traits of T.
* ValueLike traits use operator>> to assign the value from strVal.
*/
template<typename T> void
ExtractValue(T &destVal, const std::string& strVal, ValueLike vl)
{
static_cast<void>(vl); // Avoid warning about unused vl
std::istringstream is(strVal);
int valuesRead = 0;
while ( is.good() ) {
if ( is.peek() != EOF )
#ifdef TCLAP_SETBASE_ZERO
is >> std::setbase(0) >> destVal;
#else
is >> destVal;
#endif
else
break;
valuesRead++;
}
if ( is.fail() )
throw( ArgParseException("Couldn't read argument value "
"from string '" + strVal + "'"));
if ( valuesRead > 1 )
throw( ArgParseException("More than one valid value parsed from "
"string '" + strVal + "'"));
}
/*
* Extract a value of type T from it's string representation contained
* in strVal. The ValueLike parameter used to select the correct
* specialization of ExtractValue depending on the value traits of T.
* StringLike uses assignment (operator=) to assign from strVal.
*/
template<typename T> void
ExtractValue(T &destVal, const std::string& strVal, StringLike sl)
{
static_cast<void>(sl); // Avoid warning about unused sl
SetString(destVal, strVal);
}
//////////////////////////////////////////////////////////////////////
//BEGIN Arg.cpp
//////////////////////////////////////////////////////////////////////
inline Arg::Arg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
bool valreq,
Visitor* v) :
_flag(flag),
_name(name),
_description(desc),
_required(req),
_requireLabel("required"),
_valueRequired(valreq),
_alreadySet(false),
_visitor( v ),
_ignoreable(true),
_xorSet(false),
_acceptsMultipleValues(false)
{
if ( _flag.length() > 1 )
throw(SpecificationException(
"Argument flag can only be one character long", toString() ) );
if ( _name != ignoreNameString() &&
( _flag == Arg::flagStartString() ||
_flag == Arg::nameStartString() ||
_flag == " " ) )
throw(SpecificationException("Argument flag cannot be either '" +
Arg::flagStartString() + "' or '" +
Arg::nameStartString() + "' or a space.",
toString() ) );
if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) ||
( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) ||
( _name.find( " ", 0 ) != std::string::npos ) )
throw(SpecificationException("Argument name begin with either '" +
Arg::flagStartString() + "' or '" +
Arg::nameStartString() + "' or space.",
toString() ) );
}
inline Arg::~Arg() { }
inline std::string Arg::shortID( const std::string& valueId ) const
{
std::string id = "";
if ( _flag != "" )
id = Arg::flagStartString() + _flag;
else
id = Arg::nameStartString() + _name;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
if ( !_required )
id = "[" + id + "]";
return id;
}
inline std::string Arg::longID( const std::string& valueId ) const
{
std::string id = "";
if ( _flag != "" )
{
id += Arg::flagStartString() + _flag;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
id += ", ";
}
id += Arg::nameStartString() + _name;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
return id;
}
inline bool Arg::operator==(const Arg& a) const
{
if ( ( _flag != "" && _flag == a._flag ) || _name == a._name)
return true;
else
return false;
}
inline std::string Arg::getDescription() const
{
std::string desc = "";
if ( _required )
desc = "(" + _requireLabel + ") ";
// if ( _valueRequired )
// desc += "(value required) ";
desc += _description;
return desc;
}
inline const std::string& Arg::getFlag() const { return _flag; }
inline const std::string& Arg::getName() const { return _name; }
inline bool Arg::isRequired() const { return _required; }
inline bool Arg::isValueRequired() const { return _valueRequired; }
inline bool Arg::isSet() const
{
if ( _alreadySet && !_xorSet )
return true;
else
return false;
}
inline bool Arg::isIgnoreable() const { return _ignoreable; }
inline void Arg::setRequireLabel( const std::string& s)
{
_requireLabel = s;
}
inline bool Arg::argMatches( const std::string& argFlag ) const
{
if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) ||
argFlag == Arg::nameStartString() + _name )
return true;
else
return false;
}
inline std::string Arg::toString() const
{
std::string s = "";
if ( _flag != "" )
s += Arg::flagStartString() + _flag + " ";
s += "(" + Arg::nameStartString() + _name + ")";
return s;
}
inline void Arg::_checkWithVisitor() const
{
if ( _visitor != NULL )
_visitor->visit();
}
/**
* Implementation of trimFlag.
*/
inline void Arg::trimFlag(std::string& flag, std::string& value) const
{
int stop = 0;
for ( int i = 0; static_cast<unsigned int>(i) < flag.length(); i++ )
if ( flag[i] == Arg::delimiter() )
{
stop = i;
break;
}
if ( stop > 1 )
{
value = flag.substr(stop+1);
flag = flag.substr(0,stop);
}
}
/**
* Implementation of _hasBlanks.
*/
inline bool Arg::_hasBlanks( const std::string& s ) const
{
for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
if ( s[i] == Arg::blankChar() )
return true;
return false;
}
inline void Arg::forceRequired()
{
_required = true;
}
inline void Arg::xorSet()
{
_alreadySet = true;
_xorSet = true;
}
/**
* Overridden by Args that need to added to the end of the list.
*/
inline void Arg::addToList( std::list<Arg*>& argList ) const
{
argList.push_front( const_cast<Arg*>(this) );
}
inline bool Arg::allowMore()
{
return false;
}
inline bool Arg::acceptsMultipleValues()
{
return _acceptsMultipleValues;
}
inline void Arg::reset()
{
_xorSet = false;
_alreadySet = false;
}
//////////////////////////////////////////////////////////////////////
//END Arg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,200 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ArgException.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ARG_EXCEPTION_H
#define TCLAP_ARG_EXCEPTION_H
#include <string>
#include <exception>
namespace TCLAP {
/**
* A simple class that defines and argument exception. Should be caught
* whenever a CmdLine is created and parsed.
*/
class ArgException : public std::exception
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source.
* \param td - Text describing the type of ArgException it is.
* of the exception.
*/
ArgException( const std::string& text = "undefined exception",
const std::string& id = "undefined",
const std::string& td = "Generic ArgException")
: std::exception(),
_errorText(text),
_argId( id ),
_typeDescription(td)
{ }
/**
* Destructor.
*/
virtual ~ArgException() throw() { }
/**
* Returns the error text.
*/
std::string error() const { return ( _errorText ); }
/**
* Returns the argument id.
*/
std::string argId() const
{
if ( _argId == "undefined" )
return " ";
else
return ( "Argument: " + _argId );
}
/**
* Returns the arg id and error text.
*/
const char* what() const throw()
{
static std::string ex;
ex = _argId + " -- " + _errorText;
return ex.c_str();
}
/**
* Returns the type of the exception. Used to explain and distinguish
* between different child exceptions.
*/
std::string typeDescription() const
{
return _typeDescription;
}
private:
/**
* The text of the exception message.
*/
std::string _errorText;
/**
* The argument related to this exception.
*/
std::string _argId;
/**
* Describes the type of the exception. Used to distinguish
* between different child exceptions.
*/
std::string _typeDescription;
};
/**
* Thrown from within the child Arg classes when it fails to properly
* parse the argument it has been passed.
*/
class ArgParseException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
ArgParseException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string( "Exception found while parsing " ) +
std::string( "the value the Arg has been passed." ))
{ }
};
/**
* Thrown from CmdLine when the arguments on the command line are not
* properly specified, e.g. too many arguments, required argument missing, etc.
*/
class CmdLineParseException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
CmdLineParseException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string( "Exception found when the values ") +
std::string( "on the command line do not meet ") +
std::string( "the requirements of the defined ") +
std::string( "Args." ))
{ }
};
/**
* Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
* same flag as another Arg, same name, etc.
*/
class SpecificationException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
SpecificationException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string("Exception found when an Arg object ")+
std::string("is improperly defined by the ") +
std::string("developer." ))
{ }
};
class ExitException {
public:
ExitException(int estat) : _estat(estat) {}
int getExitStatus() const { return _estat; }
private:
int _estat;
};
} // namespace TCLAP
#endif

@ -0,0 +1,81 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ArgTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
// This is an internal tclap file, you should probably not have to
// include this directly
#ifndef TCLAP_ARGTRAITS_H
#define TCLAP_ARGTRAITS_H
namespace TCLAP {
// We use two empty structs to get compile type specialization
// function to work
/**
* A value like argument value type is a value that can be set using
* operator>>. This is the default value type.
*/
struct ValueLike {
typedef ValueLike ValueCategory;
};
/**
* A string like argument value type is a value that can be set using
* operator=(string). Usefull if the value type contains spaces which
* will be broken up into individual tokens by operator>>.
*/
struct StringLike {};
/**
* A class can inherit from this object to make it have string like
* traits. This is a compile time thing and does not add any overhead
* to the inherenting class.
*/
struct StringLikeTrait {
typedef StringLike ValueCategory;
};
/**
* A class can inherit from this object to make it have value like
* traits. This is a compile time thing and does not add any overhead
* to the inherenting class.
*/
struct ValueLikeTrait {
typedef ValueLike ValueCategory;
};
/**
* Arg traits are used to get compile type specialization when parsing
* argument values. Using an ArgTraits you can specify the way that
* values gets assigned to any particular type during parsing. The two
* supported types are string like and value like.
*/
template<typename T>
struct ArgTraits {
typedef typename T::ValueCategory ValueCategory;
//typedef ValueLike ValueCategory;
};
#endif
} // namespace

@ -0,0 +1,621 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: CmdLine.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CMDLINE_H
#define TCLAP_CMDLINE_H
#include <tclap/SwitchArg.h>
#include <tclap/MultiSwitchArg.h>
#include <tclap/UnlabeledValueArg.h>
#include <tclap/UnlabeledMultiArg.h>
#include <tclap/XorHandler.h>
#include <tclap/HelpVisitor.h>
#include <tclap/VersionVisitor.h>
#include <tclap/IgnoreRestVisitor.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/StdOutput.h>
#include <tclap/Constraint.h>
#include <tclap/ValuesConstraint.h>
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.
namespace TCLAP {
template<typename T> void DelPtr(T ptr)
{
delete ptr;
}
template<typename C> void ClearContainer(C &c)
{
typedef typename C::value_type value_type;
std::for_each(c.begin(), c.end(), DelPtr<value_type>);
c.clear();
}
/**
* The base class that manages the command line definition and passes
* along the parsing to the appropriate Arg classes.
*/
class CmdLine : public CmdLineInterface
{
protected:
/**
* The list of arguments that will be tested against the
* command line.
*/
std::list<Arg*> _argList;
/**
* The name of the program. Set to argv[0].
*/
std::string _progName;
/**
* A message used to describe the program. Used in the usage output.
*/
std::string _message;
/**
* The version to be displayed with the --version switch.
*/
std::string _version;
/**
* The number of arguments that are required to be present on
* the command line. This is set dynamically, based on the
* Args added to the CmdLine object.
*/
int _numRequired;
/**
* The character that is used to separate the argument flag/name
* from the value. Defaults to ' ' (space).
*/
char _delimiter;
/**
* The handler that manages xoring lists of args.
*/
XorHandler _xorHandler;
/**
* A list of Args to be explicitly deleted when the destructor
* is called. At the moment, this only includes the three default
* Args.
*/
std::list<Arg*> _argDeleteOnExitList;
/**
* A list of Visitors to be explicitly deleted when the destructor
* is called. At the moment, these are the Vistors created for the
* default Args.
*/
std::list<Visitor*> _visitorDeleteOnExitList;
/**
* Object that handles all output for the CmdLine.
*/
CmdLineOutput* _output;
/**
* Should CmdLine handle parsing exceptions internally?
*/
bool _handleExceptions;
/**
* Throws an exception listing the missing args.
*/
void missingArgsException();
/**
* Checks whether a name/flag string matches entirely matches
* the Arg::blankChar. Used when multiple switches are combined
* into a single argument.
* \param s - The message to be used in the usage.
*/
bool _emptyCombined(const std::string& s);
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Arg* ptr);
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Visitor* ptr);
private:
/**
* Encapsulates the code common to the constructors
* (which is all of it).
*/
void _constructor();
/**
* Is set to true when a user sets the output object. We use this so
* that we don't delete objects that are created outside of this lib.
*/
bool _userSetOutput;
/**
* Whether or not to automatically create help and version switches.
*/
bool _helpAndVersion;
public:
/**
* Command line constructor. Defines how the arguments will be
* parsed.
* \param message - The message to be used in the usage
* output.
* \param delimiter - The character that is used to separate
* the argument flag/name from the value. Defaults to ' ' (space).
* \param version - The version number to be used in the
* --version switch.
* \param helpAndVersion - Whether or not to create the Help and
* Version switches. Defaults to true.
*/
CmdLine(const std::string& message,
const char delimiter = ' ',
const std::string& version = "none",
bool helpAndVersion = true);
/**
* Deletes any resources allocated by a CmdLine object.
*/
virtual ~CmdLine();
/**
* Adds an argument to the list of arguments to be parsed.
* \param a - Argument to be added.
*/
void add( Arg& a );
/**
* An alternative add. Functionally identical.
* \param a - Argument to be added.
*/
void add( Arg* a );
/**
* Add two Args that will be xor'd. If this method is used, add does
* not need to be called.
* \param a - Argument to be added and xor'd.
* \param b - Argument to be added and xor'd.
*/
void xorAdd( Arg& a, Arg& b );
/**
* Add a list of Args that will be xor'd. If this method is used,
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
void xorAdd( std::vector<Arg*>& xors );
/**
* Parses the command line.
* \param argc - Number of arguments.
* \param argv - Array of arguments.
*/
void parse(int argc, const char * const * argv);
/**
* Parses the command line.
* \param args - A vector of strings representing the args.
* args[0] is still the program name.
*/
void parse(std::vector<std::string>& args);
/**
*
*/
CmdLineOutput* getOutput();
/**
*
*/
void setOutput(CmdLineOutput* co);
/**
*
*/
std::string& getVersion();
/**
*
*/
std::string& getProgramName();
/**
*
*/
std::list<Arg*>& getArgList();
/**
*
*/
XorHandler& getXorHandler();
/**
*
*/
char getDelimiter();
/**
*
*/
std::string& getMessage();
/**
*
*/
bool hasHelpAndVersion();
/**
* Disables or enables CmdLine's internal parsing exception handling.
*
* @param state Should CmdLine handle parsing exceptions internally?
*/
void setExceptionHandling(const bool state);
/**
* Returns the current state of the internal exception handling.
*
* @retval true Parsing exceptions are handled internally.
* @retval false Parsing exceptions are propagated to the caller.
*/
bool getExceptionHandling() const;
/**
* Allows the CmdLine object to be reused.
*/
void reset();
};
///////////////////////////////////////////////////////////////////////////////
//Begin CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
inline CmdLine::CmdLine(const std::string& m,
char delim,
const std::string& v,
bool help )
: _progName("not_set_yet"),
_message(m),
_version(v),
_numRequired(0),
_delimiter(delim),
_handleExceptions(true),
_userSetOutput(false),
_helpAndVersion(help)
{
_constructor();
}
inline CmdLine::~CmdLine()
{
ClearContainer(_argDeleteOnExitList);
ClearContainer(_visitorDeleteOnExitList);
if ( !_userSetOutput ) {
delete _output;
_output = 0;
}
}
inline void CmdLine::_constructor()
{
_output = new StdOutput;
Arg::setDelimiter( _delimiter );
Visitor* v;
if ( _helpAndVersion )
{
v = new HelpVisitor( this, &_output );
SwitchArg* help = new SwitchArg("h","help",
"Displays usage information and exits.",
false, v);
add( help );
deleteOnExit(help);
deleteOnExit(v);
v = new VersionVisitor( this, &_output );
SwitchArg* vers = new SwitchArg("","version",
"Displays version information and exits.",
false, v);
add( vers );
deleteOnExit(vers);
deleteOnExit(v);
}
v = new IgnoreRestVisitor();
SwitchArg* ignore = new SwitchArg(Arg::flagStartString(),
Arg::ignoreNameString(),
"Ignores the rest of the labeled arguments following this flag.",
false, v);
add( ignore );
deleteOnExit(ignore);
deleteOnExit(v);
}
inline void CmdLine::xorAdd( std::vector<Arg*>& ors )
{
_xorHandler.add( ors );
for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++)
{
(*it)->forceRequired();
(*it)->setRequireLabel( "OR required" );
add( *it );
}
}
inline void CmdLine::xorAdd( Arg& a, Arg& b )
{
std::vector<Arg*> ors;
ors.push_back( &a );
ors.push_back( &b );
xorAdd( ors );
}
inline void CmdLine::add( Arg& a )
{
add( &a );
}
inline void CmdLine::add( Arg* a )
{
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
if ( *a == *(*it) )
throw( SpecificationException(
"Argument with same flag/name already exists!",
a->longID() ) );
a->addToList( _argList );
if ( a->isRequired() )
_numRequired++;
}
inline void CmdLine::parse(int argc, const char * const * argv)
{
// this step is necessary so that we have easy access to
// mutable strings.
std::vector<std::string> args;
for (int i = 0; i < argc; i++)
args.push_back(argv[i]);
parse(args);
}
inline void CmdLine::parse(std::vector<std::string>& args)
{
bool shouldExit = false;
int estat = 0;
try {
_progName = args.front();
args.erase(args.begin());
int requiredCount = 0;
for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++) {
bool matched = false;
for (ArgListIterator it = _argList.begin();
it != _argList.end(); it++) {
if ( (*it)->processArg( &i, args ) )
{
requiredCount += _xorHandler.check( *it );
matched = true;
break;
}
}
// checks to see if the argument is an empty combined
// switch and if so, then we've actually matched it
if ( !matched && _emptyCombined( args[i] ) )
matched = true;
if ( !matched && !Arg::ignoreRest() )
throw(CmdLineParseException("Couldn't find match "
"for argument",
args[i]));
}
if ( requiredCount < _numRequired )
missingArgsException();
if ( requiredCount > _numRequired )
throw(CmdLineParseException("Too many arguments!"));
} catch ( ArgException& e ) {
// If we're not handling the exceptions, rethrow.
if ( !_handleExceptions) {
throw;
}
try {
_output->failure(*this,e);
} catch ( ExitException &ee ) {
estat = ee.getExitStatus();
shouldExit = true;
}
} catch (ExitException &ee) {
// If we're not handling the exceptions, rethrow.
if ( !_handleExceptions) {
throw;
}
estat = ee.getExitStatus();
shouldExit = true;
}
if (shouldExit)
exit(estat);
}
inline bool CmdLine::_emptyCombined(const std::string& s)
{
if ( s.length() > 0 && s[0] != Arg::flagStartChar() )
return false;
for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
if ( s[i] != Arg::blankChar() )
return false;
return true;
}
inline void CmdLine::missingArgsException()
{
int count = 0;
std::string missingArgList;
for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
{
if ( (*it)->isRequired() && !(*it)->isSet() )
{
missingArgList += (*it)->getName();
missingArgList += ", ";
count++;
}
}
missingArgList = missingArgList.substr(0,missingArgList.length()-2);
std::string msg;
if ( count > 1 )
msg = "Required arguments missing: ";
else
msg = "Required argument missing: ";
msg += missingArgList;
throw(CmdLineParseException(msg));
}
inline void CmdLine::deleteOnExit(Arg* ptr)
{
_argDeleteOnExitList.push_back(ptr);
}
inline void CmdLine::deleteOnExit(Visitor* ptr)
{
_visitorDeleteOnExitList.push_back(ptr);
}
inline CmdLineOutput* CmdLine::getOutput()
{
return _output;
}
inline void CmdLine::setOutput(CmdLineOutput* co)
{
_userSetOutput = true;
_output = co;
}
inline std::string& CmdLine::getVersion()
{
return _version;
}
inline std::string& CmdLine::getProgramName()
{
return _progName;
}
inline std::list<Arg*>& CmdLine::getArgList()
{
return _argList;
}
inline XorHandler& CmdLine::getXorHandler()
{
return _xorHandler;
}
inline char CmdLine::getDelimiter()
{
return _delimiter;
}
inline std::string& CmdLine::getMessage()
{
return _message;
}
inline bool CmdLine::hasHelpAndVersion()
{
return _helpAndVersion;
}
inline void CmdLine::setExceptionHandling(const bool state)
{
_handleExceptions = state;
}
inline bool CmdLine::getExceptionHandling() const
{
return _handleExceptions;
}
inline void CmdLine::reset()
{
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
{
(*it)->reset();
}
_progName.clear();
}
///////////////////////////////////////////////////////////////////////////////
//End CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,150 @@
/******************************************************************************
*
* file: CmdLineInterface.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_COMMANDLINE_INTERFACE_H
#define TCLAP_COMMANDLINE_INTERFACE_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
namespace TCLAP {
class Arg;
class CmdLineOutput;
class XorHandler;
/**
* The base class that manages the command line definition and passes
* along the parsing to the appropriate Arg classes.
*/
class CmdLineInterface
{
public:
/**
* Destructor
*/
virtual ~CmdLineInterface() {}
/**
* Adds an argument to the list of arguments to be parsed.
* \param a - Argument to be added.
*/
virtual void add( Arg& a )=0;
/**
* An alternative add. Functionally identical.
* \param a - Argument to be added.
*/
virtual void add( Arg* a )=0;
/**
* Add two Args that will be xor'd.
* If this method is used, add does
* not need to be called.
* \param a - Argument to be added and xor'd.
* \param b - Argument to be added and xor'd.
*/
virtual void xorAdd( Arg& a, Arg& b )=0;
/**
* Add a list of Args that will be xor'd. If this method is used,
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
virtual void xorAdd( std::vector<Arg*>& xors )=0;
/**
* Parses the command line.
* \param argc - Number of arguments.
* \param argv - Array of arguments.
*/
virtual void parse(int argc, const char * const * argv)=0;
/**
* Parses the command line.
* \param args - A vector of strings representing the args.
* args[0] is still the program name.
*/
void parse(std::vector<std::string>& args);
/**
* Returns the CmdLineOutput object.
*/
virtual CmdLineOutput* getOutput()=0;
/**
* \param co - CmdLineOutput object that we want to use instead.
*/
virtual void setOutput(CmdLineOutput* co)=0;
/**
* Returns the version string.
*/
virtual std::string& getVersion()=0;
/**
* Returns the program name string.
*/
virtual std::string& getProgramName()=0;
/**
* Returns the argList.
*/
virtual std::list<Arg*>& getArgList()=0;
/**
* Returns the XorHandler.
*/
virtual XorHandler& getXorHandler()=0;
/**
* Returns the delimiter string.
*/
virtual char getDelimiter()=0;
/**
* Returns the message string.
*/
virtual std::string& getMessage()=0;
/**
* Indicates whether or not the help and version switches were created
* automatically.
*/
virtual bool hasHelpAndVersion()=0;
/**
* Resets the instance as if it had just been constructed so that the
* instance can be reused.
*/
virtual void reset()=0;
};
} //namespace
#endif

@ -0,0 +1,74 @@
/******************************************************************************
*
* file: CmdLineOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CMDLINEOUTPUT_H
#define TCLAP_CMDLINEOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
namespace TCLAP {
class CmdLineInterface;
class ArgException;
/**
* The interface that any output object must implement.
*/
class CmdLineOutput
{
public:
/**
* Virtual destructor.
*/
virtual ~CmdLineOutput() {}
/**
* Generates some sort of output for the USAGE.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c)=0;
/**
* Generates some sort of output for the version.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c)=0;
/**
* Generates some sort of output for a failure.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure( CmdLineInterface& c,
ArgException& e )=0;
};
} //namespace TCLAP
#endif

@ -0,0 +1,68 @@
/******************************************************************************
*
* file: Constraint.h
*
* Copyright (c) 2005, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CONSTRAINT_H
#define TCLAP_CONSTRAINT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
namespace TCLAP {
/**
* The interface that defines the interaction between the Arg and Constraint.
*/
template<class T>
class Constraint
{
public:
/**
* Returns a description of the Constraint.
*/
virtual std::string description() const =0;
/**
* Returns the short ID for the Constraint.
*/
virtual std::string shortID() const =0;
/**
* The method used to verify that the value parsed from the command
* line meets the constraint.
* \param value - The value that will be checked.
*/
virtual bool check(const T& value) const =0;
/**
* Destructor.
* Silences warnings about Constraint being a base class with virtual
* functions but without a virtual destructor.
*/
virtual ~Constraint() { ; }
};
} //namespace TCLAP
#endif

@ -0,0 +1,299 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: DocBookOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_DOCBOOKOUTPUT_H
#define TCLAP_DOCBOOKOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that generates DocBook output for usage() method for the
* given CmdLine and its Args.
*/
class DocBookOutput : public CmdLineOutput
{
public:
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
/**
* Substitutes the char r for string x in string s.
* \param s - The string to operate on.
* \param r - The char to replace.
* \param x - What to replace r with.
*/
void substituteSpecialChars( std::string& s, char r, std::string& x );
void removeChar( std::string& s, char r);
void basename( std::string& s );
void printShortArg(Arg* it);
void printLongArg(Arg* it);
char theDelimiter;
};
inline void DocBookOutput::version(CmdLineInterface& _cmd)
{
std::cout << _cmd.getVersion() << std::endl;
}
inline void DocBookOutput::usage(CmdLineInterface& _cmd )
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
theDelimiter = _cmd.getDelimiter();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
basename(progName);
std::cout << "<?xml version='1.0'?>" << std::endl;
std::cout << "<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"" << std::endl;
std::cout << "\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl << std::endl;
std::cout << "<refentry>" << std::endl;
std::cout << "<refmeta>" << std::endl;
std::cout << "<refentrytitle>" << progName << "</refentrytitle>" << std::endl;
std::cout << "<manvolnum>1</manvolnum>" << std::endl;
std::cout << "</refmeta>" << std::endl;
std::cout << "<refnamediv>" << std::endl;
std::cout << "<refname>" << progName << "</refname>" << std::endl;
std::cout << "<refpurpose>" << _cmd.getMessage() << "</refpurpose>" << std::endl;
std::cout << "</refnamediv>" << std::endl;
std::cout << "<refsynopsisdiv>" << std::endl;
std::cout << "<cmdsynopsis>" << std::endl;
std::cout << "<command>" << progName << "</command>" << std::endl;
// xor
for ( int i = 0; (unsigned int)i < xorList.size(); i++ )
{
std::cout << "<group choice='req'>" << std::endl;
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end(); it++ )
printShortArg((*it));
std::cout << "</group>" << std::endl;
}
// rest of args
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
printShortArg((*it));
std::cout << "</cmdsynopsis>" << std::endl;
std::cout << "</refsynopsisdiv>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Description</title>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << _cmd.getMessage() << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Options</title>" << std::endl;
std::cout << "<variablelist>" << std::endl;
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
printLongArg((*it));
std::cout << "</variablelist>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Version</title>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << version << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "</refentry>" << std::endl;
}
inline void DocBookOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
static_cast<void>(_cmd); // unused
std::cout << e.what() << std::endl;
throw ExitException(1);
}
inline void DocBookOutput::substituteSpecialChars( std::string& s,
char r,
std::string& x )
{
size_t p;
while ( (p = s.find_first_of(r)) != std::string::npos )
{
s.erase(p,1);
s.insert(p,x);
}
}
inline void DocBookOutput::removeChar( std::string& s, char r)
{
size_t p;
while ( (p = s.find_first_of(r)) != std::string::npos )
{
s.erase(p,1);
}
}
inline void DocBookOutput::basename( std::string& s )
{
size_t p = s.find_last_of('/');
if ( p != std::string::npos )
{
s.erase(0, p + 1);
}
}
inline void DocBookOutput::printShortArg(Arg* a)
{
std::string lt = "&lt;";
std::string gt = "&gt;";
std::string id = a->shortID();
substituteSpecialChars(id,'<',lt);
substituteSpecialChars(id,'>',gt);
removeChar(id,'[');
removeChar(id,']');
std::string choice = "opt";
if ( a->isRequired() )
choice = "plain";
std::cout << "<arg choice='" << choice << '\'';
if ( a->acceptsMultipleValues() )
std::cout << " rep='repeat'";
std::cout << '>';
if ( !a->getFlag().empty() )
std::cout << a->flagStartChar() << a->getFlag();
else
std::cout << a->nameStartString() << a->getName();
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
removeChar(arg,'[');
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
}
std::cout << "</arg>" << std::endl;
}
inline void DocBookOutput::printLongArg(Arg* a)
{
std::string lt = "&lt;";
std::string gt = "&gt;";
std::string desc = a->getDescription();
substituteSpecialChars(desc,'<',lt);
substituteSpecialChars(desc,'>',gt);
std::cout << "<varlistentry>" << std::endl;
if ( !a->getFlag().empty() )
{
std::cout << "<term>" << std::endl;
std::cout << "<option>";
std::cout << a->flagStartChar() << a->getFlag();
std::cout << "</option>" << std::endl;
std::cout << "</term>" << std::endl;
}
std::cout << "<term>" << std::endl;
std::cout << "<option>";
std::cout << a->nameStartString() << a->getName();
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
removeChar(arg,'[');
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
}
std::cout << "</option>" << std::endl;
std::cout << "</term>" << std::endl;
std::cout << "<listitem>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << desc << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</listitem>" << std::endl;
std::cout << "</varlistentry>" << std::endl;
}
} //namespace TCLAP
#endif

@ -0,0 +1,69 @@
/******************************************************************************
*
* file: HelpVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_HELP_VISITOR_H
#define TCLAP_HELP_VISITOR_H
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h>
namespace TCLAP {
/**
* A Visitor object that calls the usage method of the given CmdLineOutput
* object for the specified CmdLine object.
*/
class HelpVisitor: public Visitor
{
protected:
/**
* The CmdLine the output will be generated for.
*/
CmdLineInterface* _cmd;
/**
* The output object.
*/
CmdLineOutput** _out;
public:
/**
* Constructor.
* \param cmd - The CmdLine the output will be generated for.
* \param out - The type of output.
*/
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the usage method of the CmdLineOutput for the
* specified CmdLine.
*/
void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
};
}
#endif

@ -0,0 +1,52 @@
/******************************************************************************
*
* file: IgnoreRestVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_IGNORE_REST_VISITOR_H
#define TCLAP_IGNORE_REST_VISITOR_H
#include <tclap/Visitor.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A Vistor that tells the CmdLine to begin ignoring arguments after
* this one is parsed.
*/
class IgnoreRestVisitor: public Visitor
{
public:
/**
* Constructor.
*/
IgnoreRestVisitor() : Visitor() {}
/**
* Sets Arg::_ignoreRest.
*/
void visit() { Arg::beginIgnoring(); }
};
}
#endif

@ -0,0 +1,28 @@
libtclapincludedir = $(includedir)/tclap
libtclapinclude_HEADERS = \
CmdLineInterface.h \
ArgException.h \
CmdLine.h \
XorHandler.h \
MultiArg.h \
UnlabeledMultiArg.h \
ValueArg.h \
UnlabeledValueArg.h \
Visitor.h Arg.h \
HelpVisitor.h \
SwitchArg.h \
MultiSwitchArg.h \
VersionVisitor.h \
IgnoreRestVisitor.h \
CmdLineOutput.h \
StdOutput.h \
DocBookOutput.h \
ZshCompletionOutput.h \
OptionalUnlabeledTracker.h \
Constraint.h \
ValuesConstraint.h \
ArgTraits.h \
StandardTraits.h

@ -0,0 +1,387 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = include/tclap
DIST_COMMON = $(libtclapinclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libtclapincludedir)"
libtclapincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(libtclapinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOC_FALSE = @DOC_FALSE@
DOC_TRUE = @DOC_TRUE@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_GNU_COMPILERS_FALSE = @HAVE_GNU_COMPILERS_FALSE@
HAVE_GNU_COMPILERS_TRUE = @HAVE_GNU_COMPILERS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
libtclapincludedir = $(includedir)/tclap
libtclapinclude_HEADERS = \
CmdLineInterface.h \
ArgException.h \
CmdLine.h \
XorHandler.h \
MultiArg.h \
UnlabeledMultiArg.h \
ValueArg.h \
UnlabeledValueArg.h \
Visitor.h Arg.h \
HelpVisitor.h \
SwitchArg.h \
MultiSwitchArg.h \
VersionVisitor.h \
IgnoreRestVisitor.h \
CmdLineOutput.h \
StdOutput.h \
DocBookOutput.h \
ZshCompletionOutput.h \
OptionalUnlabeledTracker.h \
Constraint.h \
ValuesConstraint.h \
ArgTraits.h \
StandardTraits.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/tclap/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu include/tclap/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
uninstall-info-am:
install-libtclapincludeHEADERS: $(libtclapinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libtclapincludedir)" || $(mkdir_p) "$(DESTDIR)$(libtclapincludedir)"
@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(libtclapincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtclapincludedir)/$$f'"; \
$(libtclapincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtclapincludedir)/$$f"; \
done
uninstall-libtclapincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libtclapincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(libtclapincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libtclapincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-libtclapincludeHEADERS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libtclapincludeHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
ctags distclean distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-libtclapincludeHEADERS \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
uninstall uninstall-am uninstall-info-am \
uninstall-libtclapincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

@ -0,0 +1,422 @@
/******************************************************************************
*
* file: MultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTIPLE_ARGUMENT_H
#define TCLAP_MULTIPLE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
#include <tclap/Constraint.h>
namespace TCLAP {
/**
* An argument that allows multiple values of type T to be specified. Very
* similar to a ValueArg, except a vector of values will be returned
* instead of just one.
*/
template<class T>
class MultiArg : public Arg
{
public:
typedef std::vector<T> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator const_iterator;
protected:
/**
* The list of values parsed from the CmdLine.
*/
std::vector<T> _values;
/**
* The description of type T to be used in the usage.
*/
std::string _typeDesc;
/**
* A list of constraint on this Arg.
*/
Constraint<T>* _constraint;
/**
* Extracts the value from the string.
* Attempts to parse string as type T, if this fails an exception
* is thrown.
* \param val - The string to be read.
*/
void _extractValue( const std::string& val );
/**
* Used by XorHandler to decide whether to keep parsing for this arg.
*/
bool _allowMore;
public:
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
Visitor* v = NULL);
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
Visitor* v = NULL );
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns a vector of type T containing the values parsed from
* the command line.
*/
const std::vector<T>& getValue();
/**
* Returns an iterator over the values parsed from the command
* line.
*/
const_iterator begin() const { return _values.begin(); }
/**
* Returns the end of the values parsed from the command
* line.
*/
const_iterator end() const { return _values.end(); }
/**
* Returns the a short id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Returns the a long id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Once we've matched the first value, then the arg is no longer
* required.
*/
virtual bool isRequired() const;
virtual bool allowMore();
virtual void reset();
};
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( typeDesc ),
_constraint( NULL ),
_allowMore(false)
{
_acceptsMultipleValues = true;
}
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( typeDesc ),
_constraint( NULL ),
_allowMore(false)
{
parser.add( this );
_acceptsMultipleValues = true;
}
/**
*
*/
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ),
_allowMore(false)
{
_acceptsMultipleValues = true;
}
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ),
_allowMore(false)
{
parser.add( this );
_acceptsMultipleValues = true;
}
template<class T>
const std::vector<T>& MultiArg<T>::getValue() { return _values; }
template<class T>
bool MultiArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
std::string flag = args[*i];
std::string value = "";
trimFlag( flag, value );
if ( argMatches( flag ) )
{
if ( Arg::delimiter() != ' ' && value == "" )
throw( ArgParseException(
"Couldn't find delimiter for this argument!",
toString() ) );
// always take the first one, regardless of start string
if ( value == "" )
{
(*i)++;
if ( static_cast<unsigned int>(*i) < args.size() )
_extractValue( args[*i] );
else
throw( ArgParseException("Missing a value for this argument!",
toString() ) );
}
else
_extractValue( value );
/*
// continuing taking the args until we hit one with a start string
while ( (unsigned int)(*i)+1 < args.size() &&
args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
_extractValue( args[++(*i)] );
*/
_alreadySet = true;
_checkWithVisitor();
return true;
}
else
return false;
}
/**
*
*/
template<class T>
std::string MultiArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::shortID(_typeDesc) + " ... ";
}
/**
*
*/
template<class T>
std::string MultiArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::longID(_typeDesc) + " (accepted multiple times)";
}
/**
* Once we've matched the first value, then the arg is no longer
* required.
*/
template<class T>
bool MultiArg<T>::isRequired() const
{
if ( _required )
{
if ( _values.size() > 1 )
return false;
else
return true;
}
else
return false;
}
template<class T>
void MultiArg<T>::_extractValue( const std::string& val )
{
try {
T tmp;
ExtractValue(tmp, val, typename ArgTraits<T>::ValueCategory());
_values.push_back(tmp);
} catch( ArgParseException &e) {
throw ArgParseException(e.error(), toString());
}
if ( _constraint != NULL )
if ( ! _constraint->check( _values.back() ) )
throw( CmdLineParseException( "Value '" + val +
"' does not meet constraint: " +
_constraint->description(),
toString() ) );
}
template<class T>
bool MultiArg<T>::allowMore()
{
bool am = _allowMore;
_allowMore = true;
return am;
}
template<class T>
void MultiArg<T>::reset()
{
Arg::reset();
_values.clear();
}
} // namespace TCLAP
#endif

@ -0,0 +1,216 @@
/******************************************************************************
*
* file: MultiSwitchArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTI_SWITCH_ARG_H
#define TCLAP_MULTI_SWITCH_ARG_H
#include <string>
#include <vector>
#include <tclap/SwitchArg.h>
namespace TCLAP {
/**
* A multiple switch argument. If the switch is set on the command line, then
* the getValue method will return the number of times the switch appears.
*/
class MultiSwitchArg : public SwitchArg
{
protected:
/**
* The value of the switch.
*/
int _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
int _default;
public:
/**
* MultiSwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param init - Optional. The initial/default value of this Arg.
* Defaults to 0.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
int init = 0,
Visitor* v = NULL);
/**
* MultiSwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param parser - A CmdLine parser object to add this Arg to
* \param init - Optional. The initial/default value of this Arg.
* Defaults to 0.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
int init = 0,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the SwitchArg version of this method to set the
* _value of the argument appropriately.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns int, the number of times the switch has been set.
*/
int getValue();
/**
* Returns the shortID for this Arg.
*/
std::string shortID(const std::string& val) const;
/**
* Returns the longID for this Arg.
*/
std::string longID(const std::string& val) const;
void reset();
};
//////////////////////////////////////////////////////////////////////
//BEGIN MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
int init,
Visitor* v )
: SwitchArg(flag, name, desc, false, v),
_value( init ),
_default( init )
{ }
inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
int init,
Visitor* v )
: SwitchArg(flag, name, desc, false, v),
_value( init ),
_default( init )
{
parser.add( this );
}
inline int MultiSwitchArg::getValue() { return _value; }
inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( argMatches( args[*i] ))
{
// so the isSet() method will work
_alreadySet = true;
// Matched argument: increment value.
++_value;
_checkWithVisitor();
return true;
}
else if ( combinedSwitchesMatch( args[*i] ) )
{
// so the isSet() method will work
_alreadySet = true;
// Matched argument: increment value.
++_value;
// Check for more in argument and increment value.
while ( combinedSwitchesMatch( args[*i] ) )
++_value;
_checkWithVisitor();
return false;
}
else
return false;
}
inline std::string
MultiSwitchArg::shortID(const std::string& val) const
{
return Arg::shortID(val) + " ... ";
}
inline std::string
MultiSwitchArg::longID(const std::string& val) const
{
return Arg::longID(val) + " (accepted multiple times)";
}
inline void
MultiSwitchArg::reset()
{
MultiSwitchArg::_value = MultiSwitchArg::_default;
}
//////////////////////////////////////////////////////////////////////
//END MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,62 @@
/******************************************************************************
*
* file: OptionalUnlabeledTracker.h
*
* Copyright (c) 2005, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#include <string>
namespace TCLAP {
class OptionalUnlabeledTracker
{
public:
static void check( bool req, const std::string& argName );
static void gotOptional() { alreadyOptionalRef() = true; }
static bool& alreadyOptional() { return alreadyOptionalRef(); }
private:
static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
};
inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
{
if ( OptionalUnlabeledTracker::alreadyOptional() )
throw( SpecificationException(
"You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
argName ) );
if ( !req )
OptionalUnlabeledTracker::gotOptional();
}
} // namespace TCLAP
#endif

@ -0,0 +1,186 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: StandardTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
// This is an internal tclap file, you should probably not have to
// include this directly
#ifndef TCLAP_STANDARD_TRAITS_H
#define TCLAP_STANDARD_TRAITS_H
#ifdef HAVE_CONFIG_H
#include <config.h> // To check for long long
#endif
namespace TCLAP {
// ======================================================================
// Integer types
// ======================================================================
/**
* longs have value-like semantics.
*/
template<>
struct ArgTraits<long> {
typedef ValueLike ValueCategory;
};
/**
* ints have value-like semantics.
*/
template<>
struct ArgTraits<int> {
typedef ValueLike ValueCategory;
};
/**
* shorts have value-like semantics.
*/
template<>
struct ArgTraits<short> {
typedef ValueLike ValueCategory;
};
/**
* chars have value-like semantics.
*/
template<>
struct ArgTraits<char> {
typedef ValueLike ValueCategory;
};
#ifdef HAVE_LONG_LONG
/**
* long longs have value-like semantics.
*/
template<>
struct ArgTraits<long long> {
typedef ValueLike ValueCategory;
};
#endif
// ======================================================================
// Unsigned integer types
// ======================================================================
/**
* unsigned longs have value-like semantics.
*/
template<>
struct ArgTraits<unsigned long> {
typedef ValueLike ValueCategory;
};
/**
* unsigned ints have value-like semantics.
*/
template<>
struct ArgTraits<unsigned int> {
typedef ValueLike ValueCategory;
};
/**
* unsigned shorts have value-like semantics.
*/
template<>
struct ArgTraits<unsigned short> {
typedef ValueLike ValueCategory;
};
/**
* unsigned chars have value-like semantics.
*/
template<>
struct ArgTraits<unsigned char> {
typedef ValueLike ValueCategory;
};
#ifdef HAVE_LONG_LONG
/**
* unsigned long longs have value-like semantics.
*/
template<>
struct ArgTraits<unsigned long long> {
typedef ValueLike ValueCategory;
};
#endif
// ======================================================================
// Float types
// ======================================================================
/**
* floats have value-like semantics.
*/
template<>
struct ArgTraits<float> {
typedef ValueLike ValueCategory;
};
/**
* doubles have value-like semantics.
*/
template<>
struct ArgTraits<double> {
typedef ValueLike ValueCategory;
};
// ======================================================================
// Other types
// ======================================================================
/**
* bools have value-like semantics.
*/
template<>
struct ArgTraits<bool> {
typedef ValueLike ValueCategory;
};
/**
* wchar_ts have value-like semantics.
*/
/*
template<>
struct ArgTraits<wchar_t> {
typedef ValueLike ValueCategory;
};
*/
/**
* Strings have string like argument traits.
*/
template<>
struct ArgTraits<std::string> {
typedef StringLike ValueCategory;
};
template<typename T>
void SetString(T &dst, const std::string &src)
{
dst = src;
}
} // namespace
#endif

@ -0,0 +1,298 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: StdOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_STDCMDLINEOUTPUT_H
#define TCLAP_STDCMDLINEOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that isolates any output from the CmdLine object so that it
* may be easily modified.
*/
class StdOutput : public CmdLineOutput
{
public:
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
/**
* Writes a brief usage message with short args.
* \param c - The CmdLine object the output is generated for.
* \param os - The stream to write the message to.
*/
void _shortUsage( CmdLineInterface& c, std::ostream& os ) const;
/**
* Writes a longer usage message with long and short args,
* provides descriptions and prints message.
* \param c - The CmdLine object the output is generated for.
* \param os - The stream to write the message to.
*/
void _longUsage( CmdLineInterface& c, std::ostream& os ) const;
/**
* This function inserts line breaks and indents long strings
* according the params input. It will only break lines at spaces,
* commas and pipes.
* \param os - The stream to be printed to.
* \param s - The string to be printed.
* \param maxWidth - The maxWidth allowed for the output line.
* \param indentSpaces - The number of spaces to indent the first line.
* \param secondLineOffset - The number of spaces to indent the second
* and all subsequent lines in addition to indentSpaces.
*/
void spacePrint( std::ostream& os,
const std::string& s,
int maxWidth,
int indentSpaces,
int secondLineOffset ) const;
};
inline void StdOutput::version(CmdLineInterface& _cmd)
{
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
std::cout << std::endl << progName << " version: "
<< version << std::endl << std::endl;
}
inline void StdOutput::usage(CmdLineInterface& _cmd )
{
std::cout << std::endl << "USAGE: " << std::endl << std::endl;
_shortUsage( _cmd, std::cout );
std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl;
_longUsage( _cmd, std::cout );
std::cout << std::endl;
}
inline void StdOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
std::string progName = _cmd.getProgramName();
std::cerr << "PARSE ERROR: " << e.argId() << std::endl
<< " " << e.error() << std::endl << std::endl;
if ( _cmd.hasHelpAndVersion() )
{
std::cerr << "Brief USAGE: " << std::endl;
_shortUsage( _cmd, std::cerr );
std::cerr << std::endl << "For complete USAGE and HELP type: "
<< std::endl << " " << progName << " --help"
<< std::endl << std::endl;
}
else
usage(_cmd);
throw ExitException(1);
}
inline void
StdOutput::_shortUsage( CmdLineInterface& _cmd,
std::ostream& os ) const
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
std::string s = progName + " ";
// first the xor
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
s += " {";
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end(); it++ )
s += (*it)->shortID() + "|";
s[s.length()-1] = '}';
}
// then the rest
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
s += " " + (*it)->shortID();
// if the program name is too long, then adjust the second line offset
int secondLineOffset = static_cast<int>(progName.length()) + 2;
if ( secondLineOffset > 75/2 )
secondLineOffset = static_cast<int>(75/2);
spacePrint( os, s, 75, 3, secondLineOffset );
}
inline void
StdOutput::_longUsage( CmdLineInterface& _cmd,
std::ostream& os ) const
{
std::list<Arg*> argList = _cmd.getArgList();
std::string message = _cmd.getMessage();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
// first the xor
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end();
it++ )
{
spacePrint( os, (*it)->longID(), 75, 3, 3 );
spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
if ( it+1 != xorList[i].end() )
spacePrint(os, "-- OR --", 75, 9, 0);
}
os << std::endl << std::endl;
}
// then the rest
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
{
spacePrint( os, (*it)->longID(), 75, 3, 3 );
spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
os << std::endl;
}
os << std::endl;
spacePrint( os, message, 75, 3, 0 );
}
inline void StdOutput::spacePrint( std::ostream& os,
const std::string& s,
int maxWidth,
int indentSpaces,
int secondLineOffset ) const
{
int len = static_cast<int>(s.length());
if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
{
int allowedLen = maxWidth - indentSpaces;
int start = 0;
while ( start < len )
{
// find the substring length
// int stringLen = std::min<int>( len - start, allowedLen );
// doing it this way to support a VisualC++ 2005 bug
using namespace std;
int stringLen = min<int>( len - start, allowedLen );
// trim the length so it doesn't end in middle of a word
if ( stringLen == allowedLen )
while ( stringLen >= 0 &&
s[stringLen+start] != ' ' &&
s[stringLen+start] != ',' &&
s[stringLen+start] != '|' )
stringLen--;
// ok, the word is longer than the line, so just split
// wherever the line ends
if ( stringLen <= 0 )
stringLen = allowedLen;
// check for newlines
for ( int i = 0; i < stringLen; i++ )
if ( s[start+i] == '\n' )
stringLen = i+1;
// print the indent
for ( int i = 0; i < indentSpaces; i++ )
os << " ";
if ( start == 0 )
{
// handle second line offsets
indentSpaces += secondLineOffset;
// adjust allowed len
allowedLen -= secondLineOffset;
}
os << s.substr(start,stringLen) << std::endl;
// so we don't start a line with a space
while ( s[stringLen+start] == ' ' && start < len )
start++;
start += stringLen;
}
}
else
{
for ( int i = 0; i < indentSpaces; i++ )
os << " ";
os << s << std::endl;
}
}
} //namespace TCLAP
#endif

@ -0,0 +1,228 @@
/******************************************************************************
*
* file: SwitchArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_SWITCH_ARG_H
#define TCLAP_SWITCH_ARG_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A simple switch argument. If the switch is set on the command line, then
* the getValue method will return the opposite of the default value for the
* switch.
*/
class SwitchArg : public Arg
{
protected:
/**
* The value of the switch.
*/
bool _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
bool _default;
public:
/**
* SwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param def - The default value for this Switch.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool def = false,
Visitor* v = NULL);
/**
* SwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param parser - A CmdLine parser object to add this Arg to
* \param def - The default value for this Switch.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
bool def = false,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Checks a string to see if any of the chars in the string
* match the flag for this Switch.
*/
bool combinedSwitchesMatch(std::string& combined);
/**
* Returns bool, whether or not the switch has been set.
*/
bool getValue();
virtual void reset();
};
//////////////////////////////////////////////////////////////////////
//BEGIN SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline SwitchArg::SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool default_val,
Visitor* v )
: Arg(flag, name, desc, false, false, v),
_value( default_val ),
_default( default_val )
{ }
inline SwitchArg::SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
bool default_val,
Visitor* v )
: Arg(flag, name, desc, false, false, v),
_value( default_val ),
_default(default_val)
{
parser.add( this );
}
inline bool SwitchArg::getValue() { return _value; }
inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )
{
// make sure this is actually a combined switch
if ( combinedSwitches.length() > 0 &&
combinedSwitches[0] != Arg::flagStartString()[0] )
return false;
// make sure it isn't a long name
if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
Arg::nameStartString() )
return false;
// make sure the delimiter isn't in the string
if ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos )
return false;
// ok, we're not specifying a ValueArg, so we know that we have
// a combined switch list.
for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
if ( _flag.length() > 0 &&
combinedSwitches[i] == _flag[0] &&
_flag[0] != Arg::flagStartString()[0] )
{
// update the combined switches so this one is no longer present
// this is necessary so that no unlabeled args are matched
// later in the processing.
//combinedSwitches.erase(i,1);
combinedSwitches[i] = Arg::blankChar();
return true;
}
// none of the switches passed in the list match.
return false;
}
inline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( argMatches( args[*i] ) || combinedSwitchesMatch( args[*i] ) )
{
// If we match on a combined switch, then we want to return false
// so that other switches in the combination will also have a
// chance to match.
bool ret = false;
if ( argMatches( args[*i] ) )
ret = true;
if ( _alreadySet || ( !ret && combinedSwitchesMatch( args[*i] ) ) )
throw(CmdLineParseException("Argument already set!", toString()));
_alreadySet = true;
if ( _value == true )
_value = false;
else
_value = true;
_checkWithVisitor();
return ret;
}
else
return false;
}
inline void SwitchArg::reset()
{
Arg::reset();
_value = _default;
}
//////////////////////////////////////////////////////////////////////
//End SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,301 @@
/******************************************************************************
*
* file: UnlabeledMultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/MultiArg.h>
#include <tclap/OptionalUnlabeledTracker.h>
namespace TCLAP {
/**
* Just like a MultiArg, except that the arguments are unlabeled. Basically,
* this Arg will slurp up everything that hasn't been matched to another
* Arg.
*/
template<class T>
class UnlabeledMultiArg : public MultiArg<T>
{
// If compiler has two stage name lookup (as gcc >= 3.4 does)
// this is requried to prevent undef. symbols
using MultiArg<T>::_ignoreable;
using MultiArg<T>::_hasBlanks;
using MultiArg<T>::_extractValue;
using MultiArg<T>::_typeDesc;
using MultiArg<T>::_name;
using MultiArg<T>::_description;
using MultiArg<T>::_alreadySet;
using MultiArg<T>::toString;
public:
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns the a short id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Returns the a long id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Opertor ==.
* \param a - The Arg to be compared to this.
*/
virtual bool operator==(const Arg& a) const;
/**
* Pushes this to back of list rather than front.
* \param argList - The list this should be added to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
};
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
parser.add( this );
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
parser.add( this );
}
template<class T>
bool UnlabeledMultiArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _hasBlanks( args[*i] ) )
return false;
// never ignore an unlabeled multi arg
// always take the first value, regardless of the start string
_extractValue( args[(*i)] );
/*
// continue taking args until we hit the end or a start string
while ( (unsigned int)(*i)+1 < args.size() &&
args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
_extractValue( args[++(*i)] );
*/
_alreadySet = true;
return true;
}
template<class T>
std::string UnlabeledMultiArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + "> ...";
}
template<class T>
std::string UnlabeledMultiArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + "> (accepted multiple times)";
}
template<class T>
bool UnlabeledMultiArg<T>::operator==(const Arg& a) const
{
if ( _name == a.getName() || _description == a.getDescription() )
return true;
else
return false;
}
template<class T>
void UnlabeledMultiArg<T>::addToList( std::list<Arg*>& argList ) const
{
argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
}
}
#endif

@ -0,0 +1,340 @@
/******************************************************************************
*
* file: UnlabeledValueArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H
#define TCLAP_UNLABELED_VALUE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/ValueArg.h>
#include <tclap/OptionalUnlabeledTracker.h>
namespace TCLAP {
/**
* The basic unlabeled argument that parses a value.
* This is a template class, which means the type T defines the type
* that a given object will attempt to parse when an UnlabeledValueArg
* is reached in the list of args that the CmdLine iterates over.
*/
template<class T>
class UnlabeledValueArg : public ValueArg<T>
{
// If compiler has two stage name lookup (as gcc >= 3.4 does)
// this is requried to prevent undef. symbols
using ValueArg<T>::_ignoreable;
using ValueArg<T>::_hasBlanks;
using ValueArg<T>::_extractValue;
using ValueArg<T>::_typeDesc;
using ValueArg<T>::_name;
using ValueArg<T>::_description;
using ValueArg<T>::_alreadySet;
using ValueArg<T>::toString;
public:
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
bool ignoreable = false,
Visitor* v = NULL);
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
bool ignoreable = false,
Visitor* v = NULL );
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. Handling specific to
* unlabled arguments.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings.
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Overrides shortID for specific behavior.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Overrides longID for specific behavior.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Overrides operator== for specific behavior.
*/
virtual bool operator==(const Arg& a ) const;
/**
* Instead of pushing to the front of list, push to the back.
* \param argList - The list to add this to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
};
/**
* Constructor implemenation.
*/
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
}
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
parser.add( this );
}
/**
* Constructor implemenation.
*/
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
}
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
parser.add( this );
}
/**
* Implementation of processArg().
*/
template<class T>
bool UnlabeledValueArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _alreadySet )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
// never ignore an unlabeled arg
_extractValue( args[*i] );
_alreadySet = true;
return true;
}
/**
* Overriding shortID for specific output.
*/
template<class T>
std::string UnlabeledValueArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + ">";
}
/**
* Overriding longID for specific output.
*/
template<class T>
std::string UnlabeledValueArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
// Ideally we would like to be able to use RTTI to return the name
// of the type required for this argument. However, g++ at least,
// doesn't appear to return terribly useful "names" of the types.
return std::string("<") + _typeDesc + ">";
}
/**
* Overriding operator== for specific behavior.
*/
template<class T>
bool UnlabeledValueArg<T>::operator==(const Arg& a ) const
{
if ( _name == a.getName() || _description == a.getDescription() )
return true;
else
return false;
}
template<class T>
void UnlabeledValueArg<T>::addToList( std::list<Arg*>& argList ) const
{
argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
}
}
#endif

@ -0,0 +1,411 @@
/******************************************************************************
*
* file: ValueArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VALUE_ARGUMENT_H
#define TCLAP_VALUE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
#include <tclap/Constraint.h>
namespace TCLAP {
/**
* The basic labeled argument that parses a value.
* This is a template class, which means the type T defines the type
* that a given object will attempt to parse when the flag/name is matched
* on the command line. While there is nothing stopping you from creating
* an unflagged ValueArg, it is unwise and would cause significant problems.
* Instead use an UnlabeledValueArg.
*/
template<class T>
class ValueArg : public Arg
{
protected:
/**
* The value parsed from the command line.
* Can be of any type, as long as the >> operator for the type
* is defined.
*/
T _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
T _default;
/**
* A human readable description of the type to be parsed.
* This is a hack, plain and simple. Ideally we would use RTTI to
* return the name of type T, but until there is some sort of
* consistent support for human readable names, we are left to our
* own devices.
*/
std::string _typeDesc;
/**
* A Constraint this Arg must conform to.
*/
Constraint<T>* _constraint;
/**
* Extracts the value from the string.
* Attempts to parse string as type T, if this fails an exception
* is thrown.
* \param val - value to be parsed.
*/
void _extractValue( const std::string& val );
public:
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
Visitor* v = NULL);
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns the value of the argument.
*/
T& getValue() ;
/**
* Specialization of shortID.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val = "val") const;
/**
* Specialization of longID.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val = "val") const;
virtual void reset() ;
};
/**
* Constructor implementation.
*/
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( typeDesc ),
_constraint( NULL )
{ }
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( typeDesc ),
_constraint( NULL )
{
parser.add( this );
}
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint )
{ }
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint )
{
parser.add( this );
}
/**
* Implementation of getValue().
*/
template<class T>
T& ValueArg<T>::getValue() { return _value; }
/**
* Implementation of processArg().
*/
template<class T>
bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
std::string flag = args[*i];
std::string value = "";
trimFlag( flag, value );
if ( argMatches( flag ) )
{
if ( _alreadySet )
throw( CmdLineParseException("Argument already set!", toString()) );
if ( Arg::delimiter() != ' ' && value == "" )
throw( ArgParseException(
"Couldn't find delimiter for this argument!",
toString() ) );
if ( value == "" )
{
(*i)++;
if ( static_cast<unsigned int>(*i) < args.size() )
_extractValue( args[*i] );
else
throw( ArgParseException("Missing a value for this argument!",
toString() ) );
}
else
_extractValue( value );
_alreadySet = true;
_checkWithVisitor();
return true;
}
else
return false;
}
/**
* Implementation of shortID.
*/
template<class T>
std::string ValueArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::shortID( _typeDesc );
}
/**
* Implementation of longID.
*/
template<class T>
std::string ValueArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::longID( _typeDesc );
}
template<class T>
void ValueArg<T>::_extractValue( const std::string& val )
{
try {
ExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());
} catch( ArgParseException &e) {
throw ArgParseException(e.error(), toString());
}
if ( _constraint != NULL )
if ( ! _constraint->check( _value ) )
throw( CmdLineParseException( "Value '" + val +
+ "' does not meet constraint: "
+ _constraint->description(),
toString() ) );
}
template<class T>
void ValueArg<T>::reset()
{
Arg::reset();
_value = _default;
}
} // namespace TCLAP
#endif

@ -0,0 +1,147 @@
/******************************************************************************
*
* file: ValuesConstraint.h
*
* Copyright (c) 2005, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VALUESCONSTRAINT_H
#define TCLAP_VALUESCONSTRAINT_H
#include <string>
#include <vector>
#include <tclap/Constraint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#define HAVE_SSTREAM
#endif
#if defined(HAVE_SSTREAM)
#include <sstream>
#elif defined(HAVE_STRSTREAM)
#include <strstream>
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
namespace TCLAP {
/**
* A Constraint that constrains the Arg to only those values specified
* in the constraint.
*/
template<class T>
class ValuesConstraint : public Constraint<T>
{
public:
/**
* Constructor.
* \param allowed - vector of allowed values.
*/
ValuesConstraint(std::vector<T>& allowed);
/**
* Virtual destructor.
*/
virtual ~ValuesConstraint() {}
/**
* Returns a description of the Constraint.
*/
virtual std::string description() const;
/**
* Returns the short ID for the Constraint.
*/
virtual std::string shortID() const;
/**
* The method used to verify that the value parsed from the command
* line meets the constraint.
* \param value - The value that will be checked.
*/
virtual bool check(const T& value) const;
protected:
/**
* The list of valid values.
*/
std::vector<T> _allowed;
/**
* The string used to describe the allowed values of this constraint.
*/
std::string _typeDesc;
};
template<class T>
ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)
: _allowed(allowed)
{
for ( unsigned int i = 0; i < _allowed.size(); i++ )
{
#if defined(HAVE_SSTREAM)
std::ostringstream os;
#elif defined(HAVE_STRSTREAM)
std::ostrstream os;
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
os << _allowed[i];
std::string temp( os.str() );
if ( i > 0 )
_typeDesc += "|";
_typeDesc += temp;
}
}
template<class T>
bool ValuesConstraint<T>::check( const T& val ) const
{
if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )
return false;
else
return true;
}
template<class T>
std::string ValuesConstraint<T>::shortID() const
{
return _typeDesc;
}
template<class T>
std::string ValuesConstraint<T>::description() const
{
return _typeDesc;
}
} //namespace TCLAP
#endif

@ -0,0 +1,74 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: VersionVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VERSION_VISITOR_H
#define TCLAP_VERSION_VISITOR_H
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h>
namespace TCLAP {
/**
* A Vistor that will call the version method of the given CmdLineOutput
* for the specified CmdLine object and then exit.
*/
class VersionVisitor: public Visitor
{
protected:
/**
* The CmdLine of interest.
*/
CmdLineInterface* _cmd;
/**
* The output object.
*/
CmdLineOutput** _out;
public:
/**
* Constructor.
* \param cmd - The CmdLine the output is generated for.
* \param out - The type of output.
*/
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out )
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the version method of the output object using the
* specified CmdLine.
*/
void visit() {
(*_out)->version(*_cmd);
throw ExitException(0);
}
};
}
#endif

@ -0,0 +1,53 @@
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Destructor. Does nothing.
*/
virtual ~Visitor() { }
/**
* Does nothing. Should be overridden by child.
*/
virtual void visit() { }
};
}
#endif

@ -0,0 +1,156 @@
/******************************************************************************
*
* file: XorHandler.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_XORHANDLER_H
#define TCLAP_XORHANDLER_H
#include <tclap/Arg.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
namespace TCLAP {
/**
* This class handles lists of Arg's that are to be XOR'd on the command
* line. This is used by CmdLine and you shouldn't ever use it.
*/
class XorHandler
{
protected:
/**
* The list of of lists of Arg's to be or'd together.
*/
std::vector< std::vector<Arg*> > _orList;
public:
/**
* Constructor. Does nothing.
*/
XorHandler( ) {}
/**
* Add a list of Arg*'s that will be orred together.
* \param ors - list of Arg* that will be xor'd.
*/
void add( std::vector<Arg*>& ors );
/**
* Checks whether the specified Arg is in one of the xor lists and
* if it does match one, returns the size of the xor list that the
* Arg matched. If the Arg matches, then it also sets the rest of
* the Arg's in the list. You shouldn't use this.
* \param a - The Arg to be checked.
*/
int check( const Arg* a );
/**
* Returns the XOR specific short usage.
*/
std::string shortUsage();
/**
* Prints the XOR specific long usage.
* \param os - Stream to print to.
*/
void printLongUsage(std::ostream& os);
/**
* Simply checks whether the Arg is contained in one of the arg
* lists.
* \param a - The Arg to be checked.
*/
bool contains( const Arg* a );
std::vector< std::vector<Arg*> >& getXorList();
};
//////////////////////////////////////////////////////////////////////
//BEGIN XOR.cpp
//////////////////////////////////////////////////////////////////////
inline void XorHandler::add( std::vector<Arg*>& ors )
{
_orList.push_back( ors );
}
inline int XorHandler::check( const Arg* a )
{
// iterate over each XOR list
for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
{
// if the XOR list contains the arg..
ArgVectorIterator ait = std::find( _orList[i].begin(),
_orList[i].end(), a );
if ( ait != _orList[i].end() )
{
// go through and set each arg that is not a
for ( ArgVectorIterator it = _orList[i].begin();
it != _orList[i].end();
it++ )
if ( a != (*it) )
(*it)->xorSet();
// return the number of required args that have now been set
if ( (*ait)->allowMore() )
return 0;
else
return static_cast<int>(_orList[i].size());
}
}
if ( a->isRequired() )
return 1;
else
return 0;
}
inline bool XorHandler::contains( const Arg* a )
{
for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
for ( ArgVectorIterator it = _orList[i].begin();
it != _orList[i].end();
it++ )
if ( a == (*it) )
return true;
return false;
}
inline std::vector< std::vector<Arg*> >& XorHandler::getXorList()
{
return _orList;
}
//////////////////////////////////////////////////////////////////////
//END XOR.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,321 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ZshCompletionOutput.h
*
* Copyright (c) 2006, Oliver Kiddle
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H
#define TCLAP_ZSHCOMPLETIONOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <map>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that generates a Zsh completion function as output from the usage()
* method for the given CmdLine and its Args.
*/
class ZshCompletionOutput : public CmdLineOutput
{
public:
ZshCompletionOutput();
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
void basename( std::string& s );
void quoteSpecialChars( std::string& s );
std::string getMutexList( CmdLineInterface& _cmd, Arg* a );
void printOption( Arg* it, std::string mutex );
void printArg( Arg* it );
std::map<std::string, std::string> common;
char theDelimiter;
};
ZshCompletionOutput::ZshCompletionOutput()
{
common["host"] = "_hosts";
common["hostname"] = "_hosts";
common["file"] = "_files";
common["filename"] = "_files";
common["user"] = "_users";
common["username"] = "_users";
common["directory"] = "_directories";
common["path"] = "_directories";
common["url"] = "_urls";
}
inline void ZshCompletionOutput::version(CmdLineInterface& _cmd)
{
std::cout << _cmd.getVersion() << std::endl;
}
inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd )
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
theDelimiter = _cmd.getDelimiter();
basename(progName);
std::cout << "#compdef " << progName << std::endl << std::endl <<
"# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl <<
"_arguments -s -S";
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
{
if ( (*it)->shortID().at(0) == '<' )
printArg((*it));
else if ( (*it)->getFlag() != "-" )
printOption((*it), getMutexList(_cmd, *it));
}
std::cout << std::endl;
}
inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
static_cast<void>(_cmd); // unused
std::cout << e.what() << std::endl;
}
inline void ZshCompletionOutput::quoteSpecialChars( std::string& s )
{
size_t idx = s.find_last_of(':');
while ( idx != std::string::npos )
{
s.insert(idx, 1, '\\');
idx = s.find_last_of(':', idx);
}
idx = s.find_last_of('\'');
while ( idx != std::string::npos )
{
s.insert(idx, "'\\'");
if (idx == 0)
idx = std::string::npos;
else
idx = s.find_last_of('\'', --idx);
}
}
inline void ZshCompletionOutput::basename( std::string& s )
{
size_t p = s.find_last_of('/');
if ( p != std::string::npos )
{
s.erase(0, p + 1);
}
}
inline void ZshCompletionOutput::printArg(Arg* a)
{
static int count = 1;
std::cout << " \\" << std::endl << " '";
if ( a->acceptsMultipleValues() )
std::cout << '*';
else
std::cout << count++;
std::cout << ':';
if ( !a->isRequired() )
std::cout << ':';
std::cout << a->getName() << ':';
std::map<std::string, std::string>::iterator compArg = common.find(a->getName());
if ( compArg != common.end() )
{
std::cout << compArg->second;
}
else
{
std::cout << "_guard \"^-*\" " << a->getName();
}
std::cout << '\'';
}
inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex)
{
std::string flag = a->flagStartChar() + a->getFlag();
std::string name = a->nameStartString() + a->getName();
std::string desc = a->getDescription();
// remove full stop and capitalisation from description as
// this is the convention for zsh function
if (!desc.compare(0, 12, "(required) "))
{
desc.erase(0, 12);
}
if (!desc.compare(0, 15, "(OR required) "))
{
desc.erase(0, 15);
}
size_t len = desc.length();
if (len && desc.at(--len) == '.')
{
desc.erase(len);
}
if (len)
{
desc.replace(0, 1, 1, tolower(desc.at(0)));
}
std::cout << " \\" << std::endl << " '" << mutex;
if ( a->getFlag().empty() )
{
std::cout << name;
}
else
{
std::cout << "'{" << flag << ',' << name << "}'";
}
if ( theDelimiter == '=' && a->isValueRequired() )
std::cout << "=-";
quoteSpecialChars(desc);
std::cout << '[' << desc << ']';
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
if ( arg.at(arg.length()-1) == ']' )
arg.erase(arg.length()-1);
if ( arg.at(arg.length()-1) == ']' )
{
arg.erase(arg.length()-1);
}
if ( arg.at(0) == '<' )
{
arg.erase(arg.length()-1);
arg.erase(0, 1);
}
size_t p = arg.find('|');
if ( p != std::string::npos )
{
do
{
arg.replace(p, 1, 1, ' ');
}
while ( (p = arg.find_first_of('|', p)) != std::string::npos );
quoteSpecialChars(arg);
std::cout << ": :(" << arg << ')';
}
else
{
std::cout << ':' << arg;
std::map<std::string, std::string>::iterator compArg = common.find(arg);
if ( compArg != common.end() )
{
std::cout << ':' << compArg->second;
}
}
}
std::cout << '\'';
}
inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a)
{
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
if (a->getName() == "help" || a->getName() == "version")
{
return "(-)";
}
std::ostringstream list;
if ( a->acceptsMultipleValues() )
{
list << '*';
}
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end();
it++)
if ( a == (*it) )
{
list << '(';
for ( ArgVectorIterator iu = xorList[i].begin();
iu != xorList[i].end();
iu++ )
{
bool notCur = (*iu) != a;
bool hasFlag = !(*iu)->getFlag().empty();
if ( iu != xorList[i].begin() && (notCur || hasFlag) )
list << ' ';
if (hasFlag)
list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' ';
if ( notCur || hasFlag )
list << (*iu)->nameStartString() << (*iu)->getName();
}
list << ')';
return list.str();
}
}
// wasn't found in xor list
if (!a->getFlag().empty()) {
list << "(" << a->flagStartChar() << a->getFlag() << ' ' <<
a->nameStartString() << a->getName() << ')';
}
return list.str();
}
} //namespace TCLAP
#endif

@ -0,0 +1,672 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: Arg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ARGUMENT_H
#define TCLAP_ARGUMENT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#define HAVE_SSTREAM
#endif
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <cstdio>
#if defined(HAVE_SSTREAM)
#include <sstream>
typedef std::istringstream istringstream;
#elif defined(HAVE_STRSTREAM)
#include <strstream>
typedef std::istrstream istringstream;
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
#include <tclap/ArgException.h>
#include <tclap/Visitor.h>
#include <tclap/CmdLineInterface.h>
#include <tclap/ArgTraits.h>
#include <tclap/StandardTraits.h>
namespace TCLAP {
/**
* A virtual base class that defines the essential data for all arguments.
* This class, or one of its existing children, must be subclassed to do
* anything.
*/
class Arg
{
private:
/**
* Indicates whether the rest of the arguments should be ignored.
*/
static bool& ignoreRestRef() { static bool ign = false; return ign; }
/**
* The delimiter that separates an argument flag/name from the
* value.
*/
static char& delimiterRef() { static char delim = ' '; return delim; }
protected:
/**
* The single char flag used to identify the argument.
* This value (preceded by a dash {-}), can be used to identify
* an argument on the command line. The _flag can be blank,
* in fact this is how unlabeled args work. Unlabeled args must
* override appropriate functions to get correct handling. Note
* that the _flag does NOT include the dash as part of the flag.
*/
std::string _flag;
/**
* A single work namd indentifying the argument.
* This value (preceded by two dashed {--}) can also be used
* to identify an argument on the command line. Note that the
* _name does NOT include the two dashes as part of the _name. The
* _name cannot be blank.
*/
std::string _name;
/**
* Description of the argument.
*/
std::string _description;
/**
* Indicating whether the argument is required.
*/
bool _required;
/**
* Label to be used in usage description. Normally set to
* "required", but can be changed when necessary.
*/
std::string _requireLabel;
/**
* Indicates whether a value is required for the argument.
* Note that the value may be required but the argument/value
* combination may not be, as specified by _required.
*/
bool _valueRequired;
/**
* Indicates whether the argument has been set.
* Indicates that a value on the command line has matched the
* name/flag of this argument and the values have been set accordingly.
*/
bool _alreadySet;
/**
* A pointer to a vistitor object.
* The visitor allows special handling to occur as soon as the
* argument is matched. This defaults to NULL and should not
* be used unless absolutely necessary.
*/
Visitor* _visitor;
/**
* Whether this argument can be ignored, if desired.
*/
bool _ignoreable;
/**
* Indicates that the arg was set as part of an XOR and not on the
* command line.
*/
bool _xorSet;
bool _acceptsMultipleValues;
/**
* Performs the special handling described by the Vistitor.
*/
void _checkWithVisitor() const;
/**
* Primary constructor. YOU (yes you) should NEVER construct an Arg
* directly, this is a base class that is extended by various children
* that are meant to be used. Use SwitchArg, ValueArg, MultiArg,
* UnlabeledValueArg, or UnlabeledMultiArg instead.
*
* \param flag - The flag identifying the argument.
* \param name - The name identifying the argument.
* \param desc - The description of the argument, used in the usage.
* \param req - Whether the argument is required.
* \param valreq - Whether the a value is required for the argument.
* \param v - The visitor checked by the argument. Defaults to NULL.
*/
Arg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
bool valreq,
Visitor* v = NULL );
public:
/**
* Destructor.
*/
virtual ~Arg();
/**
* Adds this to the specified list of Args.
* \param argList - The list to add this to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
/**
* Begin ignoring arguments since the "--" argument was specified.
*/
static void beginIgnoring() { ignoreRestRef() = true; }
/**
* Whether to ignore the rest.
*/
static bool ignoreRest() { return ignoreRestRef(); }
/**
* The delimiter that separates an argument flag/name from the
* value.
*/
static char delimiter() { return delimiterRef(); }
/**
* The char used as a place holder when SwitchArgs are combined.
* Currently set to the bell char (ASCII 7).
*/
static char blankChar() { return (char)7; }
/**
* The char that indicates the beginning of a flag. Currently '-'.
*/
static char flagStartChar() { return '-'; }
/**
* The sting that indicates the beginning of a flag. Currently "-".
* Should be identical to flagStartChar.
*/
static const std::string flagStartString() { return "-"; }
/**
* The sting that indicates the beginning of a name. Currently "--".
* Should be flagStartChar twice.
*/
static const std::string nameStartString() { return "--"; }
/**
* The name used to identify the ignore rest argument.
*/
static const std::string ignoreNameString() { return "ignore_rest"; }
/**
* Sets the delimiter for all arguments.
* \param c - The character that delimits flags/names from values.
*/
static void setDelimiter( char c ) { delimiterRef() = c; }
/**
* Pure virtual method meant to handle the parsing and value assignment
* of the string on the command line.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. What is
* passed in from main.
*/
virtual bool processArg(int *i, std::vector<std::string>& args) = 0;
/**
* Operator ==.
* Equality operator. Must be virtual to handle unlabeled args.
* \param a - The Arg to be compared to this.
*/
virtual bool operator==(const Arg& a) const;
/**
* Returns the argument flag.
*/
const std::string& getFlag() const;
/**
* Returns the argument name.
*/
const std::string& getName() const;
/**
* Returns the argument description.
*/
std::string getDescription() const;
/**
* Indicates whether the argument is required.
*/
virtual bool isRequired() const;
/**
* Sets _required to true. This is used by the XorHandler.
* You really have no reason to ever use it.
*/
void forceRequired();
/**
* Sets the _alreadySet value to true. This is used by the XorHandler.
* You really have no reason to ever use it.
*/
void xorSet();
/**
* Indicates whether a value must be specified for argument.
*/
bool isValueRequired() const;
/**
* Indicates whether the argument has already been set. Only true
* if the arg has been matched on the command line.
*/
bool isSet() const;
/**
* Indicates whether the argument can be ignored, if desired.
*/
bool isIgnoreable() const;
/**
* A method that tests whether a string matches this argument.
* This is generally called by the processArg() method. This
* method could be re-implemented by a child to change how
* arguments are specified on the command line.
* \param s - The string to be compared to the flag/name to determine
* whether the arg matches.
*/
virtual bool argMatches( const std::string& s ) const;
/**
* Returns a simple string representation of the argument.
* Primarily for debugging.
*/
virtual std::string toString() const;
/**
* Returns a short ID for the usage.
* \param valueId - The value used in the id.
*/
virtual std::string shortID( const std::string& valueId = "val" ) const;
/**
* Returns a long ID for the usage.
* \param valueId - The value used in the id.
*/
virtual std::string longID( const std::string& valueId = "val" ) const;
/**
* Trims a value off of the flag.
* \param flag - The string from which the flag and value will be
* trimmed. Contains the flag once the value has been trimmed.
* \param value - Where the value trimmed from the string will
* be stored.
*/
virtual void trimFlag( std::string& flag, std::string& value ) const;
/**
* Checks whether a given string has blank chars, indicating that
* it is a combined SwitchArg. If so, return true, otherwise return
* false.
* \param s - string to be checked.
*/
bool _hasBlanks( const std::string& s ) const;
/**
* Sets the requireLabel. Used by XorHandler. You shouldn't ever
* use this.
* \param s - Set the requireLabel to this value.
*/
void setRequireLabel( const std::string& s );
/**
* Used for MultiArgs and XorHandler to determine whether args
* can still be set.
*/
virtual bool allowMore();
/**
* Use by output classes to determine whether an Arg accepts
* multiple values.
*/
virtual bool acceptsMultipleValues();
/**
* Clears the Arg object and allows it to be reused by new
* command lines.
*/
virtual void reset();
};
/**
* Typedef of an Arg list iterator.
*/
typedef std::list<Arg*>::iterator ArgListIterator;
/**
* Typedef of an Arg vector iterator.
*/
typedef std::vector<Arg*>::iterator ArgVectorIterator;
/**
* Typedef of a Visitor list iterator.
*/
typedef std::list<Visitor*>::iterator VisitorListIterator;
/*
* Extract a value of type T from it's string representation contained
* in strVal. The ValueLike parameter used to select the correct
* specialization of ExtractValue depending on the value traits of T.
* ValueLike traits use operator>> to assign the value from strVal.
*/
template<typename T> void
ExtractValue(T &destVal, const std::string& strVal, ValueLike vl)
{
static_cast<void>(vl); // Avoid warning about unused vl
std::istringstream is(strVal);
int valuesRead = 0;
while ( is.good() ) {
if ( is.peek() != EOF )
#ifdef TCLAP_SETBASE_ZERO
is >> std::setbase(0) >> destVal;
#else
is >> destVal;
#endif
else
break;
valuesRead++;
}
if ( is.fail() )
throw( ArgParseException("Couldn't read argument value "
"from string '" + strVal + "'"));
if ( valuesRead > 1 )
throw( ArgParseException("More than one valid value parsed from "
"string '" + strVal + "'"));
}
/*
* Extract a value of type T from it's string representation contained
* in strVal. The ValueLike parameter used to select the correct
* specialization of ExtractValue depending on the value traits of T.
* StringLike uses assignment (operator=) to assign from strVal.
*/
template<typename T> void
ExtractValue(T &destVal, const std::string& strVal, StringLike sl)
{
static_cast<void>(sl); // Avoid warning about unused sl
SetString(destVal, strVal);
}
//////////////////////////////////////////////////////////////////////
//BEGIN Arg.cpp
//////////////////////////////////////////////////////////////////////
inline Arg::Arg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
bool valreq,
Visitor* v) :
_flag(flag),
_name(name),
_description(desc),
_required(req),
_requireLabel("required"),
_valueRequired(valreq),
_alreadySet(false),
_visitor( v ),
_ignoreable(true),
_xorSet(false),
_acceptsMultipleValues(false)
{
if ( _flag.length() > 1 )
throw(SpecificationException(
"Argument flag can only be one character long", toString() ) );
if ( _name != ignoreNameString() &&
( _flag == Arg::flagStartString() ||
_flag == Arg::nameStartString() ||
_flag == " " ) )
throw(SpecificationException("Argument flag cannot be either '" +
Arg::flagStartString() + "' or '" +
Arg::nameStartString() + "' or a space.",
toString() ) );
if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) ||
( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) ||
( _name.find( " ", 0 ) != std::string::npos ) )
throw(SpecificationException("Argument name begin with either '" +
Arg::flagStartString() + "' or '" +
Arg::nameStartString() + "' or space.",
toString() ) );
}
inline Arg::~Arg() { }
inline std::string Arg::shortID( const std::string& valueId ) const
{
std::string id = "";
if ( _flag != "" )
id = Arg::flagStartString() + _flag;
else
id = Arg::nameStartString() + _name;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
if ( !_required )
id = "[" + id + "]";
return id;
}
inline std::string Arg::longID( const std::string& valueId ) const
{
std::string id = "";
if ( _flag != "" )
{
id += Arg::flagStartString() + _flag;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
id += ", ";
}
id += Arg::nameStartString() + _name;
if ( _valueRequired )
id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
return id;
}
inline bool Arg::operator==(const Arg& a) const
{
if ( ( _flag != "" && _flag == a._flag ) || _name == a._name)
return true;
else
return false;
}
inline std::string Arg::getDescription() const
{
std::string desc = "";
if ( _required )
desc = "(" + _requireLabel + ") ";
// if ( _valueRequired )
// desc += "(value required) ";
desc += _description;
return desc;
}
inline const std::string& Arg::getFlag() const { return _flag; }
inline const std::string& Arg::getName() const { return _name; }
inline bool Arg::isRequired() const { return _required; }
inline bool Arg::isValueRequired() const { return _valueRequired; }
inline bool Arg::isSet() const
{
if ( _alreadySet && !_xorSet )
return true;
else
return false;
}
inline bool Arg::isIgnoreable() const { return _ignoreable; }
inline void Arg::setRequireLabel( const std::string& s)
{
_requireLabel = s;
}
inline bool Arg::argMatches( const std::string& argFlag ) const
{
if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) ||
argFlag == Arg::nameStartString() + _name )
return true;
else
return false;
}
inline std::string Arg::toString() const
{
std::string s = "";
if ( _flag != "" )
s += Arg::flagStartString() + _flag + " ";
s += "(" + Arg::nameStartString() + _name + ")";
return s;
}
inline void Arg::_checkWithVisitor() const
{
if ( _visitor != NULL )
_visitor->visit();
}
/**
* Implementation of trimFlag.
*/
inline void Arg::trimFlag(std::string& flag, std::string& value) const
{
int stop = 0;
for ( int i = 0; static_cast<unsigned int>(i) < flag.length(); i++ )
if ( flag[i] == Arg::delimiter() )
{
stop = i;
break;
}
if ( stop > 1 )
{
value = flag.substr(stop+1);
flag = flag.substr(0,stop);
}
}
/**
* Implementation of _hasBlanks.
*/
inline bool Arg::_hasBlanks( const std::string& s ) const
{
for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
if ( s[i] == Arg::blankChar() )
return true;
return false;
}
inline void Arg::forceRequired()
{
_required = true;
}
inline void Arg::xorSet()
{
_alreadySet = true;
_xorSet = true;
}
/**
* Overridden by Args that need to added to the end of the list.
*/
inline void Arg::addToList( std::list<Arg*>& argList ) const
{
argList.push_front( const_cast<Arg*>(this) );
}
inline bool Arg::allowMore()
{
return false;
}
inline bool Arg::acceptsMultipleValues()
{
return _acceptsMultipleValues;
}
inline void Arg::reset()
{
_xorSet = false;
_alreadySet = false;
}
//////////////////////////////////////////////////////////////////////
//END Arg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,200 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ArgException.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ARG_EXCEPTION_H
#define TCLAP_ARG_EXCEPTION_H
#include <string>
#include <exception>
namespace TCLAP {
/**
* A simple class that defines and argument exception. Should be caught
* whenever a CmdLine is created and parsed.
*/
class ArgException : public std::exception
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source.
* \param td - Text describing the type of ArgException it is.
* of the exception.
*/
ArgException( const std::string& text = "undefined exception",
const std::string& id = "undefined",
const std::string& td = "Generic ArgException")
: std::exception(),
_errorText(text),
_argId( id ),
_typeDescription(td)
{ }
/**
* Destructor.
*/
virtual ~ArgException() throw() { }
/**
* Returns the error text.
*/
std::string error() const { return ( _errorText ); }
/**
* Returns the argument id.
*/
std::string argId() const
{
if ( _argId == "undefined" )
return " ";
else
return ( "Argument: " + _argId );
}
/**
* Returns the arg id and error text.
*/
const char* what() const throw()
{
static std::string ex;
ex = _argId + " -- " + _errorText;
return ex.c_str();
}
/**
* Returns the type of the exception. Used to explain and distinguish
* between different child exceptions.
*/
std::string typeDescription() const
{
return _typeDescription;
}
private:
/**
* The text of the exception message.
*/
std::string _errorText;
/**
* The argument related to this exception.
*/
std::string _argId;
/**
* Describes the type of the exception. Used to distinguish
* between different child exceptions.
*/
std::string _typeDescription;
};
/**
* Thrown from within the child Arg classes when it fails to properly
* parse the argument it has been passed.
*/
class ArgParseException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
ArgParseException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string( "Exception found while parsing " ) +
std::string( "the value the Arg has been passed." ))
{ }
};
/**
* Thrown from CmdLine when the arguments on the command line are not
* properly specified, e.g. too many arguments, required argument missing, etc.
*/
class CmdLineParseException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
CmdLineParseException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string( "Exception found when the values ") +
std::string( "on the command line do not meet ") +
std::string( "the requirements of the defined ") +
std::string( "Args." ))
{ }
};
/**
* Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
* same flag as another Arg, same name, etc.
*/
class SpecificationException : public ArgException
{
public:
/**
* Constructor.
* \param text - The text of the exception.
* \param id - The text identifying the argument source
* of the exception.
*/
SpecificationException( const std::string& text = "undefined exception",
const std::string& id = "undefined" )
: ArgException( text,
id,
std::string("Exception found when an Arg object ")+
std::string("is improperly defined by the ") +
std::string("developer." ))
{ }
};
class ExitException {
public:
ExitException(int estat) : _estat(estat) {}
int getExitStatus() const { return _estat; }
private:
int _estat;
};
} // namespace TCLAP
#endif

@ -0,0 +1,81 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ArgTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
// This is an internal tclap file, you should probably not have to
// include this directly
#ifndef TCLAP_ARGTRAITS_H
#define TCLAP_ARGTRAITS_H
namespace TCLAP {
// We use two empty structs to get compile type specialization
// function to work
/**
* A value like argument value type is a value that can be set using
* operator>>. This is the default value type.
*/
struct ValueLike {
typedef ValueLike ValueCategory;
};
/**
* A string like argument value type is a value that can be set using
* operator=(string). Usefull if the value type contains spaces which
* will be broken up into individual tokens by operator>>.
*/
struct StringLike {};
/**
* A class can inherit from this object to make it have string like
* traits. This is a compile time thing and does not add any overhead
* to the inherenting class.
*/
struct StringLikeTrait {
typedef StringLike ValueCategory;
};
/**
* A class can inherit from this object to make it have value like
* traits. This is a compile time thing and does not add any overhead
* to the inherenting class.
*/
struct ValueLikeTrait {
typedef ValueLike ValueCategory;
};
/**
* Arg traits are used to get compile type specialization when parsing
* argument values. Using an ArgTraits you can specify the way that
* values gets assigned to any particular type during parsing. The two
* supported types are string like and value like.
*/
template<typename T>
struct ArgTraits {
typedef typename T::ValueCategory ValueCategory;
//typedef ValueLike ValueCategory;
};
#endif
} // namespace

@ -0,0 +1,621 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: CmdLine.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CMDLINE_H
#define TCLAP_CMDLINE_H
#include <tclap/SwitchArg.h>
#include <tclap/MultiSwitchArg.h>
#include <tclap/UnlabeledValueArg.h>
#include <tclap/UnlabeledMultiArg.h>
#include <tclap/XorHandler.h>
#include <tclap/HelpVisitor.h>
#include <tclap/VersionVisitor.h>
#include <tclap/IgnoreRestVisitor.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/StdOutput.h>
#include <tclap/Constraint.h>
#include <tclap/ValuesConstraint.h>
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.
namespace TCLAP {
template<typename T> void DelPtr(T ptr)
{
delete ptr;
}
template<typename C> void ClearContainer(C &c)
{
typedef typename C::value_type value_type;
std::for_each(c.begin(), c.end(), DelPtr<value_type>);
c.clear();
}
/**
* The base class that manages the command line definition and passes
* along the parsing to the appropriate Arg classes.
*/
class CmdLine : public CmdLineInterface
{
protected:
/**
* The list of arguments that will be tested against the
* command line.
*/
std::list<Arg*> _argList;
/**
* The name of the program. Set to argv[0].
*/
std::string _progName;
/**
* A message used to describe the program. Used in the usage output.
*/
std::string _message;
/**
* The version to be displayed with the --version switch.
*/
std::string _version;
/**
* The number of arguments that are required to be present on
* the command line. This is set dynamically, based on the
* Args added to the CmdLine object.
*/
int _numRequired;
/**
* The character that is used to separate the argument flag/name
* from the value. Defaults to ' ' (space).
*/
char _delimiter;
/**
* The handler that manages xoring lists of args.
*/
XorHandler _xorHandler;
/**
* A list of Args to be explicitly deleted when the destructor
* is called. At the moment, this only includes the three default
* Args.
*/
std::list<Arg*> _argDeleteOnExitList;
/**
* A list of Visitors to be explicitly deleted when the destructor
* is called. At the moment, these are the Vistors created for the
* default Args.
*/
std::list<Visitor*> _visitorDeleteOnExitList;
/**
* Object that handles all output for the CmdLine.
*/
CmdLineOutput* _output;
/**
* Should CmdLine handle parsing exceptions internally?
*/
bool _handleExceptions;
/**
* Throws an exception listing the missing args.
*/
void missingArgsException();
/**
* Checks whether a name/flag string matches entirely matches
* the Arg::blankChar. Used when multiple switches are combined
* into a single argument.
* \param s - The message to be used in the usage.
*/
bool _emptyCombined(const std::string& s);
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Arg* ptr);
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Visitor* ptr);
private:
/**
* Encapsulates the code common to the constructors
* (which is all of it).
*/
void _constructor();
/**
* Is set to true when a user sets the output object. We use this so
* that we don't delete objects that are created outside of this lib.
*/
bool _userSetOutput;
/**
* Whether or not to automatically create help and version switches.
*/
bool _helpAndVersion;
public:
/**
* Command line constructor. Defines how the arguments will be
* parsed.
* \param message - The message to be used in the usage
* output.
* \param delimiter - The character that is used to separate
* the argument flag/name from the value. Defaults to ' ' (space).
* \param version - The version number to be used in the
* --version switch.
* \param helpAndVersion - Whether or not to create the Help and
* Version switches. Defaults to true.
*/
CmdLine(const std::string& message,
const char delimiter = ' ',
const std::string& version = "none",
bool helpAndVersion = true);
/**
* Deletes any resources allocated by a CmdLine object.
*/
virtual ~CmdLine();
/**
* Adds an argument to the list of arguments to be parsed.
* \param a - Argument to be added.
*/
void add( Arg& a );
/**
* An alternative add. Functionally identical.
* \param a - Argument to be added.
*/
void add( Arg* a );
/**
* Add two Args that will be xor'd. If this method is used, add does
* not need to be called.
* \param a - Argument to be added and xor'd.
* \param b - Argument to be added and xor'd.
*/
void xorAdd( Arg& a, Arg& b );
/**
* Add a list of Args that will be xor'd. If this method is used,
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
void xorAdd( std::vector<Arg*>& xors );
/**
* Parses the command line.
* \param argc - Number of arguments.
* \param argv - Array of arguments.
*/
void parse(int argc, const char * const * argv);
/**
* Parses the command line.
* \param args - A vector of strings representing the args.
* args[0] is still the program name.
*/
void parse(std::vector<std::string>& args);
/**
*
*/
CmdLineOutput* getOutput();
/**
*
*/
void setOutput(CmdLineOutput* co);
/**
*
*/
std::string& getVersion();
/**
*
*/
std::string& getProgramName();
/**
*
*/
std::list<Arg*>& getArgList();
/**
*
*/
XorHandler& getXorHandler();
/**
*
*/
char getDelimiter();
/**
*
*/
std::string& getMessage();
/**
*
*/
bool hasHelpAndVersion();
/**
* Disables or enables CmdLine's internal parsing exception handling.
*
* @param state Should CmdLine handle parsing exceptions internally?
*/
void setExceptionHandling(const bool state);
/**
* Returns the current state of the internal exception handling.
*
* @retval true Parsing exceptions are handled internally.
* @retval false Parsing exceptions are propagated to the caller.
*/
bool getExceptionHandling() const;
/**
* Allows the CmdLine object to be reused.
*/
void reset();
};
///////////////////////////////////////////////////////////////////////////////
//Begin CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
inline CmdLine::CmdLine(const std::string& m,
char delim,
const std::string& v,
bool help )
: _progName("not_set_yet"),
_message(m),
_version(v),
_numRequired(0),
_delimiter(delim),
_handleExceptions(true),
_userSetOutput(false),
_helpAndVersion(help)
{
_constructor();
}
inline CmdLine::~CmdLine()
{
ClearContainer(_argDeleteOnExitList);
ClearContainer(_visitorDeleteOnExitList);
if ( !_userSetOutput ) {
delete _output;
_output = 0;
}
}
inline void CmdLine::_constructor()
{
_output = new StdOutput;
Arg::setDelimiter( _delimiter );
Visitor* v;
if ( _helpAndVersion )
{
v = new HelpVisitor( this, &_output );
SwitchArg* help = new SwitchArg("h","help",
"Displays usage information and exits.",
false, v);
add( help );
deleteOnExit(help);
deleteOnExit(v);
v = new VersionVisitor( this, &_output );
SwitchArg* vers = new SwitchArg("","version",
"Displays version information and exits.",
false, v);
add( vers );
deleteOnExit(vers);
deleteOnExit(v);
}
v = new IgnoreRestVisitor();
SwitchArg* ignore = new SwitchArg(Arg::flagStartString(),
Arg::ignoreNameString(),
"Ignores the rest of the labeled arguments following this flag.",
false, v);
add( ignore );
deleteOnExit(ignore);
deleteOnExit(v);
}
inline void CmdLine::xorAdd( std::vector<Arg*>& ors )
{
_xorHandler.add( ors );
for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++)
{
(*it)->forceRequired();
(*it)->setRequireLabel( "OR required" );
add( *it );
}
}
inline void CmdLine::xorAdd( Arg& a, Arg& b )
{
std::vector<Arg*> ors;
ors.push_back( &a );
ors.push_back( &b );
xorAdd( ors );
}
inline void CmdLine::add( Arg& a )
{
add( &a );
}
inline void CmdLine::add( Arg* a )
{
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
if ( *a == *(*it) )
throw( SpecificationException(
"Argument with same flag/name already exists!",
a->longID() ) );
a->addToList( _argList );
if ( a->isRequired() )
_numRequired++;
}
inline void CmdLine::parse(int argc, const char * const * argv)
{
// this step is necessary so that we have easy access to
// mutable strings.
std::vector<std::string> args;
for (int i = 0; i < argc; i++)
args.push_back(argv[i]);
parse(args);
}
inline void CmdLine::parse(std::vector<std::string>& args)
{
bool shouldExit = false;
int estat = 0;
try {
_progName = args.front();
args.erase(args.begin());
int requiredCount = 0;
for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++) {
bool matched = false;
for (ArgListIterator it = _argList.begin();
it != _argList.end(); it++) {
if ( (*it)->processArg( &i, args ) )
{
requiredCount += _xorHandler.check( *it );
matched = true;
break;
}
}
// checks to see if the argument is an empty combined
// switch and if so, then we've actually matched it
if ( !matched && _emptyCombined( args[i] ) )
matched = true;
if ( !matched && !Arg::ignoreRest() )
throw(CmdLineParseException("Couldn't find match "
"for argument",
args[i]));
}
if ( requiredCount < _numRequired )
missingArgsException();
if ( requiredCount > _numRequired )
throw(CmdLineParseException("Too many arguments!"));
} catch ( ArgException& e ) {
// If we're not handling the exceptions, rethrow.
if ( !_handleExceptions) {
throw;
}
try {
_output->failure(*this,e);
} catch ( ExitException &ee ) {
estat = ee.getExitStatus();
shouldExit = true;
}
} catch (ExitException &ee) {
// If we're not handling the exceptions, rethrow.
if ( !_handleExceptions) {
throw;
}
estat = ee.getExitStatus();
shouldExit = true;
}
if (shouldExit)
exit(estat);
}
inline bool CmdLine::_emptyCombined(const std::string& s)
{
if ( s.length() > 0 && s[0] != Arg::flagStartChar() )
return false;
for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
if ( s[i] != Arg::blankChar() )
return false;
return true;
}
inline void CmdLine::missingArgsException()
{
int count = 0;
std::string missingArgList;
for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
{
if ( (*it)->isRequired() && !(*it)->isSet() )
{
missingArgList += (*it)->getName();
missingArgList += ", ";
count++;
}
}
missingArgList = missingArgList.substr(0,missingArgList.length()-2);
std::string msg;
if ( count > 1 )
msg = "Required arguments missing: ";
else
msg = "Required argument missing: ";
msg += missingArgList;
throw(CmdLineParseException(msg));
}
inline void CmdLine::deleteOnExit(Arg* ptr)
{
_argDeleteOnExitList.push_back(ptr);
}
inline void CmdLine::deleteOnExit(Visitor* ptr)
{
_visitorDeleteOnExitList.push_back(ptr);
}
inline CmdLineOutput* CmdLine::getOutput()
{
return _output;
}
inline void CmdLine::setOutput(CmdLineOutput* co)
{
_userSetOutput = true;
_output = co;
}
inline std::string& CmdLine::getVersion()
{
return _version;
}
inline std::string& CmdLine::getProgramName()
{
return _progName;
}
inline std::list<Arg*>& CmdLine::getArgList()
{
return _argList;
}
inline XorHandler& CmdLine::getXorHandler()
{
return _xorHandler;
}
inline char CmdLine::getDelimiter()
{
return _delimiter;
}
inline std::string& CmdLine::getMessage()
{
return _message;
}
inline bool CmdLine::hasHelpAndVersion()
{
return _helpAndVersion;
}
inline void CmdLine::setExceptionHandling(const bool state)
{
_handleExceptions = state;
}
inline bool CmdLine::getExceptionHandling() const
{
return _handleExceptions;
}
inline void CmdLine::reset()
{
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
{
(*it)->reset();
}
_progName.clear();
}
///////////////////////////////////////////////////////////////////////////////
//End CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,150 @@
/******************************************************************************
*
* file: CmdLineInterface.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_COMMANDLINE_INTERFACE_H
#define TCLAP_COMMANDLINE_INTERFACE_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
namespace TCLAP {
class Arg;
class CmdLineOutput;
class XorHandler;
/**
* The base class that manages the command line definition and passes
* along the parsing to the appropriate Arg classes.
*/
class CmdLineInterface
{
public:
/**
* Destructor
*/
virtual ~CmdLineInterface() {}
/**
* Adds an argument to the list of arguments to be parsed.
* \param a - Argument to be added.
*/
virtual void add( Arg& a )=0;
/**
* An alternative add. Functionally identical.
* \param a - Argument to be added.
*/
virtual void add( Arg* a )=0;
/**
* Add two Args that will be xor'd.
* If this method is used, add does
* not need to be called.
* \param a - Argument to be added and xor'd.
* \param b - Argument to be added and xor'd.
*/
virtual void xorAdd( Arg& a, Arg& b )=0;
/**
* Add a list of Args that will be xor'd. If this method is used,
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
virtual void xorAdd( std::vector<Arg*>& xors )=0;
/**
* Parses the command line.
* \param argc - Number of arguments.
* \param argv - Array of arguments.
*/
virtual void parse(int argc, const char * const * argv)=0;
/**
* Parses the command line.
* \param args - A vector of strings representing the args.
* args[0] is still the program name.
*/
void parse(std::vector<std::string>& args);
/**
* Returns the CmdLineOutput object.
*/
virtual CmdLineOutput* getOutput()=0;
/**
* \param co - CmdLineOutput object that we want to use instead.
*/
virtual void setOutput(CmdLineOutput* co)=0;
/**
* Returns the version string.
*/
virtual std::string& getVersion()=0;
/**
* Returns the program name string.
*/
virtual std::string& getProgramName()=0;
/**
* Returns the argList.
*/
virtual std::list<Arg*>& getArgList()=0;
/**
* Returns the XorHandler.
*/
virtual XorHandler& getXorHandler()=0;
/**
* Returns the delimiter string.
*/
virtual char getDelimiter()=0;
/**
* Returns the message string.
*/
virtual std::string& getMessage()=0;
/**
* Indicates whether or not the help and version switches were created
* automatically.
*/
virtual bool hasHelpAndVersion()=0;
/**
* Resets the instance as if it had just been constructed so that the
* instance can be reused.
*/
virtual void reset()=0;
};
} //namespace
#endif

@ -0,0 +1,74 @@
/******************************************************************************
*
* file: CmdLineOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CMDLINEOUTPUT_H
#define TCLAP_CMDLINEOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
namespace TCLAP {
class CmdLineInterface;
class ArgException;
/**
* The interface that any output object must implement.
*/
class CmdLineOutput
{
public:
/**
* Virtual destructor.
*/
virtual ~CmdLineOutput() {}
/**
* Generates some sort of output for the USAGE.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c)=0;
/**
* Generates some sort of output for the version.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c)=0;
/**
* Generates some sort of output for a failure.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure( CmdLineInterface& c,
ArgException& e )=0;
};
} //namespace TCLAP
#endif

@ -0,0 +1,68 @@
/******************************************************************************
*
* file: Constraint.h
*
* Copyright (c) 2005, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_CONSTRAINT_H
#define TCLAP_CONSTRAINT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <algorithm>
namespace TCLAP {
/**
* The interface that defines the interaction between the Arg and Constraint.
*/
template<class T>
class Constraint
{
public:
/**
* Returns a description of the Constraint.
*/
virtual std::string description() const =0;
/**
* Returns the short ID for the Constraint.
*/
virtual std::string shortID() const =0;
/**
* The method used to verify that the value parsed from the command
* line meets the constraint.
* \param value - The value that will be checked.
*/
virtual bool check(const T& value) const =0;
/**
* Destructor.
* Silences warnings about Constraint being a base class with virtual
* functions but without a virtual destructor.
*/
virtual ~Constraint() { ; }
};
} //namespace TCLAP
#endif

@ -0,0 +1,299 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: DocBookOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_DOCBOOKOUTPUT_H
#define TCLAP_DOCBOOKOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that generates DocBook output for usage() method for the
* given CmdLine and its Args.
*/
class DocBookOutput : public CmdLineOutput
{
public:
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
/**
* Substitutes the char r for string x in string s.
* \param s - The string to operate on.
* \param r - The char to replace.
* \param x - What to replace r with.
*/
void substituteSpecialChars( std::string& s, char r, std::string& x );
void removeChar( std::string& s, char r);
void basename( std::string& s );
void printShortArg(Arg* it);
void printLongArg(Arg* it);
char theDelimiter;
};
inline void DocBookOutput::version(CmdLineInterface& _cmd)
{
std::cout << _cmd.getVersion() << std::endl;
}
inline void DocBookOutput::usage(CmdLineInterface& _cmd )
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
theDelimiter = _cmd.getDelimiter();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
basename(progName);
std::cout << "<?xml version='1.0'?>" << std::endl;
std::cout << "<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"" << std::endl;
std::cout << "\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl << std::endl;
std::cout << "<refentry>" << std::endl;
std::cout << "<refmeta>" << std::endl;
std::cout << "<refentrytitle>" << progName << "</refentrytitle>" << std::endl;
std::cout << "<manvolnum>1</manvolnum>" << std::endl;
std::cout << "</refmeta>" << std::endl;
std::cout << "<refnamediv>" << std::endl;
std::cout << "<refname>" << progName << "</refname>" << std::endl;
std::cout << "<refpurpose>" << _cmd.getMessage() << "</refpurpose>" << std::endl;
std::cout << "</refnamediv>" << std::endl;
std::cout << "<refsynopsisdiv>" << std::endl;
std::cout << "<cmdsynopsis>" << std::endl;
std::cout << "<command>" << progName << "</command>" << std::endl;
// xor
for ( int i = 0; (unsigned int)i < xorList.size(); i++ )
{
std::cout << "<group choice='req'>" << std::endl;
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end(); it++ )
printShortArg((*it));
std::cout << "</group>" << std::endl;
}
// rest of args
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
printShortArg((*it));
std::cout << "</cmdsynopsis>" << std::endl;
std::cout << "</refsynopsisdiv>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Description</title>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << _cmd.getMessage() << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Options</title>" << std::endl;
std::cout << "<variablelist>" << std::endl;
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
printLongArg((*it));
std::cout << "</variablelist>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "<refsect1>" << std::endl;
std::cout << "<title>Version</title>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << version << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</refsect1>" << std::endl;
std::cout << "</refentry>" << std::endl;
}
inline void DocBookOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
static_cast<void>(_cmd); // unused
std::cout << e.what() << std::endl;
throw ExitException(1);
}
inline void DocBookOutput::substituteSpecialChars( std::string& s,
char r,
std::string& x )
{
size_t p;
while ( (p = s.find_first_of(r)) != std::string::npos )
{
s.erase(p,1);
s.insert(p,x);
}
}
inline void DocBookOutput::removeChar( std::string& s, char r)
{
size_t p;
while ( (p = s.find_first_of(r)) != std::string::npos )
{
s.erase(p,1);
}
}
inline void DocBookOutput::basename( std::string& s )
{
size_t p = s.find_last_of('/');
if ( p != std::string::npos )
{
s.erase(0, p + 1);
}
}
inline void DocBookOutput::printShortArg(Arg* a)
{
std::string lt = "&lt;";
std::string gt = "&gt;";
std::string id = a->shortID();
substituteSpecialChars(id,'<',lt);
substituteSpecialChars(id,'>',gt);
removeChar(id,'[');
removeChar(id,']');
std::string choice = "opt";
if ( a->isRequired() )
choice = "plain";
std::cout << "<arg choice='" << choice << '\'';
if ( a->acceptsMultipleValues() )
std::cout << " rep='repeat'";
std::cout << '>';
if ( !a->getFlag().empty() )
std::cout << a->flagStartChar() << a->getFlag();
else
std::cout << a->nameStartString() << a->getName();
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
removeChar(arg,'[');
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
}
std::cout << "</arg>" << std::endl;
}
inline void DocBookOutput::printLongArg(Arg* a)
{
std::string lt = "&lt;";
std::string gt = "&gt;";
std::string desc = a->getDescription();
substituteSpecialChars(desc,'<',lt);
substituteSpecialChars(desc,'>',gt);
std::cout << "<varlistentry>" << std::endl;
if ( !a->getFlag().empty() )
{
std::cout << "<term>" << std::endl;
std::cout << "<option>";
std::cout << a->flagStartChar() << a->getFlag();
std::cout << "</option>" << std::endl;
std::cout << "</term>" << std::endl;
}
std::cout << "<term>" << std::endl;
std::cout << "<option>";
std::cout << a->nameStartString() << a->getName();
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
removeChar(arg,'[');
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
}
std::cout << "</option>" << std::endl;
std::cout << "</term>" << std::endl;
std::cout << "<listitem>" << std::endl;
std::cout << "<para>" << std::endl;
std::cout << desc << std::endl;
std::cout << "</para>" << std::endl;
std::cout << "</listitem>" << std::endl;
std::cout << "</varlistentry>" << std::endl;
}
} //namespace TCLAP
#endif

@ -0,0 +1,69 @@
/******************************************************************************
*
* file: HelpVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_HELP_VISITOR_H
#define TCLAP_HELP_VISITOR_H
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h>
namespace TCLAP {
/**
* A Visitor object that calls the usage method of the given CmdLineOutput
* object for the specified CmdLine object.
*/
class HelpVisitor: public Visitor
{
protected:
/**
* The CmdLine the output will be generated for.
*/
CmdLineInterface* _cmd;
/**
* The output object.
*/
CmdLineOutput** _out;
public:
/**
* Constructor.
* \param cmd - The CmdLine the output will be generated for.
* \param out - The type of output.
*/
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the usage method of the CmdLineOutput for the
* specified CmdLine.
*/
void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
};
}
#endif

@ -0,0 +1,52 @@
/******************************************************************************
*
* file: IgnoreRestVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_IGNORE_REST_VISITOR_H
#define TCLAP_IGNORE_REST_VISITOR_H
#include <tclap/Visitor.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A Vistor that tells the CmdLine to begin ignoring arguments after
* this one is parsed.
*/
class IgnoreRestVisitor: public Visitor
{
public:
/**
* Constructor.
*/
IgnoreRestVisitor() : Visitor() {}
/**
* Sets Arg::_ignoreRest.
*/
void visit() { Arg::beginIgnoring(); }
};
}
#endif

@ -0,0 +1,28 @@
libtclapincludedir = $(includedir)/tclap
libtclapinclude_HEADERS = \
CmdLineInterface.h \
ArgException.h \
CmdLine.h \
XorHandler.h \
MultiArg.h \
UnlabeledMultiArg.h \
ValueArg.h \
UnlabeledValueArg.h \
Visitor.h Arg.h \
HelpVisitor.h \
SwitchArg.h \
MultiSwitchArg.h \
VersionVisitor.h \
IgnoreRestVisitor.h \
CmdLineOutput.h \
StdOutput.h \
DocBookOutput.h \
ZshCompletionOutput.h \
OptionalUnlabeledTracker.h \
Constraint.h \
ValuesConstraint.h \
ArgTraits.h \
StandardTraits.h

@ -0,0 +1,387 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = include/tclap
DIST_COMMON = $(libtclapinclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libtclapincludedir)"
libtclapincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(libtclapinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOC_FALSE = @DOC_FALSE@
DOC_TRUE = @DOC_TRUE@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_GNU_COMPILERS_FALSE = @HAVE_GNU_COMPILERS_FALSE@
HAVE_GNU_COMPILERS_TRUE = @HAVE_GNU_COMPILERS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
libtclapincludedir = $(includedir)/tclap
libtclapinclude_HEADERS = \
CmdLineInterface.h \
ArgException.h \
CmdLine.h \
XorHandler.h \
MultiArg.h \
UnlabeledMultiArg.h \
ValueArg.h \
UnlabeledValueArg.h \
Visitor.h Arg.h \
HelpVisitor.h \
SwitchArg.h \
MultiSwitchArg.h \
VersionVisitor.h \
IgnoreRestVisitor.h \
CmdLineOutput.h \
StdOutput.h \
DocBookOutput.h \
ZshCompletionOutput.h \
OptionalUnlabeledTracker.h \
Constraint.h \
ValuesConstraint.h \
ArgTraits.h \
StandardTraits.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/tclap/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu include/tclap/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
uninstall-info-am:
install-libtclapincludeHEADERS: $(libtclapinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libtclapincludedir)" || $(mkdir_p) "$(DESTDIR)$(libtclapincludedir)"
@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(libtclapincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtclapincludedir)/$$f'"; \
$(libtclapincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtclapincludedir)/$$f"; \
done
uninstall-libtclapincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libtclapincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(libtclapincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libtclapincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-libtclapincludeHEADERS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libtclapincludeHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
ctags distclean distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-libtclapincludeHEADERS \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
uninstall uninstall-am uninstall-info-am \
uninstall-libtclapincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

@ -0,0 +1,422 @@
/******************************************************************************
*
* file: MultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTIPLE_ARGUMENT_H
#define TCLAP_MULTIPLE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
#include <tclap/Constraint.h>
namespace TCLAP {
/**
* An argument that allows multiple values of type T to be specified. Very
* similar to a ValueArg, except a vector of values will be returned
* instead of just one.
*/
template<class T>
class MultiArg : public Arg
{
public:
typedef std::vector<T> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator const_iterator;
protected:
/**
* The list of values parsed from the CmdLine.
*/
std::vector<T> _values;
/**
* The description of type T to be used in the usage.
*/
std::string _typeDesc;
/**
* A list of constraint on this Arg.
*/
Constraint<T>* _constraint;
/**
* Extracts the value from the string.
* Attempts to parse string as type T, if this fails an exception
* is thrown.
* \param val - The string to be read.
*/
void _extractValue( const std::string& val );
/**
* Used by XorHandler to decide whether to keep parsing for this arg.
*/
bool _allowMore;
public:
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
Visitor* v = NULL);
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
Visitor* v = NULL );
/**
* Constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns a vector of type T containing the values parsed from
* the command line.
*/
const std::vector<T>& getValue();
/**
* Returns an iterator over the values parsed from the command
* line.
*/
const_iterator begin() const { return _values.begin(); }
/**
* Returns the end of the values parsed from the command
* line.
*/
const_iterator end() const { return _values.end(); }
/**
* Returns the a short id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Returns the a long id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Once we've matched the first value, then the arg is no longer
* required.
*/
virtual bool isRequired() const;
virtual bool allowMore();
virtual void reset();
};
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( typeDesc ),
_constraint( NULL ),
_allowMore(false)
{
_acceptsMultipleValues = true;
}
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( typeDesc ),
_constraint( NULL ),
_allowMore(false)
{
parser.add( this );
_acceptsMultipleValues = true;
}
/**
*
*/
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ),
_allowMore(false)
{
_acceptsMultipleValues = true;
}
template<class T>
MultiArg<T>::MultiArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ),
_allowMore(false)
{
parser.add( this );
_acceptsMultipleValues = true;
}
template<class T>
const std::vector<T>& MultiArg<T>::getValue() { return _values; }
template<class T>
bool MultiArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
std::string flag = args[*i];
std::string value = "";
trimFlag( flag, value );
if ( argMatches( flag ) )
{
if ( Arg::delimiter() != ' ' && value == "" )
throw( ArgParseException(
"Couldn't find delimiter for this argument!",
toString() ) );
// always take the first one, regardless of start string
if ( value == "" )
{
(*i)++;
if ( static_cast<unsigned int>(*i) < args.size() )
_extractValue( args[*i] );
else
throw( ArgParseException("Missing a value for this argument!",
toString() ) );
}
else
_extractValue( value );
/*
// continuing taking the args until we hit one with a start string
while ( (unsigned int)(*i)+1 < args.size() &&
args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
_extractValue( args[++(*i)] );
*/
_alreadySet = true;
_checkWithVisitor();
return true;
}
else
return false;
}
/**
*
*/
template<class T>
std::string MultiArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::shortID(_typeDesc) + " ... ";
}
/**
*
*/
template<class T>
std::string MultiArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::longID(_typeDesc) + " (accepted multiple times)";
}
/**
* Once we've matched the first value, then the arg is no longer
* required.
*/
template<class T>
bool MultiArg<T>::isRequired() const
{
if ( _required )
{
if ( _values.size() > 1 )
return false;
else
return true;
}
else
return false;
}
template<class T>
void MultiArg<T>::_extractValue( const std::string& val )
{
try {
T tmp;
ExtractValue(tmp, val, typename ArgTraits<T>::ValueCategory());
_values.push_back(tmp);
} catch( ArgParseException &e) {
throw ArgParseException(e.error(), toString());
}
if ( _constraint != NULL )
if ( ! _constraint->check( _values.back() ) )
throw( CmdLineParseException( "Value '" + val +
"' does not meet constraint: " +
_constraint->description(),
toString() ) );
}
template<class T>
bool MultiArg<T>::allowMore()
{
bool am = _allowMore;
_allowMore = true;
return am;
}
template<class T>
void MultiArg<T>::reset()
{
Arg::reset();
_values.clear();
}
} // namespace TCLAP
#endif

@ -0,0 +1,216 @@
/******************************************************************************
*
* file: MultiSwitchArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTI_SWITCH_ARG_H
#define TCLAP_MULTI_SWITCH_ARG_H
#include <string>
#include <vector>
#include <tclap/SwitchArg.h>
namespace TCLAP {
/**
* A multiple switch argument. If the switch is set on the command line, then
* the getValue method will return the number of times the switch appears.
*/
class MultiSwitchArg : public SwitchArg
{
protected:
/**
* The value of the switch.
*/
int _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
int _default;
public:
/**
* MultiSwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param init - Optional. The initial/default value of this Arg.
* Defaults to 0.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
int init = 0,
Visitor* v = NULL);
/**
* MultiSwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param parser - A CmdLine parser object to add this Arg to
* \param init - Optional. The initial/default value of this Arg.
* Defaults to 0.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
int init = 0,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the SwitchArg version of this method to set the
* _value of the argument appropriately.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns int, the number of times the switch has been set.
*/
int getValue();
/**
* Returns the shortID for this Arg.
*/
std::string shortID(const std::string& val) const;
/**
* Returns the longID for this Arg.
*/
std::string longID(const std::string& val) const;
void reset();
};
//////////////////////////////////////////////////////////////////////
//BEGIN MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
int init,
Visitor* v )
: SwitchArg(flag, name, desc, false, v),
_value( init ),
_default( init )
{ }
inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
int init,
Visitor* v )
: SwitchArg(flag, name, desc, false, v),
_value( init ),
_default( init )
{
parser.add( this );
}
inline int MultiSwitchArg::getValue() { return _value; }
inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( argMatches( args[*i] ))
{
// so the isSet() method will work
_alreadySet = true;
// Matched argument: increment value.
++_value;
_checkWithVisitor();
return true;
}
else if ( combinedSwitchesMatch( args[*i] ) )
{
// so the isSet() method will work
_alreadySet = true;
// Matched argument: increment value.
++_value;
// Check for more in argument and increment value.
while ( combinedSwitchesMatch( args[*i] ) )
++_value;
_checkWithVisitor();
return false;
}
else
return false;
}
inline std::string
MultiSwitchArg::shortID(const std::string& val) const
{
return Arg::shortID(val) + " ... ";
}
inline std::string
MultiSwitchArg::longID(const std::string& val) const
{
return Arg::longID(val) + " (accepted multiple times)";
}
inline void
MultiSwitchArg::reset()
{
MultiSwitchArg::_value = MultiSwitchArg::_default;
}
//////////////////////////////////////////////////////////////////////
//END MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,62 @@
/******************************************************************************
*
* file: OptionalUnlabeledTracker.h
*
* Copyright (c) 2005, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#include <string>
namespace TCLAP {
class OptionalUnlabeledTracker
{
public:
static void check( bool req, const std::string& argName );
static void gotOptional() { alreadyOptionalRef() = true; }
static bool& alreadyOptional() { return alreadyOptionalRef(); }
private:
static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
};
inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
{
if ( OptionalUnlabeledTracker::alreadyOptional() )
throw( SpecificationException(
"You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
argName ) );
if ( !req )
OptionalUnlabeledTracker::gotOptional();
}
} // namespace TCLAP
#endif

@ -0,0 +1,186 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: StandardTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
// This is an internal tclap file, you should probably not have to
// include this directly
#ifndef TCLAP_STANDARD_TRAITS_H
#define TCLAP_STANDARD_TRAITS_H
#ifdef HAVE_CONFIG_H
#include <config.h> // To check for long long
#endif
namespace TCLAP {
// ======================================================================
// Integer types
// ======================================================================
/**
* longs have value-like semantics.
*/
template<>
struct ArgTraits<long> {
typedef ValueLike ValueCategory;
};
/**
* ints have value-like semantics.
*/
template<>
struct ArgTraits<int> {
typedef ValueLike ValueCategory;
};
/**
* shorts have value-like semantics.
*/
template<>
struct ArgTraits<short> {
typedef ValueLike ValueCategory;
};
/**
* chars have value-like semantics.
*/
template<>
struct ArgTraits<char> {
typedef ValueLike ValueCategory;
};
#ifdef HAVE_LONG_LONG
/**
* long longs have value-like semantics.
*/
template<>
struct ArgTraits<long long> {
typedef ValueLike ValueCategory;
};
#endif
// ======================================================================
// Unsigned integer types
// ======================================================================
/**
* unsigned longs have value-like semantics.
*/
template<>
struct ArgTraits<unsigned long> {
typedef ValueLike ValueCategory;
};
/**
* unsigned ints have value-like semantics.
*/
template<>
struct ArgTraits<unsigned int> {
typedef ValueLike ValueCategory;
};
/**
* unsigned shorts have value-like semantics.
*/
template<>
struct ArgTraits<unsigned short> {
typedef ValueLike ValueCategory;
};
/**
* unsigned chars have value-like semantics.
*/
template<>
struct ArgTraits<unsigned char> {
typedef ValueLike ValueCategory;
};
#ifdef HAVE_LONG_LONG
/**
* unsigned long longs have value-like semantics.
*/
template<>
struct ArgTraits<unsigned long long> {
typedef ValueLike ValueCategory;
};
#endif
// ======================================================================
// Float types
// ======================================================================
/**
* floats have value-like semantics.
*/
template<>
struct ArgTraits<float> {
typedef ValueLike ValueCategory;
};
/**
* doubles have value-like semantics.
*/
template<>
struct ArgTraits<double> {
typedef ValueLike ValueCategory;
};
// ======================================================================
// Other types
// ======================================================================
/**
* bools have value-like semantics.
*/
template<>
struct ArgTraits<bool> {
typedef ValueLike ValueCategory;
};
/**
* wchar_ts have value-like semantics.
*/
/*
template<>
struct ArgTraits<wchar_t> {
typedef ValueLike ValueCategory;
};
*/
/**
* Strings have string like argument traits.
*/
template<>
struct ArgTraits<std::string> {
typedef StringLike ValueCategory;
};
template<typename T>
void SetString(T &dst, const std::string &src)
{
dst = src;
}
} // namespace
#endif

@ -0,0 +1,298 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: StdOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_STDCMDLINEOUTPUT_H
#define TCLAP_STDCMDLINEOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that isolates any output from the CmdLine object so that it
* may be easily modified.
*/
class StdOutput : public CmdLineOutput
{
public:
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
/**
* Writes a brief usage message with short args.
* \param c - The CmdLine object the output is generated for.
* \param os - The stream to write the message to.
*/
void _shortUsage( CmdLineInterface& c, std::ostream& os ) const;
/**
* Writes a longer usage message with long and short args,
* provides descriptions and prints message.
* \param c - The CmdLine object the output is generated for.
* \param os - The stream to write the message to.
*/
void _longUsage( CmdLineInterface& c, std::ostream& os ) const;
/**
* This function inserts line breaks and indents long strings
* according the params input. It will only break lines at spaces,
* commas and pipes.
* \param os - The stream to be printed to.
* \param s - The string to be printed.
* \param maxWidth - The maxWidth allowed for the output line.
* \param indentSpaces - The number of spaces to indent the first line.
* \param secondLineOffset - The number of spaces to indent the second
* and all subsequent lines in addition to indentSpaces.
*/
void spacePrint( std::ostream& os,
const std::string& s,
int maxWidth,
int indentSpaces,
int secondLineOffset ) const;
};
inline void StdOutput::version(CmdLineInterface& _cmd)
{
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
std::cout << std::endl << progName << " version: "
<< version << std::endl << std::endl;
}
inline void StdOutput::usage(CmdLineInterface& _cmd )
{
std::cout << std::endl << "USAGE: " << std::endl << std::endl;
_shortUsage( _cmd, std::cout );
std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl;
_longUsage( _cmd, std::cout );
std::cout << std::endl;
}
inline void StdOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
std::string progName = _cmd.getProgramName();
std::cerr << "PARSE ERROR: " << e.argId() << std::endl
<< " " << e.error() << std::endl << std::endl;
if ( _cmd.hasHelpAndVersion() )
{
std::cerr << "Brief USAGE: " << std::endl;
_shortUsage( _cmd, std::cerr );
std::cerr << std::endl << "For complete USAGE and HELP type: "
<< std::endl << " " << progName << " --help"
<< std::endl << std::endl;
}
else
usage(_cmd);
throw ExitException(1);
}
inline void
StdOutput::_shortUsage( CmdLineInterface& _cmd,
std::ostream& os ) const
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
std::string s = progName + " ";
// first the xor
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
s += " {";
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end(); it++ )
s += (*it)->shortID() + "|";
s[s.length()-1] = '}';
}
// then the rest
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
s += " " + (*it)->shortID();
// if the program name is too long, then adjust the second line offset
int secondLineOffset = static_cast<int>(progName.length()) + 2;
if ( secondLineOffset > 75/2 )
secondLineOffset = static_cast<int>(75/2);
spacePrint( os, s, 75, 3, secondLineOffset );
}
inline void
StdOutput::_longUsage( CmdLineInterface& _cmd,
std::ostream& os ) const
{
std::list<Arg*> argList = _cmd.getArgList();
std::string message = _cmd.getMessage();
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
// first the xor
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end();
it++ )
{
spacePrint( os, (*it)->longID(), 75, 3, 3 );
spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
if ( it+1 != xorList[i].end() )
spacePrint(os, "-- OR --", 75, 9, 0);
}
os << std::endl << std::endl;
}
// then the rest
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
{
spacePrint( os, (*it)->longID(), 75, 3, 3 );
spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
os << std::endl;
}
os << std::endl;
spacePrint( os, message, 75, 3, 0 );
}
inline void StdOutput::spacePrint( std::ostream& os,
const std::string& s,
int maxWidth,
int indentSpaces,
int secondLineOffset ) const
{
int len = static_cast<int>(s.length());
if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
{
int allowedLen = maxWidth - indentSpaces;
int start = 0;
while ( start < len )
{
// find the substring length
// int stringLen = std::min<int>( len - start, allowedLen );
// doing it this way to support a VisualC++ 2005 bug
using namespace std;
int stringLen = min<int>( len - start, allowedLen );
// trim the length so it doesn't end in middle of a word
if ( stringLen == allowedLen )
while ( stringLen >= 0 &&
s[stringLen+start] != ' ' &&
s[stringLen+start] != ',' &&
s[stringLen+start] != '|' )
stringLen--;
// ok, the word is longer than the line, so just split
// wherever the line ends
if ( stringLen <= 0 )
stringLen = allowedLen;
// check for newlines
for ( int i = 0; i < stringLen; i++ )
if ( s[start+i] == '\n' )
stringLen = i+1;
// print the indent
for ( int i = 0; i < indentSpaces; i++ )
os << " ";
if ( start == 0 )
{
// handle second line offsets
indentSpaces += secondLineOffset;
// adjust allowed len
allowedLen -= secondLineOffset;
}
os << s.substr(start,stringLen) << std::endl;
// so we don't start a line with a space
while ( s[stringLen+start] == ' ' && start < len )
start++;
start += stringLen;
}
}
else
{
for ( int i = 0; i < indentSpaces; i++ )
os << " ";
os << s << std::endl;
}
}
} //namespace TCLAP
#endif

@ -0,0 +1,228 @@
/******************************************************************************
*
* file: SwitchArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_SWITCH_ARG_H
#define TCLAP_SWITCH_ARG_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A simple switch argument. If the switch is set on the command line, then
* the getValue method will return the opposite of the default value for the
* switch.
*/
class SwitchArg : public Arg
{
protected:
/**
* The value of the switch.
*/
bool _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
bool _default;
public:
/**
* SwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param def - The default value for this Switch.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool def = false,
Visitor* v = NULL);
/**
* SwitchArg constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param parser - A CmdLine parser object to add this Arg to
* \param def - The default value for this Switch.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
bool def = false,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Checks a string to see if any of the chars in the string
* match the flag for this Switch.
*/
bool combinedSwitchesMatch(std::string& combined);
/**
* Returns bool, whether or not the switch has been set.
*/
bool getValue();
virtual void reset();
};
//////////////////////////////////////////////////////////////////////
//BEGIN SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline SwitchArg::SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool default_val,
Visitor* v )
: Arg(flag, name, desc, false, false, v),
_value( default_val ),
_default( default_val )
{ }
inline SwitchArg::SwitchArg(const std::string& flag,
const std::string& name,
const std::string& desc,
CmdLineInterface& parser,
bool default_val,
Visitor* v )
: Arg(flag, name, desc, false, false, v),
_value( default_val ),
_default(default_val)
{
parser.add( this );
}
inline bool SwitchArg::getValue() { return _value; }
inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )
{
// make sure this is actually a combined switch
if ( combinedSwitches.length() > 0 &&
combinedSwitches[0] != Arg::flagStartString()[0] )
return false;
// make sure it isn't a long name
if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
Arg::nameStartString() )
return false;
// make sure the delimiter isn't in the string
if ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos )
return false;
// ok, we're not specifying a ValueArg, so we know that we have
// a combined switch list.
for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
if ( _flag.length() > 0 &&
combinedSwitches[i] == _flag[0] &&
_flag[0] != Arg::flagStartString()[0] )
{
// update the combined switches so this one is no longer present
// this is necessary so that no unlabeled args are matched
// later in the processing.
//combinedSwitches.erase(i,1);
combinedSwitches[i] = Arg::blankChar();
return true;
}
// none of the switches passed in the list match.
return false;
}
inline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( argMatches( args[*i] ) || combinedSwitchesMatch( args[*i] ) )
{
// If we match on a combined switch, then we want to return false
// so that other switches in the combination will also have a
// chance to match.
bool ret = false;
if ( argMatches( args[*i] ) )
ret = true;
if ( _alreadySet || ( !ret && combinedSwitchesMatch( args[*i] ) ) )
throw(CmdLineParseException("Argument already set!", toString()));
_alreadySet = true;
if ( _value == true )
_value = false;
else
_value = true;
_checkWithVisitor();
return ret;
}
else
return false;
}
inline void SwitchArg::reset()
{
Arg::reset();
_value = _default;
}
//////////////////////////////////////////////////////////////////////
//End SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,301 @@
/******************************************************************************
*
* file: UnlabeledMultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/MultiArg.h>
#include <tclap/OptionalUnlabeledTracker.h>
namespace TCLAP {
/**
* Just like a MultiArg, except that the arguments are unlabeled. Basically,
* this Arg will slurp up everything that hasn't been matched to another
* Arg.
*/
template<class T>
class UnlabeledMultiArg : public MultiArg<T>
{
// If compiler has two stage name lookup (as gcc >= 3.4 does)
// this is requried to prevent undef. symbols
using MultiArg<T>::_ignoreable;
using MultiArg<T>::_hasBlanks;
using MultiArg<T>::_extractValue;
using MultiArg<T>::_typeDesc;
using MultiArg<T>::_name;
using MultiArg<T>::_description;
using MultiArg<T>::_alreadySet;
using MultiArg<T>::toString;
public:
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Constructor.
* \param name - The name of the Arg. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Whether or not this argument can be ignored
* using the "--" flag.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
UnlabeledMultiArg( const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns the a short id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Returns the a long id string. Used in the usage.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Opertor ==.
* \param a - The Arg to be compared to this.
*/
virtual bool operator==(const Arg& a) const;
/**
* Pushes this to back of list rather than front.
* \param argList - The list this should be added to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
};
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
parser.add( this );
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
}
template<class T>
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
const std::string& desc,
bool req,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: MultiArg<T>("", name, desc, req, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(true, toString());
parser.add( this );
}
template<class T>
bool UnlabeledMultiArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _hasBlanks( args[*i] ) )
return false;
// never ignore an unlabeled multi arg
// always take the first value, regardless of the start string
_extractValue( args[(*i)] );
/*
// continue taking args until we hit the end or a start string
while ( (unsigned int)(*i)+1 < args.size() &&
args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
_extractValue( args[++(*i)] );
*/
_alreadySet = true;
return true;
}
template<class T>
std::string UnlabeledMultiArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + "> ...";
}
template<class T>
std::string UnlabeledMultiArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + "> (accepted multiple times)";
}
template<class T>
bool UnlabeledMultiArg<T>::operator==(const Arg& a) const
{
if ( _name == a.getName() || _description == a.getDescription() )
return true;
else
return false;
}
template<class T>
void UnlabeledMultiArg<T>::addToList( std::list<Arg*>& argList ) const
{
argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
}
}
#endif

@ -0,0 +1,340 @@
/******************************************************************************
*
* file: UnlabeledValueArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H
#define TCLAP_UNLABELED_VALUE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/ValueArg.h>
#include <tclap/OptionalUnlabeledTracker.h>
namespace TCLAP {
/**
* The basic unlabeled argument that parses a value.
* This is a template class, which means the type T defines the type
* that a given object will attempt to parse when an UnlabeledValueArg
* is reached in the list of args that the CmdLine iterates over.
*/
template<class T>
class UnlabeledValueArg : public ValueArg<T>
{
// If compiler has two stage name lookup (as gcc >= 3.4 does)
// this is requried to prevent undef. symbols
using ValueArg<T>::_ignoreable;
using ValueArg<T>::_hasBlanks;
using ValueArg<T>::_extractValue;
using ValueArg<T>::_typeDesc;
using ValueArg<T>::_name;
using ValueArg<T>::_description;
using ValueArg<T>::_alreadySet;
using ValueArg<T>::toString;
public:
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
bool ignoreable = false,
Visitor* v = NULL);
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL );
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
bool ignoreable = false,
Visitor* v = NULL );
/**
* UnlabeledValueArg constructor.
* \param name - A one word name for the argument. Note that this is used for
* identification, not as a long flag.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to
* \param ignoreable - Allows you to specify that this argument can be
* ignored if the '--' flag is set. This defaults to false (cannot
* be ignored) and should generally stay that way unless you have
* some special need for certain arguments to be ignored.
* \param v - Optional Vistor. You should leave this blank unless
* you have a very good reason.
*/
UnlabeledValueArg( const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable = false,
Visitor* v = NULL);
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. Handling specific to
* unlabled arguments.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings.
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Overrides shortID for specific behavior.
*/
virtual std::string shortID(const std::string& val="val") const;
/**
* Overrides longID for specific behavior.
*/
virtual std::string longID(const std::string& val="val") const;
/**
* Overrides operator== for specific behavior.
*/
virtual bool operator==(const Arg& a ) const;
/**
* Instead of pushing to the front of list, push to the back.
* \param argList - The list to add this to.
*/
virtual void addToList( std::list<Arg*>& argList ) const;
};
/**
* Constructor implemenation.
*/
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
}
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, typeDesc, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
parser.add( this );
}
/**
* Constructor implemenation.
*/
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
}
template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
CmdLineInterface& parser,
bool ignoreable,
Visitor* v)
: ValueArg<T>("", name, desc, req, val, constraint, v)
{
_ignoreable = ignoreable;
OptionalUnlabeledTracker::check(req, toString());
parser.add( this );
}
/**
* Implementation of processArg().
*/
template<class T>
bool UnlabeledValueArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _alreadySet )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
// never ignore an unlabeled arg
_extractValue( args[*i] );
_alreadySet = true;
return true;
}
/**
* Overriding shortID for specific output.
*/
template<class T>
std::string UnlabeledValueArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return std::string("<") + _typeDesc + ">";
}
/**
* Overriding longID for specific output.
*/
template<class T>
std::string UnlabeledValueArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
// Ideally we would like to be able to use RTTI to return the name
// of the type required for this argument. However, g++ at least,
// doesn't appear to return terribly useful "names" of the types.
return std::string("<") + _typeDesc + ">";
}
/**
* Overriding operator== for specific behavior.
*/
template<class T>
bool UnlabeledValueArg<T>::operator==(const Arg& a ) const
{
if ( _name == a.getName() || _description == a.getDescription() )
return true;
else
return false;
}
template<class T>
void UnlabeledValueArg<T>::addToList( std::list<Arg*>& argList ) const
{
argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
}
}
#endif

@ -0,0 +1,411 @@
/******************************************************************************
*
* file: ValueArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VALUE_ARGUMENT_H
#define TCLAP_VALUE_ARGUMENT_H
#include <string>
#include <vector>
#include <tclap/Arg.h>
#include <tclap/Constraint.h>
namespace TCLAP {
/**
* The basic labeled argument that parses a value.
* This is a template class, which means the type T defines the type
* that a given object will attempt to parse when the flag/name is matched
* on the command line. While there is nothing stopping you from creating
* an unflagged ValueArg, it is unwise and would cause significant problems.
* Instead use an UnlabeledValueArg.
*/
template<class T>
class ValueArg : public Arg
{
protected:
/**
* The value parsed from the command line.
* Can be of any type, as long as the >> operator for the type
* is defined.
*/
T _value;
/**
* Used to support the reset() method so that ValueArg can be
* reset to their constructed value.
*/
T _default;
/**
* A human readable description of the type to be parsed.
* This is a hack, plain and simple. Ideally we would use RTTI to
* return the name of type T, but until there is some sort of
* consistent support for human readable names, we are left to our
* own devices.
*/
std::string _typeDesc;
/**
* A Constraint this Arg must conform to.
*/
Constraint<T>* _constraint;
/**
* Extracts the value from the string.
* Attempts to parse string as type T, if this fails an exception
* is thrown.
* \param val - value to be parsed.
*/
void _extractValue( const std::string& val );
public:
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
Visitor* v = NULL);
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param typeDesc - A short, human readable description of the
* type that this object expects. This is used in the generation
* of the USAGE statement. The goal is to be helpful to the end user
* of the program.
* \param parser - A CmdLine parser object to add this Arg to
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param parser - A CmdLine parser object to add this Arg to.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v = NULL );
/**
* Labeled ValueArg constructor.
* You could conceivably call this constructor with a blank flag,
* but that would make you a bad person. It would also cause
* an exception to be thrown. If you want an unlabeled argument,
* use the other constructor.
* \param flag - The one character flag that identifies this
* argument on the command line.
* \param name - A one word name for the argument. Can be
* used as a long flag on the command line.
* \param desc - A description of what the argument is for or
* does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it
* is not present on the command line.
* \param constraint - A pointer to a Constraint object used
* to constrain this Arg.
* \param v - An optional visitor. You probably should not
* use this unless you have a very good reason.
*/
ValueArg( const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T value,
Constraint<T>* constraint,
Visitor* v = NULL );
/**
* Handles the processing of the argument.
* This re-implements the Arg version of this method to set the
* _value of the argument appropriately. It knows the difference
* between labeled and unlabeled.
* \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. Passed
* in from main().
*/
virtual bool processArg(int* i, std::vector<std::string>& args);
/**
* Returns the value of the argument.
*/
T& getValue() ;
/**
* Specialization of shortID.
* \param val - value to be used.
*/
virtual std::string shortID(const std::string& val = "val") const;
/**
* Specialization of longID.
* \param val - value to be used.
*/
virtual std::string longID(const std::string& val = "val") const;
virtual void reset() ;
};
/**
* Constructor implementation.
*/
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( typeDesc ),
_constraint( NULL )
{ }
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( typeDesc ),
_constraint( NULL )
{
parser.add( this );
}
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint )
{ }
template<class T>
ValueArg<T>::ValueArg(const std::string& flag,
const std::string& name,
const std::string& desc,
bool req,
T val,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v)
: Arg(flag, name, desc, req, true, v),
_value( val ),
_default( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint )
{
parser.add( this );
}
/**
* Implementation of getValue().
*/
template<class T>
T& ValueArg<T>::getValue() { return _value; }
/**
* Implementation of processArg().
*/
template<class T>
bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
return false;
if ( _hasBlanks( args[*i] ) )
return false;
std::string flag = args[*i];
std::string value = "";
trimFlag( flag, value );
if ( argMatches( flag ) )
{
if ( _alreadySet )
throw( CmdLineParseException("Argument already set!", toString()) );
if ( Arg::delimiter() != ' ' && value == "" )
throw( ArgParseException(
"Couldn't find delimiter for this argument!",
toString() ) );
if ( value == "" )
{
(*i)++;
if ( static_cast<unsigned int>(*i) < args.size() )
_extractValue( args[*i] );
else
throw( ArgParseException("Missing a value for this argument!",
toString() ) );
}
else
_extractValue( value );
_alreadySet = true;
_checkWithVisitor();
return true;
}
else
return false;
}
/**
* Implementation of shortID.
*/
template<class T>
std::string ValueArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::shortID( _typeDesc );
}
/**
* Implementation of longID.
*/
template<class T>
std::string ValueArg<T>::longID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
return Arg::longID( _typeDesc );
}
template<class T>
void ValueArg<T>::_extractValue( const std::string& val )
{
try {
ExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());
} catch( ArgParseException &e) {
throw ArgParseException(e.error(), toString());
}
if ( _constraint != NULL )
if ( ! _constraint->check( _value ) )
throw( CmdLineParseException( "Value '" + val +
+ "' does not meet constraint: "
+ _constraint->description(),
toString() ) );
}
template<class T>
void ValueArg<T>::reset()
{
Arg::reset();
_value = _default;
}
} // namespace TCLAP
#endif

@ -0,0 +1,147 @@
/******************************************************************************
*
* file: ValuesConstraint.h
*
* Copyright (c) 2005, Michael E. Smoot
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VALUESCONSTRAINT_H
#define TCLAP_VALUESCONSTRAINT_H
#include <string>
#include <vector>
#include <tclap/Constraint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#define HAVE_SSTREAM
#endif
#if defined(HAVE_SSTREAM)
#include <sstream>
#elif defined(HAVE_STRSTREAM)
#include <strstream>
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
namespace TCLAP {
/**
* A Constraint that constrains the Arg to only those values specified
* in the constraint.
*/
template<class T>
class ValuesConstraint : public Constraint<T>
{
public:
/**
* Constructor.
* \param allowed - vector of allowed values.
*/
ValuesConstraint(std::vector<T>& allowed);
/**
* Virtual destructor.
*/
virtual ~ValuesConstraint() {}
/**
* Returns a description of the Constraint.
*/
virtual std::string description() const;
/**
* Returns the short ID for the Constraint.
*/
virtual std::string shortID() const;
/**
* The method used to verify that the value parsed from the command
* line meets the constraint.
* \param value - The value that will be checked.
*/
virtual bool check(const T& value) const;
protected:
/**
* The list of valid values.
*/
std::vector<T> _allowed;
/**
* The string used to describe the allowed values of this constraint.
*/
std::string _typeDesc;
};
template<class T>
ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)
: _allowed(allowed)
{
for ( unsigned int i = 0; i < _allowed.size(); i++ )
{
#if defined(HAVE_SSTREAM)
std::ostringstream os;
#elif defined(HAVE_STRSTREAM)
std::ostrstream os;
#else
#error "Need a stringstream (sstream or strstream) to compile!"
#endif
os << _allowed[i];
std::string temp( os.str() );
if ( i > 0 )
_typeDesc += "|";
_typeDesc += temp;
}
}
template<class T>
bool ValuesConstraint<T>::check( const T& val ) const
{
if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )
return false;
else
return true;
}
template<class T>
std::string ValuesConstraint<T>::shortID() const
{
return _typeDesc;
}
template<class T>
std::string ValuesConstraint<T>::description() const
{
return _typeDesc;
}
} //namespace TCLAP
#endif

@ -0,0 +1,74 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: VersionVisitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VERSION_VISITOR_H
#define TCLAP_VERSION_VISITOR_H
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h>
namespace TCLAP {
/**
* A Vistor that will call the version method of the given CmdLineOutput
* for the specified CmdLine object and then exit.
*/
class VersionVisitor: public Visitor
{
protected:
/**
* The CmdLine of interest.
*/
CmdLineInterface* _cmd;
/**
* The output object.
*/
CmdLineOutput** _out;
public:
/**
* Constructor.
* \param cmd - The CmdLine the output is generated for.
* \param out - The type of output.
*/
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out )
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the version method of the output object using the
* specified CmdLine.
*/
void visit() {
(*_out)->version(*_cmd);
throw ExitException(0);
}
};
}
#endif

@ -0,0 +1,53 @@
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Destructor. Does nothing.
*/
virtual ~Visitor() { }
/**
* Does nothing. Should be overridden by child.
*/
virtual void visit() { }
};
}
#endif

@ -0,0 +1,156 @@
/******************************************************************************
*
* file: XorHandler.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_XORHANDLER_H
#define TCLAP_XORHANDLER_H
#include <tclap/Arg.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
namespace TCLAP {
/**
* This class handles lists of Arg's that are to be XOR'd on the command
* line. This is used by CmdLine and you shouldn't ever use it.
*/
class XorHandler
{
protected:
/**
* The list of of lists of Arg's to be or'd together.
*/
std::vector< std::vector<Arg*> > _orList;
public:
/**
* Constructor. Does nothing.
*/
XorHandler( ) {}
/**
* Add a list of Arg*'s that will be orred together.
* \param ors - list of Arg* that will be xor'd.
*/
void add( std::vector<Arg*>& ors );
/**
* Checks whether the specified Arg is in one of the xor lists and
* if it does match one, returns the size of the xor list that the
* Arg matched. If the Arg matches, then it also sets the rest of
* the Arg's in the list. You shouldn't use this.
* \param a - The Arg to be checked.
*/
int check( const Arg* a );
/**
* Returns the XOR specific short usage.
*/
std::string shortUsage();
/**
* Prints the XOR specific long usage.
* \param os - Stream to print to.
*/
void printLongUsage(std::ostream& os);
/**
* Simply checks whether the Arg is contained in one of the arg
* lists.
* \param a - The Arg to be checked.
*/
bool contains( const Arg* a );
std::vector< std::vector<Arg*> >& getXorList();
};
//////////////////////////////////////////////////////////////////////
//BEGIN XOR.cpp
//////////////////////////////////////////////////////////////////////
inline void XorHandler::add( std::vector<Arg*>& ors )
{
_orList.push_back( ors );
}
inline int XorHandler::check( const Arg* a )
{
// iterate over each XOR list
for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
{
// if the XOR list contains the arg..
ArgVectorIterator ait = std::find( _orList[i].begin(),
_orList[i].end(), a );
if ( ait != _orList[i].end() )
{
// go through and set each arg that is not a
for ( ArgVectorIterator it = _orList[i].begin();
it != _orList[i].end();
it++ )
if ( a != (*it) )
(*it)->xorSet();
// return the number of required args that have now been set
if ( (*ait)->allowMore() )
return 0;
else
return static_cast<int>(_orList[i].size());
}
}
if ( a->isRequired() )
return 1;
else
return 0;
}
inline bool XorHandler::contains( const Arg* a )
{
for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
for ( ArgVectorIterator it = _orList[i].begin();
it != _orList[i].end();
it++ )
if ( a == (*it) )
return true;
return false;
}
inline std::vector< std::vector<Arg*> >& XorHandler::getXorList()
{
return _orList;
}
//////////////////////////////////////////////////////////////////////
//END XOR.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif

@ -0,0 +1,321 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: ZshCompletionOutput.h
*
* Copyright (c) 2006, Oliver Kiddle
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H
#define TCLAP_ZSHCOMPLETIONOUTPUT_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <map>
#include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h>
#include <tclap/XorHandler.h>
#include <tclap/Arg.h>
namespace TCLAP {
/**
* A class that generates a Zsh completion function as output from the usage()
* method for the given CmdLine and its Args.
*/
class ZshCompletionOutput : public CmdLineOutput
{
public:
ZshCompletionOutput();
/**
* Prints the usage to stdout. Can be overridden to
* produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void usage(CmdLineInterface& c);
/**
* Prints the version to stdout. Can be overridden
* to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
*/
virtual void version(CmdLineInterface& c);
/**
* Prints (to stderr) an error message, short usage
* Can be overridden to produce alternative behavior.
* \param c - The CmdLine object the output is generated for.
* \param e - The ArgException that caused the failure.
*/
virtual void failure(CmdLineInterface& c,
ArgException& e );
protected:
void basename( std::string& s );
void quoteSpecialChars( std::string& s );
std::string getMutexList( CmdLineInterface& _cmd, Arg* a );
void printOption( Arg* it, std::string mutex );
void printArg( Arg* it );
std::map<std::string, std::string> common;
char theDelimiter;
};
ZshCompletionOutput::ZshCompletionOutput()
{
common["host"] = "_hosts";
common["hostname"] = "_hosts";
common["file"] = "_files";
common["filename"] = "_files";
common["user"] = "_users";
common["username"] = "_users";
common["directory"] = "_directories";
common["path"] = "_directories";
common["url"] = "_urls";
}
inline void ZshCompletionOutput::version(CmdLineInterface& _cmd)
{
std::cout << _cmd.getVersion() << std::endl;
}
inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd )
{
std::list<Arg*> argList = _cmd.getArgList();
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
theDelimiter = _cmd.getDelimiter();
basename(progName);
std::cout << "#compdef " << progName << std::endl << std::endl <<
"# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl <<
"_arguments -s -S";
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
{
if ( (*it)->shortID().at(0) == '<' )
printArg((*it));
else if ( (*it)->getFlag() != "-" )
printOption((*it), getMutexList(_cmd, *it));
}
std::cout << std::endl;
}
inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd,
ArgException& e )
{
static_cast<void>(_cmd); // unused
std::cout << e.what() << std::endl;
}
inline void ZshCompletionOutput::quoteSpecialChars( std::string& s )
{
size_t idx = s.find_last_of(':');
while ( idx != std::string::npos )
{
s.insert(idx, 1, '\\');
idx = s.find_last_of(':', idx);
}
idx = s.find_last_of('\'');
while ( idx != std::string::npos )
{
s.insert(idx, "'\\'");
if (idx == 0)
idx = std::string::npos;
else
idx = s.find_last_of('\'', --idx);
}
}
inline void ZshCompletionOutput::basename( std::string& s )
{
size_t p = s.find_last_of('/');
if ( p != std::string::npos )
{
s.erase(0, p + 1);
}
}
inline void ZshCompletionOutput::printArg(Arg* a)
{
static int count = 1;
std::cout << " \\" << std::endl << " '";
if ( a->acceptsMultipleValues() )
std::cout << '*';
else
std::cout << count++;
std::cout << ':';
if ( !a->isRequired() )
std::cout << ':';
std::cout << a->getName() << ':';
std::map<std::string, std::string>::iterator compArg = common.find(a->getName());
if ( compArg != common.end() )
{
std::cout << compArg->second;
}
else
{
std::cout << "_guard \"^-*\" " << a->getName();
}
std::cout << '\'';
}
inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex)
{
std::string flag = a->flagStartChar() + a->getFlag();
std::string name = a->nameStartString() + a->getName();
std::string desc = a->getDescription();
// remove full stop and capitalisation from description as
// this is the convention for zsh function
if (!desc.compare(0, 12, "(required) "))
{
desc.erase(0, 12);
}
if (!desc.compare(0, 15, "(OR required) "))
{
desc.erase(0, 15);
}
size_t len = desc.length();
if (len && desc.at(--len) == '.')
{
desc.erase(len);
}
if (len)
{
desc.replace(0, 1, 1, tolower(desc.at(0)));
}
std::cout << " \\" << std::endl << " '" << mutex;
if ( a->getFlag().empty() )
{
std::cout << name;
}
else
{
std::cout << "'{" << flag << ',' << name << "}'";
}
if ( theDelimiter == '=' && a->isValueRequired() )
std::cout << "=-";
quoteSpecialChars(desc);
std::cout << '[' << desc << ']';
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
if ( arg.at(arg.length()-1) == ']' )
arg.erase(arg.length()-1);
if ( arg.at(arg.length()-1) == ']' )
{
arg.erase(arg.length()-1);
}
if ( arg.at(0) == '<' )
{
arg.erase(arg.length()-1);
arg.erase(0, 1);
}
size_t p = arg.find('|');
if ( p != std::string::npos )
{
do
{
arg.replace(p, 1, 1, ' ');
}
while ( (p = arg.find_first_of('|', p)) != std::string::npos );
quoteSpecialChars(arg);
std::cout << ": :(" << arg << ')';
}
else
{
std::cout << ':' << arg;
std::map<std::string, std::string>::iterator compArg = common.find(arg);
if ( compArg != common.end() )
{
std::cout << ':' << compArg->second;
}
}
}
std::cout << '\'';
}
inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a)
{
XorHandler xorHandler = _cmd.getXorHandler();
std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
if (a->getName() == "help" || a->getName() == "version")
{
return "(-)";
}
std::ostringstream list;
if ( a->acceptsMultipleValues() )
{
list << '*';
}
for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
{
for ( ArgVectorIterator it = xorList[i].begin();
it != xorList[i].end();
it++)
if ( a == (*it) )
{
list << '(';
for ( ArgVectorIterator iu = xorList[i].begin();
iu != xorList[i].end();
iu++ )
{
bool notCur = (*iu) != a;
bool hasFlag = !(*iu)->getFlag().empty();
if ( iu != xorList[i].begin() && (notCur || hasFlag) )
list << ' ';
if (hasFlag)
list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' ';
if ( notCur || hasFlag )
list << (*iu)->nameStartString() << (*iu)->getName();
}
list << ')';
return list.str();
}
}
// wasn't found in xor list
if (!a->getFlag().empty()) {
list << "(" << a->flagStartChar() << a->getFlag() << ' ' <<
a->nameStartString() << a->getName() << ')';
}
return list.str();
}
} //namespace TCLAP
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save