Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Components / Validator / Castle.Components.Validator / IBrowserValidationGenerator.cs
bloba2facf86c78050e8451b527c4bfa14a75d07fdf1
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Components.Validator
17 using System;
19 /// <summary>
20 /// Abstracts a JS validation library implementation.
21 /// Each implementation should map the calls to their
22 /// own approach to enforce validation.
23 /// </summary>
24 public interface IBrowserValidationGenerator
26 /// <summary>
27 /// Set that a field should only accept digits.
28 /// </summary>
29 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
30 /// <param name="violationMessage">The violation message.</param>
31 void SetDigitsOnly(string target, string violationMessage);
33 /// <summary>
34 /// Set that a field should only accept numbers.
35 /// </summary>
36 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
37 /// <param name="violationMessage">The violation message.</param>
38 void SetNumberOnly(string target, string violationMessage);
40 /// <summary>
41 /// Sets that a field is required.
42 /// </summary>
43 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
44 /// <param name="violationMessage">The violation message.</param>
45 void SetAsRequired(string target, string violationMessage);
47 /// <summary>
48 /// Sets that a field value must match the specified regular expression.
49 /// </summary>
50 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
51 /// <param name="regExp">The reg exp.</param>
52 /// <param name="violationMessage">The violation message.</param>
53 void SetRegExp(string target, string regExp, string violationMessage);
55 /// <summary>
56 /// Sets that a field value must be a valid email address.
57 /// </summary>
58 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
59 /// <param name="violationMessage">The violation message.</param>
60 void SetEmail(string target, string violationMessage);
62 /// <summary>
63 /// Sets that field must have an exact lenght.
64 /// </summary>
65 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
66 /// <param name="length">The length.</param>
67 void SetExactLength(string target, int length);
69 /// <summary>
70 /// Sets that field must have an exact lenght.
71 /// </summary>
72 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
73 /// <param name="length">The length.</param>
74 /// <param name="violationMessage">The violation message.</param>
75 void SetExactLength(string target, int length, string violationMessage);
77 /// <summary>
78 /// Sets that field must have an minimum lenght.
79 /// </summary>
80 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
81 /// <param name="minLength">The minimum length.</param>
82 void SetMinLength(string target, int minLength);
84 /// <summary>
85 /// Sets that field must have an minimum lenght.
86 /// </summary>
87 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
88 /// <param name="minLength">The minimum length.</param>
89 /// <param name="violationMessage">The violation message.</param>
90 void SetMinLength(string target, int minLength, string violationMessage);
92 /// <summary>
93 /// Sets that field must have an maximum lenght.
94 /// </summary>
95 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
96 /// <param name="maxLength">The maximum length.</param>
97 void SetMaxLength(string target, int maxLength);
99 /// <summary>
100 /// Sets that field must have an maximum lenght.
101 /// </summary>
102 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
103 /// <param name="maxLength">The maximum length.</param>
104 /// <param name="violationMessage">The violation message.</param>
105 void SetMaxLength(string target, int maxLength, string violationMessage);
107 /// <summary>
108 /// Sets that field must be between a length range.
109 /// </summary>
110 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
111 /// <param name="minLength">The minimum length.</param>
112 /// <param name="maxLength">The maximum length.</param>
113 void SetLengthRange(string target, int minLength, int maxLength);
115 /// <summary>
116 /// Sets that field must be between a length range.
117 /// </summary>
118 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
119 /// <param name="minLength">The minimum length.</param>
120 /// <param name="maxLength">The maximum length.</param>
121 /// <param name="violationMessage">The violation message.</param>
122 void SetLengthRange(string target, int minLength, int maxLength, string violationMessage);
124 /// <summary>
125 /// Sets that field must be between a value range.
126 /// </summary>
127 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
128 /// <param name="minValue">Minimum value.</param>
129 /// <param name="maxValue">Maximum value.</param>
130 /// <param name="violationMessage">The violation message.</param>
131 void SetValueRange(string target, int minValue, int maxValue, string violationMessage);
133 /// <summary>
134 /// Sets that field must be between a value range.
135 /// </summary>
136 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
137 /// <param name="minValue">Minimum value.</param>
138 /// <param name="maxValue">Maximum value.</param>
139 /// <param name="violationMessage">The violation message.</param>
140 void SetValueRange(string target, decimal minValue, decimal maxValue, string violationMessage);
142 /// <summary>
143 /// Sets that field must be between a value range.
144 /// </summary>
145 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
146 /// <param name="minValue">Minimum value.</param>
147 /// <param name="maxValue">Maximum value.</param>
148 /// <param name="violationMessage">The violation message.</param>
149 void SetValueRange(string target, DateTime minValue, DateTime maxValue, string violationMessage);
151 /// <summary>
152 /// Sets that field must be between a value range.
153 /// </summary>
154 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
155 /// <param name="minValue">Minimum value.</param>
156 /// <param name="maxValue">Maximum value.</param>
157 /// <param name="violationMessage">The violation message.</param>
158 void SetValueRange(string target, string minValue, string maxValue, string violationMessage);
160 /// <summary>
161 /// Set that a field value must be the same as another field's value.
162 /// </summary>
163 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
164 /// <param name="comparisonFieldName">The name of the field to compare with.</param>
165 /// <param name="violationMessage">The violation message.</param>
166 void SetAsSameAs(string target, string comparisonFieldName, string violationMessage);
168 /// <summary>
169 /// Set that a field value must _not_ be the same as another field's value.
170 /// </summary>
171 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
172 /// <param name="comparisonFieldName">The name of the field to compare with.</param>
173 /// <param name="violationMessage">The violation message.</param>
174 void SetAsNotSameAs(string target, string comparisonFieldName, string violationMessage);
176 /// <summary>
177 /// Set that a field value must be a valid date.
178 /// </summary>
179 /// <param name="target">The target name (ie, a hint about the controller being validated)</param>
180 /// <param name="violationMessage">The violation message.</param>
181 void SetDate(string target, string violationMessage);