1 
2 /* Compiler implementation of the D programming language
3  * Copyright (C) 2015-2021 by The D Language Foundation, All Rights Reserved
4  * written by Michel Fortin
5  * http://www.digitalmars.com
6  * Distributed under the Boost Software License, Version 1.0.
7  * http://www.boost.org/LICENSE_1_0.txt
8  * https://github.com/dlang/dmd/blob/master/src/dmd/objc.h
9  */
10 
11 #pragma once
12 
13 #include "root/root.h"
14 #include "root/stringtable.h"
15 
16 class Identifier;
17 class FuncDeclaration;
18 class ClassDeclaration;
19 class InterfaceDeclaration;
20 struct Scope;
21 class StructDeclaration;
22 
23 struct ObjcSelector
24 {
25     static StringTable stringtable;
26     static StringTable vTableDispatchSelectors;
27     static int incnum;
28 
29     const char *stringvalue;
30     size_t stringlen;
31     size_t paramCount;
32 
33     static void _init();
34 
35     ObjcSelector(const char *sv, size_t len, size_t pcount);
36 
37     static ObjcSelector *lookup(const char *s);
38     static ObjcSelector *lookup(const char *s, size_t len, size_t pcount);
39 
40     static ObjcSelector *create(FuncDeclaration *fdecl);
41 };
42 
43 class Objc
44 {
45 public:
46     static void _init();
47 
48     virtual void setObjc(ClassDeclaration* cd) = 0;
49     virtual void setObjc(InterfaceDeclaration*) = 0;
50     virtual void setSelector(FuncDeclaration*, Scope* sc) = 0;
51     virtual void validateSelector(FuncDeclaration* fd) = 0;
52     virtual void checkLinkage(FuncDeclaration* fd) = 0;
53 };
54