1 | /** |
2 | * Copyright (c) 2006-2023 LOVE Development Team |
3 | * |
4 | * This software is provided 'as-is', without any express or implied |
5 | * warranty. In no event will the authors be held liable for any damages |
6 | * arising from the use of this software. |
7 | * |
8 | * Permission is granted to anyone to use this software for any purpose, |
9 | * including commercial applications, and to alter it and redistribute it |
10 | * freely, subject to the following restrictions: |
11 | * |
12 | * 1. The origin of this software must not be misrepresented; you must not |
13 | * claim that you wrote the original software. If you use this software |
14 | * in a product, an acknowledgment in the product documentation would be |
15 | * appreciated but is not required. |
16 | * 2. Altered source versions must be plainly marked as such, and must not be |
17 | * misrepresented as being the original software. |
18 | * 3. This notice may not be removed or altered from any source distribution. |
19 | **/ |
20 | |
21 | #pragma once |
22 | |
23 | #include "int.h" |
24 | |
25 | #include <string> |
26 | #include <vector> |
27 | |
28 | namespace love |
29 | { |
30 | |
31 | enum APIType |
32 | { |
33 | API_FUNCTION, |
34 | API_METHOD, |
35 | API_FIELD, |
36 | API_CONSTANT, |
37 | }; |
38 | |
39 | enum DeprecationType |
40 | { |
41 | DEPRECATED_NO_REPLACEMENT, |
42 | DEPRECATED_REPLACED, |
43 | DEPRECATED_RENAMED, |
44 | }; |
45 | |
46 | struct DeprecationInfo |
47 | { |
48 | DeprecationType type; |
49 | APIType apiType; |
50 | int64 uses; |
51 | std::string name; |
52 | std::string replacement; |
53 | std::string where; |
54 | }; |
55 | |
56 | void initDeprecation(); |
57 | void deinitDeprecation(); |
58 | |
59 | void setDeprecationOutputEnabled(bool enable); |
60 | bool isDeprecationOutputEnabled(); |
61 | |
62 | std::string getDeprecationNotice(const DeprecationInfo &info, bool usewhere); |
63 | |
64 | struct GetDeprecated |
65 | { |
66 | GetDeprecated(); |
67 | ~GetDeprecated(); |
68 | |
69 | const std::vector<const DeprecationInfo *> &all; |
70 | }; |
71 | |
72 | struct MarkDeprecated |
73 | { |
74 | MarkDeprecated(const char *name, APIType api); |
75 | MarkDeprecated(const char *name, APIType api, DeprecationType type, const char *replacement); |
76 | ~MarkDeprecated(); |
77 | |
78 | DeprecationInfo *info; |
79 | }; |
80 | |
81 | } // love |
82 | |