Mailinglist Archive: zypp-commit (606 mails)

< Previous Next >
[zypp-commit] r9506 - in /trunk/libzypp: devel/devel.jkupec/poolquery.cc tests/zypp/PoolQuery_test.cc zypp/PoolQuery.cc
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Thu, 10 Apr 2008 11:31:20 -0000
  • Message-id: <20080410113120.EDE8F33DC7@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Thu Apr 10 13:31:20 2008
New Revision: 9506

URL: http://svn.opensuse.org/viewcvs/zypp?rev=9506&view=rev
Log:
- enabled different per-attribute query srtrings (one value)

Modified:
trunk/libzypp/devel/devel.jkupec/poolquery.cc
trunk/libzypp/tests/zypp/PoolQuery_test.cc
trunk/libzypp/zypp/PoolQuery.cc

Modified: trunk/libzypp/devel/devel.jkupec/poolquery.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/poolquery.cc?rev=9506&r1=9505&r2=9506&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/poolquery.cc (original)
+++ trunk/libzypp/devel/devel.jkupec/poolquery.cc Thu Apr 10 13:31:20 2008
@@ -49,11 +49,11 @@
init_pool();

PoolQuery q;
- //q.addString("novell");
q.addAttribute(sat::SolvAttr::name, "novell");
- q.addAttribute(sat::SolvAttr::summary, "novell");
+ q.addAttribute(sat::SolvAttr::summary, "package management");

std::for_each(q.begin(), q.end(), &result_cb);

cout << q.size() << endl;
+ cout << q << endl;
}

Modified: trunk/libzypp/tests/zypp/PoolQuery_test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/PoolQuery_test.cc?rev=9506&r1=9505&r2=9506&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/PoolQuery_test.cc (original)
+++ trunk/libzypp/tests/zypp/PoolQuery_test.cc Thu Apr 10 13:31:20 2008
@@ -348,6 +348,20 @@
cout << endl;
}

+
+// multiple attributes, different search strings (one string per attrbute)
+BOOST_AUTO_TEST_CASE(pool_query_104)
+{
+ cout << "****104****" << endl;
+ PoolQuery q;
+ q.addAttribute(sat::SolvAttr::name, "novell");
+ q.addAttribute(sat::SolvAttr::summary, "package management");
+
+ std::for_each(q.begin(), q.end(), &result_cb);
+ BOOST_CHECK(q.size() == 22);
+}
+
+
/////////////////////////////////////////////////////////////////////////////
// 3xx repo filter queries (addRepo(alias_str))
/////////////////////////////////////////////////////////////////////////////

Modified: trunk/libzypp/zypp/PoolQuery.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/PoolQuery.cc?rev=9506&r1=9505&r2=9506&view=diff
==============================================================================
--- trunk/libzypp/zypp/PoolQuery.cc (original)
+++ trunk/libzypp/zypp/PoolQuery.cc Thu Apr 10 13:31:20 2008
@@ -178,7 +178,6 @@
attrvals_empty = false;
goto attremptycheckend;
}
-
attremptycheckend:

// chceck whether the per-attribute strings are all the same
@@ -195,7 +194,6 @@
inserter(result, result.begin())/*, ltstr()*/);
if (!result.empty())
{
- copy(result.begin(), result.end(), ostream_iterator<string>(cout, "
"));
attrvals_thesame = false;
break;
}
@@ -223,15 +221,21 @@
for_(ai, _attrs.begin(), _attrs.end())
_rcattrs.insert(pair<sat::SolvAttr, string>(ai->first, string()));
}
+
// // DIFFERENT STRINGS FOR DIFFERENT ATTRS
// if _attrs is not empty and it contains non-empty vectors with
non-empty strings
// for each key in _attrs take all _strings + all _attrs[key] strings
// create regex; store in _rcattrs; flag 'different'; if more
strings flag regex;
else
{
- /* set_union(A.begin(), A.end(), B.begin(), B.end(),
- ostream_iterator<const char*>(cout, " "),
- ltstr());*/
+ for_(ai, _attrs.begin(), _attrs.end())
+ {
+ StrContainer joined;
+ invokeOnEach(_strings.begin(), _strings.end(), EmptyFilter(),
MyInserter(joined));
+ invokeOnEach(ai->second.begin(), ai->second.end(), EmptyFilter(),
MyInserter(joined));
+ string s = createRegex(joined);
+ _rcattrs.insert(pair<sat::SolvAttr, string>(ai->first, s));
+ }
}
}


--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages