Skip to content
Snippets Groups Projects
Select Git revision
  • 02c08af585e42fdc35a4674932c32e7a6afc6131
  • master default protected
  • fix-words-ann
  • wccl-rules-migration
  • develop
5 results

position.h

Blame
  • user avatar
    Adam Wardyński authored
    Adding some methods to values for use by operators, e.g. equals and is_subset_of/intersection. Some are just stubs.
    fa524598
    History
    position.h 776 B
    #ifndef LIBWCCL_VALUES_POSITION_H
    #define LIBWCCL_VALUES_POSITION_H
    
    #include <libwccl/values/value.h>
    #include <cstdlib>
    #include <boost/integer_traits.hpp>
    
    namespace Wccl {
    
    class Position : public Value
    {
    public:
    	WCCL_VALUE_PREAMBLE
    
    	explicit Position(int v = 0)
    		: val_(v)
    	{
    	}
    
    	static const int Nowhere = boost::integer_traits<int>::const_min;
    	static const int Begin = boost::integer_traits<int>::const_min + 1;
    	static const int End = boost::integer_traits<int>::const_max;
    
    	int get_value() const {
    		return val_;
    	}
    
    	void set_value(int v) {
    		val_ = v;
    	}
    
    	/// Value override
    	std::string to_raw_string() const;
    
    	bool equals(const Position& other) {
    		return val_ == other.val_;
    	}
    
    private:
    	int val_;
    };
    
    
    } /* end ns Wccl */
    
    #endif // LIBWCCL_POSITION_H