**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Web.Mobile / System.Web.Mobile / DeviceFilterDictionary.cs
blobc12c50f8b48de55103a2d79d36ac40020b2428dd
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 /**
23 * Project : Mono
24 * Namespace : System.Web.Mobile
25 * Class : DeviceFilterDictionary
26 * Author : Gaurav Vaish
28 * Copyright : 2003 with Gaurav Vaish, and with
29 * Ximian Inc
32 using System;
33 using System.Collections;
34 using System.Web;
35 using System.Web.UI;
37 namespace System.Web.Mobile
39 class DeviceFilterDictionary
41 internal class ComparisonEvaluator
43 public readonly string Name;
44 public readonly string Argument;
46 public ComparisonEvaluator(string name, string argument)
48 this.Name = name;
49 this.Argument = argument;
53 // for comparisons
54 private Hashtable cmpEvaluators;
56 // for delegates
57 private Hashtable dlgEvaluators;
59 internal DeviceFilterDictionary()
61 this.cmpEvaluators = new Hashtable();
62 this.dlgEvaluators = new Hashtable();
65 internal DeviceFilterDictionary(DeviceFilterDictionary init)
67 this.cmpEvaluators = (Hashtable)init.cmpEvaluators.Clone();
68 this.dlgEvaluators = (Hashtable)init.dlgEvaluators.Clone();
71 internal void AddCapabilityDelegate(string name,
72 MobileCapabilities.EvaluateCapabilitiesHandler handler)
74 dlgEvaluators[name] = handler;
77 internal void AddComparisonDelegate(string delegateName,
78 string comparisonName, string argument)
80 this.cmpEvaluators[delegateName] =
81 new ComparisonEvaluator(comparisonName, argument);
84 private void InvalidateComparisonDelegateLoops(string name)
86 // throws exception in case of a loop
87 throw new NotImplementedException();
90 internal bool LocateComparisonEvaluator(string evaluatorName,
91 out string capabilityName, out string capArgument)
93 throw new NotImplementedException();
96 internal bool LocateDelegateEvaluator(string name,
97 out MobileCapabilities.EvaluateCapabilitiesHandler result)
99 throw new NotImplementedException();
102 internal bool IsComparisonEvaluator(string name)
104 return cmpEvaluators.Contains(name);
107 internal bool IsDelegateEvaluator(string name)
109 return dlgEvaluators.Contains(name);