// ContentIdList.h #ifndef ContentIdList_H #define ContentIdList_H // David Adams // June 2002 // // Ordered list of content ID's. // // XML format: // // ContentIdList // ContentId // name = Myclass // key = mykey // ContentId // name = AnotherClass // key = another_key // #include #include #include "dataset_id/ContentId.h" class XmlElement; class ContentIdList : public std::set { public: // static methods. // XML name. static const char* xml_name() { return "ContentIdList"; } // XML DTD. static const Text& dtd(); public: // methods // Default constructor. ContentIdList(); // Constructor from xml. // If try_children is true, then the children of the XML element will // be searched for a list. The corresponding child will be used if there // is exactly one match. explicit ContentIdList(const XmlElement& ele, bool try_children =false); // Keep only elements that are in the provided list. // The size of the new list is returned. ContentIdList::size_type select(const ContentIdList& cids); // Return if the list contains a content ID. bool contains(ContentId cid) const; // Return if the list contains another list. bool contains(const ContentIdList& cids) const; // Write to xml. const XmlElement* xml() const; // Output stream. std::ostream& ostr(std::ostream& lhs, std::string indent) const; }; // Output stream. std::ostream& operator<<(std::ostream& lhs, const ContentIdList& rhs); #endif