// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. namespace WixToolset.Data { using System; public enum AccessModifier { /// /// Indicates the identifier is globally visible to all other sections. /// Global, [Obsolete] Public = Global, /// /// Indicates the identifier is visible only to sections in the same library. /// Library, [Obsolete] Internal = Library, /// /// Indicates the identifier is visible only to sections in the same source file. /// File, [Obsolete] Protected = File, /// /// Indicates the identifiers is visible only to the section where it is defined. /// Section, [Obsolete] Private = Section, } /// /// Extensions for converting AccessModifier to and from strings optimally. /// public static class AccessModifierExtensions { /// /// Converts a string to an AccessModifier. /// /// String value to convert. /// Converted AccessModifier. public static AccessModifier AsAccessModifier(this string access) { switch (access) { case "global": case "public": return AccessModifier.Global; case "library": case "internal": return AccessModifier.Library; case "file": case "protected": return AccessModifier.File; case "section": case "private": return AccessModifier.Section; default: throw new ArgumentException($"Unknown AccessModifier: {access}", nameof(access)); } } /// /// Converts an AccessModifier to a string. /// /// AccessModifier value to convert. /// Converted string. public static string AsString(this AccessModifier access) { switch (access) { case AccessModifier.Global: return "global"; case AccessModifier.Library: return "library"; case AccessModifier.File: return "file"; case AccessModifier.Section: return "section"; default: throw new ArgumentException($"Unknown AccessModifier: {access}", nameof(access)); } } } }