Import doxygen generated api doc
[qanava.git] / src / qanRepository.h
blobc759ce8cbf0aaf7f3311a76f71ff8f688a4c338c
1 /*
2 Qanava - Graph drawing library for QT
3 Copyright (C) 2006 Benoit AUTHEMAN
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //-----------------------------------------------------------------------------
21 // This file is a part of the Qanava software.
23 // \file qanRepository.h
24 // \author Benoit Autheman (benoit@libqanava.org)
25 // \date 2005 December 23
26 //-----------------------------------------------------------------------------
29 #ifndef qanRepository_h
30 #define qanRepository_h
33 // Qanava headers
34 #include "./qanConfig.h"
35 #include "./qanGraph.h"
38 // STD headers
39 #include <string>
42 // QT headers
43 #include <QDomDocument>
46 //-----------------------------------------------------------------------------
47 namespace qan { // ::qan
49 //! Model an abstract storage object for graphs.
50 /*!
51 \nosubgrouping
53 class Repository
55 /*! \name Graph Serialization Management *///----------------------
56 //@{
57 public:
59 //! Repository constructor with name initialization.
60 Repository( const std::string& name ) : _name( name ) { }
62 //! Repsoitory standard virtual destructor.
63 virtual ~Repository( ) { }
65 //! .
66 virtual void load( Graph* graph ) = 0;
68 //! .
69 virtual void save( Graph* graph ) = 0;
71 //! Get the repository name.
72 const std::string& getName( ) const { return _name; }
74 private:
76 //! Repository name (usually a file name).
77 std::string _name;
78 //@}
79 //-----------------------------------------------------------------
84 //!
85 /*!
86 \nosubgrouping
88 class PajekRepository : public Repository
90 /*! \name Graph Serialization Management *///----------------------
91 //@{
92 public:
94 PajekRepository( const std::string& name ) : Repository( name ) { }
96 virtual ~PajekRepository( ) { }
98 //! .
99 virtual void load( Graph* graph );
101 //! .
102 virtual void save( Graph* graph );
104 private:
106 //! Current data mode (Pajek Vertices, Arcs or Edges)
107 enum Mode
109 UNDEFINED = 1,
110 VERTICES = 2,
111 ARCS = 4,
112 EDGES = 8
114 //@}
115 //-----------------------------------------------------------------
120 //! DEPRECATED
121 /*! DEPRECATED, used for debugging purposes only.
122 \nosubgrouping
124 class GraphvizRepository : public Repository
126 /*! \name Graph Serialization Management *///----------------------
127 //@{
128 public:
130 GraphvizRepository( const std::string& name ) : Repository( name ) { }
132 virtual ~GraphvizRepository( ) { }
134 //! .
135 virtual void load( Graph* graph );
137 //! .
138 virtual void save( Graph* graph );
139 //@}
140 //-----------------------------------------------------------------
143 //! GML (XML based Graph Markup Language) repository.
145 \nosubgrouping
147 class GMLRepository : public Repository
149 /*! \name Graph Serialization Management *///----------------------
150 //@{
151 public:
153 GMLRepository( const std::string& name );
155 virtual ~GMLRepository( ) { }
157 //! .
158 virtual void load( Graph* graph );
160 //! .
161 virtual void save( Graph* graph );
163 private:
165 void parseGraph( QDomDocument domDocument, QDomElement graphChild, Graph* graph );
166 //@}
167 //-----------------------------------------------------------------
169 } // ::qan
170 //-----------------------------------------------------------------------------
173 #endif // qanRepository_h