author | zecke <zecke> | 2004-07-17 16:37:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-17 16:37:22 (UTC) |
commit | ff046ffbe3d08ea07b08b914c81529f86b006b7f (patch) (unidiff) | |
tree | a1b57319a5a2f3075d883622cca88be38bf86e22 | |
parent | f02993238f76eb8975bb4138f213d2211710afa4 (diff) | |
download | opie-ff046ffbe3d08ea07b08b914c81529f86b006b7f.zip opie-ff046ffbe3d08ea07b08b914c81529f86b006b7f.tar.gz opie-ff046ffbe3d08ea07b08b914c81529f86b006b7f.tar.bz2 |
Cosmetic changes
using namespace Opie::DB -> namespace Opie { namespace DB {
-rw-r--r-- | libopie2/opiedb/opiedb.pro | 3 | ||||
-rw-r--r-- | libopie2/opiedb/osqlbackend.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiedb/osqlmanager.cpp | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index e5b1ac9..8432674 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -1,42 +1,43 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = osqlbackend.h \ | 4 | HEADERS = osqlbackend.h \ |
5 | osqldriver.h \ | 5 | osqldriver.h \ |
6 | osqlerror.h \ | 6 | osqlerror.h \ |
7 | osqlmanager.h \ | 7 | osqlmanager.h \ |
8 | osqlquery.h \ | 8 | osqlquery.h \ |
9 | osqlresult.h \ | 9 | osqlresult.h \ |
10 | osqltable.h \ | 10 | osqltable.h \ |
11 | osqlbackendmanager.h \ | 11 | osqlbackendmanager.h \ |
12 | osqlitedriver.h | 12 | osqlitedriver.h |
13 | |||
13 | SOURCES = osqlbackend.cpp \ | 14 | SOURCES = osqlbackend.cpp \ |
14 | osqldriver.cpp \ | 15 | osqldriver.cpp \ |
15 | osqlerror.cpp \ | 16 | osqlerror.cpp \ |
16 | osqlmanager.cpp \ | 17 | osqlmanager.cpp \ |
17 | osqlquery.cpp \ | 18 | osqlquery.cpp \ |
18 | osqlresult.cpp \ | 19 | osqlresult.cpp \ |
19 | osqltable.cpp \ | 20 | osqltable.cpp \ |
20 | osqlbackendmanager.cpp \ | 21 | osqlbackendmanager.cpp \ |
21 | osqlitedriver.cpp | 22 | osqlitedriver.cpp |
22 | INTERFACES = | 23 | |
23 | TARGET = opiedb2 | 24 | TARGET = opiedb2 |
24 | VERSION = 1.9.0 | 25 | VERSION = 1.9.0 |
25 | INCLUDEPATH = $(OPIEDIR)/include | 26 | INCLUDEPATH = $(OPIEDIR)/include |
26 | DEPENDPATH = $(OPIEDIR)/include | 27 | DEPENDPATH = $(OPIEDIR)/include |
27 | LIBS += -lopiecore2 -lqpe -lsqlite | 28 | LIBS += -lopiecore2 -lqpe -lsqlite |
28 | 29 | ||
29 | !contains( platform, x11 ) { | 30 | !contains( platform, x11 ) { |
30 | include ( $(OPIEDIR)/include.pro ) | 31 | include ( $(OPIEDIR)/include.pro ) |
31 | } | 32 | } |
32 | 33 | ||
33 | contains( platform, x11 ) { | 34 | contains( platform, x11 ) { |
34 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 35 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
35 | } | 36 | } |
36 | 37 | ||
37 | !isEmpty( LIBSQLITE_INC_DIR ) { | 38 | !isEmpty( LIBSQLITE_INC_DIR ) { |
38 | INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH | 39 | INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH |
39 | } | 40 | } |
40 | !isEmpty( LIBSQLITE_LIB_DIR ) { | 41 | !isEmpty( LIBSQLITE_LIB_DIR ) { |
41 | LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS | 42 | LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS |
42 | } | 43 | } |
diff --git a/libopie2/opiedb/osqlbackend.cpp b/libopie2/opiedb/osqlbackend.cpp index 6e5159f..aede7c1 100644 --- a/libopie2/opiedb/osqlbackend.cpp +++ b/libopie2/opiedb/osqlbackend.cpp | |||
@@ -1,75 +1,80 @@ | |||
1 | 1 | ||
2 | #include "osqlbackend.h" | 2 | #include "osqlbackend.h" |
3 | 3 | ||
4 | using namespace Opie::DB; | 4 | namespace Opie { |
5 | namespace DB { | ||
5 | 6 | ||
6 | 7 | ||
7 | OSQLBackEnd::OSQLBackEnd( const QString& name, | 8 | OSQLBackEnd::OSQLBackEnd( const QString& name, |
8 | const QString& vendor, | 9 | const QString& vendor, |
9 | const QString& license, | 10 | const QString& license, |
10 | const QCString& lib ) | 11 | const QCString& lib ) |
11 | : m_name( name), m_vendor( vendor), m_license( license ), m_lib( lib ) | 12 | : m_name( name), m_vendor( vendor), m_license( license ), m_lib( lib ) |
12 | { | 13 | { |
13 | m_default = false; | 14 | m_default = false; |
14 | m_pref = -1; | 15 | m_pref = -1; |
15 | } | 16 | } |
16 | OSQLBackEnd::OSQLBackEnd( const OSQLBackEnd& back ) { | 17 | OSQLBackEnd::OSQLBackEnd( const OSQLBackEnd& back ) { |
17 | (*this) = back; | 18 | (*this) = back; |
18 | } | 19 | } |
19 | OSQLBackEnd::~OSQLBackEnd() { | 20 | OSQLBackEnd::~OSQLBackEnd() { |
20 | } | 21 | } |
21 | bool OSQLBackEnd::operator==( const OSQLBackEnd& other ) { | 22 | bool OSQLBackEnd::operator==( const OSQLBackEnd& other ) { |
22 | if ( m_pref != other.m_pref ) return false; | 23 | if ( m_pref != other.m_pref ) return false; |
23 | if ( m_default != other.m_default ) return false; | 24 | if ( m_default != other.m_default ) return false; |
24 | if ( m_name != other.m_name ) return false; | 25 | if ( m_name != other.m_name ) return false; |
25 | if ( m_vendor != other.m_vendor ) return false; | 26 | if ( m_vendor != other.m_vendor ) return false; |
26 | if ( m_license != other.m_license ) return false; | 27 | if ( m_license != other.m_license ) return false; |
27 | if ( m_lib != other.m_lib ) return false; | 28 | if ( m_lib != other.m_lib ) return false; |
28 | 29 | ||
29 | return true; | 30 | return true; |
30 | } | 31 | } |
31 | OSQLBackEnd &OSQLBackEnd::operator=(const OSQLBackEnd& back ) { | 32 | OSQLBackEnd &OSQLBackEnd::operator=(const OSQLBackEnd& back ) { |
32 | m_name = back.m_name; | 33 | m_name = back.m_name; |
33 | m_vendor = back.m_vendor; | 34 | m_vendor = back.m_vendor; |
34 | m_license = back.m_license; | 35 | m_license = back.m_license; |
35 | m_lib = back.m_lib; | 36 | m_lib = back.m_lib; |
36 | m_pref = back.m_pref; | 37 | m_pref = back.m_pref; |
37 | m_default = back.m_default; | 38 | m_default = back.m_default; |
38 | return *this; | 39 | return *this; |
39 | } | 40 | } |
40 | QString OSQLBackEnd::name() const { | 41 | QString OSQLBackEnd::name() const { |
41 | return m_name; | 42 | return m_name; |
42 | } | 43 | } |
43 | QString OSQLBackEnd::vendor() const { | 44 | QString OSQLBackEnd::vendor() const { |
44 | return m_vendor; | 45 | return m_vendor; |
45 | } | 46 | } |
46 | QString OSQLBackEnd::license() const { | 47 | QString OSQLBackEnd::license() const { |
47 | return m_license; | 48 | return m_license; |
48 | } | 49 | } |
49 | QCString OSQLBackEnd::library() const { | 50 | QCString OSQLBackEnd::library() const { |
50 | return m_lib; | 51 | return m_lib; |
51 | } | 52 | } |
52 | bool OSQLBackEnd::isDefault()const { | 53 | bool OSQLBackEnd::isDefault()const { |
53 | return m_default; | 54 | return m_default; |
54 | } | 55 | } |
55 | int OSQLBackEnd::preference()const { | 56 | int OSQLBackEnd::preference()const { |
56 | return m_pref; | 57 | return m_pref; |
57 | } | 58 | } |
58 | void OSQLBackEnd::setName( const QString& name ) { | 59 | void OSQLBackEnd::setName( const QString& name ) { |
59 | m_name = name; | 60 | m_name = name; |
60 | } | 61 | } |
61 | void OSQLBackEnd::setVendor( const QString& vendor ) { | 62 | void OSQLBackEnd::setVendor( const QString& vendor ) { |
62 | m_vendor = vendor; | 63 | m_vendor = vendor; |
63 | } | 64 | } |
64 | void OSQLBackEnd::setLicense( const QString & license ) { | 65 | void OSQLBackEnd::setLicense( const QString & license ) { |
65 | m_license = license; | 66 | m_license = license; |
66 | } | 67 | } |
67 | void OSQLBackEnd::setLibrary( const QCString& lib ) { | 68 | void OSQLBackEnd::setLibrary( const QCString& lib ) { |
68 | m_lib = lib; | 69 | m_lib = lib; |
69 | } | 70 | } |
70 | void OSQLBackEnd::setDefault( bool def) { | 71 | void OSQLBackEnd::setDefault( bool def) { |
71 | m_default = def; | 72 | m_default = def; |
72 | } | 73 | } |
73 | void OSQLBackEnd::setPreference( int pref ) { | 74 | void OSQLBackEnd::setPreference( int pref ) { |
74 | m_pref = pref; | 75 | m_pref = pref; |
75 | } | 76 | } |
77 | |||
78 | |||
79 | } | ||
80 | } \ No newline at end of file | ||
diff --git a/libopie2/opiedb/osqlmanager.cpp b/libopie2/opiedb/osqlmanager.cpp index a6498df..f093766 100644 --- a/libopie2/opiedb/osqlmanager.cpp +++ b/libopie2/opiedb/osqlmanager.cpp | |||
@@ -1,83 +1,88 @@ | |||
1 | 1 | ||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include "osqlmanager.h" | 4 | #include "osqlmanager.h" |
5 | #include "osqlbackendmanager.h" | 5 | #include "osqlbackendmanager.h" |
6 | #include "osqlitedriver.h" | 6 | #include "osqlitedriver.h" |
7 | 7 | ||
8 | using namespace Opie::DB; | 8 | namespace Opie { |
9 | namespace DB { | ||
9 | 10 | ||
10 | OSQLManager::OSQLManager() { | 11 | OSQLManager::OSQLManager() { |
11 | } | 12 | } |
12 | OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { | 13 | OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { |
13 | m_list.clear(); | 14 | m_list.clear(); |
14 | QString opie = QString::fromLatin1( getenv("OPIEDIR") ); | 15 | QString opie = QString::fromLatin1( getenv("OPIEDIR") ); |
15 | QString qpe = QString::fromLatin1( getenv("QPEDIR") ); | 16 | QString qpe = QString::fromLatin1( getenv("QPEDIR") ); |
16 | 17 | ||
17 | if ( !m_path.contains(opie) && !opie.isEmpty() ) | 18 | if ( !m_path.contains(opie) && !opie.isEmpty() ) |
18 | m_path << opie; | 19 | m_path << opie; |
19 | if ( !m_path.contains(qpe) && !qpe.isEmpty() ) | 20 | if ( !m_path.contains(qpe) && !qpe.isEmpty() ) |
20 | m_path << qpe; | 21 | m_path << qpe; |
21 | 22 | ||
22 | OSQLBackEndManager mng( m_path ); | 23 | OSQLBackEndManager mng( m_path ); |
23 | m_list = mng.scan(); | 24 | m_list = mng.scan(); |
24 | m_list += builtIn(); | 25 | m_list += builtIn(); |
25 | 26 | ||
26 | return m_list; | 27 | return m_list; |
27 | } | 28 | } |
28 | /* | 29 | /* |
29 | * loading dso's is currently not enabled due problems with QLibrary | 30 | * loading dso's is currently not enabled due problems with QLibrary |
30 | * beeing in libqpe and not libqte | 31 | * beeing in libqpe and not libqte |
31 | */ | 32 | */ |
32 | OSQLDriver* OSQLManager::load( const QString& name ) { | 33 | OSQLDriver* OSQLManager::load( const QString& name ) { |
33 | OSQLDriver* driver = 0l; | 34 | OSQLDriver* driver = 0l; |
34 | 35 | ||
35 | if ( name == "SQLite" ) { | 36 | if ( name == "SQLite" ) { |
36 | driver = new Opie::DB::Internal::OSQLiteDriver; | 37 | driver = new Opie::DB::Internal::OSQLiteDriver; |
37 | } | 38 | } |
38 | return driver; | 39 | return driver; |
39 | } | 40 | } |
40 | /* | 41 | /* |
41 | * same as above | 42 | * same as above |
42 | */ | 43 | */ |
43 | OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { | 44 | OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { |
44 | OSQLDriver *driver = 0l; | 45 | OSQLDriver *driver = 0l; |
45 | if ( end.library() == "builtin" && | 46 | if ( end.library() == "builtin" && |
46 | end.name() == "SQLite" ) | 47 | end.name() == "SQLite" ) |
47 | driver = new Opie::DB::Internal::OSQLiteDriver; | 48 | driver = new Opie::DB::Internal::OSQLiteDriver; |
48 | 49 | ||
49 | return driver; | 50 | return driver; |
50 | } | 51 | } |
51 | /* | 52 | /* |
52 | * let's find the a default with the highes preference | 53 | * let's find the a default with the highes preference |
53 | */ | 54 | */ |
54 | OSQLDriver* OSQLManager::standard() { | 55 | OSQLDriver* OSQLManager::standard() { |
55 | OSQLDriver* driver =0l; | 56 | OSQLDriver* driver =0l; |
56 | if ( m_list.isEmpty() ) queryBackEnd(); | 57 | if ( m_list.isEmpty() ) queryBackEnd(); |
57 | OSQLBackEnd::ValueList::Iterator it; | 58 | OSQLBackEnd::ValueList::Iterator it; |
58 | OSQLBackEnd back; | 59 | OSQLBackEnd back; |
59 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 60 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
60 | if ( (*it).isDefault() && | 61 | if ( (*it).isDefault() && |
61 | back.preference() < (*it).preference() ) { | 62 | back.preference() < (*it).preference() ) { |
62 | back = (*it); | 63 | back = (*it); |
63 | } | 64 | } |
64 | } | 65 | } |
65 | driver = load( back ); | 66 | driver = load( back ); |
66 | return driver; | 67 | return driver; |
67 | } | 68 | } |
68 | void OSQLManager::registerPath( const QString& path ) { | 69 | void OSQLManager::registerPath( const QString& path ) { |
69 | m_path << path; | 70 | m_path << path; |
70 | } | 71 | } |
71 | bool OSQLManager::unregisterPath( const QString& path ) { | 72 | bool OSQLManager::unregisterPath( const QString& path ) { |
72 | m_path.remove( path ); | 73 | m_path.remove( path ); |
73 | return true; | 74 | return true; |
74 | } | 75 | } |
75 | OSQLBackEnd::ValueList OSQLManager::builtIn()const { | 76 | OSQLBackEnd::ValueList OSQLManager::builtIn()const { |
76 | OSQLBackEnd::ValueList list; | 77 | OSQLBackEnd::ValueList list; |
77 | // create the OSQLiteBackend | 78 | // create the OSQLiteBackend |
78 | OSQLBackEnd back("SQLite","Opie e.V.","GPL", "builtin" ); | 79 | OSQLBackEnd back("SQLite","Opie e.V.","GPL", "builtin" ); |
79 | back.setDefault( true ); | 80 | back.setDefault( true ); |
80 | back.setPreference( 50 ); | 81 | back.setPreference( 50 ); |
81 | list.append( back ); | 82 | list.append( back ); |
82 | return list; | 83 | return list; |
83 | } | 84 | } |
85 | |||
86 | |||
87 | } | ||
88 | } | ||