Update of /cvsroot/cpptool/rfta/include/rfta/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv10664/include/rfta/parser
Added Files:
PlainTextDocument.h TextDocument.h
Log Message:
-- moved closer to preprocessor
--- NEW FILE: PlainTextDocument.h ---
// //////////////////////////////////////////////////////////////////////////
// (c)Copyright 2002, Baptiste Lepilleur.
// Created: 2002/10/31
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PLAINTEXTDOCUMENT_H
#define RFTA_PLAINTEXTDOCUMENT_H
#include <rfta/parser/Config.h>
#include <rfta/parser/SourceRange.h>
#include <rfta/parser/TextDocument.h>
#include <boost/utility.hpp>
namespace Refactoring
{
/// Plain TextDocument, backed up by a simple string.
class RFTAPARSER_API PlainTextDocument : public TextDocument
, public boost::noncopyable
{
public:
PlainTextDocument();
PlainTextDocument( const std::string &content );
/// Destructor.
virtual ~PlainTextDocument();
/*! Gets the text of the document.
* \return Text of the document. EOL are in the original text format.
* \warning Discard current selection.
*/
const std::string getAllText() const;
std::string getTextRange( const Refactoring::SourceRange &range );
void replaceTextRange( const Refactoring::SourceRange &range,
const std::string &text );
private:
std::string content_;
};
// Inlines methods for PlainTextDocument:
// --------------------------------------
} // namespace Refactoring
#endif // RFTA_PLAINTEXTDOCUMENT_H
--- NEW FILE: TextDocument.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file Rfta/TextDocument.h for class TextDocument
// (c)Copyright 2002, Baptiste Lepilleur.
// Created: 2001/10/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_TEXTDOCUMENT_H_INCLUDED
#define RFTA_TEXTDOCUMENT_H_INCLUDED
#include <rfta/parser/Config.h>
#include <rfta/parser/SourceRange.h>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <string>
namespace Refactoring
{
class TextDocument;
typedef boost::shared_ptr<TextDocument> TextDocumentPtr;
/*! \brief This class represents an abstract text document.
*/
class RFTAPARSER_API TextDocument: public boost::enable_shared_from_this<TextDocument>
{
public:
/// Destructor.
virtual ~TextDocument() { /* to make sure correct destructor will be called */ }
/*! Gets the text of the document.
* \return Text of the document. EOL are in the original text format.
* \warning Discard current selection.
*/
virtual const std::string getAllText() const =0;
/*! Gets the text of the specified text range.
* \param range Range of text to return.
* \return Text of the specified text range.
*/
virtual std::string getTextRange( const Refactoring::SourceRange &range ) = 0;
/*! Replaces the text of a given text range with the specified text.
* \param range Range of text to replace. Length may be null is text
* is being inserted.
* \param text Text that replace the specified range. May be empty if
* the text range is being deleted.
*/
virtual void replaceTextRange( const Refactoring::SourceRange &range,
const std::string &text ) = 0;
private:
};
// Inlines methods for AbstractTextDocument:
// -----------------------------------------
} // namespace Refactoring
#endif // RFTA_TEXTDOCUMENT_H_INCLUDED
|