Commit eae65317 authored by Atsuhito Kohda's avatar Atsuhito Kohda

Imported Upstream version 0.3~svn671

parent 04d660e1
License
License
=======
TeXworks is copyright (c) 2007-09 by Jonathan Kew.
Distributed under the terms of the GNU General Public License, version 2 or (at your option) any later version.
See the file COPYING for details.
The SyncTeX code is copyright (c) 2008, 2009 by JŽr™me Laurens; see synctex_parser.c for license details.
The SyncTeX code is copyright (c) 2008, 2009 by Jérôme Laurens; see synctex_parser.c for license details.
Building TeXworks
......
......@@ -29,24 +29,30 @@ OBJECTS_DIR = ./obj
UI_DIR = ./ui
RCC_DIR = ./rcc
# packagers should override this to identify the source of the particular TeXworks build;
# avoid spaces or other chars that would need quoting on the command line
QMAKE_CXXFLAGS += -DTW_BUILD_ID=personal
# comment this out if poppler's xpdf headers are not available on the build system
QMAKE_CXXFLAGS += -DHAVE_POPPLER_XPDF_HEADERS
# put all symbols in the dynamic symbol table to plugins can access them; if not
# given, plugin loading may fail with a debug warning for some plugins
# Note: only works for gnu compilers; need to check what flags to pass to other compilers
QMAKE_LFLAGS += -Wl,--export-dynamic
!macx {
QMAKE_LFLAGS += -Wl,--export-dynamic
}
unix:!macx {
TARGET = texworks
} else {
TARGET = TeXworks
QMAKE_CXXFLAGS = -fexceptions
QMAKE_LFLAGS = -fexceptions
QMAKE_CXXFLAGS += -fexceptions
QMAKE_LFLAGS += -fexceptions
}
QT += xml script scripttools
CONFIG += rtti
CONFIG += rtti uitools
unix {
system(./getDefaultBinPaths.sh):warning("Unable to determine TeX path, guessing defaults")
......@@ -64,12 +70,14 @@ macx {
INCLUDEPATH += /usr/local/include/poppler/qt4
INCLUDEPATH += /usr/local/include/hunspell
LIBS += /usr/lib/libQtUiTools.a
LIBS += -L/usr/local/lib
LIBS += -lpoppler
LIBS += -lpoppler-qt4
LIBS += -lhunspell-1.2
LIBS += -lgcc_eh
LIBS += -lz
LIBS += -framework CoreServices
QMAKE_INFO_PLIST = TeXworks.plist
......@@ -96,6 +104,8 @@ linux-g++ {
# Qt/dbus config on Debian is broken, hence the lines below
LIBS += -lQtDBus
INCLUDEPATH += /usr/include/qt4/QtDBus
# needed to link successfully on Fedora, apparently
LIBS += -lz
}
openbsd-g++ {
......@@ -138,6 +148,7 @@ HEADERS += src/TWApp.h \
src/TWScript.h \
src/TWScriptAPI.h \
src/TeXDocument.h \
src/CommandlineParser.h \
src/CompletingEdit.h \
src/TeXHighlighter.h \
src/TeXDocks.h \
......@@ -172,7 +183,9 @@ SOURCES += src/main.cpp \
src/TWUtils.cpp \
src/TWScriptable.cpp \
src/TWScript.cpp \
src/TWScriptAPI.cpp \
src/TeXDocument.cpp \
src/CommandlineParser.cpp \
src/CompletingEdit.cpp \
src/TeXHighlighter.cpp \
src/TeXDocks.cpp \
......@@ -209,3 +222,23 @@ TRANSLATIONS += trans/TeXworks_af.ts \
trans/TeXworks_tr.ts \
trans/TeXworks_zh_CN.ts
unix:!macx { # installation on Unix-ish platforms
isEmpty(INSTALL_PREFIX):INSTALL_PREFIX = /usr/local
isEmpty(BIN_DIR):BIN_DIR = $$INSTALL_PREFIX/bin
isEmpty(DATA_DIR):DATA_DIR = $$INSTALL_PREFIX/share
isEmpty(DOCS_DIR):DOCS_DIR = $$DATA_DIR/doc/texworks
isEmpty(ICON_DIR):ICON_DIR = $$DATA_DIR/pixmaps
isEmpty(MAN_DIR):MAN_DIR = $$DATA_DIR/man/man1
isEmpty(DESKTOP_DIR):DESKTOP_DIR = $$DATA_DIR/applications
target.path = $$BIN_DIR
documentation.files = COPYING README
documentation.path = $$DOCS_DIR
icon.files = res/images/TeXworks.png
icon.path = $$ICON_DIR
man.files = man/texworks.1
man.path = $$MAN_DIR
desktop.files = texworks.desktop
desktop.path = $$DESKTOP_DIR
INSTALLS = target documentation icon man desktop
}
.TH TEXWORKS 1
.SH NAME
.B texworks
\- a simple TeX front-end program
.SH SYNOPSIS
.B texworks
[OPTIONS] [FILES]
.SH DESCRIPTION
.B TeXworks
is an environment for authoring TeX (LaTeX, ConTeXt, etc) documents, with a Unicode-based, TeX-aware editor, integrated PDF viewer, and a clean, simple interface accessible to casual and non-technical users.
It is inspired by Dick Koch's award-winning TeXShop program for Mac OS X, which has made quality typesetting through TeX accessible to a wider community of users, without a technical or intimidating face. The goal of
.B TeXworks
is to deliver a similarly integrated, easy-to-use environment for users on other platforms, especially GNU/Linux and Windows.
.SH OPTIONS
.TP
.B --help, -?
Display a short overview over all command line options
.TP
.B --position=, -p
Open the next specified file at the given position (line or page)
.TP
.B --version, -v
Display version information
.SH ENVIRONMENT
.TP
TW_INIPATH
Overrides the location of the preferences file.
.TP
TW_LIBPATH
Overrides the location of the additional configuration and library files.
.TP
TW_DICPATH
Overrides the location of dictionary files.
.TP
TW_HELPPATH
Overrides the location of help files.
.TP
TW_PLUGINPATH
Overrides the location of plugins.
.SH FILES
.TP
.I ~/.config/TUG/TeXworks.conf
Text file to store the preferences.
.TP
.I ~/.TeXworks/*
Additional configuration and library files (e.g. for auto completion, templates, etc.).
.TP
.I /usr/local/bin/texworks-setup.ini
Setup file to override the location of the files mentioned above (e.g. for enabling portable operation).
.SH SEE ALSO
.B TeXworks
homepage: \%http://tug.org/texworks/
.B TeXworks
development: \%http://code.google.com/p/texworks/
.SH BUGS
If you find a bug, please report it at \%http://code.google.com/p/texworks/issues/list
.SH AUTHORS
Jonathan Kew, Stefan Löffler, and others
......@@ -30,9 +30,6 @@
TWLuaPlugin::TWLuaPlugin()
{
// Base class constructor
QObject::QObject();
// Initialize lua state
luaState = luaL_newstate();
if (luaState) {
......@@ -42,7 +39,8 @@ TWLuaPlugin::TWLuaPlugin()
TWLuaPlugin::~TWLuaPlugin()
{
if (luaState) lua_close(luaState);
if (luaState)
lua_close(luaState);
}
TWScript* TWLuaPlugin::newScript(const QString& fileName)
......@@ -58,7 +56,8 @@ bool LuaScript::execute(TWScriptAPI *tw) const
int status;
lua_State * L = m_LuaPlugin->getLuaState();
if (!L) return false;
if (!L)
return false;
// register the TW interface for use in lua
if (!LuaScript::pushQObject(L, tw, false)) {
......@@ -91,7 +90,10 @@ bool LuaScript::execute(TWScriptAPI *tw) const
/*static*/
int LuaScript::pushQObject(lua_State * L, QObject * obj, const bool throwError /*= true*/)
{
if (!L || !obj) return 0;
Q_UNUSED(throwError)
if (!L || !obj)
return 0;
lua_newtable(L);
......@@ -99,6 +101,9 @@ int LuaScript::pushQObject(lua_State * L, QObject * obj, const bool throwError /
// all call operations on object methods
if (lua_getmetatable(L, -1) == 0)
lua_newtable(L);
lua_pushlightuserdata(L, obj);
lua_setfield(L, -2, "__qobject");
lua_pushlightuserdata(L, obj);
lua_pushcclosure(L, LuaScript::setProperty, 1);
......@@ -129,7 +134,8 @@ int LuaScript::pushVariant(lua_State * L, const QVariant & v, const bool throwEr
QVariantMap::const_iterator iMap;
QVariantMap map;
if (!L) return 0;
if (!L)
return 0;
if (v.isNull()) {
lua_pushnil(L);
return 1;
......@@ -156,8 +162,9 @@ int LuaScript::pushVariant(lua_State * L, const QVariant & v, const bool throwEr
lua_newtable(L);
for (i = 1, iList = list.begin(); iList != list.end(); ++iList, ++i) {
lua_pushnumber(L, i);
LuaScript::pushVariant(L, *iList);
lua_setfield(L, -2, qPrintable(QString("%1").arg(i)));
lua_settable(L, -3);
}
return 1;
#if QT_VERSION >= 0x040500
......@@ -181,8 +188,9 @@ int LuaScript::pushVariant(lua_State * L, const QVariant & v, const bool throwEr
}
return 1;
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
return LuaScript::pushQObject(L, v.value<QObject*>(), throwError);
case QMetaType::QWidgetStar:
return LuaScript::pushQObject(L, qobject_cast<QObject*>(v.value<QWidget*>()), throwError);
default:
// Don't throw errors if we are not in protected mode in lua, i.e.
// if the call to this function originated from C code, not in response
......@@ -311,7 +319,7 @@ int LuaScript::setProperty(lua_State * L)
/*static*/
QVariant LuaScript::getLuaStackValue(lua_State * L, int idx, const bool throwError /*= true*/)
{
bool isArray = true, isMap = true;
bool isArray = true, isMap = true, isQObject = false;
QVariantList vl;
QVariantMap vm;
int i, n, iMax;
......@@ -328,40 +336,72 @@ QVariant LuaScript::getLuaStackValue(lua_State * L, int idx, const bool throwErr
case LUA_TSTRING:
return QVariant(QString::fromUtf8(lua_tostring(L, idx)));
case LUA_TTABLE:
// Special treatment for tables
// If all keys are in the form 1..n, we can convert it to a QList
// convert index to an absolute value since we'll be messing with
// the stack
if (idx < 0) idx += lua_gettop(L) + 1;
// Check if we're dealing with a QObject* wrapper
if (lua_getmetatable(L, idx)) {
i = lua_gettop(L);
lua_pushnil(L);
// see if the metatable contains the key "__qobject"; if it
// doesn't, trying to get it later could result in an error
while (lua_next(L, i)) {
lua_pop(L, 1); // pop the value (we don't need it)
if (!lua_isstring(L, -1))
continue;
lua_pushvalue(L, -1); // duplicate the key so we don't disturb lua_next
if (QString(lua_tostring(L, -1)) == "__qobject")
isQObject = true;
lua_pop(L, 1); // pop the duplicate key
}
if (isQObject) {
lua_getfield(L, -1, "__qobject");
if (lua_islightuserdata(L, -1)) {
QObject * obj = (QObject*)lua_touserdata(L, -1);
lua_pop(L, 2);
return QVariant::fromValue(obj);
}
lua_pop(L, 1);
}
lua_pop(L, 1); // pop the metatable
}
// Special treatment for tables
// If all keys are in the form 1..n, we can convert it to a QList
// taken from the lua reference of lua_next()
lua_pushnil(L);
n = 0;
iMax = 0;
while (lua_next(L, idx)) {
if (isArray) {
if (!lua_isnumber(L, -2)) isArray = false;
if (!lua_isnumber(L, -2))
isArray = false;
else {
++n;
if (lua_tonumber(L, -2) > iMax) iMax = lua_tonumber(L, -2);
if (lua_tonumber(L, -2) > iMax)
iMax = lua_tonumber(L, -2);
}
}
if (isMap) {
// keys must be convertable to string
if (!lua_isstring(L, -2)) isMap = false;
if (!lua_isstring(L, -2))
isMap = false;
// some value types are not supported by QVariant
if (
lua_isfunction(L, -1) ||
if (lua_isfunction(L, -1) ||
lua_islightuserdata(L, -1) ||
lua_isthread(L, -1) ||
lua_isuserdata(L, -1)
) isMap = false;
lua_isuserdata(L, -1) )
isMap = false;
}
lua_pop(L, 1);
++i;
}
if (n != iMax) isArray = false;
if (n != iMax)
isArray = false;
// Lua is picky about the correct type of index for accessing table
// members. Hence we can't simply retrieve the table items by index
......@@ -370,8 +410,9 @@ QVariant LuaScript::getLuaStackValue(lua_State * L, int idx, const bool throwErr
// they keys need not be ordered when calling lua_next, we have to
// allocate the complete list first and overwrite the items as we
// get them.
if(isArray) {
for(i = 0; i < n; ++i) vl.append(QVariant());
if (isArray) {
for (i = 0; i < n; ++i)
vl.append(QVariant());
lua_pushnil(L);
while (lua_next(L, idx)) {
......@@ -406,7 +447,8 @@ QVariant LuaScript::getLuaStackValue(lua_State * L, int idx, const bool throwErr
// if the call to this function originated from C code, not in response
// to a lua request (e.g. during initialization or finalization) as that
// would crash Tw
if (throwError) luaL_error(L, qPrintable(tr("the lua type %s is currently not supported")), lua_typename(L, lua_type(L, idx)));
if (throwError)
luaL_error(L, qPrintable(tr("the lua type %s is currently not supported")), lua_typename(L, lua_type(L, idx)));
}
return QVariant();
}
......@@ -28,7 +28,7 @@ OBJECTS_DIR = ./obj
TARGET = TWLuaPlugin
CONFIG += rtti
CONFIG += rtti uitools
macx {
CONFIG += x86 ppc
......@@ -66,4 +66,6 @@ HEADERS += TWLuaPlugin.h \
../../src/TWScriptAPI.h
SOURCES += TWLuaPlugin.cpp \
../../src/TWScript.cpp
../../src/TWScript.cpp \
../../src/TWScriptAPI.cpp
......@@ -74,9 +74,6 @@ static void QObjectMethodDealloc(pyQObjectMethodObject * self) {
TWPythonPlugin::TWPythonPlugin()
{
// Base class constructor
QObject::QObject();
// Initialize the python interpretor
Py_Initialize();
}
......@@ -105,7 +102,7 @@ bool PythonScript::execute(TWScriptAPI *tw) const
// handle error
return false;
}
QString contents = QString::fromUtf8(scriptFile.readAll());
QString contents = m_Codec->toUnicode(scriptFile.readAll());
scriptFile.close();
// Python seems to require Unix style line endings
......@@ -258,6 +255,9 @@ PyObject* PythonScript::getAttribute(PyObject * o, PyObject * attr_name)
return NULL;
}
if (propName.length() > 1 && propName.endsWith(QChar('_')))
propName.chop(1);
switch (doGetProperty(obj, propName, result)) {
case Property_DoesNotExist:
PyErr_Format(PyExc_AttributeError, qPrintable(tr("getattr: object doesn't have property/method %s")), qPrintable(propName));
......@@ -325,6 +325,7 @@ int PythonScript::setAttribute(PyObject * o, PyObject * attr_name, PyObject * v)
/*static*/
PyObject * PythonScript::callMethod(PyObject * o, PyObject * pyArgs, PyObject * kw)
{
Q_UNUSED(kw)
QObject * obj;
QString methodName;
QVariantList args;
......@@ -342,7 +343,8 @@ PyObject * PythonScript::callMethod(PyObject * o, PyObject * pyArgs, PyObject *
for (i = 0; i < PyTuple_Size(pyArgs); ++i) {
args.append(PythonScript::PythonToVariant(PyTuple_GetItem(pyArgs, i)));
}
if (methodName.length() > 1 && methodName.endsWith(QChar('_')))
methodName.chop(1);
switch (doCallMethod(obj, methodName, args, result)) {
case Method_OK:
return PythonScript::VariantToPython(result);
......@@ -432,8 +434,9 @@ PyObject * PythonScript::VariantToPython(const QVariant & v)
}
return pyDict;
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
return PythonScript::QObjectToPython(v.value<QObject*>());
case QMetaType::QWidgetStar:
return PythonScript::QObjectToPython(qobject_cast<QObject*>(v.value<QWidget*>()));
default:
PyErr_Format(PyExc_TypeError, qPrintable(tr("the type %s is currently not supported")), v.typeName());
return NULL;
......@@ -450,6 +453,8 @@ QVariant PythonScript::PythonToVariant(PyObject * o)
Py_ssize_t i = 0;
QString str;
if (o == Py_None)
return QVariant();
// in Python 3.x, the PyInt_* were removed in favor of PyLong_*
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(o)) return QVariant((int)PyInt_AsLong(o));
......@@ -476,6 +481,9 @@ QVariant PythonScript::PythonToVariant(PyObject * o)
}
return map;
}
if (PyObject_TypeCheck(o, &pyQObjectType)) {
return QVariant::fromValue((QObject*)PyCObject_AsVoidPtr(((pyQObject*)o)->_TWcontext));
}
// \TODO Complex numbers, byte arrays
PyErr_Format(PyExc_TypeError, qPrintable(tr("the python type %s is currently not supported")), o->ob_type->tp_name);
return QVariant();
......
......@@ -132,7 +132,7 @@ protected:
* \note Calling by keywords is currently not supported
* \param o the pyQObjectMethodObject to call
* \param pyArgs python tuple of arguments
* \param kw dictionary of key-value argument pairs
* \param kw dictionary of key-value argument pairs (not supported)
* \return the return value of the method (PyNone for void functions) on
* success, \c NULL if an error occured
*/
......
......@@ -28,7 +28,7 @@ OBJECTS_DIR = ./obj
TARGET = TWPythonPlugin
CONFIG += rtti
CONFIG += rtti uitools
macx {
CONFIG += x86 ppc
......@@ -74,4 +74,5 @@ HEADERS += TWPythonPlugin.h \
../../src/TWScriptAPI.h
SOURCES += TWPythonPlugin.cpp \
../../src/TWScript.cpp
../../src/TWScript.cpp \
../../src/TWScriptAPI.cpp
<RCC>
<qresource>
<file>resfiles/completion/tw-basic.txt</file>
<file>resfiles/completion/tw-beamer.txt</file>
<file>resfiles/completion/tw-context.txt</file>
<file>resfiles/completion/tw-latex.txt</file>
<file>resfiles/configuration/auto-indent-patterns.txt</file>
......
%%!TEX encoding = UTF-8 Unicode
bfrm:=\begin{frame}#RET##INS##RET#\end{frame}
\action<#INS#>{•}
\againframe{#INS#}
\againframe<•>{#INS#}
\againframe<•>[•]{#INS#}
\alert{#INS#}
\alert<•>{#INS#}
{alertenv}<#INS#>#RET##RET#\end{alertenv}
\alt<#INS#>{•}{•}
{altenv}<#INS#>{•}{•}{•}{•}#RET##RET#\end{altenv}
{actionenv}<#INS#>#RET##RET#\end{actionenv}
{beamercolorbox}{#INS#}#RET##RET#\end{beamercolorbox}
{beamercolorbox}[•]{#INS#}#RET##RET#\end{beamercolorbox}
\beamerbutton{#INS#}
\beamergotobutton{#INS#}
\beamerreturnbutton{#INS#}
\beamerskipbutton{#INS#}
{block}{#INS#}#RET##RET#\end{block}
{block}<•>{#INS#}#RET##RET#\end{block}
\column{#INS#}
\column[•]{#INS#}
{column}{#INS#}#RET##RET#\end{column}
{column}[•]{#INS#}#RET##RET#\end{column}
{columns}#RET##INS##RET#\end{columns}
{columns}[•]#RET##INS##RET#\end{columns}
{frame}#RET##INS##RET#\end{frame}
{frame}{#INS#}#RET##RET#\end{frame}
{frame}[•]{#INS#}#RET##RET#\end{frame}
\frametitle{#INS#}#RET#
\frametitle<•>[•]{#INS#}#RET#
\framesubtitle{#INS#}#RET#
\framesubtitle<•>{#INS#}#RET#
\framezoom<#INS#><•>(•,•)(•,•)
\framezoom<#INS#><•>[•](•,•)(•,•)
\hypertarget{#INS#}{•}
\hypertarget<•>{#INS#}{•}
\includeonlyframes{#INS#}
\includeonlylecture{#INS#}
\invisible<#INS#>{•}
\lecture{#INS#}{•}
\note{#INS#}
\note<•>{#INS#}
\note<•>[•]{#INS#}
\only<#INS#>{•}
{onlyenv}<#INS#>#RET##RET#\end{onlyenv}
\onslide<>{#INS#}
\onslide+<>{#INS#}
\onslide*<>{#INS#}
{overlayarea}{#INS#}{•}#RET##RET#\end{overlayarea}
{overprint}#RET##INS##RET#\end{overprint}
\pause#RET##INS#
\pause[#INS#]#RET#
\setbeamercolor{#INS#}{•}#RET#
\setbeamersize{#INS#}#RET#
\setbeameroption{#INS#}
\setbeamertemplate{#INS#}{•}#RET#
\structure{#INS#}
{structureenv}#RET##INS##RET#\end{structureenv}
\temporal<#INS#>{•}{•}{•}
\uncover<#INS#>{•}
\usebeamercolor{#INS#}
\visible<#INS#>{•}
// TeXworksScript
// Title: Toggle Emphasized
// Shortcut: Ctrl+Shift+I
// Description: Encloses the current selection in \textem{}
// Description: Encloses the current selection in \emph{}
// Author: Jonathan Kew
// Version: 0.3
// Date: 2010-01-09
......@@ -27,4 +27,4 @@ function addOrRemove(prefix, suffix) {
return;
};
addOrRemove("\\textem{", "}");
addOrRemove("\\emph{", "}");
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2010 Jonathan Kew
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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the author,
see <http://texworks.org/>.
*/
#include "CommandlineParser.h"
#include <QFileInfo>
bool CommandlineParser::parse()
{
bool found;
foreach (const QString& rawItem, m_rawItems) {
found = false;
foreach (const CommandlineItemSpec& spec, m_specs) {
CommandlineItem item;
item.type = spec.type;
item.longName = spec.longName;
item.processed = false;
QString strLong = "--" + spec.longName;
QString strShort = "-" + spec.shortName;
switch (spec.type) {
case Commandline_Option:
if (!spec.longName.isEmpty() && rawItem.startsWith(strLong + "=")) {
item.value = rawItem.mid(strLong.length() + 1);
found = true;
}
else if (!spec.shortName.isEmpty() && rawItem.startsWith(strShort + "=")) {
item.value = rawItem.mid(strShort.length() + 1);
found = true;
}
break;
case Commandline_Switch:
if (!spec.longName.isEmpty() && rawItem == strLong)
found = true;
else if (!spec.shortName.isEmpty() && rawItem == strShort)
found = true;
break;
default:
break;
}
if (found) {
m_items << item;
break;
}
}
if (!found) {
CommandlineItem item;
item.type = Commandline_Argument;
item.processed = false;
item.value = rawItem;
m_items << item;
}
}
return true;
}
void CommandlineParser::printUsage(QTextStream & stream)
{
stream << "Usage: " << QFileInfo(QCoreApplication::applicationFilePath()).fileName() << " [opts/args]\n\n";
foreach (const CommandlineItemSpec& spec, m_specs) {
switch (spec.type) {
case Commandline_Option:
stream << " --" << spec.longName << "=...";
if (!spec.shortName.isEmpty())
stream << ", -" << spec.shortName << "=...";
break;
case Commandline_Switch:
stream << " --" << spec.longName;
if (!spec.shortName.isEmpty())
stream << ", -" << spec.shortName;
break;
default:
continue;
}
stream << " " << spec.description << "\n";
}
stream.flush();
}
int CommandlineParser::getNextArgument(int index /*= -1*/, CommandlineGetItemFlags flags /*= GetFlag_Default*/) const
{
for (++index; index < m_items.size(); ++index) {
if (m_items[index].type == Commandline_Argument) {
if ((flags & GetFlag_IncludeProcessed) || !m_items[index].processed)
return index;
}
}
return -1;
}
int CommandlineParser::getPrevArgument(int index /*= -1*/, CommandlineGetItemFlags flags /*= GetFlag_Default*/) const
{
for (--index; index >= 0; --index) {
if (m_items[index].type == Commandline_Argument) {
if ((flags & GetFlag_IncludeProcessed) || !m_items[index].processed)
return index;
}
}
return -1;
}
int CommandlineParser::getNextOption(
const QString longName /*= QString()*/,
int index /*= -1*/,
CommandlineGetItemFlags flags /*= GetFlag_Default*/
) const
{
for (++index; index < m_items.size(); ++index) {
if (m_items[index].type == Commandline_Option && m_items[index].longName == longName) {
if ((flags & GetFlag_IncludeProcessed) || !m_items[index].processed)
return index;
}
}
return -1;
}
int CommandlineParser::getPrevOption(
const QString longName /*= QString()*/,
int index /*= -1*/,
CommandlineGetItemFlags flags /*= GetFlag_Default*/
) const
{
for (--index; index >= 0; --index) {
if (m_items[index].type == Commandline_Option && m_items[index].longName == longName) {