summaryrefslogtreecommitdiff
path: root/src/inc/configuration.h
blob: d8f8dff72bb797c0a43ba37bc14d80ff4c55455e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// 
// --------------------------------------------------------------------------------------------------
// configuration.h
// 
// 
// Access and update configuration values, falling back on legacy CLRConfig methods where necessary.
// 
// --------------------------------------------------------------------------------------------------

#include "clrconfig.h"

#ifndef __configuration_h__
#define __configuration_h__

class Configuration
{
public:
    static void InitializeConfigurationKnobs(int numberOfConfigs, LPCWSTR *configNames, LPCWSTR *configValues);

    // Returns (in priority order):
    //    - The value of the ConfigDWORDInfo if it's set
    //    - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul).
    //    - The default set in the ConfigDWORDInfo
    static DWORD GetKnobDWORDValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);

    // Returns (in priority order):
    //    - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul)
    //    - The default value passed in
    static DWORD GetKnobDWORDValue(LPCWSTR name, DWORD defaultValue);

    // Returns (in priority order):
    //    - The value of the ConfigStringInfo if it's set
    //    - The value of the ConfigurationKnob (searched by name) if it's set
    //    - nullptr
    static LPCWSTR GetKnobStringValue(LPCWSTR name, const CLRConfig::ConfigStringInfo& stringInfo);

    // Returns (in priority order):
    //    - The value of the ConfigurationKnob (searched by name) if it's set
    //    - nullptr
    static LPCWSTR GetKnobStringValue(LPCWSTR name);

    // Returns (in priority order):
    //    - The value of the ConfigDWORDInfo if it's set (1 is true, anything else is false)
    //    - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
    //    - The default set in the ConfigDWORDInfo (1 is true, anything else is false)
    static bool GetKnobBooleanValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);

    // Returns (in priority order):
    //    - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
    //    - The default value passed in
    static bool GetKnobBooleanValue(LPCWSTR name, bool defaultValue);
};

#endif // __configuration_h__