Skip to content
Snippets Groups Projects
strset.h 1.23 KiB
Newer Older
ilor's avatar
ilor committed
#ifndef LIBWCCL_VALUES_STRSET_H
#define LIBWCCL_VALUES_STRSET_H

#include <libwccl/values/value.h>
#include <boost/unordered_set.hpp>
#include <libcorpus2/lexeme.h> // for unicodestring hash

namespace Wccl {

class StrSet : public Value
{
public:
	WCCL_VALUE_PREAMBLE

	typedef boost::unordered_set<UnicodeString> set_t;

	StrSet()
		: set_()
	{
	}

	explicit StrSet(const set_t& s)
		: set_(s)
	{
	}

	const set_t& contents() const {
		return set_;
	}

	set_t& contents() {
		return set_;
	}

	void set_contents(const set_t& set) {
		set_ = set;
	}

	void swap(StrSet& ss) {
		ss.set_.swap(set_);
	}

	void insert(const UnicodeString& u) {
		set_.insert(u);
	}

	void insert_utf8(const std::string& u) {
		insert(UnicodeString::fromUTF8(u));
	}

	int size() const {
		return set_.size();
	}

	bool empty() const {
		return set_.empty();
	}

	bool is_subset_of(const StrSet& /*set*/) const {
		//TODO: implement this
		return false;
	}

	bool intersects(const StrSet& /*set*/) const {
	}

	bool equals(const StrSet& /*set*/) const {
		//TODO: implement this
		return false;
	}

ilor's avatar
ilor committed
	/// Value override
	std::string to_raw_string() const;

private:
	set_t set_;
};

} /* end ns Wccl */

#endif // LIBWCCL_VALUES_STRSET_H