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
a74f430a
Kaydet (Commit)
a74f430a
authored
Haz 03, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tweak the odk example to be equivalent to the standard template
üst
d6fb1ee8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
service1_impl.cxx
...DevelopersGuide/Components/CppComponent/service1_impl.cxx
+25
-14
No files found.
odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
Dosyayı görüntüle @
a74f430a
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <osl/interlck.h>
#include <osl/interlck.h>
#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <rtl/uuid.h>
#include <rtl/uuid.h>
#include <rtl/instance.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
...
@@ -172,24 +173,34 @@ Sequence< Type > MyService1Impl::getTypes()
...
@@ -172,24 +173,34 @@ Sequence< Type > MyService1Impl::getTypes()
seq
[
2
]
=
::
cppu
::
UnoType
<
Reference
<
::
my_module
::
XSomething
>
>::
get
();
seq
[
2
]
=
::
cppu
::
UnoType
<
Reference
<
::
my_module
::
XSomething
>
>::
get
();
return
seq
;
return
seq
;
}
}
Sequence
<
sal_Int8
>
MyService1Impl
::
getImplementationId
()
namespace
throw
(
RuntimeException
)
{
{
static
Sequence
<
sal_Int8
>
*
s_pId
=
0
;
// class to create an unique id
if
(
!
s_pId
)
class
UniqueIdInit
{
{
// create unique id
private
:
Sequence
<
sal_Int8
>
id
(
16
);
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
m_aSeq
;
::
rtl_createUuid
(
(
sal_uInt8
*
)
id
.
getArray
(),
0
,
sal_True
);
public
:
// guard initialization with some mutex
UniqueIdInitIdInit
()
:
m_aSeq
(
16
)
::
osl
::
MutexGuard
guard
(
::
osl
::
Mutex
::
getGlobalMutex
()
);
if
(
!
s_pId
)
{
{
static
Sequence
<
sal_Int8
>
s_id
(
id
);
rtl_createUuid
(
(
sal_uInt8
*
)
m_aSeq
.
getArray
(),
0
,
sal_True
);
s_pId
=
&
s_id
;
}
}
}
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>&
getSeq
()
const
{
return
m_aSeq
;
}
return
*
s_pId
;
};
//A multi-thread safe UniqueIdInitIdInit singleton wrapper
class
theService1ImplImplementationId
:
public
rtl
::
Static
<
UniqueIdInitIdInit
,
theService1ImplImplementationId
>
{
};
}
Sequence
<
sal_Int8
>
MyService1Impl
::
getImplementationId
()
throw
(
RuntimeException
)
{
//create a singleton that generates a unique id on
//first initialization and returns the same one
//on subsequent calls.
return
theService1ImplImplementationId
::
get
().
getSeq
();
}
}
// XSomething implementation
// XSomething implementation
...
...
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