]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/d/dmd/root/object.h
Merge dmd upstream 6243fa6d2
[thirdparty/gcc.git] / gcc / d / dmd / root / object.h
CommitLineData
b4c522fa
IB
1
2/* Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved
3 * http://www.digitalmars.com
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
6 * https://github.com/dlang/dmd/blob/master/src/root/object.h
7 */
8
b4c522fa
IB
9#pragma once
10
f9ab59ff 11#include "dsystem.h"
b4c522fa
IB
12
13typedef size_t hash_t;
14
15struct OutBuffer;
16
17enum DYNCAST
18{
19 DYNCAST_OBJECT,
20 DYNCAST_EXPRESSION,
21 DYNCAST_DSYMBOL,
22 DYNCAST_TYPE,
23 DYNCAST_IDENTIFIER,
24 DYNCAST_TUPLE,
25 DYNCAST_PARAMETER,
f9ab59ff 26 DYNCAST_STATEMENT
b4c522fa
IB
27};
28
29/*
30 * Root of our class library.
31 */
32class RootObject
33{
34public:
35 RootObject() { }
36
37 virtual bool equals(RootObject *o);
38
39 /**
40 * Return <0, ==0, or >0 if this is less than, equal to, or greater than obj.
41 * Useful for sorting Objects.
42 */
43 virtual int compare(RootObject *obj);
44
45 /**
46 * Pretty-print an Object. Useful for debugging the old-fashioned way.
47 */
48 virtual void print();
49
50 virtual const char *toChars();
51 virtual void toBuffer(OutBuffer *buf);
52
53 /**
54 * Used as a replacement for dynamic_cast. Returns a unique number
55 * defined by the library user. For Object, the return value is 0.
56 */
57 virtual int dyncast() const;
58};