[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/qrdf/src
From: Daniele Galdi <daniele.galdi () gmail ! com>
Date: 2006-10-31 23:47:08
Message-ID: 1162338428.672413.1027.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 600842 by dagnele:
World became a Singleton
M +17 -15 World.cpp
M +10 -9 World.h
--- trunk/playground/base/qrdf/src/World.cpp #600841:600842
@@ -18,35 +18,37 @@
* Boston, MA 02110-1301, USA.
*/
+#include <QtGlobal>
+
#include "World.h"
using namespace RDF;
-struct World::Private
+World *World::m_instance = NULL;
+
+World *World::self()
{
- Private() : world(0L)
- {}
- librdf_world* world;
-};
+ if ( !m_instance )
+ {
+ qDebug( "new World()\n" );
+ m_instance = new World();
+ }
+ return m_instance;
+}
+
World::World()
{
- d = new Private;
- d->world = librdf_new_world();
+ m_world = librdf_new_world();
+ librdf_world_open( m_world );
}
World::~World()
{
- librdf_free_world( d->world );
- delete d;
+ librdf_free_world( m_world );
}
-void World::open()
-{
- librdf_world_open( d->world );
-}
-
librdf_world* World::worldPtr() const
{
- return d->world;
+ return m_world;
}
--- trunk/playground/base/qrdf/src/World.h #600841:600842
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef REDLAND_WORLD_H
-#define REDLAND_WORLD_H
+#ifndef RDF_REDLAND_WORLD_H
+#define RDF_REDLAND_WORLD_H
#include <redland.h>
@@ -29,20 +29,21 @@
class World
{
public:
- World();
+ static World *self();
+
~World();
-
- void open();
-
+
librdf_world* worldPtr() const;
private:
+ World();
World( const World &other ) {};
- class Private;
- Private *d;
+ librdf_world * m_world;
+
+ static World *m_instance;
};
}
-#endif
+#endif // RDF_REDLAND_WORLD_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic