Demangling interface
Christophe de Dinechin
ddd at cup.hp.com
Thu Mar 30 20:02:05 UTC 2000
Here is the interface HP offers today. As I said, it seems overly complicated,
compared to what Matt proposed. On the plus side, it has handling of erroneous
input, which I believe we need to define.
Regards
Christophe
class TDemangler {
public:
void * operator new(size_t size) {
return (void*)malloc(size);
}
void operator delete(void *deadObject) {
free(deadObject);
}
TDemangler();
TDemangler(const char *mangledDecl);
~TDemangler();
enum Status { OK, Empty, Error, Truncated };
void reset();
Status getStatus() const { return status; }
Status demangleDecl(const char *mangledDecl);
Status demangleType(const char *mangledType);
Status copy(char *result, size_t maxToCopy /*including null*/) const;
Status copy(char *result, size_t maxToCopy /*including null*/,
char *name, size_t nameLength) const;
private:
Status status;
const char *p;
const char *end;
void partial(bool top, bool typeOfExternalDecl = false);
void typeName(size_t &baseOffset, size_t &baseLength);
void templateArgs();
void writePrefix(const char *text, size_t length);
void writeSuffix(const char *text, size_t length);
void writeDuplicate(unsigned offset, unsigned length);
void writeBaseName(const char *baseName, size_t baseNameLength,
size_t classNameOffset, size_t classNameLength);
enum Spacing { Before, None, After };
void writeQualifiers(const char *cv, Spacing spacing);
size_t extractCount();
void demangleDecl();
char *buffer;
size_t bufferSize;
enum { InternalBufferSize = 200 };
char internalBuffer[InternalBufferSize];
size_t nameSize;
size_t prefixSize;
size_t suffixSize;
bool spaceBeforeName;
void makeAvailable(size_t length);
void merge();
static size_t min(size_t a, size_t b) { return a < b ? a : b; }
};
More information about the cxx-abi-dev
mailing list