Quickfix for adding a declaration to a class from a definition.

This commit is contained in:
Erik Verbruggen
2010-07-08 16:40:46 +02:00
parent 65eb1d5515
commit 9135c8ccb1
10 changed files with 432 additions and 3 deletions

View File

@@ -30,6 +30,9 @@
#include "Overview.h"
#include "NamePrettyPrinter.h"
#include "TypePrettyPrinter.h"
#include <Control.h>
#include <CoreTypes.h>
#include <FullySpecifiedType.h>
using namespace CPlusPlus;
@@ -145,3 +148,23 @@ QString Overview::prettyType(const FullySpecifiedType &ty,
TypePrettyPrinter pp(this);
return pp(ty, name);
}
/**
* Pretty-prints the given fully-specified type, but replacing the contained
* type with the given name.
*
* \param type the fully-specified type to convert to string
* \param the name for the named-type to use
* \param the control where the name is registered
* \return the pretty-printed name
*/
QString Overview::prettyTypeWithName(const FullySpecifiedType &type,
const Name *name,
Control *control)
{
NamedType *namedTy = control->namedType(name);
FullySpecifiedType newTy = type;
newTy.setType(namedTy);
return prettyType(newTy);
}