Skip to content
Snippets Groups Projects
StringBase.h 1.61 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jan Trávníček's avatar
    Jan Trávníček committed
    /*
     * StringBase.h
     *
     *  Created on: Mar 26, 2013
     *      Author: Jan Travnicek
     */
    
    #ifndef STRING_BASE_H_
    #define STRING_BASE_H_
    
    #include "../label/LabelBase.h"
    #include <ostream>
    #include <set>
    #include "../alphabet/Symbol.h"
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    namespace string {
    
    class LinearString;
    class CyclicString;
    class Epsilon;
    
    /**
     * Represents string in an alphabet.
     */
    
    class StringBase : public std::elementBase<Epsilon, LinearString, CyclicString> {
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    public:
    	virtual ~StringBase() noexcept;
    
    	virtual StringBase* clone() const = 0;
    	virtual StringBase* plunder() && = 0; 
    
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    	bool operator>=(const StringBase& other) const;
    
    	bool operator<=(const StringBase& other) const;
    
    
    	bool operator!=(const StringBase& other) const;
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    	virtual bool operator==(const StringBase& other) const = 0;
    
    	virtual bool operator==(const LinearString& other) const = 0;
    	virtual bool operator==(const CyclicString& other) const = 0;
    	virtual bool operator==(const Epsilon& other) const = 0;
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    	virtual bool operator<(const StringBase& other) const = 0;
    
    	virtual bool operator<(const LinearString& other) const = 0;
    	virtual bool operator<(const CyclicString& other) const = 0;
    	virtual bool operator<(const Epsilon& other) const = 0;
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    	virtual bool operator>(const StringBase& other) const = 0;
    
    Jan Trávníček's avatar
    Jan Trávníček committed
    
    	/**
    	 * Prints XML representation of the String to the output stream.
    	 * @param out output stream to which print the String
    	 * @param string String to print
    	 */
    	friend std::ostream& operator<<(std::ostream&, const StringBase&);
    
    	virtual void operator>>(std::ostream& out) const = 0;
    
    	virtual operator std::string () const = 0;
    };
    
    } /* namespace string */
    
    #endif /* STRING_BASE_H_ */