Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1ded035f
Kaydet (Commit)
1ded035f
authored
Kas 21, 2015
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tdf#74608 dbaccess: Constructor for singleton DataAccessDescriptorFactory
Change-Id: Id1453e3cf1c8aef22536b4e0797cca7e654316c0
üst
8227e8be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
106 deletions
+31
-106
dataaccessdescriptor.cxx
dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+28
-50
services.hxx
dbaccess/source/core/inc/services.hxx
+0
-31
services.cxx
dbaccess/source/core/misc/services.cxx
+1
-24
dba.component
dbaccess/util/dba.component
+2
-1
No files found.
dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
Dosyayı görüntüle @
1ded035f
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
*/
*/
#include "dbastrings.hrc"
#include "dbastrings.hrc"
#include "module_dba.hxx"
#include "services.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
...
@@ -28,6 +26,7 @@
...
@@ -28,6 +26,7 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdb/XDataAccessDescriptorFactory.hpp>
#include <com/sun/star/sdb/XDataAccessDescriptorFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/proparrhlp.hxx>
#include <comphelper/proparrhlp.hxx>
...
@@ -36,28 +35,20 @@
...
@@ -36,28 +35,20 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/supportsservice.hxx>
namespace
dbaccess
namespace
{
{
using
::
com
::
sun
::
star
::
uno
::
Reference
;
using
::
com
::
sun
::
star
::
uno
::
Reference
;
using
::
com
::
sun
::
star
::
uno
::
XInterface
;
using
::
com
::
sun
::
star
::
uno
::
UNO_QUERY
;
using
::
com
::
sun
::
star
::
uno
::
UNO_QUERY_THROW
;
using
::
com
::
sun
::
star
::
uno
::
UNO_SET_THROW
;
using
::
com
::
sun
::
star
::
uno
::
Exception
;
using
::
com
::
sun
::
star
::
uno
::
RuntimeException
;
using
::
com
::
sun
::
star
::
uno
::
RuntimeException
;
using
::
com
::
sun
::
star
::
uno
::
Any
;
using
::
com
::
sun
::
star
::
uno
::
Any
;
using
::
com
::
sun
::
star
::
uno
::
makeAny
;
using
::
com
::
sun
::
star
::
uno
::
Sequence
;
using
::
com
::
sun
::
star
::
uno
::
Sequence
;
using
::
com
::
sun
::
star
::
uno
::
XComponentContext
;
using
::
com
::
sun
::
star
::
lang
::
XServiceInfo
;
using
::
com
::
sun
::
star
::
lang
::
XServiceInfo
;
using
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
;
using
::
com
::
sun
::
star
::
beans
::
XPropertySetInfo
;
using
::
com
::
sun
::
star
::
beans
::
XPropertySetInfo
;
using
::
com
::
sun
::
star
::
beans
::
Property
;
using
::
com
::
sun
::
star
::
beans
::
Property
;
using
::
com
::
sun
::
star
::
sdbc
::
XConnection
;
using
::
com
::
sun
::
star
::
sdbc
::
XConnection
;
using
::
com
::
sun
::
star
::
sdbc
::
XResultSet
;
using
::
com
::
sun
::
star
::
sdbc
::
XResultSet
;
using
::
com
::
sun
::
star
::
sdb
::
XDataAccessDescriptorFactory
;
using
::
com
::
sun
::
star
::
beans
::
XPropertySet
;
using
::
com
::
sun
::
star
::
beans
::
XPropertySet
;
using
::
com
::
sun
::
star
::
uno
::
XComponentContext
;
using
::
com
::
sun
::
star
::
beans
::
PropertyValue
;
using
::
com
::
sun
::
star
::
beans
::
PropertyValue
;
namespace
PropertyAttribute
=
::
com
::
sun
::
star
::
beans
::
PropertyAttribute
;
namespace
PropertyAttribute
=
::
com
::
sun
::
star
::
beans
::
PropertyAttribute
;
...
@@ -211,10 +202,7 @@ namespace dbaccess
...
@@ -211,10 +202,7 @@ namespace dbaccess
}
}
// DataAccessDescriptorFactory
// DataAccessDescriptorFactory
typedef
::
cppu
::
WeakImplHelper
<
XServiceInfo
class
DataAccessDescriptorFactory
:
public
::
cppu
::
WeakImplHelper
<
XServiceInfo
,
css
::
sdb
::
XDataAccessDescriptorFactory
>
,
XDataAccessDescriptorFactory
>
DataAccessDescriptorFactory_Base
;
class
DataAccessDescriptorFactory
:
public
DataAccessDescriptorFactory_Base
{
{
public
:
public
:
// XServiceInfo
// XServiceInfo
...
@@ -222,16 +210,9 @@ namespace dbaccess
...
@@ -222,16 +210,9 @@ namespace dbaccess
virtual
sal_Bool
SAL_CALL
supportsService
(
const
OUString
&
ServiceName
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
virtual
sal_Bool
SAL_CALL
supportsService
(
const
OUString
&
ServiceName
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
virtual
Sequence
<
OUString
>
SAL_CALL
getSupportedServiceNames
(
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
virtual
Sequence
<
OUString
>
SAL_CALL
getSupportedServiceNames
(
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
// XServiceInfo - static versions
static
Sequence
<
OUString
>
getSupportedServiceNames_static
()
throw
(
RuntimeException
);
static
OUString
getImplementationName_static
()
throw
(
RuntimeException
);
static
Reference
<
XInterface
>
Create
(
const
Reference
<
XComponentContext
>&
_rxContext
);
static
OUString
getSingletonName_static
();
// XDataAccessDescriptorFactory
// XDataAccessDescriptorFactory
virtual
Reference
<
XPropertySet
>
SAL_CALL
createDataAccessDescriptor
(
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
virtual
Reference
<
XPropertySet
>
SAL_CALL
createDataAccessDescriptor
(
)
throw
(
RuntimeException
,
std
::
exception
)
override
;
protected
:
explicit
DataAccessDescriptorFactory
(
const
Reference
<
XComponentContext
>&
_rxContext
);
explicit
DataAccessDescriptorFactory
(
const
Reference
<
XComponentContext
>&
_rxContext
);
virtual
~
DataAccessDescriptorFactory
();
virtual
~
DataAccessDescriptorFactory
();
...
@@ -248,30 +229,9 @@ namespace dbaccess
...
@@ -248,30 +229,9 @@ namespace dbaccess
{
{
}
}
OUString
DataAccessDescriptorFactory
::
getSingletonName_static
()
{
return
OUString
(
"com.sun.star.sdb.DataAccessDescriptorFactory"
);
}
Sequence
<
OUString
>
DataAccessDescriptorFactory
::
getSupportedServiceNames_static
()
throw
(
RuntimeException
)
{
Sequence
<
OUString
>
aServices
{
getSingletonName_static
()
};
return
aServices
;
}
OUString
DataAccessDescriptorFactory
::
getImplementationName_static
()
throw
(
RuntimeException
)
{
return
OUString
(
"com.sun.star.comp.dba.DataAccessDescriptorFactory"
);
}
Reference
<
XInterface
>
DataAccessDescriptorFactory
::
Create
(
const
Reference
<
XComponentContext
>&
_rxContext
)
{
return
*
(
new
DataAccessDescriptorFactory
(
_rxContext
)
);
}
OUString
SAL_CALL
DataAccessDescriptorFactory
::
getImplementationName
()
throw
(
RuntimeException
,
std
::
exception
)
OUString
SAL_CALL
DataAccessDescriptorFactory
::
getImplementationName
()
throw
(
RuntimeException
,
std
::
exception
)
{
{
return
getImplementationName_static
(
);
return
OUString
(
"com.sun.star.comp.dba.DataAccessDescriptorFactory"
);
}
}
sal_Bool
SAL_CALL
DataAccessDescriptorFactory
::
supportsService
(
const
OUString
&
rServiceName
)
throw
(
RuntimeException
,
std
::
exception
)
sal_Bool
SAL_CALL
DataAccessDescriptorFactory
::
supportsService
(
const
OUString
&
rServiceName
)
throw
(
RuntimeException
,
std
::
exception
)
...
@@ -279,9 +239,10 @@ namespace dbaccess
...
@@ -279,9 +239,10 @@ namespace dbaccess
return
cppu
::
supportsService
(
this
,
rServiceName
);
return
cppu
::
supportsService
(
this
,
rServiceName
);
}
}
Sequence
<
OUString
>
SAL_CALL
DataAccessDescriptorFactory
::
getSupportedServiceNames
(
)
throw
(
RuntimeException
,
std
::
exception
)
Sequence
<
OUString
>
SAL_CALL
DataAccessDescriptorFactory
::
getSupportedServiceNames
()
throw
(
RuntimeException
,
std
::
exception
)
{
{
return
getSupportedServiceNames_static
();
Sequence
<
OUString
>
aServices
{
"com.sun.star.sdb.DataAccessDescriptorFactory"
};
return
aServices
;
}
}
Reference
<
XPropertySet
>
SAL_CALL
DataAccessDescriptorFactory
::
createDataAccessDescriptor
(
)
throw
(
RuntimeException
,
std
::
exception
)
Reference
<
XPropertySet
>
SAL_CALL
DataAccessDescriptorFactory
::
createDataAccessDescriptor
(
)
throw
(
RuntimeException
,
std
::
exception
)
...
@@ -289,11 +250,28 @@ namespace dbaccess
...
@@ -289,11 +250,28 @@ namespace dbaccess
return
new
DataAccessDescriptor
(
m_xContext
);
return
new
DataAccessDescriptor
(
m_xContext
);
}
}
}
// namespace dbaccess
struct
Instance
{
explicit
Instance
(
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
const
&
context
)
:
instance
(
new
DataAccessDescriptorFactory
(
context
))
{}
css
::
uno
::
Reference
<
cppu
::
OWeakObject
>
instance
;
};
struct
Singleton
:
public
rtl
::
StaticWithArg
<
Instance
,
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
,
Singleton
>
{};
}
extern
"C"
void
SAL_CALL
createRegistryInfo_DataAccessDescriptorFactory
()
extern
"C"
SAL_DLLPUBLIC_EXPORT
css
::
uno
::
XInterface
*
SAL_CALL
com_sun_star_comp_dba_DataAccessDescriptorFactory
(
css
::
uno
::
XComponentContext
*
context
,
css
::
uno
::
Sequence
<
css
::
uno
::
Any
>
const
&
)
{
{
static
::
dba
::
OSingletonRegistration
<
::
dbaccess
::
DataAccessDescriptorFactory
>
aAutoRegistration
;
return
cppu
::
acquire
(
Singleton
::
get
(
context
).
instance
.
get
())
;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
dbaccess/source/core/inc/services.hxx
deleted
100644 → 0
Dosyayı görüntüle @
8227e8be
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_SERVICES_HXX
#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SERVICES_HXX
#include <sal/config.h>
#include <sal/types.h>
extern
"C"
void
SAL_CALL
createRegistryInfo_DataAccessDescriptorFactory
();
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
dbaccess/source/core/misc/services.cxx
Dosyayı görüntüle @
1ded035f
...
@@ -19,13 +19,11 @@
...
@@ -19,13 +19,11 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implementationentry.hxx>
#include "module_dba.hxx"
#include <osl/diagnose.h>
#include <osl/diagnose.h>
#include "DatabaseDataProvider.hxx"
#include "DatabaseDataProvider.hxx"
#include "dbadllapi.hxx"
#include "dbadllapi.hxx"
#include <../dataaccess/databasecontext.hxx>
#include <../dataaccess/databasecontext.hxx>
#include <services.hxx>
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
lang
;
...
@@ -51,34 +49,13 @@ namespace dba{
...
@@ -51,34 +49,13 @@ namespace dba{
};
};
}
}
// The prescribed C api must be complied with
// It consists of three functions which must be exported by the module.
extern
"C"
void
SAL_CALL
createRegistryInfo_DBA
()
{
static
bool
bInit
=
false
;
if
(
!
bInit
)
{
createRegistryInfo_DataAccessDescriptorFactory
();
bInit
=
true
;
}
}
extern
"C"
SAL_DLLPUBLIC_EXPORT
void
*
SAL_CALL
dba_component_getFactory
(
extern
"C"
SAL_DLLPUBLIC_EXPORT
void
*
SAL_CALL
dba_component_getFactory
(
const
sal_Char
*
pImplementationName
,
const
sal_Char
*
pImplementationName
,
void
*
pServiceManager
,
void
*
pServiceManager
,
void
*
pRegistryKey
)
void
*
pRegistryKey
)
{
{
createRegistryInfo_DBA
();
return
cppu
::
component_getFactoryHelper
(
Reference
<
XInterface
>
xRet
(
::
dba
::
DbaModule
::
getInstance
().
getComponentFactory
(
OUString
::
createFromAscii
(
pImplementationName
)));
if
(
xRet
.
is
())
xRet
->
acquire
();
else
return
cppu
::
component_getFactoryHelper
(
pImplementationName
,
pServiceManager
,
pRegistryKey
,
dba
::
entries
);
pImplementationName
,
pServiceManager
,
pRegistryKey
,
dba
::
entries
);
return
xRet
.
get
();
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
dbaccess/util/dba.component
Dosyayı görüntüle @
1ded035f
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
<implementation
name=
"com.sun.star.comp.dbaccess.DatabaseDataProvider"
>
<implementation
name=
"com.sun.star.comp.dbaccess.DatabaseDataProvider"
>
<service
name=
"com.sun.star.chart2.data.DatabaseDataProvider"
/>
<service
name=
"com.sun.star.chart2.data.DatabaseDataProvider"
/>
</implementation>
</implementation>
<implementation
name=
"com.sun.star.comp.dba.DataAccessDescriptorFactory"
>
<implementation
name=
"com.sun.star.comp.dba.DataAccessDescriptorFactory"
constructor=
"com_sun_star_comp_dba_DataAccessDescriptorFactory"
>
<singleton
name=
"com.sun.star.sdb.DataAccessDescriptorFactory"
/>
<singleton
name=
"com.sun.star.sdb.DataAccessDescriptorFactory"
/>
</implementation>
</implementation>
<implementation
name=
"com.sun.star.comp.dba.OCommandDefinition"
<implementation
name=
"com.sun.star.comp.dba.OCommandDefinition"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment