2010-07-27 15:29:16 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef INSERTIONPOINTLOCATOR_H
|
|
|
|
|
#define INSERTIONPOINTLOCATOR_H
|
|
|
|
|
|
2010-09-27 18:01:04 +02:00
|
|
|
#include <ASTfwd.h>
|
2010-07-27 15:29:16 +02:00
|
|
|
#include <CPlusPlusForwardDeclarations.h>
|
|
|
|
|
#include <Symbols.h>
|
|
|
|
|
|
2010-07-28 12:09:50 +02:00
|
|
|
#include "CppDocument.h"
|
2010-07-27 15:29:16 +02:00
|
|
|
|
|
|
|
|
namespace CPlusPlus {
|
|
|
|
|
|
|
|
|
|
class CPLUSPLUS_EXPORT InsertionLocation
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
InsertionLocation();
|
2010-07-28 12:09:50 +02:00
|
|
|
InsertionLocation(const QString &prefix, const QString &suffix, unsigned line, unsigned column);
|
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
|
|
|
|
|
{ return m_line > 0 && m_column > 0; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CPLUSPLUS_EXPORT InsertionPointLocator
|
|
|
|
|
{
|
|
|
|
|
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-09-27 18:01:04 +02:00
|
|
|
PrivateSlot = Private | SlotBit,
|
2010-07-27 15:29:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2010-09-27 18:01:04 +02:00
|
|
|
InsertionPointLocator(const Snapshot &snapshot);
|
2010-07-27 15:29:16 +02:00
|
|
|
|
2010-09-27 18:01:04 +02:00
|
|
|
InsertionLocation methodDeclarationInClass(const QString &fileName,
|
|
|
|
|
const Class *clazz,
|
2010-07-27 15:29:16 +02:00
|
|
|
AccessSpec xsSpec) const;
|
|
|
|
|
|
2010-09-27 18:05:24 +02:00
|
|
|
QList<InsertionLocation> methodDefinition(const QString &fileName) const;
|
2010-09-27 18:01:04 +02:00
|
|
|
|
2010-07-27 15:29:16 +02:00
|
|
|
private:
|
2010-09-27 18:01:04 +02:00
|
|
|
Snapshot m_snapshot;
|
2010-07-27 15:29:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace CPlusPlus
|
|
|
|
|
|
|
|
|
|
#endif // INSERTIONPOINTLOCATOR_H
|