From: Baptiste L. <gai...@fr...> - 2003-05-14 20:38:02
|
I'm thinking of simplifying the interface of TextDocument. Actually, it is: virtual const std::string getAllText() const =0; virtual const std::string getSelection() const =0; virtual void replaceSelection( const std::string &text ) =0; virtual SourceRange getSelectionRange() const =0; virtual void setSelectionRange( const SourceRange &selection ) =0; There is a lot of stuff we don't need there. The only need for refactoring are: // retrieve all the text const std::string getAllText() const; // retrieve a specified text range std::string getTextRange( const Refactoring::SourceRange &range ); // replace a specified text range void replaceTextRange( const Refactoring::SourceRange &range, const std::string &text ); This make the interface simpler and less ambiguous. With this interface, there is no 'state'. It is simpler to implement and less ambigous. Does anybody have suggestion to further improve the interface ? Baptiste. |