objc.h revision 1.1.1.2 1 1.1 mrg
2 1.1 mrg /* Compiler implementation of the D programming language
3 1.1.1.2 mrg * Copyright (C) 2015-2022 by The D Language Foundation, All Rights Reserved
4 1.1 mrg * written by Michel Fortin
5 1.1.1.2 mrg * https://www.digitalmars.com
6 1.1 mrg * Distributed under the Boost Software License, Version 1.0.
7 1.1.1.2 mrg * https://www.boost.org/LICENSE_1_0.txt
8 1.1 mrg * https://github.com/dlang/dmd/blob/master/src/dmd/objc.h
9 1.1 mrg */
10 1.1 mrg
11 1.1 mrg #pragma once
12 1.1 mrg
13 1.1.1.2 mrg #include "root/dsystem.h"
14 1.1.1.2 mrg #include "arraytypes.h"
15 1.1 mrg
16 1.1.1.2 mrg class AggregateDeclaration;
17 1.1.1.2 mrg class AttribDeclaration;
18 1.1 mrg class ClassDeclaration;
19 1.1.1.2 mrg class FuncDeclaration;
20 1.1.1.2 mrg class Identifier;
21 1.1 mrg class InterfaceDeclaration;
22 1.1.1.2 mrg
23 1.1 mrg struct Scope;
24 1.1 mrg
25 1.1 mrg struct ObjcSelector
26 1.1 mrg {
27 1.1 mrg const char *stringvalue;
28 1.1 mrg size_t stringlen;
29 1.1 mrg size_t paramCount;
30 1.1 mrg
31 1.1 mrg static void _init();
32 1.1 mrg
33 1.1 mrg ObjcSelector(const char *sv, size_t len, size_t pcount);
34 1.1 mrg
35 1.1 mrg static ObjcSelector *create(FuncDeclaration *fdecl);
36 1.1 mrg };
37 1.1 mrg
38 1.1.1.2 mrg struct ObjcClassDeclaration
39 1.1.1.2 mrg {
40 1.1.1.2 mrg bool isMeta;
41 1.1.1.2 mrg bool isExtern;
42 1.1.1.2 mrg
43 1.1.1.2 mrg Identifier* identifier;
44 1.1.1.2 mrg ClassDeclaration* classDeclaration;
45 1.1.1.2 mrg ClassDeclaration* metaclass;
46 1.1.1.2 mrg DArray<FuncDeclaration*> methodList;
47 1.1.1.2 mrg
48 1.1.1.2 mrg bool isRootClass() const;
49 1.1.1.2 mrg };
50 1.1.1.2 mrg
51 1.1.1.2 mrg struct ObjcFuncDeclaration
52 1.1.1.2 mrg {
53 1.1.1.2 mrg ObjcSelector* selector;
54 1.1.1.2 mrg VarDeclaration* selectorParameter;
55 1.1.1.2 mrg bool isOptional;
56 1.1.1.2 mrg };
57 1.1.1.2 mrg
58 1.1 mrg class Objc
59 1.1 mrg {
60 1.1 mrg public:
61 1.1 mrg static void _init();
62 1.1 mrg
63 1.1 mrg virtual void setObjc(ClassDeclaration* cd) = 0;
64 1.1 mrg virtual void setObjc(InterfaceDeclaration*) = 0;
65 1.1.1.2 mrg virtual const char *toPrettyChars(ClassDeclaration *cd, bool qualifyTypes) const = 0;
66 1.1.1.2 mrg
67 1.1 mrg virtual void setSelector(FuncDeclaration*, Scope* sc) = 0;
68 1.1 mrg virtual void validateSelector(FuncDeclaration* fd) = 0;
69 1.1 mrg virtual void checkLinkage(FuncDeclaration* fd) = 0;
70 1.1.1.2 mrg virtual bool isVirtual(const FuncDeclaration*) const = 0;
71 1.1.1.2 mrg virtual void setAsOptional(FuncDeclaration *fd, Scope *sc) const = 0;
72 1.1.1.2 mrg virtual void validateOptional(FuncDeclaration *fd) const = 0;
73 1.1.1.2 mrg virtual ClassDeclaration* getParent(FuncDeclaration*, ClassDeclaration*) const = 0;
74 1.1.1.2 mrg virtual void addToClassMethodList(FuncDeclaration*, ClassDeclaration*) const = 0;
75 1.1.1.2 mrg virtual AggregateDeclaration* isThis(FuncDeclaration* fd) = 0;
76 1.1.1.2 mrg virtual VarDeclaration* createSelectorParameter(FuncDeclaration*, Scope*) const = 0;
77 1.1.1.2 mrg
78 1.1.1.2 mrg virtual void setMetaclass(InterfaceDeclaration* id, Scope*) const = 0;
79 1.1.1.2 mrg virtual void setMetaclass(ClassDeclaration* id, Scope*) const = 0;
80 1.1.1.2 mrg virtual ClassDeclaration* getRuntimeMetaclass(ClassDeclaration* cd) = 0;
81 1.1.1.2 mrg
82 1.1.1.2 mrg virtual void addSymbols(AttribDeclaration*, ClassDeclarations*, ClassDeclarations*) const = 0;
83 1.1.1.2 mrg virtual void addSymbols(ClassDeclaration*, ClassDeclarations*, ClassDeclarations*) const = 0;
84 1.1 mrg };
85