|
From: <net...@us...> - 2003-12-16 13:47:03
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28898/src/rfta
Added Files:
PreProcessTransform.cpp PreProcessTransform.h Transform.h
Log Message:
-- files of a preprocessor implementation
--- NEW FILE: PreProcessTransform.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Implementation file PreProcessTransform.cpp for class PreProcessTransform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PreProcessTransform.h"
#include <rfta/refactoring/TextDocument.h>
namespace Refactoring
{
PreProcessTransform::PreProcessTransform( const SourceRange &replaceRange, const int& lengthDelta )
: range_( replaceRange ),
lengthDelta_( lengthDelta )
{
}
PreProcessTransform::~PreProcessTransform()
{
}
int
PreProcessTransform::apply( TextDocument &document ) const
{
/** nothing to do here - keep the original text **/
return lengthDelta_;
}
void
PreProcessTransform::moveStartIndexBy( int delta )
{
range_.moveStartIndexBy( delta );
}
int
PreProcessTransform::getStartIndex()
{
return range_.getStartIndex();
}
} // namespace Refactoring
--- NEW FILE: PreProcessTransform.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessTransform.h for class PreProcessTransform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PREPROCESSTRANSFORM_H
#define RFTA_PREPROCESSTRANSFORM_H
#include <rfta/refactoring/Config.h>
#include <rfta/parser/SourceRange.h>
#include <string>
#include "Transform.h"
namespace Refactoring
{
class TextDocument;
/**
* Stores a macro replace transformation done by preprocessor.
* This is used for backtransformation of text positions in original code
*/
class PreProcessTransform: public Transform
{
public:
/*! Constructs a PreProcessTransform object.
* @para replaceRange is the position and length of the macro-use,
* @para lengthDelta is the length inserted text for the macro.
*/
PreProcessTransform( const SourceRange &replaceRange, const int &lengthDelta );
/// Destructor.
virtual ~PreProcessTransform();
/**
* does the text transformation and returns the delta-length
*/
int apply( TextDocument &document ) const;
void moveStartIndexBy( int delta );
int getStartIndex();
int getLength();
private:
SourceRange range_;
int lengthDelta_;
};
// Inlines methods for PreProcessTransform:
// -----------------------------------------
inline int
PreProcessTransform::getLength()
{
return range_.getLength();
}
} // namespace Refactoring
#endif // RFTA_PREPROCESSTRANSFORM_H
--- NEW FILE: Transform.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file Transform.h for class Transform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_TRANSFORM_H
#define RFTA_TRANSFORM_H
#include <rfta/refactoring/Config.h>
namespace Refactoring
{
class TextDocument;
/**
* Stores a macro replace transformation done by preprocessor.
* This is used for backtransformation of text positions in original code
*/
class Transform
{
public:
/// Destructor.
virtual ~Transform() { }
/**
* does the text transformation and returns the delta-length
*/
virtual int apply( TextDocument &document ) const = 0;
virtual void moveStartIndexBy( int delta ) = 0;
virtual int getStartIndex() = 0;
virtual int getLength() = 0;
};
// Inlines methods for Transform:
// -----------------------------------------
} // namespace Refactoring
#endif // RFTA_TRANSFORM_H
|