[Debtags-commits] [svn] r1745 - in tagcoll/2.0: . tagcoll
tagcoll/coll tools
Enrico Zini
enrico at costa.debian.org
Tue May 9 22:24:41 UTC 2006
Author: enrico
Date: Tue May 9 22:24:39 2006
New Revision: 1745
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/DerivedTags.cc
tagcoll/2.0/tagcoll/coll/fast.cc
tagcoll/2.0/tagcoll/coll/simple.cc
tagcoll/2.0/tagcoll/coll/simple.h
tagcoll/2.0/tools/tagcoll.cc
Log:
r2670 at viaza: enrico | 2006-05-09 10:30:36 -0500
More tagcoll updates
Modified: tagcoll/2.0/tagcoll/DerivedTags.cc
==============================================================================
--- tagcoll/2.0/tagcoll/DerivedTags.cc (original)
+++ tagcoll/2.0/tagcoll/DerivedTags.cc Tue May 9 22:24:39 2006
@@ -24,16 +24,6 @@
using namespace tagcoll;
-#ifndef INSTANTIATING_TEMPLATES
-#include <string>
-
-namespace tagcoll {
- template class AddDerived<std::string>;
- template class RemoveDerived<std::string>;
-}
-#endif
-
-
#ifdef COMPILE_TESTSUITE
#include <tests/test-utils.h>
Modified: tagcoll/2.0/tagcoll/coll/fast.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/fast.cc (original)
+++ tagcoll/2.0/tagcoll/coll/fast.cc Tue May 9 22:24:39 2006
@@ -135,16 +135,6 @@
}
}
-#ifndef INSTANTIATING_TEMPLATES
-#include <string>
-
-namespace tagcoll {
-namespace coll {
- template class Fast<std::string, std::string>;
-}
-}
-#endif
-
#ifdef COMPILE_TESTSUITE
#include <tests/test-utils.h>
Modified: tagcoll/2.0/tagcoll/coll/simple.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/simple.cc (original)
+++ tagcoll/2.0/tagcoll/coll/simple.cc Tue May 9 22:24:39 2006
@@ -184,17 +184,6 @@
}
-#ifndef INSTANTIATING_TEMPLATES
-#include <string>
-
-namespace tagcoll {
-namespace coll {
-template class Simple<std::string, std::string>;
-}
-}
-#endif
-
-
#ifdef COMPILE_TESTSUITE
#include <tests/test-utils.h>
Modified: tagcoll/2.0/tagcoll/coll/simple.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/simple.h (original)
+++ tagcoll/2.0/tagcoll/coll/simple.h Tue May 9 22:24:39 2006
@@ -79,6 +79,8 @@
iterator begin() { return coll.begin(); }
iterator end() { return coll.end(); }
+ bool empty() const { return coll.empty(); }
+
template<typename ITEMS, typename TAGS>
void insert(const ITEMS& items, const TAGS& tags)
{
Modified: tagcoll/2.0/tools/tagcoll.cc
==============================================================================
--- tagcoll/2.0/tools/tagcoll.cc (original)
+++ tagcoll/2.0/tools/tagcoll.cc Tue May 9 22:24:39 2006
@@ -39,23 +39,25 @@
#include <wibble/exception.h>
#include <wibble/operators.h>
-#include <tagcoll/filters.h>
-#include <tagcoll/sink.h>
+#include <tagcoll/stream/filters.h>
+#include <tagcoll/stream/sink.h>
+#include <tagcoll/stream/substitutions.h>
+#include <tagcoll/stream/patcher.h>
+#include <tagcoll/stream/expression.h>
#include <tagcoll/CardinalityStore.h>
#include <tagcoll/SmartHierarchy.h>
#include <tagcoll/Consumer.h>
-#include <tagcoll/InputMerger.h>
+#include <tagcoll/coll/simple.h>
#include <tagcoll/Implications.h>
#include <tagcoll/Patches.h>
#include <tagcoll/DerivedTags.h>
-#include <tagcoll/TDBIndexer.h>
+#include <tagcoll/coll/fast.h>
-#include <tagcoll/StdioParserInput.h>
+#include <tagcoll/input/stdio.h>
#include <tagcoll/TextFormat.h>
#include <tagcoll/Serializer.h>
-#include <tagcoll/Expression.h>
#include <algorithm>
#include <iostream>
@@ -118,12 +120,12 @@
{
if (file == "-")
{
- StdioParserInput input(stdin, "<stdin>");
+ input::Stdio input(stdin, "<stdin>");
textformat::parse(input, out);
}
else
{
- StdioParserInput input(file);
+ input::Stdio input(file);
textformat::parse(input, out);
}
}
@@ -135,7 +137,7 @@
if (file == "-")
{
- StdioParserInput input(stdin, "<stdin>");
+ input::Stdio input(stdin, "<stdin>");
return textformat::parsePatch(conv, conv, input);
}
else if (isdir(file))
@@ -148,7 +150,7 @@
{
if (d->d_name[0] == '.')
continue;
- StdioParserInput input(file + '/' + d->d_name);
+ input::Stdio input(file + '/' + d->d_name);
patches.addPatch(textformat::parsePatch(conv, conv, input));
}
closedir(dir);
@@ -156,12 +158,12 @@
}
else
{
- StdioParserInput input(file);
+ input::Stdio input(file);
return textformat::parsePatch(conv, conv, input);
}
}
-void parseDerivedTags(ParserInput& in, DerivedTags& output)
+void parseDerivedTags(input::Input& in, DerivedTags& output)
{
string tag;
string expr;
@@ -169,7 +171,7 @@
int c;
enum {TAG, TAGCOLON, SEXPR, EXPR} state = TAG;
int line = 1;
- while ((c = in.nextChar()) != ParserInput::Eof)
+ while ((c = in.nextChar()) != input::Input::Eof)
{
if (c == '\n')
{
@@ -239,12 +241,12 @@
{
if (file == "-")
{
- StdioParserInput input(stdin, "<stdin>");
+ input::Stdio input(stdin, "<stdin>");
parseDerivedTags(input, derivedTags);
}
else
{
- StdioParserInput input(file);
+ input::Stdio input(file);
parseDerivedTags(input, derivedTags);
}
}
@@ -344,7 +346,7 @@
class Tagcoll
{
wibble::commandline::TagcollParser& opts;
- TDBIndexer<string, string> grouper;
+ coll::Fast<string, string> grouper;
FilterStepManager wman;
FilterStep* m_writer;
@@ -352,7 +354,7 @@
// Support structures for the input filter chain
Implications<string> implications;
DerivedTags derivedTags;
- Substitutions<string> substitutions;
+ stream::Substitutions<string> substitutions;
PatchList<string, string> patches;
FilterStep* makeReaderHead(FilterStep* out)
@@ -360,17 +362,17 @@
if (opts.in_patch->boolValue())
if (opts.in_rename->boolValue())
return filterStep(
- patcher(patches,
- substitute(substitutions,
+ stream::patcher(patches,
+ stream::substitute(substitutions,
FilterForwarder(out))));
else
return filterStep(
- patcher(patches,
+ stream::patcher(patches,
FilterForwarder(out)));
else
if (opts.in_rename->boolValue())
return filterStep(
- substitute(substitutions,
+ stream::substitute(substitutions,
FilterForwarder(out)));
else
return out;
@@ -404,15 +406,15 @@
if (opts.in_rmunfaceted->boolValue())
if (opts.in_rmtags->boolValue())
return filterStep(
- unfacetedRemover(
- filterTagsByExpression(
+ stream::unfacetedRemover(
+ stream::filterTagsByExpression(
not Expression(opts.in_rmtags->stringValue()), out)));
else
- return filterStep(unfacetedRemover(out));
+ return filterStep(stream::unfacetedRemover(out));
else
if (opts.in_rmtags->boolValue())
return filterStep(
- filterTagsByExpression(
+ stream::filterTagsByExpression(
not Expression(opts.in_rmtags->stringValue()), out));
else
return filterStep(out);
@@ -444,14 +446,14 @@
{
if (opts.out_itemsOnly->boolValue())
if (opts.out_group->boolValue())
- return filterStep(itemsOnly(consumer(grouper)));
+ return filterStep(stream::itemsOnly(inserter(grouper)));
else
- return filterStep(itemsOnly(ungroupItems(textformat::StdioWriter(stdout))));
+ return filterStep(stream::itemsOnly(stream::ungroupItems(textformat::StdioWriter(stdout))));
else
if (opts.out_group->boolValue())
- return filterStep(consumer(grouper));
+ return filterStep(inserter(grouper));
else
- return filterStep(ungroupItems(textformat::StdioWriter(stdout)));
+ return filterStep(stream::ungroupItems(textformat::StdioWriter(stdout)));
}
public:
@@ -460,7 +462,7 @@
{
if (opts.in_extimpl->boolValue())
{
- readCollection(opts.in_extimpl->stringValue(), consumer(implications));
+ readCollection(opts.in_extimpl->stringValue(), inserter(implications));
// Pack the structure for faster expansions
implications.pack();
}
@@ -474,7 +476,7 @@
~Tagcoll()
{
if (!grouper.empty())
- grouper.outputToIterator(textformat::StdioWriter(stdout));
+ grouper.output(textformat::StdioWriter(stdout));
}
template<typename OUT>
@@ -516,11 +518,11 @@
void diff(const std::string& input1, const std::string& input2)
{
- InputMerger<string, string> merger1;
- readFile(input1, consumer(merger1));
+ coll::Simple<string, string> merger1;
+ readFile(input1, inserter(merger1));
- InputMerger<string, string> merger2;
- readFile(input2, consumer(merger2));
+ coll::Simple<string, string> merger2;
+ readFile(input2, inserter(merger2));
PatchList<string, string> newpatches;
newpatches.addPatch(merger1, merger2);
@@ -537,15 +539,15 @@
int grep(const std::string& expr)
{
int count = 0;
- ExpressionFilter::MatchType type =
+ stream::ExpressionFilter::MatchType type =
opts.misc_invert->boolValue() ?
- ExpressionFilter::INVERTED : ExpressionFilter::PLAIN;
+ stream::ExpressionFilter::INVERTED : stream::ExpressionFilter::PLAIN;
if (opts.misc_quiet->boolValue())
- readAll(filterItemsByExpression(expr, type, countingSink(count)));
+ readAll(stream::filterItemsByExpression(expr, type, stream::countingSink(count)));
else
- readAll(filterItemsByExpression(expr, type,
- teeFilter(writer(), countingSink(count))));
+ readAll(stream::filterItemsByExpression(expr, type,
+ teeFilter(writer(), stream::countingSink(count))));
return count > 0 ? 0 : 1;
}
@@ -629,7 +631,7 @@
else if (opts.foundCommand() == opts.related)
{
string item = opts.next();
- InputMerger<string, string> merger;
+ coll::Simple<string, string> merger;
tagcoll.readAll(merger);
int maxdist = 0;
@@ -697,11 +699,9 @@
if (opts.misc_untaggedTag->boolValue())
revnull = opts.misc_untaggedTag->stringValue();
- InputMerger<string, string> reversed;
- Reverser<string, string> reverser(reversed, revnull);
- tagcoll.readAll(reverser);
-
- reversed.outputToIterator(tagcoll.writer());
+ coll::Simple<string, string> reversed;
+ tagcoll.readAll(stream::reverser(revnull, inserter(reversed)));
+ reversed.output(tagcoll.writer());
}
else if (opts.foundCommand() == opts.copy)
{
More information about the Debtags-commits
mailing list