STK++ 0.9.13
STK_Import_Util.cpp
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::
27 * created on: 18 juil. 2011
28 * Purpose: .
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 *
31 **/
32
37#include "../include/STK_Import_Util.h"
38
39namespace STK
40{
41
42namespace Import
43{
44
45/* convert a String to a TypeRegression.
46 * @param type the type of regression we want to define
47 * @return the TypeRegression represented by the String @c type. if the string
48 * does not match any known name, the @c unknown_ type is returned.
49 **/
51{
52 if (toUpperString(type) == toUpperString(_T("unknown"))) return unknown_;
53 if (toUpperString(type) == toUpperString(_T("numeric"))) return numeric_;
54 if (toUpperString(type) == toUpperString(_T("only_numeric"))) return only_numeric_;
55 if (toUpperString(type) == toUpperString(_T("string"))) return string_;
56 if (toUpperString(type) == toUpperString(_T("directed"))) return directed_;
57 if (toUpperString(type) == toUpperString(_T("intelligent"))) return intelligent_;
58 return unknown_;
59}
60
61/* convert a TypeRegression to a String.
62 * @param type the type of regression we want to convert
63 * @return the string associated to this type.
64 **/
66{
67 if (type == numeric_) return String(_T("numeric"));
68 if (type == only_numeric_) return String(_T("only_numeric"));
69 if (type == string_) return String(_T("string"));
70 if (type == directed_) return String(_T("directed"));
71 if (type == intelligent_) return String(_T("intelligent"));
72 return String(_T("unknown"));
73}
74
75} // namespace Import
76
77} // namespace STK
#define _T(x)
Let x unmodified.
String const & toUpperString(String &s)
convert the characters of the String to upper case
Definition STK_String.h:134
TypeImport
define the type of import we want to perform.
TypeImport stringToTypeImport(String const &type)
Convert a String to a TypeImport.
@ numeric_
try to convert the columns in numeric values and let the others as string
@ only_numeric_
conserve only the columns with numeric values
@ intelligent_
try to convert with the most appropriate format the columns. NOT implemented
@ string_
copy the columns
@ directed_
convert using an array of conversion.
@ unknown_
try to convert the columns in numeric values and let the others as string
std::basic_string< Char > String
STK fundamental type of a String.
String typeImportToString(TypeImport const &type)
convert a TypeImport to a String.
The namespace STK is the main domain space of the Statistical ToolKit project.