1 /**
2 * Copyright © DiamondMVC 2019
3 * License: MIT (https://github.com/DiamondMVC/Diamond/blob/master/LICENSE)
4 * Author: Jacob Jensen (bausshf)
5 */
6 module diamond.core.apptype;
7 
8 public
9 {
10   version (Diamond_WebSite)
11   {
12     /// Boolean determining whether the application is compiled as a webserver or not.
13     static const bool isWebServer = true;
14     /// Boolean determining whether the application is compiled as a webapi or not.
15     static const bool isWebApi = false;
16   }
17   else version (Diamond_WebApi)
18   {
19     /// Boolean determining whether the application is compiled as a webserver or not.
20     static const bool isWebServer = false;
21     /// Boolean determining whether the application is compiled as a webapi or not.
22     static const bool isWebApi = true;
23   }
24   else
25   {
26     /// Boolean determining whether the application is compiled as a webserver or not.
27     static const bool isWebServer = true;
28     /// Boolean determining whether the application is compiled as a webapi or not.
29     static const bool isWebApi = true;
30   }
31 
32   /// Boolean determining whether the application is web related or not.
33   static const bool isWeb = true;//isWebServer || isWebApi;
34 
35   version (Diamond_UnitTesting)
36   {
37     /// Boolean determining whether the application is running tests or not.
38     static const bool isTesting = isWeb; // Testing can only be enabled for web applications.
39   }
40   else
41   {
42     /// Boolean determining whether the application is running tests or not.
43     static const bool isTesting = false;
44   }
45 
46   version (Diamond_Logging)
47   {
48     /// Boolean determining whether the application logs or not.
49     static const bool loggingEnabled = isWeb; // Testing can only be enabled for web applications.
50   }
51   else
52   {
53     /// Boolean determining whether the application logs or not.
54     static const bool loggingEnabled = false;
55   }
56 
57   version (Diamond_CustomMain)
58   {
59     /// Boolean determining whether the application uses a custom main or not.
60     static const bool isCustomMain = isWeb;
61   }
62   else
63   {
64     /// Boolean determining whether the application uses a custom main or not.
65     static const bool isCustomMain = false;
66   }
67 
68   version (Diamond_Debug)
69   {
70     /// Boolean determining whether application is being debugged or not.
71     static const bool debugging = true;
72   }
73   else
74   {
75     /// Boolean determining whether application is being debugged or not.
76     static const bool debugging = false;
77   }
78 
79   version (USE_ODBC)
80   {
81     /// Boolean determining whether the application has support for ODBC through DDBC.
82     static const bool hasDDBC_ODBC = true;
83   }
84   else
85   {
86     /// Boolean determining whether the application has support for ODBC through DDBC.
87     static const bool hasDDBC_ODBC = false;
88   }
89 
90   version (Diamond_DDBC_MSSQL)
91   {
92     /// Boolean determining whether the application has support for Microsoft's sql server.
93     static const bool hasMsSql = hasDDBC_ODBC;
94   }
95   else
96   {
97     /// Boolean determining whether the application has support for Microsoft's sql server.
98     static const bool hasMsSql = false;
99   }
100 
101   version (Diamond_DDBC_PostgreSQL)
102   {
103     /// Boolean determining whether the application has support for postgreSQL.
104     static const bool hasPostgreSql = true;
105   }
106   else
107   {
108     /// Boolean determining whether the application has support for postgreSQL.
109     static const bool hasPostgreSql = false;
110   }
111 
112   version (Diamond_DDBC_Sqlite)
113   {
114     /// Boolean determining whether the application has support for sqlite.
115     static const bool hasSqlite = true;
116   }
117   else
118   {
119     /// Boolean determining whether the application has support for sqlite.
120     static const bool hasSqlite = false;
121   }
122 }