Loading...
Searching...
No Matches
AbstractWriterFactory.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/xml/AbstractWriterFactory.h
22
23 \brief This is the abstract factory for XML writers.
24*/
25
26#ifndef __TERRALIB_XML_INTERNAL_ABSTRACTWRITERFACTORY_H
27#define __TERRALIB_XML_INTERNAL_ABSTRACTWRITERFACTORY_H
28
29// TerraLib
30#include "../common/AbstractFactory.h"
31#include "AbstractWriter.h"
32
33// STL
34#include <string>
35
36namespace te
37{
38 namespace xml
39 {
40
41 /*!
42 \class AbstractWriterFactory
43
44 \brief This is the abstract factory for XML writers.
45
46 This is an abstract factory, so you will need to call the static method make
47 as follow:
48
49 \code
50 AbstractWriter* writer = AbstractWriterFactory::make("XERCES");
51 \endcode
52
53 or
54
55 \code
56 // for a default writer
57 AbstractWriter* writer = AbstractWriterFactory::make();
58 \endcode
59
60 \ingroup xml
61
62 \sa Writer
63 */
64 class TEXMLEXPORT AbstractWriterFactory : public te::common::AbstractFactory<te::xml::AbstractWriter, std::string>
65 {
66 public:
67
68 /*!
69 \brief It creates a new XML writer using the dafault implementation.
70
71 \return A new XML writer using the dafault implementation.
72 */
74
75 /*!
76 \brief It creates a new XML writer.
77
78 \param writerType The type of XML writer to be created.
79
80 \return A new XML writer.
81 */
82 static te::xml::AbstractWriter* make(const std::string& writerType);
83
84 /*!
85 \brief It sets the default driver used to create the XML writer objects.
86
87 \param writerType The default driver name for creating XML writer objects.
88 */
89 static void setDefaultWriter(const std::string& writerType);
90
91 /*!
92 \brief Virtual destructor.
93
94 \note It will automatically unregister the factory from the dictionary.
95 */
97
98 protected:
99
100 /*!
101 \brief It creates the factory.
102
103 The key of a AbstractWriterFactory is a string.
104
105 \param factoryKey The key that identifies the factory.
106 */
107 AbstractWriterFactory(const std::string& factoryKey);
108
109 private:
110
111 static std::string sm_defaultWriterType; //!< The type of the writer to be created if no type is informed.
112 };
113
114 } // end namespace xml
115} // end namespace te
116
117#endif // __TERRALIB_XML_INTERNAL_ABSTRACTWRITERFACTORY_H
118
This class models a XML writer object.
This class defines the interface of abstract factories without initializing parameters.
This is the abstract factory for XML writers.
static te::xml::AbstractWriter * make(const std::string &writerType)
It creates a new XML writer.
static void setDefaultWriter(const std::string &writerType)
It sets the default driver used to create the XML writer objects.
AbstractWriterFactory(const std::string &factoryKey)
It creates the factory.
static te::xml::AbstractWriter * make()
It creates a new XML writer using the dafault implementation.
virtual ~AbstractWriterFactory()
Virtual destructor.
static std::string sm_defaultWriterType
The type of the writer to be created if no type is informed.
This class models a XML writer object.
TerraLib.
#define TEXMLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88