2010-07-27 15:29:16 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2010-07-27 15:29:16 +02:00
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2010-07-27 15:29:16 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2010-07-27 15:29:16 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-07-27 15:29:16 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef INSERTIONPOINTLOCATOR_H
|
|
|
|
|
#define INSERTIONPOINTLOCATOR_H
|
|
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
#include "cpptools_global.h"
|
|
|
|
|
|
2010-09-27 18:01:04 +02:00
|
|
|
#include <ASTfwd.h>
|
2010-07-27 15:29:16 +02:00
|
|
|
#include <CPlusPlusForwardDeclarations.h>
|
|
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
#include <cplusplus/CppDocument.h>
|
2011-08-17 11:35:57 +02:00
|
|
|
#include <cpptools/cpprefactoringchanges.h>
|
2010-09-30 12:09:38 +02:00
|
|
|
|
|
|
|
|
namespace CppTools {
|
2010-07-27 15:29:16 +02:00
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
class CPPTOOLS_EXPORT InsertionLocation
|
2010-07-27 15:29:16 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
InsertionLocation();
|
2010-09-30 12:09:38 +02:00
|
|
|
InsertionLocation(const QString &fileName, const QString &prefix,
|
|
|
|
|
const QString &suffix, unsigned line, unsigned column);
|
|
|
|
|
|
|
|
|
|
QString fileName() const
|
|
|
|
|
{ return m_fileName; }
|
2010-07-27 15:29:16 +02:00
|
|
|
|
|
|
|
|
/// \returns The prefix to insert before any other text.
|
|
|
|
|
QString prefix() const
|
|
|
|
|
{ return m_prefix; }
|
|
|
|
|
|
2010-07-28 12:09:50 +02:00
|
|
|
/// \returns The suffix to insert after the other inserted text.
|
|
|
|
|
QString suffix() const
|
|
|
|
|
{ return m_suffix; }
|
|
|
|
|
|
2010-07-27 15:29:16 +02:00
|
|
|
/// \returns The line where to insert. The line number is 1-based.
|
2010-07-28 12:09:50 +02:00
|
|
|
unsigned line() const
|
2010-07-27 15:29:16 +02:00
|
|
|
{ return m_line; }
|
|
|
|
|
|
|
|
|
|
/// \returns The column where to insert. The column number is 1-based.
|
2010-07-28 12:09:50 +02:00
|
|
|
unsigned column() const
|
2010-07-27 15:29:16 +02:00
|
|
|
{ return m_column; }
|
|
|
|
|
|
|
|
|
|
bool isValid() const
|
2010-09-30 12:09:38 +02:00
|
|
|
{ return !m_fileName.isEmpty() && m_line > 0 && m_column > 0; }
|
2010-07-27 15:29:16 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-09-30 12:09:38 +02:00
|
|
|
QString m_fileName;
|
2010-07-27 15:29:16 +02:00
|
|
|
QString m_prefix;
|
2010-07-28 12:09:50 +02:00
|
|
|
QString m_suffix;
|
2010-07-27 15:29:16 +02:00
|
|
|
unsigned m_line;
|
|
|
|
|
unsigned m_column;
|
|
|
|
|
};
|
|
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
class CPPTOOLS_EXPORT InsertionPointLocator
|
2010-07-27 15:29:16 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum AccessSpec {
|
|
|
|
|
Invalid = -1,
|
|
|
|
|
Signals = 0,
|
|
|
|
|
|
|
|
|
|
Public = 1,
|
|
|
|
|
Protected = 2,
|
|
|
|
|
Private = 3,
|
|
|
|
|
|
|
|
|
|
SlotBit = 1 << 2,
|
|
|
|
|
|
2010-09-27 18:01:04 +02:00
|
|
|
PublicSlot = Public | SlotBit,
|
2010-07-27 15:29:16 +02:00
|
|
|
ProtectedSlot = Protected | SlotBit,
|
2010-12-16 12:05:48 +01:00
|
|
|
PrivateSlot = Private | SlotBit
|
2010-07-27 15:29:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2011-08-17 11:35:57 +02:00
|
|
|
InsertionPointLocator(const CppRefactoringChanges &refactoringChanges);
|
2010-07-27 15:29:16 +02:00
|
|
|
|
2010-09-27 18:01:04 +02:00
|
|
|
InsertionLocation methodDeclarationInClass(const QString &fileName,
|
2010-09-30 12:09:38 +02:00
|
|
|
const CPlusPlus::Class *clazz,
|
2010-07-27 15:29:16 +02:00
|
|
|
AccessSpec xsSpec) const;
|
|
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
QList<InsertionLocation> methodDefinition(CPlusPlus::Declaration *declaration) const;
|
2010-09-27 18:01:04 +02:00
|
|
|
|
2010-07-27 15:29:16 +02:00
|
|
|
private:
|
2011-08-17 11:35:57 +02:00
|
|
|
CppRefactoringChanges m_refactoringChanges;
|
2010-07-27 15:29:16 +02:00
|
|
|
};
|
|
|
|
|
|
2010-09-30 12:09:38 +02:00
|
|
|
} // namespace CppTools
|
2010-07-27 15:29:16 +02:00
|
|
|
|
|
|
|
|
#endif // INSERTIONPOINTLOCATOR_H
|