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 
32 namespace te
33 {
34  namespace dt
35  {
36 // Forward declarations
37  class AbstractData;
38 
39  /** @name String Methods
40  * Methods related to String conversion.
41  */
42  //@{
43 
44  /*!
45  \brief It converts an String data value to a Int16 data value.
46 
47  \param d The input data value.
48 
49  \return A new data value converted to Int16 data type. The caller will take the ownership of the returned data.
50 
51  \exception Exception It throws an exception if the input abstract data is not a String type.
52  */
53  AbstractData* StringToInt16Converter(AbstractData* d) throw(Exception);
54 
55  /*!
56  \brief It converts an String data value to an unsigned Int16 data value.
57 
58  \param d The input data value.
59 
60  \return A new data value converted to unsigned Int16 data type. The caller will take the ownership of the returned data.
61 
62  \exception Exception It throws an exception if the input abstract data is not a String type.
63  */
64  AbstractData* StringToUInt16Converter(AbstractData* d) throw(Exception);
65 
66  /*!
67  \brief It converts an String data value to a Int32 data value.
68 
69  \param d The input data value.
70 
71  \return A new data value converted to Int32 data type. The caller will take the ownership of the returned data.
72 
73  \exception Exception It throws an exception if the input abstract data is not a String type.
74  */
75  AbstractData* StringToInt32Converter(AbstractData* d) throw(Exception);
76 
77  /*!
78  \brief It converts an String data value to an unsigned Int32 data value.
79 
80  \param d The input data value.
81 
82  \return A new data value converted to unsigned Int32 data type. The caller will take the ownership of the returned data.
83 
84  \exception Exception It throws an exception if the input abstract data is not a String type.
85  */
86  AbstractData* StringToUInt32Converter(AbstractData* d) throw(Exception);
87 
88  /*!
89  \brief It converts an String data value to a Int64 data value.
90 
91  \param d The input data value.
92 
93  \return A new data value converted to Int64 data type. The caller will take the ownership of the returned data.
94 
95  \exception Exception It throws an exception if the input abstract data is not a String type.
96  */
97  AbstractData* StringToInt64Converter(AbstractData* d) throw(Exception);
98 
99  /*!
100  \brief It converts an String data value to an unsigned Int64 data value.
101 
102  \param d The input data value.
103 
104  \return A new data value converted to unsigned Int64 data type. The caller will take the ownership of the returned data.
105 
106  \exception Exception It throws an exception if the input abstract data is not a String type.
107  */
108  AbstractData* StringToUInt64Converter(AbstractData* d) throw(Exception);
109 
110  /*!
111  \brief It converts an String data value to a float data value.
112 
113  \param d The input data value.
114 
115  \return A new data value converted to float data type. The caller will take the ownership of the returned data.
116 
117  \exception Exception It throws an exception if the input abstract data is not a String type.
118  */
119  AbstractData* StringToFloatConverter(AbstractData* d) throw(Exception);
120 
121  /*!
122  \brief It converts an String data value to a double data value.
123 
124  \param d The input data value.
125 
126  \return A new data value converted to double data type. The caller will take the ownership of the returned data.
127 
128  \exception Exception It throws an exception if the input abstract data is not a String type.
129  */
130  AbstractData* StringToDoubleConverter(AbstractData* d) throw(Exception);
131 
132  /*!
133  \brief It converts an String data value to a Numeric data value.
134 
135  \param d The input data value.
136 
137  \return A new data value converted to Numeric data type. The caller will take the ownership of the returned data.
138 
139  \exception Exception It throws an exception if the input abstract data is not a String type.
140  */
141  AbstractData* StringToNumericConverter(AbstractData* d) throw(Exception);
142 
143  /*!
144  \brief Auxiliary method that asserts that the given data is an String type.
145 
146  \param d The input data value.
147 
148  \exception Exception It throws an exception if the input abstract data is not a String type.
149  */
150  void AssertString(AbstractData* d) throw(Exception);
151 
152  //@}
153 
154  } // end namespace dt
155 } // end namespace te
156 
157 #endif // __TERRALIB_DATATYPE_INTERNAL_STRINGCONVERTERS_H
An exception class for the DataType module.
AbstractData * StringToUInt16Converter(AbstractData *d)
It converts an String data value to an unsigned Int16 data value.
AbstractData * StringToInt16Converter(AbstractData *d)
It converts an String data value to a Int16 data value.
void AssertString(AbstractData *d)
Auxiliary method that asserts that the given data is an String type.
AbstractData * StringToInt32Converter(AbstractData *d)
It converts an String data value to a Int32 data value.
AbstractData * StringToUInt32Converter(AbstractData *d)
It converts an String data value to an unsigned Int32 data value.
URI C++ Library.
AbstractData * StringToFloatConverter(AbstractData *d)
It converts an String data value to a float data value.
AbstractData * StringToInt64Converter(AbstractData *d)
It converts an String data value to a Int64 data value.
AbstractData * StringToNumericConverter(AbstractData *d)
It converts an String data value to a Numeric data value.
AbstractData * StringToDoubleConverter(AbstractData *d)
It converts an String data value to a double data value.
AbstractData * StringToUInt64Converter(AbstractData *d)
It converts an String data value to an unsigned Int64 data value.