1
# strings.rb : Different Types to deal with strings
2
# Copyright (C) 2006 Vincent Fourmond
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
require 'ctioga2/utils'
22
Version::register_svn_info('$Revision: 2 $', '$Date: 2009-04-25 14:03:30 +0200 (Sat, 25 Apr 2009) $')
27
# The module Types should be used for all subclasses of
28
# Type, to keep the place clean and tidy.
32
class StringParameter < Type
40
def string_to_type(str)
45
# A piece of text representing the path to a file.
46
class FileParameter < StringParameter
50
# The file filters, Qt style.
55
@filter = @type[:filter]
64
# A String or a regular expression
65
class StringOrRegexpParameter < Type
67
type_name :string_or_regexp
73
def string_to_type(str)
74
if str =~ /^\/(.*)\/$/
81
def type_to_string(val)