aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-06 00:18:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-06 00:18:20 +0000
commitbe75725ef69df695ff8f29a276e3d31d9b9637fd (patch)
tree154aa762f4e1e21ffaf1537fcd39ab41753ae139
parent90be84ddab43c347b3cef69a6a17a41fab3abc40 (diff)
downloadpaludis-be75725ef69df695ff8f29a276e3d31d9b9637fd.tar.gz
paludis-be75725ef69df695ff8f29a276e3d31d9b9637fd.tar.xz
Kill more sr
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/qa.cc16
-rw-r--r--paludis/qa.hh41
-rw-r--r--paludis/qa.sr37
-rw-r--r--paludis/repositories/e/qa/default_functions_TEST.cc2
-rw-r--r--paludis/repositories/e/qa/extractors_TEST.cc2
-rw-r--r--paludis/repositories/e/qa/homepage_key_TEST.cc2
-rw-r--r--paludis/repositories/e/qa/kv_variables_TEST.cc2
-rw-r--r--paludis/repositories/e/qa/qa_controller.cc2
-rw-r--r--paludis/repositories/e/qa/visibility_TEST.cc2
-rw-r--r--python/qa.cc26
-rw-r--r--ruby/qa.cc20
-rw-r--r--src/clients/qualudis/qualudis.cc24
13 files changed, 101 insertions, 79 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index f13875e..fafb8cb 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -41,7 +41,7 @@ add(`formatter', `hh', `fwd', `cc')
add(`generator', `hh', `cc', `fwd', `test')
add(`generator_handler', `hh', `cc', `fwd')
add(`handled_information', `hh', `fwd', `cc')
-add(`hook', `hh', `cc', `fwd',`se')
+add(`hook', `hh', `cc', `fwd', `se')
add(`hooker', `hh', `cc', `test', `testscript')
add(`install_task', `hh', `cc', `se')
add(`literal_metadata_key', `hh', `cc')
@@ -59,7 +59,7 @@ add(`override_functions', `hh', `cc')
add(`package_database', `hh', `cc', `fwd', `test')
add(`package_id', `hh', `cc', `fwd', `se')
add(`paludis', `hh')
-add(`qa', `hh', `cc', `fwd', `se', `sr')
+add(`qa', `hh', `cc', `fwd', `se')
add(`query_visitor', `hh', `cc')
add(`range_rewriter', `hh', `cc', `test')
add(`report_task', `hh', `cc')
diff --git a/paludis/qa.cc b/paludis/qa.cc
index 74a94f7..413ee37 100644
--- a/paludis/qa.cc
+++ b/paludis/qa.cc
@@ -25,7 +25,6 @@
using namespace paludis;
#include <paludis/qa-se.cc>
-#include <paludis/qa-sr.cc>
template class Set<std::tr1::shared_ptr<const PackageID>, PackageIDSetComparator>;
template class Sequence<std::tr1::shared_ptr<const MetadataKey> >;
@@ -49,7 +48,7 @@ QAMessage::default_associated_keys()
QAMessage &
QAMessage::with_associated_id(const std::tr1::shared_ptr<const PackageID> & id)
{
- associated_ids->insert(id);
+ associated_ids()->insert(id);
return *this;
}
@@ -57,7 +56,18 @@ QAMessage &
QAMessage::with_associated_key(const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const MetadataKey> & k)
{
- associated_keys->push_back(std::make_pair(id, k));
+ associated_keys()->push_back(std::make_pair(id, k));
return *this;
}
+QAMessage::QAMessage(const FSEntry & f, const QAMessageLevel & l,
+ const std::string & n, const std::string & m) :
+ associated_ids(default_associated_ids()),
+ associated_keys(default_associated_keys()),
+ entry(f),
+ level(l),
+ message(m),
+ name(n)
+{
+}
+
diff --git a/paludis/qa.hh b/paludis/qa.hh
index 2194939..165ebeb 100644
--- a/paludis/qa.hh
+++ b/paludis/qa.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -26,7 +26,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/set-fwd.hh>
-#include <paludis/util/sr.hh>
+#include <paludis/util/named_value.hh>
/** \file
* Declarations for Repository QA classes.
@@ -40,7 +40,42 @@
namespace paludis
{
-#include <paludis/qa-sr.hh>
+ namespace n
+ {
+ struct associated_ids;
+ struct associated_keys;
+ struct entry;
+ struct level;
+ struct message;
+ struct name;
+ }
+
+ /**
+ * Parameters for a QA message.
+ *
+ * \see RepositoryQAInterface
+ * \ingroup g_repository
+ * \since 0.26
+ * \nosubgrouping
+ */
+ struct PALUDIS_VISIBLE QAMessage
+ {
+ typedef Sequence<std::pair<std::tr1::shared_ptr<const PackageID>, std::tr1::shared_ptr<const MetadataKey> > > KeysSequence;
+
+ NamedValue<n::associated_ids, std::tr1::shared_ptr<PackageIDSet> > associated_ids;
+ NamedValue<n::associated_keys, std::tr1::shared_ptr<KeysSequence> > associated_keys;
+ NamedValue<n::entry, FSEntry> entry;
+ NamedValue<n::level, QAMessageLevel> level;
+ NamedValue<n::message, std::string> message;
+ NamedValue<n::name, std::string> name;
+
+ static std::tr1::shared_ptr<PackageIDSet> default_associated_ids();
+ static std::tr1::shared_ptr<KeysSequence> default_associated_keys();
+ QAMessage & with_associated_id(const std::tr1::shared_ptr<const PackageID> &);
+ QAMessage & with_associated_key(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const MetadataKey> &);
+
+ QAMessage(const FSEntry &, const QAMessageLevel &, const std::string & name, const std::string & message);
+ };
/**
* A QAReporter subclass is passed to RepositoryQAInterface::check_qa to do
diff --git a/paludis/qa.sr b/paludis/qa.sr
deleted file mode 100644
index f6290c0..0000000
--- a/paludis/qa.sr
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_QAMessage()
-{
- visible
-
- typedef "Sequence<std::pair<std::tr1::shared_ptr<const PackageID>, std::tr1::shared_ptr<const MetadataKey> > > KeysSequence"
-
- key entry "FSEntry"
- key level "QAMessageLevel"
- key name "std::string"
- key message "std::string"
- key associated_ids "std::tr1::shared_ptr<PackageIDSet>" "default_associated_ids()"
- key associated_keys "std::tr1::shared_ptr<KeysSequence>" "default_associated_keys()"
-
- extra_methods <<END
- static std::tr1::shared_ptr<PackageIDSet> default_associated_ids();
- static std::tr1::shared_ptr<KeysSequence> default_associated_keys();
- QAMessage & with_associated_id(const std::tr1::shared_ptr<const PackageID> &);
- QAMessage & with_associated_key(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const MetadataKey> &);
-END
-
- allow_named_args
-
- doxygen_comment << "END"
- /**
- * Parameters for a QA message.
- *
- * \see RepositoryQAInterface
- * \ingroup g_repository
- * \since 0.26
- * \nosubgrouping
- */
-END
-}
-
diff --git a/paludis/repositories/e/qa/default_functions_TEST.cc b/paludis/repositories/e/qa/default_functions_TEST.cc
index f7357b3..7b705ff 100644
--- a/paludis/repositories/e/qa/default_functions_TEST.cc
+++ b/paludis/repositories/e/qa/default_functions_TEST.cc
@@ -48,7 +48,7 @@ namespace
++count;
if (! messages.empty())
messages.append(", ");
- messages.append(m.message);
+ messages.append(m.message());
}
void status(const std::string &)
diff --git a/paludis/repositories/e/qa/extractors_TEST.cc b/paludis/repositories/e/qa/extractors_TEST.cc
index adcd91b..b8f65d0 100644
--- a/paludis/repositories/e/qa/extractors_TEST.cc
+++ b/paludis/repositories/e/qa/extractors_TEST.cc
@@ -46,7 +46,7 @@ namespace
void message(const QAMessage & m)
{
++count;
- last_message = m.message;
+ last_message = m.message();
}
void status(const std::string &)
diff --git a/paludis/repositories/e/qa/homepage_key_TEST.cc b/paludis/repositories/e/qa/homepage_key_TEST.cc
index 9fd1865..e0dfbdd 100644
--- a/paludis/repositories/e/qa/homepage_key_TEST.cc
+++ b/paludis/repositories/e/qa/homepage_key_TEST.cc
@@ -47,7 +47,7 @@ namespace
void message(const QAMessage & m)
{
++count;
- last_message = m.message;
+ last_message = m.message();
}
void status(const std::string &)
diff --git a/paludis/repositories/e/qa/kv_variables_TEST.cc b/paludis/repositories/e/qa/kv_variables_TEST.cc
index ac818cb..62bc077 100644
--- a/paludis/repositories/e/qa/kv_variables_TEST.cc
+++ b/paludis/repositories/e/qa/kv_variables_TEST.cc
@@ -48,7 +48,7 @@ namespace
++count;
if (! messages.empty())
messages.append(", ");
- messages.append(m.message);
+ messages.append(m.message());
}
void status(const std::string &)
diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc
index ae64850..31187ec 100644
--- a/paludis/repositories/e/qa/qa_controller.cc
+++ b/paludis/repositories/e/qa/qa_controller.cc
@@ -91,7 +91,7 @@ namespace
void message(const QAMessage & msg)
{
Lock lock(mutex);
- message_buf.insert(std::make_pair(msg.entry, msg));
+ message_buf.insert(std::make_pair(msg.entry(), msg));
}
void status(const std::string & s)
diff --git a/paludis/repositories/e/qa/visibility_TEST.cc b/paludis/repositories/e/qa/visibility_TEST.cc
index 295493f..298470f 100644
--- a/paludis/repositories/e/qa/visibility_TEST.cc
+++ b/paludis/repositories/e/qa/visibility_TEST.cc
@@ -56,7 +56,7 @@ namespace
++count;
if (! messages.empty())
messages.append(", ");
- messages.append(m.message);
+ messages.append(m.message());
}
void status(const std::string &)
diff --git a/python/qa.cc b/python/qa.cc
index 3f7408a..f286455 100644
--- a/python/qa.cc
+++ b/python/qa.cc
@@ -78,13 +78,27 @@ void expose_qa()
"NEED_DOC",
bp::init<const FSEntry &, const QAMessageLevel, const std::string &, const std::string &>()
)
- .add_property("entry", bp::make_getter(&QAMessage::entry, bp::return_value_policy<bp::return_by_value>()))
- .def_readonly("level", &QAMessage::level)
-
- .def_readonly("name", &QAMessage::name)
-
- .def_readonly("message", &QAMessage::message)
+ .add_property("entry",
+ &named_values_getter<QAMessage, n::entry, FSEntry, &QAMessage::entry>,
+ &named_values_setter<QAMessage, n::entry, FSEntry, &QAMessage::entry>,
+ "[rw] FSEntry"
+ )
+
+ .add_property("level",
+ &named_values_getter<QAMessage, n::level, QAMessageLevel, &QAMessage::level>,
+ "[ro] QAMessageLevel"
+ )
+
+ .add_property("name",
+ &named_values_getter<QAMessage, n::name, std::string, &QAMessage::name>,
+ "[ro] String"
+ )
+
+ .add_property("message",
+ &named_values_getter<QAMessage, n::message, std::string, &QAMessage::message>,
+ "[ro] String"
+ )
;
/**
diff --git a/ruby/qa.cc b/ruby/qa.cc
index aee2f3a..b29a7f2 100644
--- a/ruby/qa.cc
+++ b/ruby/qa.cc
@@ -182,7 +182,7 @@ namespace
{
QAMessage * m_ptr;
Data_Get_Struct(self, QAMessage, m_ptr);
- return INT2FIX(m_ptr->level);
+ return INT2FIX(m_ptr->level());
}
/*
@@ -201,7 +201,7 @@ namespace
int ml = NUM2INT(qa_message_level);
if (ml < 0 || ml >= last_qaml)
rb_raise(rb_eArgError, "QAMessageLevel out of range");
- m_ptr->level = static_cast<QAMessageLevel>(ml);
+ m_ptr->level() = static_cast<QAMessageLevel>(ml);
return Qnil;
}
catch (const std::exception & e)
@@ -218,7 +218,7 @@ namespace
{
T_ * p;
Data_Get_Struct(self, T_, p);
- return rb_str_new2(stringify(p->*m_).c_str());
+ return rb_str_new2(stringify((p->*m_)()).c_str());
}
static VALUE
@@ -228,7 +228,7 @@ namespace
{
T_ * p;
Data_Get_Struct(self, T_, p);
- p->*m_ = M_ ((StringValuePtr(str)));
+ (p->*m_)() = typename M_::ValueType(stringify((StringValuePtr(str))));
return Qnil;
}
catch (const std::exception & e)
@@ -296,19 +296,19 @@ namespace
rb_define_singleton_method(c_qa_message, "new", RUBY_FUNC_CAST(&qa_message_new), -1);
rb_define_method(c_qa_message, "initialize", RUBY_FUNC_CAST(&qa_message_init), -1);
rb_define_method(c_qa_message, "entry",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, FSEntry, &QAMessage::entry>::fetch)), 0);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::entry, FSEntry>, &QAMessage::entry>::fetch)), 0);
rb_define_method(c_qa_message, "entry=",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, FSEntry, &QAMessage::entry>::set)), 1);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::entry, FSEntry>, &QAMessage::entry>::set)), 1);
rb_define_method(c_qa_message, "level", RUBY_FUNC_CAST(&qa_message_level), 0);
rb_define_method(c_qa_message, "level=", RUBY_FUNC_CAST(&qa_message_level_set), 1);
rb_define_method(c_qa_message, "name",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, std::string, &QAMessage::name>::fetch)), 0);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::name, std::string>, &QAMessage::name>::fetch)), 0);
rb_define_method(c_qa_message, "name=",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, std::string, &QAMessage::name>::set)), 1);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::name, std::string>, &QAMessage::name>::set)), 1);
rb_define_method(c_qa_message, "message",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, std::string, &QAMessage::message>::fetch)), 0);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::message, std::string>, &QAMessage::message>::fetch)), 0);
rb_define_method(c_qa_message, "message=",
- RUBY_FUNC_CAST((&FetchSetString<QAMessage, std::string, &QAMessage::message>::set)), 1);
+ RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::message, std::string>, &QAMessage::message>::set)), 1);
}
}
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index dd5f151..1fd2071 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -205,19 +205,19 @@ namespace
void message(const QAMessage & msg)
{
- if (previous_entry != msg.entry)
+ if (previous_entry != msg.entry())
{
if (FSEntry("/NONE") != previous_entry)
std::cout << std::endl;
- std::string filename(strip_leading_string(stringify(msg.entry.strip_leading(FSEntry::cwd())), "/"));
+ std::string filename(strip_leading_string(stringify(msg.entry().strip_leading(FSEntry::cwd())), "/"));
std::cout << colour(cl_package_name, filename.length() > 0 ? filename : ".")
<< ":" << std::endl;
- previous_entry = msg.entry;
+ previous_entry = msg.entry();
}
std::cout << " [";
- switch (msg.level)
+ switch (msg.level())
{
case qaml_maybe:
std::cout << "?";
@@ -243,20 +243,20 @@ namespace
break;
}
- std::cout << "] " + msg.name + ": " << msg.message << std::endl;
+ std::cout << "] " + msg.name() + ": " << msg.message() << std::endl;
- if (! msg.associated_ids->empty())
+ if (! msg.associated_ids()->empty())
{
- for (PackageIDSet::ConstIterator i(msg.associated_ids->begin()),
- i_end(msg.associated_ids->end()) ; i != i_end ; ++i)
- if (! (*i)->fs_location_key() || (*i)->fs_location_key()->value() != msg.entry)
+ for (PackageIDSet::ConstIterator i(msg.associated_ids()->begin()),
+ i_end(msg.associated_ids()->end()) ; i != i_end ; ++i)
+ if (! (*i)->fs_location_key() || (*i)->fs_location_key()->value() != msg.entry())
std::cout << " " << stringify(**i) << std::endl;
}
- if (show_keys && ! msg.associated_keys->empty())
+ if (show_keys && ! msg.associated_keys()->empty())
{
- for (QAMessage::KeysSequence::ConstIterator i(msg.associated_keys->begin()),
- i_end(msg.associated_keys->end()) ; i != i_end ; ++i)
+ for (QAMessage::KeysSequence::ConstIterator i(msg.associated_keys()->begin()),
+ i_end(msg.associated_keys()->end()) ; i != i_end ; ++i)
{
if (show_keys_once && ! printed_keys[i->first].insert(i->second->raw_name()).second)
continue;