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
14bc5fc0
Kaydet (Commit)
14bc5fc0
authored
Eyl 16, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
WIP: additional unoidl::Provider that directly reads a single .idl file
Change-Id: Iab795a34a657cb36ced24a1a05f6c21a6c1637aa
üst
6292bba6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
191 additions
and
0 deletions
+191
-0
Library_unoidl.mk
unoidl/Library_unoidl.mk
+1
-0
sourcefileprovider.cxx
unoidl/source/sourcefileprovider.cxx
+142
-0
sourcefileprovider.hxx
unoidl/source/sourcefileprovider.hxx
+44
-0
unoidl.cxx
unoidl/source/unoidl.cxx
+4
-0
No files found.
unoidl/Library_unoidl.mk
Dosyayı görüntüle @
14bc5fc0
...
...
@@ -13,6 +13,7 @@ $(eval $(call gb_Library_add_defs,unoidl,-DLO_DLLIMPLEMENTATION_UNOIDL))
$(eval $(call gb_Library_add_exception_objects,unoidl, \
unoidl/source/legacyprovider \
unoidl/source/sourcefileprovider \
unoidl/source/sourcetreeprovider \
unoidl/source/unoidl \
unoidl/source/unoidlprovider \
...
...
unoidl/source/sourcefileprovider.cxx
0 → 100644
Dosyayı görüntüle @
14bc5fc0
/* -*- 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/.
*/
#include "sal/config.h"
#include <map>
#include <utility>
#include <vector>
#include "sourcefileprovider.hxx"
#include "sourceprovider-scanner.hxx"
namespace
unoidl
{
namespace
detail
{
namespace
{
class
Cursor
:
public
MapCursor
{
public
:
explicit
Cursor
(
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
const
&
map
)
:
map_
(
map
),
iterator_
(
map_
.
begin
())
{}
private
:
virtual
~
Cursor
()
throw
()
{}
virtual
rtl
::
Reference
<
Entity
>
getNext
(
OUString
*
name
);
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
const
&
map_
;
//TODO: extent
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>::
const_iterator
iterator_
;
};
rtl
::
Reference
<
Entity
>
Cursor
::
getNext
(
OUString
*
name
)
{
assert
(
name
!=
0
);
rtl
::
Reference
<
Entity
>
ent
;
if
(
iterator_
!=
map_
.
end
())
{
*
name
=
iterator_
->
first
;
ent
=
iterator_
->
second
;
++
iterator_
;
}
return
ent
;
}
class
Module
:
public
ModuleEntity
{
public
:
Module
()
{}
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
map
;
private
:
virtual
~
Module
()
throw
()
{}
virtual
std
::
vector
<
rtl
::
OUString
>
getMemberNames
()
const
;
virtual
rtl
::
Reference
<
MapCursor
>
createCursor
()
const
{
return
new
Cursor
(
map
);
}
};
std
::
vector
<
rtl
::
OUString
>
Module
::
getMemberNames
()
const
{
std
::
vector
<
rtl
::
OUString
>
names
;
for
(
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>::
const_iterator
i
(
map
.
begin
());
i
!=
map
.
end
();
++
i
)
{
names
.
push_back
(
i
->
first
);
}
return
names
;
}
}
SourceFileProvider
::
SourceFileProvider
(
rtl
::
Reference
<
Manager
>
const
&
manager
,
OUString
const
&
uri
)
{
SourceProviderScannerData
data
(
manager
);
if
(
!
parse
(
uri
,
&
data
))
{
throw
NoSuchFileException
(
uri
);
}
for
(
std
::
map
<
OUString
,
SourceProviderEntity
>::
iterator
i
(
data
.
entities
.
begin
());
i
!=
data
.
entities
.
end
();
++
i
)
{
if
(
i
->
second
.
kind
==
SourceProviderEntity
::
KIND_LOCAL
)
{
assert
(
i
->
second
.
entity
.
is
());
assert
(
i
->
second
.
entity
->
getSort
()
!=
Entity
::
SORT_MODULE
);
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
*
map
=
&
rootMap_
;
for
(
sal_Int32
j
=
0
;;)
{
OUString
id
(
i
->
first
.
getToken
(
0
,
'.'
,
j
));
if
(
j
==
-
1
)
{
map
->
insert
(
std
::
make_pair
(
id
,
i
->
second
.
entity
));
break
;
}
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>::
const_iterator
k
(
map
->
find
(
id
));
if
(
k
==
map
->
end
())
{
k
=
map
->
insert
(
std
::
make_pair
(
id
,
new
Module
)).
first
;
}
Module
*
mod
=
dynamic_cast
<
Module
*
>
(
k
->
second
.
get
());
assert
(
mod
!=
0
);
map
=
&
mod
->
map
;
}
}
}
}
rtl
::
Reference
<
MapCursor
>
SourceFileProvider
::
createRootCursor
()
const
{
return
new
Cursor
(
rootMap_
);
}
rtl
::
Reference
<
Entity
>
SourceFileProvider
::
findEntity
(
OUString
const
&
name
)
const
{
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
const
*
map
=
&
rootMap_
;
for
(
sal_Int32
i
=
0
;;)
{
OUString
id
(
name
.
getToken
(
0
,
'.'
,
i
));
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>::
const_iterator
j
(
map
->
find
(
id
));
if
(
j
==
map
->
end
())
{
return
rtl
::
Reference
<
Entity
>
();
}
if
(
i
==
-
1
)
{
return
j
->
second
;
}
if
(
j
->
second
->
getSort
()
!=
Entity
::
SORT_MODULE
)
{
return
rtl
::
Reference
<
Entity
>
();
}
Module
*
mod
=
dynamic_cast
<
Module
*
>
(
j
->
second
.
get
());
assert
(
mod
!=
0
);
map
=
&
mod
->
map
;
}
}
SourceFileProvider
::~
SourceFileProvider
()
throw
()
{}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
unoidl/source/sourcefileprovider.hxx
0 → 100644
Dosyayı görüntüle @
14bc5fc0
/* -*- 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/.
*/
#ifndef INCLUDED_UNOIDL_SOURCEFILEPROVIDER_HXX
#define INCLUDED_UNOIDL_SOURCEFILEPROVIDER_HXX
#include "sal/config.h"
#include <map>
#include "rtl/ref.hxx"
#include "unoidl/unoidl.hxx"
namespace
unoidl
{
namespace
detail
{
class
SourceFileProvider
:
public
Provider
{
public
:
// throws FileFormatException, NoSuchFileException:
SourceFileProvider
(
rtl
::
Reference
<
Manager
>
const
&
manager
,
OUString
const
&
uri
);
// throws FileFormatException:
virtual
rtl
::
Reference
<
MapCursor
>
createRootCursor
()
const
;
// throws FileFormatException:
virtual
rtl
::
Reference
<
Entity
>
findEntity
(
OUString
const
&
name
)
const
;
private
:
virtual
~
SourceFileProvider
()
throw
();
std
::
map
<
OUString
,
rtl
::
Reference
<
Entity
>
>
rootMap_
;
};
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
unoidl/source/unoidl.cxx
Dosyayı görüntüle @
14bc5fc0
...
...
@@ -20,6 +20,7 @@
#include "unoidl/unoidl.hxx"
#include "legacyprovider.hxx"
#include "sourcefileprovider.hxx"
#include "sourcetreeprovider.hxx"
#include "unoidlprovider.hxx"
...
...
@@ -117,6 +118,9 @@ rtl::Reference< Provider > loadProvider(
return
new
detail
::
SourceTreeProvider
(
manager
,
uri
);
}
}
if
(
uri
.
endsWith
(
".idl"
))
{
return
new
detail
::
SourceFileProvider
(
manager
,
uri
);
}
try
{
return
new
detail
::
UnoidlProvider
(
uri
);
}
catch
(
FileFormatException
&
e
)
{
...
...
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