StringConverters.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/datatype/StringConverters.h
22 
23  \brief A set of function that convert an String type to other types.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_STRINGCONVERTERS_H
27 #define __TERRALIB_DATATYPE_INTERNAL_STRINGCONVERTERS_H
28 
29 // TerraLib
30 #include "Exception.h"
31 #include "Config.h"
32 
33 namespace te
34 {
35  namespace dt
36  {
37 // Forward declarations
38  class AbstractData;
39 
40  /** @name String Methods
41  * Methods related to String conversion.
42  */
43  //@{
44 
45  /*!
46  \brief It converts an String data value to a Int16 data value.
47 
48  \param d The input data value.
49 
50  \return A new data value converted to Int16 data type. The caller will take the ownership of the returned data.
51 
52  \exception Exception It throws an exception if the input abstract data is not a String type.
53  */
54  TEDATATYPEEXPORT AbstractData* StringToInt16Converter(AbstractData* d) throw(Exception);
55 
56  /*!
57  \brief It converts an String data value to an unsigned Int16 data value.
58 
59  \param d The input data value.
60 
61  \return A new data value converted to unsigned Int16 data type. The caller will take the ownership of the returned data.
62 
63  \exception Exception It throws an exception if the input abstract data is not a String type.
64  */
65  TEDATATYPEEXPORT AbstractData* StringToUInt16Converter(AbstractData* d) throw(Exception);
66 
67  /*!
68  \brief It converts an String data value to a Int32 data value.
69 
70  \param d The input data value.
71 
72  \return A new data value converted to Int32 data type. The caller will take the ownership of the returned data.
73 
74  \exception Exception It throws an exception if the input abstract data is not a String type.
75  */
76  TEDATATYPEEXPORT AbstractData* StringToInt32Converter(AbstractData* d) throw(Exception);
77 
78  /*!
79  \brief It converts an String data value to an unsigned Int32 data value.
80 
81  \param d The input data value.
82 
83  \return A new data value converted to unsigned Int32 data type. The caller will take the ownership of the returned data.
84 
85  \exception Exception It throws an exception if the input abstract data is not a String type.
86  */
87  TEDATATYPEEXPORT AbstractData* StringToUInt32Converter(AbstractData* d) throw(Exception);
88 
89  /*!
90  \brief It converts an String data value to a Int64 data value.
91 
92  \param d The input data value.
93 
94  \return A new data value converted to Int64 data type. The caller will take the ownership of the returned data.
95 
96  \exception Exception It throws an exception if the input abstract data is not a String type.
97  */
98  TEDATATYPEEXPORT AbstractData* StringToInt64Converter(AbstractData* d) throw(Exception);
99 
100  /*!
101  \brief It converts an String data value to an unsigned Int64 data value.
102 
103  \param d The input data value.
104 
105  \return A new data value converted to unsigned Int64 data type. The caller will take the ownership of the returned data.
106 
107  \exception Exception It throws an exception if the input abstract data is not a String type.
108  */
109  TEDATATYPEEXPORT AbstractData* StringToUInt64Converter(AbstractData* d) throw(Exception);
110 
111  /*!
112  \brief It converts an String data value to a float data value.
113 
114  \param d The input data value.
115 
116  \return A new data value converted to float data type. The caller will take the ownership of the returned data.
117 
118  \exception Exception It throws an exception if the input abstract data is not a String type.
119  */
120  TEDATATYPEEXPORT AbstractData* StringToFloatConverter(AbstractData* d) throw(Exception);
121 
122  /*!
123  \brief It converts an String data value to a double data value.
124 
125  \param d The input data value.
126 
127  \return A new data value converted to double data type. The caller will take the ownership of the returned data.
128 
129  \exception Exception It throws an exception if the input abstract data is not a String type.
130  */
131  TEDATATYPEEXPORT AbstractData* StringToDoubleConverter(AbstractData* d) throw(Exception);
132 
133  /*!
134  \brief It converts an String data value to a Numeric data value.
135 
136  \param d The input data value.
137 
138  \return A new data value converted to Numeric data type. The caller will take the ownership of the returned data.
139 
140  \exception Exception It throws an exception if the input abstract data is not a String type.
141  */
142  TEDATATYPEEXPORT AbstractData* StringToNumericConverter(AbstractData* d) throw(Exception);
143 
144  /*!
145  \brief Auxiliary method that asserts that the given data is an String type.
146 
147  \param d The input data value.
148 
149  \exception Exception It throws an exception if the input abstract data is not a String type.
150  */
151  TEDATATYPEEXPORT void AssertString(AbstractData* d) throw(Exception);
152 
153  //@}
154 
155  } // end namespace dt
156 } // end namespace te
157 
158 #endif // __TERRALIB_DATATYPE_INTERNAL_STRINGCONVERTERS_H
TEDATATYPEEXPORT AbstractData * StringToInt16Converter(AbstractData *d)
It converts an String data value to a Int16 data value.
TEDATATYPEEXPORT AbstractData * StringToNumericConverter(AbstractData *d)
It converts an String data value to a Numeric data value.
An exception class for the DataType module.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Configuration flags for the DataType module of TerraLib.
TEDATATYPEEXPORT AbstractData * StringToUInt16Converter(AbstractData *d)
It converts an String data value to an unsigned Int16 data value.
TEDATATYPEEXPORT AbstractData * StringToUInt32Converter(AbstractData *d)
It converts an String data value to an unsigned Int32 data value.
URI C++ Library.
TEDATATYPEEXPORT AbstractData * StringToInt64Converter(AbstractData *d)
It converts an String data value to a Int64 data value.
TEDATATYPEEXPORT AbstractData * StringToInt32Converter(AbstractData *d)
It converts an String data value to a Int32 data value.
TEDATATYPEEXPORT AbstractData * StringToUInt64Converter(AbstractData *d)
It converts an String data value to an unsigned Int64 data value.
TEDATATYPEEXPORT AbstractData * StringToFloatConverter(AbstractData *d)
It converts an String data value to a float data value.
TEDATATYPEEXPORT void AssertString(AbstractData *d)
Auxiliary method that asserts that the given data is an String type.
TEDATATYPEEXPORT AbstractData * StringToDoubleConverter(AbstractData *d)
It converts an String data value to a double data value.