[MediaContent] Fix description of Delete method (#866)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Xaml / src / internal / XamlBinding / EffectiveFlowDirectionExtensions.cs
1 using System;
2
3 namespace Tizen.NUI.XamlBinding
4 {
5     internal static class EffectiveFlowDirectionExtensions
6     {
7         internal static EffectiveFlowDirection ToEffectiveFlowDirection(this FlowDirection self, bool isExplicit = false)
8         {
9             switch (self)
10             {
11                 case FlowDirection.MatchParent:
12                     return default(EffectiveFlowDirection);
13
14
15                 case FlowDirection.LeftToRight:
16                     if (isExplicit)
17                     {
18                         return EffectiveFlowDirection.Explicit;
19                     }
20                     else
21                     {
22                         return default(EffectiveFlowDirection);
23                     }
24
25                 case FlowDirection.RightToLeft:
26                     if (isExplicit)
27                     {
28                         return EffectiveFlowDirection.RightToLeft | EffectiveFlowDirection.Explicit;
29                     }
30                     else
31                     {
32                         return EffectiveFlowDirection.RightToLeft;
33                     }
34
35                 default:
36                     throw new InvalidOperationException($"Cannot convert {self} to {nameof(EffectiveFlowDirection)}.");
37             }
38         }
39
40         internal static FlowDirection ToFlowDirection(this EffectiveFlowDirection self)
41         {
42             if (self.IsLeftToRight())
43                 return FlowDirection.LeftToRight;
44             else
45                 return FlowDirection.RightToLeft;
46
47             throw new InvalidOperationException($"Cannot convert {self} to {nameof(FlowDirection)}.");
48         }
49
50         public static bool IsRightToLeft(this EffectiveFlowDirection self)
51         {
52             return (self & EffectiveFlowDirection.RightToLeft) == EffectiveFlowDirection.RightToLeft;
53         }
54
55         public static bool IsLeftToRight(this EffectiveFlowDirection self)
56         {
57             return (self & EffectiveFlowDirection.RightToLeft) != EffectiveFlowDirection.RightToLeft;
58         }
59
60         public static bool IsImplicit(this EffectiveFlowDirection self)
61         {
62             return (self & EffectiveFlowDirection.Explicit) != EffectiveFlowDirection.Explicit;
63         }
64
65         public static bool IsExplicit(this EffectiveFlowDirection self)
66         {
67             return (self & EffectiveFlowDirection.Explicit) == EffectiveFlowDirection.Explicit;
68         }
69     }
70 }