r15709 - in software/ui: . debian libxdgutils m4 src
Enrico Zini
enrico at moszumanska.debian.org
Sat Jan 30 18:06:50 UTC 2016
Author: enrico
Date: 2016-01-30 18:06:49 +0000 (Sat, 30 Jan 2016)
New Revision: 15709
Added:
software/ui/m4/
software/ui/m4/m4_ax_cxx_compile_stdcxx_11.m4
Removed:
software/ui/src/GamesOptions.h
software/ui/src/manpage.cpp
Modified:
software/ui/Makefile.am
software/ui/configure.ac
software/ui/debian/changelog
software/ui/debian/control
software/ui/libxdgutils/XDGDesktopEntry.cpp
software/ui/src/Engine.cpp
software/ui/src/Makefile.am
software/ui/src/Makefile.test
software/ui/src/goplay.cpp
software/ui/src/pkgbrowser.cpp
Log:
Ported to new libept, removed tagcoll and wibble deps
Modified: software/ui/Makefile.am
===================================================================
--- software/ui/Makefile.am 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/Makefile.am 2016-01-30 18:06:49 UTC (rev 15709)
@@ -4,7 +4,4 @@
man_MANS = goplay.1
-goplay.1: src/manpage
- src/manpage goplay > $@ || rm $@
-
EXTRA_DIST = $(man_MANS) FAQ LICENSE README data autogen.sh
Modified: software/ui/configure.ac
===================================================================
--- software/ui/configure.ac 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/configure.ac 2016-01-30 18:06:49 UTC (rev 15709)
@@ -3,6 +3,7 @@
AC_CONFIG_SRCDIR([configure.ac])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])
+AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl To use subdirs
@@ -18,13 +19,14 @@
AC_HEADER_STDC
AC_PROG_RANLIB
+dnl Use c++11
+AX_CXX_COMPILE_STDCXX_11
+
dnl Use libtool
AM_PROG_LIBTOOL
-dnl Use wibble, tagcoll2 and pkg
-PKG_CHECK_MODULES([LIBWIBBLE], [libwibble])
+dnl Use libept
PKG_CHECK_MODULES([LIBEPT], [libept])
-PKG_CHECK_MODULES([LIBTAGCOLL2], [libtagcoll2])
dnl Look for apt-get
AC_PATH_PROG(APTGET, apt-get, /usr/bin/apt-get)
Modified: software/ui/debian/changelog
===================================================================
--- software/ui/debian/changelog 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/debian/changelog 2016-01-30 18:06:49 UTC (rev 15709)
@@ -1,3 +1,10 @@
+goplay (0.10) UNRELEASED; urgency=medium
+
+ * Build using new libept and C++11, dropping libwibble and libtagcoll
+ dependencies.
+
+ -- Enrico Zini <enrico at debian.org> Thu, 10 Sep 2015 18:24:03 +0200
+
goplay (0.9.1) unstable; urgency=medium
* Team upload.
Modified: software/ui/debian/control
===================================================================
--- software/ui/debian/control 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/debian/control 2016-01-30 18:06:49 UTC (rev 15709)
@@ -6,7 +6,7 @@
Miriam Ruiz <miriam at debian.org>,
Petter Reinholdtsen <pere at debian.org>
Build-Depends: debhelper (>= 9), pkg-config, dh-autoreconf,
- libept-dev, libwibble-dev, libfltk1.3-dev, libtagcoll2-dev
+ libept-dev (>= 1.1), libfltk1.3-dev
,imagemagick
,libcurl4-gnutls-dev
,fluid
Modified: software/ui/libxdgutils/XDGDesktopEntry.cpp
===================================================================
--- software/ui/libxdgutils/XDGDesktopEntry.cpp 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/libxdgutils/XDGDesktopEntry.cpp 2016-01-30 18:06:49 UTC (rev 15709)
@@ -468,7 +468,7 @@
// Now find missing required keys
for(i = 0; registeredEntries[i].name != NULL; i++) {
- if (!(registeredEntries[i].type & type))
+ if (~registeredEntries[i].type & type)
continue;
if (registeredEntries[i].required) {
Added: software/ui/m4/m4_ax_cxx_compile_stdcxx_11.m4
===================================================================
--- software/ui/m4/m4_ax_cxx_compile_stdcxx_11.m4 (rev 0)
+++ software/ui/m4/m4_ax_cxx_compile_stdcxx_11.m4 2016-01-30 18:06:49 UTC (rev 15709)
@@ -0,0 +1,133 @@
+# ============================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++11
+# standard; if necessary, add switches to CXXFLAGS to enable support.
+#
+# The first argument, if specified, indicates whether you insist on an
+# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+# -std=c++11). If neither is specified, you get whatever works, with
+# preference for an extended mode.
+#
+# The second argument, if specified 'mandatory' or if left unspecified,
+# indicates that baseline C++11 support is required and that the macro
+# should error out if no mode with that support is found. If specified
+# 'optional', then configuration proceeds regardless, after defining
+# HAVE_CXX11 if and only if a supporting mode is found.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 3
+
+m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = static_cast<check_type&&>(c);
+
+ auto d = a;
+])
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
+ m4_if([$1], [], [],
+ [$1], [ext], [],
+ [$1], [noext], [],
+ [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
+ m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
+ [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
+ [$2], [optional], [ax_cxx_compile_cxx11_required=false],
+ [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
+ AC_LANG_PUSH([C++])dnl
+ ac_success=no
+ AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
+ ax_cv_cxx_compile_cxx11,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [ax_cv_cxx_compile_cxx11=yes],
+ [ax_cv_cxx_compile_cxx11=no])])
+ if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+ ac_success=yes
+ fi
+
+ m4_if([$1], [noext], [], [dnl
+ if test x$ac_success = xno; then
+ for switch in -std=gnu++11; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+ $cachevar,
+ [ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXXFLAGS="$ac_save_CXXFLAGS"])
+ if eval test x\$$cachevar = xyes; then
+ CXXFLAGS="$CXXFLAGS $switch"
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+
+ m4_if([$1], [ext], [], [dnl
+ if test x$ac_success = xno; then
+ for switch in -std=c++11; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+ $cachevar,
+ [ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXXFLAGS="$ac_save_CXXFLAGS"])
+ if eval test x\$$cachevar = xyes; then
+ CXXFLAGS="$CXXFLAGS $switch"
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+ AC_LANG_POP([C++])
+ if test x$ax_cxx_compile_cxx11_required = xtrue; then
+ if test x$ac_success = xno; then
+ AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
+ fi
+ else
+ if test x$ac_success = xno; then
+ HAVE_CXX11=0
+ AC_MSG_NOTICE([No compiler with C++11 support was found])
+ else
+ HAVE_CXX11=1
+ AC_DEFINE(HAVE_CXX11,1,
+ [define if the compiler supports basic C++11 syntax])
+ fi
+
+ AC_SUBST(HAVE_CXX11)
+ fi
+])
Modified: software/ui/src/Engine.cpp
===================================================================
--- software/ui/src/Engine.cpp 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/Engine.cpp 2016-01-30 18:06:49 UTC (rev 15709)
@@ -19,14 +19,13 @@
*/
#include "Engine.h"
-
-#include <wibble/string.h>
-#include <wibble/regexp.h>
+#include <ept/utils/string.h>
+#include <regex>
#include <iostream>
#include <fstream>
using namespace std;
-using namespace wibble;
+using namespace ept;
using namespace ept::apt;
using namespace ept::debtags;
@@ -46,16 +45,17 @@
in.open("/var/lib/apt-xapian-index/values", ios::in);
if (!in.is_open() || in.fail())
m_popcon_validx = -1;
- ERegexp match_line("^app-popcon[ \t]+([0-9]+)", 2);
+ std::regex match_line(R"(^app-popcon\S+(\d+))", 2);
string line;
while (true)
{
getline(in, line);
if (in.fail()) break;
if (in.eof()) break;
- if (match_line.match(line))
+ std::smatch match;
+ if (std::regex_search(line, match, match_line))
{
- m_popcon_validx = strtoul(match_line[1].c_str(), 0, 10);
+ m_popcon_validx = strtoul(match[1].str().c_str(), 0, 10);
break;
}
}
@@ -106,19 +106,19 @@
if (!m_filter_keywords.empty())
{
// Add prefixes to tag names
- Splitter splitter("[ \t]*,[ \t]*", REG_EXTENDED);
+ std::regex splitter(R"([ \t]*,[ \t]*)");
vector<string> kw;
- for (Splitter::const_iterator i = splitter.begin(m_filter_keywords);
- i != splitter.end(); ++i)
+ for (auto i = std::sregex_token_iterator(m_filter_keywords.begin(), m_filter_keywords.end(), splitter, -1);
+ i != std::sregex_token_iterator(); ++i)
{
if (m_vocabulary.hasTag(*i))
- kw.push_back("tag:" + *i);
+ kw.push_back("tag:" + i->str());
else
kw.push_back(*i);
}
bool do_partial = not (kw.size() == 1 and kw[0].size() < 3);
- kwquery = m_qp.parse_query(str::join(kw.begin(), kw.end(), " "),
+ kwquery = m_qp.parse_query(str::join(" ", kw.begin(), kw.end()),
Xapian::QueryParser::FLAG_BOOLEAN |
Xapian::QueryParser::FLAG_LOVEHATE |
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
@@ -365,5 +365,3 @@
m_filter_state = state;
m_dirty = true;
}
-
-// vim:set ts=4 sw=4:
Deleted: software/ui/src/GamesOptions.h
===================================================================
--- software/ui/src/GamesOptions.h 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/GamesOptions.h 2016-01-30 18:06:49 UTC (rev 15709)
@@ -1,69 +0,0 @@
-#ifndef GAMES_OPTIONS_H
-#define GAMES_OPTIONS_H
-
-/*
- * Commandline parser for the game viewer
- *
- * Copyright (C) 2003,2004,2005,2006,2007 Enrico Zini
- *
- * 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
- */
-
-#include <wibble/commandline/parser.h>
-
-namespace wibble {
-namespace commandline {
-
-struct GamesOptions : public StandardParserWithManpage
-{
-public:
- BoolOption* out_debug;
- BoolOption* out_verbose;
- StringOption* gowhere;
- StringOption* mainFacet;
- StringOption* secondaryFacet;
- StringOption* ftags;
-
- GamesOptions()
- : StandardParserWithManpage("goplay", VERSION, 1, "Enrico Zini <enrico at enricozini.org> and Miriam Ruiz <little_miry at yahoo.es>")
- {
- usage = "[options and arguments]";
- description = "Debian game browser";
- longDescription =
- "GoPlay! is a Graphical User Interface (GUI) that uses DebTags"
- " for finding games in Debian easily.\n";
-
- out_verbose = add<BoolOption>("verbose", 'v', "verbose", "",
- "enable verbose output");
- out_debug = add<BoolOption>("debug", 0, "debug", "",
- "enable debugging output (including verbose output)");
- gowhere = add<StringOption>("go", 0, "go", "where",
- "change the interface flavour. "
- "Available flavours are: play, learn, admin, net, office, safe, web, science");
- mainFacet = add<StringOption>("primary", 0, "primary", "facet",
- "use the given facet instead of 'games'");
- secondaryFacet = add<StringOption>("secondary", 0, "secondary", "facet",
- "use the given facet instead of 'interface'");
- ftags = add<StringOption>("ftags", 0, "ftags", "tags",
- "comma-separated list of tags that are always "
- "required in search results (default: role::program)");
- }
-};
-
-}
-}
-
-// vim:set ts=4 sw=4:
-#endif
Modified: software/ui/src/Makefile.am
===================================================================
--- software/ui/src/Makefile.am 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/Makefile.am 2016-01-30 18:06:49 UTC (rev 15709)
@@ -1,7 +1,6 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = goplay
-noinst_PROGRAMS = manpage
BUILT_SOURCES = goweb gonet goadmin gooffice golearn gosafe goscience
CLEANFILES = $(BUILT_SOURCES)
@@ -16,7 +15,6 @@
Environment.h \
URLFetcher.h \
filter.h \
- GamesOptions.h \
pkgbrowser.h \
taghandler.h \
windows.h
@@ -39,9 +37,6 @@
../libxdgutils/libxdgutils.a \
$(LIBEPT_LIBS)
-manpage_SOURCES = manpage.cpp
-manpage_LDADD = $(LIBEPT_LIBS)
-
ui.h ui.cpp: ui.fld
fluid -c -o ui.cpp -h ui.h ui.fld
@@ -56,9 +51,9 @@
-Wformat \
-Werror=format-security
-INCLUDES = -I.. $(LIBEPT_CFLAGS) `fltk-config --cxxflags --use-images` `curl-config --cflags` $(WARNFLAGS) -ggdb
+INCLUDES = -I.. --std=c++11 $(LIBEPT_CFLAGS) `fltk-config --cxxflags --use-images` `curl-config --cflags` $(WARNFLAGS) -ggdb
-EXTRA_DIST = GamesOptions.h Environment.h Engine.h ui.fld ui.h ui.cpp pkgbrowser.h LICENSE \
+EXTRA_DIST = Environment.h Engine.h ui.fld ui.h ui.cpp pkgbrowser.h LICENSE \
Makefile.test CuTest.h CuTest.c CuTest.sh CuTest.txt \
CuTest.example/example.c \
CuTest.example/Makefile \
Modified: software/ui/src/Makefile.test
===================================================================
--- software/ui/src/Makefile.test 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/Makefile.test 2016-01-30 18:06:49 UTC (rev 15709)
@@ -2,8 +2,8 @@
test_goplay.o test_pkgbrowser.o test_taghandler.o \
test_ui.o test_windows.o CuTest.o test_main.o
-CFLAGS= -O2 -g -I.. -I/usr/include/tagcoll-2.0.7 `fltk-config --cxxflags --use-images` -Wall
-LDFLAGS= -lept -lept-core -lapt-pkg -lxapian -ltagcoll2 -lz -lwibble `fltk-config --ldflags --use-images`
+CFLAGS= -O2 -g -I.. `fltk-config --cxxflags --use-images` -Wall
+LDFLAGS= -lept -lept-core -lapt-pkg -lxapian -lz `fltk-config --ldflags --use-images`
test: $(OBJS)
g++ -o $@ $(LDFLAGS) $+
Modified: software/ui/src/goplay.cpp
===================================================================
--- software/ui/src/goplay.cpp 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/goplay.cpp 2016-01-30 18:06:49 UTC (rev 15709)
@@ -29,7 +29,6 @@
#endif
#include "Environment.h"
-#include "GamesOptions.h"
#include "Engine.h"
#include "common.h"
@@ -37,10 +36,10 @@
#include "filter.h"
#include <ept/apt/packagerecord.h>
-#include <wibble/regexp.h>
-#include <wibble/string.h>
+#include <ept/utils/string.h>
#include <xapian.h>
+#include <regex>
#include <iostream>
#include <fstream>
#include <cmath>
@@ -53,6 +52,8 @@
#define gettext(a) (a)
#endif
+#include <getopt.h>
+
#include <FL/Fl.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/fl_ask.H>
@@ -75,21 +76,8 @@
return out;
}
-template<typename TAG, typename _Traits>
-basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& out, const wibble::Singleton<TAG>& tags)
-{
- out << *tags.begin();
- return out;
}
-template<typename TAG, typename _Traits>
-basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& out, const wibble::Empty<TAG>&)
-{
- return out;
-}
-
-}
-
using namespace std;
using namespace ept;
using namespace ept::debtags;
@@ -384,8 +372,34 @@
}
#endif
+static void do_usage(const char* argv0, FILE* out)
+{
+ fprintf(out, "Usage: %s [options]\n", argv0);
+}
+
+static void do_help(const char* argv0, FILE* out)
+{
+ do_usage(argv0, out);
+ fprintf(out, R"(Debian game browser
+
+GoPlay! is a Graphical User Interface (GUI) that uses DebTags for finding games
+in Debian easily.
+
+Options:
+ -h,--help this help text
+ -v,--verbose enable verbose output
+ --debug enable debugging output (including verbose output)
+ --go <where> change the interface flavour. Available flavours are:
+ play, learn, admin, net, office, safe, web, science
+ --primary <facet> use the given facet instead of 'games'
+ --secondary <facet> use the given facet instead of 'interface'
+ --ftags <tags> comma-separated list of tags that are always
+ required in search results (default: role::program)
+)");
+}
+
#ifndef UNIT_TEST
-int main(int argc, const char* argv[])
+int main(int argc, char* argv[])
{
#ifdef USE_GETTEXT
setlocale (LC_MESSAGES, "");
@@ -395,25 +409,56 @@
bindtextdomain ("gamesui", NULL);
#endif
- wibble::commandline::GamesOptions opts;
+ static struct option long_options[] =
+ {
+ /* These options set a flag. */
+ {"verbose", no_argument, NULL, 'v'},
+ {"debug", no_argument, NULL, 'D'},
+ {"go", required_argument, NULL, 'G'},
+ {"primary", required_argument, NULL, 'P'},
+ {"seconday", required_argument, NULL, 'S'},
+ {"ftags", required_argument, NULL, 'F'},
+ {"help", no_argument, NULL, 'h'},
+ {0, 0, 0, 0}
+ };
- try {
- // Install the handler for unexpected exceptions
- wibble::exception::InstallUnexpected installUnexpected;
+ try {
+ string gowhere;
+ string primary;
+ string secondary;
+ string ftags;
- if (opts.parse(argc, argv))
- return 0;
+ while (1)
+ {
+ // getopt_long stores the option index here
+ int option_index = 0;
- if (opts.out_verbose->boolValue())
- ::Environment::get().verbose(true);
+ int c = getopt_long(argc, argv, "vDG:P:S:F:h", long_options, &option_index);
- if (opts.out_debug->boolValue())
- ::Environment::get().debug(true);
+ // Detect the end of the options
+ if (c == -1)
+ break;
- Engine engine;
+ switch (c)
+ {
+ case 'v': ::Environment::get().verbose(true); break;
+ case 'D': ::Environment::get().debug(true); break;
+ case 'G': gowhere = optarg; break;
+ case 'P': primary = optarg; break;
+ case 'S': secondary = optarg; break;
+ case 'F': ftags = optarg; break;
+ case 'h': do_help(argv[0], stdout); return 0;
+ default:
+ fprintf(stderr, "unknown option character %c (%d)\n", c, c);
+ do_help(argv[0], stderr);
+ return 1;
+ }
+ }
- if (wibble::str::endsWith(argv[0], "learn") || opts.gowhere->stringValue() == "learn")
- {
+ Engine engine;
+
+ if (str::endswith(argv[0], "learn") || gowhere == "learn")
+ {
engine.mainFacet = "field";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_AND,
@@ -421,37 +466,37 @@
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program")),
Xapian::Query("XTuse::learning"));
- } else if (wibble::str::endsWith(argv[0], "admin") || opts.gowhere->stringValue() == "admin") {
+ } else if (str::endswith(argv[0], "admin") || gowhere == "admin") {
engine.mainFacet = "admin";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program"));
- } else if (wibble::str::endsWith(argv[0], "net") || opts.gowhere->stringValue() == "net") {
+ } else if (str::endswith(argv[0], "net") || gowhere == "net") {
engine.mainFacet = "network";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program"));
- } else if (wibble::str::endsWith(argv[0], "office") || opts.gowhere->stringValue() == "office") {
+ } else if (str::endswith(argv[0], "office") || gowhere == "office") {
engine.mainFacet = "office";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program"));
- } else if (wibble::str::endsWith(argv[0], "safe") || opts.gowhere->stringValue() == "safe") {
+ } else if (str::endswith(argv[0], "safe") || gowhere == "safe") {
engine.mainFacet = "security";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program"));
- } else if (wibble::str::endsWith(argv[0], "web") || opts.gowhere->stringValue() == "web") {
+ } else if (str::endswith(argv[0], "web") || gowhere == "web") {
engine.mainFacet = "web";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
Xapian::Query("XTrole::documentation"),
Xapian::Query("XTrole::program"));
- } else if (wibble::str::endsWith(argv[0], "science") || opts.gowhere->stringValue() == "science") {
+ } else if (str::endswith(argv[0], "science") || gowhere == "science") {
engine.mainFacet = "field";
engine.secondaryFacet = "interface";
engine.globalFilter = Xapian::Query(Xapian::Query::OP_OR,
@@ -463,28 +508,28 @@
engine.globalFilter = Xapian::Query("XTrole::program");
}
- if (opts.mainFacet->isSet())
- engine.mainFacet = opts.mainFacet->stringValue();
+ if (!primary.empty())
+ engine.mainFacet = primary;
- if (opts.secondaryFacet->isSet())
- engine.secondaryFacet = opts.secondaryFacet->stringValue();
+ if (!secondary.empty())
+ engine.secondaryFacet = secondary;
- if (opts.ftags->isSet())
- {
- Xapian::Query fquery;
- wibble::Splitter tags(", *", REG_EXTENDED);
- bool first = true;
- for (wibble::Splitter::const_iterator i = tags.begin(opts.ftags->stringValue());
- i != tags.end(); ++i)
- {
- if (first)
- {
- fquery = Xapian::Query("XT"+*i);
- first = false;
- }
- else
- fquery = Xapian::Query(Xapian::Query::OP_AND, fquery, Xapian::Query("XT"+*i));
- }
+ if (!ftags.empty())
+ {
+ Xapian::Query fquery;
+ std::regex tags(R"(, *)");
+ bool first = true;
+ for (auto i = std::sregex_token_iterator(ftags.begin(), ftags.end(), tags, -1);
+ i != std::sregex_token_iterator(); ++i)
+ {
+ if (first)
+ {
+ fquery = Xapian::Query("XT" + i->str());
+ first = false;
+ }
+ else
+ fquery = Xapian::Query(Xapian::Query::OP_AND, fquery, Xapian::Query("XT" + i->str()));
+ }
engine.globalFilter = fquery;
}
@@ -535,10 +580,6 @@
window->show(argc, (char**)argv);
while (Fl::wait());
return 0;
- } catch (wibble::exception::BadOption& e) {
- cerr << e.desc() << endl;
- opts.outputHelp(cerr);
- return 1;
} catch (std::exception& e) {
cerr << e.what() << endl;
return 1;
@@ -568,5 +609,3 @@
}
#endif
-
-// vim:set ts=4 sw=4:
Deleted: software/ui/src/manpage.cpp
===================================================================
--- software/ui/src/manpage.cpp 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/manpage.cpp 2016-01-30 18:06:49 UTC (rev 15709)
@@ -1,60 +0,0 @@
-/*
- * tagged collection - Experimental programs to test and study tagged collections
- *
- * Copyright (C) 2003,2004,2005,2006 Enrico Zini
- *
- * 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
- */
-
-#include <config.h>
-#include <wibble/commandline/doc.h>
-#include "GamesOptions.h"
-#include <iostream>
-
-using namespace std;
-
-int main(int argc, const char* argv[])
-{
- try {
- if (argc == 1)
- throw wibble::exception::BadOption("no arguments provided");
-
- string cmd(argv[1]);
- string hooks(argc > 2 ? argv[2] : "");
-
- if (cmd == "goplay")
- {
- wibble::commandline::GamesOptions opts;
- wibble::commandline::Manpage help("goplay", VERSION, 1, "Enrico Zini <enrico at enricozini.org> and Miriam Ruiz <little_miry at yahoo.es>");
- if (!hooks.empty())
- help.readHooks(hooks);
- help.output(cout, opts);
- }
- else
- throw wibble::exception::BadOption("unknown command " + cmd);
-
- return 0;
- } catch (wibble::exception::BadOption& e) {
- cerr << e.desc() << endl << endl;
- cerr << "Usage: manpage <command>" << endl << endl;
- cerr << "Supported commands are: goplay" << endl;
- return 1;
- } catch (std::exception& e) {
- cerr << e.what() << endl;
- return 1;
- }
-}
-
-// vim:set ts=4 sw=4:
Modified: software/ui/src/pkgbrowser.cpp
===================================================================
--- software/ui/src/pkgbrowser.cpp 2016-01-30 18:06:46 UTC (rev 15708)
+++ software/ui/src/pkgbrowser.cpp 2016-01-30 18:06:49 UTC (rev 15709)
@@ -33,7 +33,6 @@
#endif
#include "Environment.h"
-#include "GamesOptions.h"
#include "Engine.h"
#include "URLFetcher.h"
More information about the Pkg-games-commits
mailing list