Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PersistenceReintegration/HeuristicLab.Data/3.3/StringConvertibleArray.cs @ 15802

Last change on this file since 15802 was 15018, checked in by gkronber, 8 years ago

#2520 introduced StorableConstructorFlag type for StorableConstructors

File size: 2.3 KB
RevLine 
[13695]1#region License Information
2
3/* HeuristicLab
4 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 *
6 * This file is part of HeuristicLab.
7 *
8 * HeuristicLab is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * HeuristicLab is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#endregion
23
24using HeuristicLab.Common;
25using HeuristicLab.Core;
[14927]26using HeuristicLab.Persistence;
[13695]27
28namespace HeuristicLab.Data {
29  [Item("StringConvertibleArray", "Represents an array of string convertible values.")]
[14927]30  [StorableType("9d1ae3cf-8bc1-4fdd-892b-048a77bbffcb")]
[13695]31  public abstract class StringConvertibleArray<T> : ValueTypeArray<T>, IStringConvertibleArray where T : struct {
32    [StorableConstructor]
[15018]33    protected StringConvertibleArray(StorableConstructorFlag deserializing) : base(deserializing) { }
[13695]34    protected StringConvertibleArray(StringConvertibleArray<T> original, Cloner cloner)
35      : base(original, cloner) { }
36
37    protected StringConvertibleArray() : base() { }
38    protected StringConvertibleArray(int length) : base(length) { }
39    protected StringConvertibleArray(T[] elements) : base(elements) { }
40
41    protected abstract bool Validate(string value, out string errorMessage);
42    protected abstract string GetValue(int index);
43    protected abstract bool SetValue(string value, int index);
44
45    #region IStringConvertibleArray Members
46    bool IStringConvertibleArray.Validate(string value, out string errorMessage) {
47      return Validate(value, out errorMessage);
48    }
49    string IStringConvertibleArray.GetValue(int index) {
50      return GetValue(index);
51    }
52    bool IStringConvertibleArray.SetValue(string value, int index) {
53      return SetValue(value, index);
54    }
55    #endregion
56  }
57}
Note: See TracBrowser for help on using the repository browser.