XMLFormatter.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/qt/af/XMLFormatter.h
22  *
23  * \brief A class for xml serialization formatting strings.
24  */
25 
26 #ifndef TE_QT_AF_XMLFORMATTER_H
27 #define TE_QT_AF_XMLFORMATTER_H
28 
29 #include "Config.h"
30 
31 //STL
32 #include <string>
33 
34 namespace te {
35 
36  //Forward declarations
37  namespace map { class AbstractLayer; }
38  namespace da { class DataSourceInfo; }
39 
40  namespace qt {
41  namespace af {
42 
43  // Forward declaration
44  class Project;
45 
46  /*!
47  \class XMLFormatter
48 
49  \brief A class that formats strings.
50 
51  Use this class for changing strings, contained in some TerraLib objects, to XML percentage encode format and/or to human readable format. Use XML formatting before serializing the object to a XML file, for example, and human readable format after read the object from a XML.
52 
53  \ingroup af
54  */
56  {
57  public:
58 
59  /*!
60  \brief Formats the project informations.
61 
62  \param p The project.
63 
64  \param encode \a Pass true to change for XML percentage format and \a false for human readable format.
65  */
66  static void format(Project* p, const bool& encode);
67 
68  /*!
69  \brief Formats the layer informations.
70 
71  \param l The layer.
72 
73  \param encode \a Pass true to change for XML percentage format and \a false for human readable format.
74 
75  \note The sublayers will be formatted too, using the \a encode passed.
76  */
77  static void format(te::map::AbstractLayer* l, const bool& encode);
78 
79  /*!
80  \brief Formats the data source informations.
81 
82  \param d The data source info.
83 
84  \param encode \a Pass true to change for XML percentage format and \a false for human readable format.
85  */
86  static void format(te::da::DataSourceInfo* d, const bool& encode);
87 
88  /*!
89  \brief Formats all data source informations registered in the \a te::da::DataSourceInfoManager object.
90 
91  \param encode \a Pass true to change for XML percentage format and \a false for human readable format.
92 
93  \sa te::da::DataSourceInfoManager
94  */
95  static void formatDataSourceInfos(const bool& encode);
96 
97  /*!
98  \brief Formats the string.
99 
100  \param s The string.
101 
102  \param encode \a Pass true to change for XML percentage format and \a false for human readable format.
103  */
104  static std::string format (const std::string& s, const bool& encode);
105  };
106 
107  } // namespace af
108  } // namespace qt
109 } // namespace te
110 
111 #endif // TE_QT_AF_XMLFORMATTER_H
This is the base class for layers.
Definition: AbstractLayer.h:76
Configuration flags for the TerraLib Application Framework.
std::string encode(const traits &ts, const std::string &comp)
Encode the URI (sub) component.
Definition: urisyn.cpp:157
URI C++ Library.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:78
A class that formats strings.
Definition: XMLFormatter.h:55
This class models the concept of a project for the TerraLib Application Framework.
Definition: Project.h:50
A class that represents a data source component.