Add getters to TagsHandlers for most things

This commit is contained in:
rr-
2016-02-24 21:55:48 +01:00
parent 4f5d33491b
commit 02c966bacb
10 changed files with 50 additions and 0 deletions

View File

@ -36,3 +36,9 @@ bool CompositeTagsHandler::done()
done &= handler->done();
return done;
}
const std::vector<std::shared_ptr<ITagsHandler>>
CompositeTagsHandler::get_handlers() const
{
return handlers;
}

View File

@ -16,6 +16,8 @@ namespace opustags {
bool edit(const int streamno, Tags &) override;
bool done() override;
const std::vector<std::shared_ptr<ITagsHandler>> get_handlers() const;
private:
std::vector<std::shared_ptr<ITagsHandler>> handlers;
};

View File

@ -11,6 +11,16 @@ InsertionTagsHandler::InsertionTagsHandler(
{
}
std::string InsertionTagsHandler::get_tag_key() const
{
return tag_key;
}
std::string InsertionTagsHandler::get_tag_value() const
{
return tag_value;
}
bool InsertionTagsHandler::edit_impl(Tags &tags)
{
if (tags.contains(tag_key))

View File

@ -12,6 +12,9 @@ namespace opustags {
const std::string &tag_key,
const std::string &tag_value);
std::string get_tag_key() const;
std::string get_tag_value() const;
protected:
bool edit_impl(Tags &) override;

View File

@ -10,6 +10,16 @@ ModificationTagsHandler::ModificationTagsHandler(
{
}
std::string ModificationTagsHandler::get_tag_key() const
{
return tag_key;
}
std::string ModificationTagsHandler::get_tag_value() const
{
return tag_value;
}
bool ModificationTagsHandler::edit_impl(Tags &tags)
{
tags.set(tag_key, tag_value);

View File

@ -12,6 +12,9 @@ namespace opustags {
const std::string &tag_key,
const std::string &tag_value);
std::string get_tag_key() const;
std::string get_tag_value() const;
protected:
bool edit_impl(Tags &) override;

View File

@ -14,6 +14,11 @@ RemovalTagsHandler::RemovalTagsHandler(
{
}
std::string RemovalTagsHandler::get_tag_key() const
{
return tag_key;
}
bool RemovalTagsHandler::edit_impl(Tags &tags)
{
if (tag_key.empty())

View File

@ -10,6 +10,8 @@ namespace opustags {
RemovalTagsHandler(const int streamno);
RemovalTagsHandler(const int streamno, const std::string &tag_key);
std::string get_tag_key() const;
protected:
bool edit_impl(Tags &) override;

View File

@ -2,11 +2,18 @@
using namespace opustags;
const int StreamTagsHandler::ALL_STREAMS = -1;
StreamTagsHandler::StreamTagsHandler(const int streamno)
: streamno(streamno), work_finished(false)
{
}
int StreamTagsHandler::get_streamno() const
{
return streamno;
}
bool StreamTagsHandler::relevant(const int streamno)
{
return streamno == this->streamno;

View File

@ -11,6 +11,8 @@ namespace opustags {
public:
StreamTagsHandler(const int streamno);
int get_streamno() const;
bool relevant(const int streamno) override;
void list(const int streamno, const Tags &) override;
bool edit(const int streamno, Tags &) override;