2016-09-19 11:50:08 +08:00
|
|
|
#pragma once
|
|
|
|
#include "StatusParagraph.h"
|
2017-01-27 09:52:54 +08:00
|
|
|
#include <iterator>
|
2017-04-28 08:56:06 +08:00
|
|
|
#include <memory>
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
|
|
|
struct StatusParagraphs
|
|
|
|
{
|
|
|
|
StatusParagraphs();
|
|
|
|
explicit StatusParagraphs(std::vector<std::unique_ptr<StatusParagraph>>&& ps);
|
|
|
|
|
|
|
|
using container = std::vector<std::unique_ptr<StatusParagraph>>;
|
|
|
|
using iterator = container::reverse_iterator;
|
|
|
|
using const_iterator = container::const_reverse_iterator;
|
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
const_iterator find(const PackageSpec& spec) const { return find(spec.name(), spec.triplet()); }
|
2017-04-11 04:08:47 +08:00
|
|
|
const_iterator find(const std::string& name, const Triplet& triplet) const;
|
|
|
|
iterator find(const std::string& name, const Triplet& triplet);
|
2017-08-31 03:34:12 +08:00
|
|
|
std::vector<std::unique_ptr<StatusParagraph>*> find_all(const std::string& name, const Triplet& triplet);
|
2017-07-26 12:29:31 +08:00
|
|
|
iterator find(const std::string& name, const Triplet& triplet, const std::string& feature);
|
2017-04-08 05:42:19 +08:00
|
|
|
|
|
|
|
const_iterator find_installed(const PackageSpec& spec) const
|
|
|
|
{
|
2017-04-11 04:03:34 +08:00
|
|
|
return find_installed(spec.name(), spec.triplet());
|
2017-04-08 05:42:19 +08:00
|
|
|
}
|
2017-04-11 04:08:47 +08:00
|
|
|
const_iterator find_installed(const std::string& name, const Triplet& triplet) const;
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
iterator insert(std::unique_ptr<StatusParagraph>);
|
|
|
|
|
2017-04-13 13:48:52 +08:00
|
|
|
friend void serialize(const StatusParagraphs& pgh, std::string& out_str);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
iterator end() { return paragraphs.rend(); }
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
const_iterator end() const { return paragraphs.rend(); }
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
iterator begin() { return paragraphs.rbegin(); }
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
const_iterator begin() const { return paragraphs.rbegin(); }
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::unique_ptr<StatusParagraph>> paragraphs;
|
|
|
|
};
|
|
|
|
|
2017-04-13 13:48:52 +08:00
|
|
|
void serialize(const StatusParagraphs& pgh, std::string& out_str);
|
2016-09-19 11:50:08 +08:00
|
|
|
}
|