clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lwptoc.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /home/maarten/src/libreoffice/core/lotuswordpro/inc -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/lotuswordpro/source/filter/lwptoc.cxx
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | #include "lwptoc.hxx" |
62 | #include <lwpfoundry.hxx> |
63 | #include "lwpdoc.hxx" |
64 | #include "lwpframelayout.hxx" |
65 | #include <lwpglobalmgr.hxx> |
66 | |
67 | #include <xfilter/xftextstyle.hxx> |
68 | #include <xfilter/xfstylemanager.hxx> |
69 | #include <xfilter/xfparastyle.hxx> |
70 | #include <xfilter/xfindex.hxx> |
71 | #include <xfilter/xffloatframe.hxx> |
72 | #include <xfilter/xfframe.hxx> |
73 | |
74 | LwpTocSuperLayout::LwpTocSuperLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) |
75 | : LwpSuperTableLayout(objHdr, pStrm) |
76 | , m_nFrom(0) |
77 | , m_pCont(nullptr) |
78 | { |
79 | } |
80 | |
81 | LwpTocSuperLayout::~LwpTocSuperLayout() |
82 | { |
83 | } |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | void LwpTocSuperLayout::Read() |
90 | { |
91 | LwpSuperTableLayout::Read(); |
92 | m_TextMarker.Read(m_pObjStrm.get()); |
93 | m_ParentName.Read(m_pObjStrm.get()); |
94 | m_DivisionName.Read(m_pObjStrm.get()); |
95 | m_SectionName.Read(m_pObjStrm.get()); |
96 | m_nFrom = m_pObjStrm->QuickReaduInt16(); |
97 | |
98 | m_SearchItems.Read(m_pObjStrm.get()); |
99 | |
100 | sal_uInt16 count = m_pObjStrm->QuickReaduInt16(); |
101 | if (count > MAX_LEVELS) |
102 | throw std::range_error("corrupt LwpTocSuperLayout"); |
103 | for (sal_uInt16 i = 0; i < count; ++i) |
104 | m_DestName[i].Read(m_pObjStrm.get()); |
105 | |
106 | count = m_pObjStrm->QuickReaduInt16(); |
107 | if (count > MAX_LEVELS) |
108 | throw std::range_error("corrupt LwpTocSuperLayout"); |
109 | for (sal_uInt16 i = 0; i < count; ++i) |
110 | m_DestPGName[i].Read(m_pObjStrm.get()); |
111 | |
112 | count = m_pObjStrm->QuickReaduInt16(); |
113 | if (count > MAX_LEVELS) |
114 | throw std::range_error("corrupt LwpTocSuperLayout"); |
115 | for (sal_uInt16 i = 0; i < count; ++i) |
116 | m_nFlags[i] = m_pObjStrm->QuickReaduInt32(); |
117 | |
118 | m_pObjStrm->SkipExtra(); |
119 | } |
120 | |
121 | |
122 | |
123 | |
124 | void LwpTocSuperLayout::RegisterStyle() |
125 | { |
126 | LwpSuperTableLayout::RegisterStyle(); |
127 | |
128 | |
129 | const LwpObjectID *pDefaultTextStyle = m_pFoundry ? m_pFoundry->GetDefaultTextStyle() : nullptr; |
130 | XFParaStyle* pBaseStyle = pDefaultTextStyle ? dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*pDefaultTextStyle)) : nullptr; |
131 | std::unique_ptr<XFTextStyle> pTextStyle(new XFTextStyle); |
132 | if (pBaseStyle) |
133 | pTextStyle->SetFont(pBaseStyle->GetFont()); |
134 | XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); |
135 | m_TabStyleName = pXFStyleManager->AddStyle(std::move(pTextStyle)).m_pStyle->GetStyleName(); |
136 | |
137 | } |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | void LwpTocSuperLayout::XFConvert(XFContentContainer* pCont) |
144 | { |
145 | rtl::Reference<XFIndex> xToc(new XFIndex); |
146 | |
147 | xToc->SetProtected(false); |
148 | xToc->SetIndexType(enumXFIndexTOC); |
149 | |
150 | |
151 | for (sal_uInt16 i = 1; i<= MAX_LEVELS; i++) |
| 1 | Loop condition is true. Entering loop body | |
|
152 | { |
153 | LwpTocLevelData * pLevel = GetSearchLevelPtr(i); |
| 2 | | Calling 'LwpTocSuperLayout::GetSearchLevelPtr' | |
|
| 11 | | Returning from 'LwpTocSuperLayout::GetSearchLevelPtr' | |
|
154 | XFIndexTemplate * pTemplate = new XFIndexTemplate(); |
155 | |
156 | if(!pLevel) |
| |
157 | { |
158 | |
159 | xToc->AddTemplate(OUString::number(i), OUString(), pTemplate); |
160 | continue; |
161 | } |
162 | |
163 | bool bInserted = false; |
164 | do |
165 | { |
166 | |
167 | if (!bInserted) |
| |
168 | { |
169 | pTemplate->SetLevel(OUString::number(i)); |
170 | if(pLevel->GetUseLeadingText()) |
| |
171 | { |
172 | pTemplate->AddEntry(enumXFIndexTemplateChapter, pLevel->GetSearchStyle()); |
173 | } |
174 | if(pLevel->GetUseText()) |
| |
175 | { |
176 | pTemplate->AddEntry(enumXFIndexTemplateText, pLevel->GetSearchStyle()); |
177 | } |
178 | if(GetUsePageNumber(i)) |
| |
179 | { |
180 | sal_uInt16 nLeaderType = GetSeparatorType(i); |
181 | if (GetRightAlignPageNumber(i)) |
182 | { |
183 | char cSep = ' '; |
184 | switch(nLeaderType) |
185 | { |
186 | default: |
187 | case NONE: |
188 | cSep = ' '; |
189 | break; |
190 | case LEADERDOTS: |
191 | cSep = '.'; |
192 | break; |
193 | case LEADERDASHES: |
194 | cSep = '-'; |
195 | break; |
196 | case LEADERUNDERLINE: |
197 | cSep = '_'; |
198 | break; |
199 | } |
200 | |
201 | pTemplate->AddTabEntry(enumXFTabRight, 0, cSep, 'd', m_TabStyleName); |
202 | } |
203 | else |
204 | { |
205 | OUString sSep; |
206 | switch(nLeaderType) |
207 | { |
208 | default: |
209 | case NONE: |
210 | sSep = " "; |
211 | break; |
212 | case SEPARATORCOMMA: |
213 | sSep = ", "; |
214 | break; |
215 | case SEPARATORDOTS: |
216 | sSep = "..."; |
217 | break; |
218 | } |
219 | pTemplate->AddTextEntry(sSep, m_TabStyleName); |
220 | } |
221 | |
222 | pTemplate->AddEntry(enumXFIndexTemplatePage, "TOC Page Number Text Style"); |
223 | } |
224 | |
225 | xToc->AddTemplate(OUString::number(static_cast<sal_Int32>(i)), m_pFoundry->FindActuralStyleName(pLevel->GetSearchStyle()), pTemplate); |
226 | bInserted = true; |
227 | } |
228 | |
229 | |
230 | LwpDocument * pDocument = m_pFoundry->GetDocument()->GetRootDocument(); |
231 | AddSourceStyle(xToc.get(), pLevel, pDocument->GetFoundry()); |
| 17 | | Calling 'LwpTocSuperLayout::AddSourceStyle' | |
|
232 | |
233 | |
234 | pLevel = GetNextSearchLevelPtr(i, pLevel); |
235 | }while (pLevel != nullptr); |
236 | } |
237 | |
238 | m_pCont = pCont; |
239 | |
240 | LwpSuperTableLayout::XFConvert(xToc.get()); |
241 | |
242 | rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout()); |
243 | if (!xContainer.is()) |
244 | return; |
245 | |
246 | |
247 | if (!xContainer->IsCell()) |
248 | { |
249 | pCont->Add(xToc.get()); |
250 | } |
251 | } |
252 | |
253 | |
254 | |
255 | |
256 | |
257 | |
258 | void LwpTocSuperLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart, sal_Int32 nEnd, bool bAll) |
259 | { |
260 | if (!m_pFrame) |
261 | return; |
262 | |
263 | rtl::Reference<XFFrame> xXFFrame; |
264 | if(nEnd < nStart) |
265 | { |
266 | xXFFrame.set(new XFFrame); |
267 | } |
268 | else |
269 | { |
270 | xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll)); |
271 | } |
272 | |
273 | m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart)); |
274 | |
275 | |
276 | LwpTableLayout * pTableLayout = GetTableLayout(); |
277 | if (!pTableLayout) |
278 | return; |
279 | |
280 | XFContentContainer* pTableContainer = xXFFrame.get(); |
281 | |
282 | |
283 | rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout()); |
284 | if (!xContainer.is()) |
285 | return; |
286 | if (xContainer->IsCell()) |
287 | { |
288 | pTableContainer = pCont; |
289 | xXFFrame->Add(pCont); |
290 | m_pCont->Add(xXFFrame.get()); |
291 | } |
292 | else |
293 | { |
294 | |
295 | pCont->Add(xXFFrame.get()); |
296 | } |
297 | pTableLayout->XFConvert(pTableContainer); |
298 | |
299 | } |
300 | |
301 | |
302 | |
303 | |
304 | |
305 | |
306 | |
307 | |
308 | void LwpTocSuperLayout::AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel, LwpFoundry * pFoundry) |
309 | { |
310 | if (!pLevel) |
| |
311 | { |
312 | return; |
313 | } |
314 | |
315 | OUString sLwpStyleName = pLevel->GetSearchStyle(); |
316 | |
317 | if (!pFoundry) |
| 19 | | Assuming 'pFoundry' is non-null | |
|
| |
318 | return; |
319 | |
320 | LwpDocument * pDoc = pFoundry->GetDocument(); |
| 21 | | 'pDoc' initialized here | |
|
321 | if (pDoc && pDoc->IsChildDoc()) |
| 22 | | Assuming 'pDoc' is null | |
|
322 | { |
323 | OUString sSodcStyleName = pFoundry->FindActuralStyleName(sLwpStyleName); |
324 | pToc->AddTocSource(pLevel->GetLevel(), sSodcStyleName); |
325 | } |
326 | else |
327 | { |
328 | pDoc = pDoc->GetFirstDivision(); |
| 23 | | Called C++ object pointer is null |
|
329 | while (pDoc) |
330 | { |
331 | AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() ); |
332 | pDoc = pDoc->GetNextDivision(); |
333 | } |
334 | } |
335 | } |
336 | |
337 | |
338 | |
339 | |
340 | |
341 | |
342 | bool LwpTocSuperLayout::GetRightAlignPageNumber(sal_uInt16 index) |
343 | { |
344 | if (index < MAX_LEVELS) |
345 | return (m_nFlags[index] & TS_RIGHTALIGN) != 0; |
346 | return false; |
347 | } |
348 | |
349 | |
350 | |
351 | |
352 | |
353 | bool LwpTocSuperLayout::GetUsePageNumber(sal_uInt16 index) |
354 | { |
355 | if (index < MAX_LEVELS) |
356 | return (m_nFlags[index] & TS_PAGENUMBER) != 0; |
357 | return false; |
358 | } |
359 | |
360 | |
361 | |
362 | |
363 | |
364 | sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index) |
365 | { |
366 | if (index >= MAX_LEVELS) |
367 | return NONE; |
368 | |
369 | sal_uInt16 Flag = static_cast<sal_uInt16>(m_nFlags[index]); |
370 | |
371 | if (Flag & TS_LEADERDOTS) |
372 | return LEADERDOTS; |
373 | else if (Flag & TS_LEADERDASHES) |
374 | return LEADERDASHES; |
375 | else if (Flag & TS_LEADERUNDERLINE) |
376 | return LEADERUNDERLINE; |
377 | else if (Flag & TS_SEPARATORCOMMA) |
378 | return SEPARATORCOMMA; |
379 | else if (Flag & TS_SEPARATORDOTS) |
380 | return SEPARATORDOTS; |
381 | else |
382 | return NONE; |
383 | } |
384 | |
385 | |
386 | |
387 | |
388 | |
389 | |
390 | LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) |
391 | { |
392 | LwpObjectID * pID = &m_SearchItems.GetHead(); |
393 | LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); |
| |
| 6 | | Returning from '~Reference' | |
|
394 | |
395 | while(pObj) |
| 7 | | Loop condition is true. Entering loop body | |
|
396 | { |
397 | if(pObj->GetLevel()== index) |
| 8 | | Assuming the condition is true | |
|
| |
398 | { |
399 | return pObj; |
| 10 | | Returning pointer (loaded from 'pObj'), which participates in a condition later | |
|
400 | } |
401 | |
402 | pID = &pObj->GetNext(); |
403 | pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); |
404 | } |
405 | |
406 | return nullptr; |
407 | } |
408 | |
409 | |
410 | |
411 | |
412 | |
413 | |
414 | LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData) |
415 | { |
416 | LwpObjectID * pID = &pCurData->GetNext(); |
417 | LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); |
418 | |
419 | while(pObj) |
420 | { |
421 | if(pObj->GetLevel()== index) |
422 | { |
423 | return pObj; |
424 | } |
425 | |
426 | pID = &pObj->GetNext(); |
427 | pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); |
428 | } |
429 | |
430 | return nullptr; |
431 | } |
432 | |
433 | LwpTocLevelData::LwpTocLevelData(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) |
434 | : LwpDLVList(objHdr, pStrm), m_nFlags(0), m_nLevel(0) |
435 | { |
436 | } |
437 | LwpTocLevelData::~LwpTocLevelData() |
438 | { |
439 | } |
440 | |
441 | |
442 | |
443 | |
444 | |
445 | void LwpTocLevelData::RegisterStyle() |
446 | { |
447 | } |
448 | |
449 | |
450 | |
451 | |
452 | |
453 | void LwpTocLevelData::XFConvert(XFContentContainer* ) |
454 | { |
455 | } |
456 | |
457 | |
458 | |
459 | |
460 | |
461 | void LwpTocLevelData::Read() |
462 | { |
463 | LwpDLVList::Read(); |
464 | m_nFlags = m_pObjStrm->QuickReaduInt16(); |
465 | m_nLevel = m_pObjStrm->QuickReaduInt16(); |
466 | m_SearchName.Read(m_pObjStrm.get()); |
467 | |
468 | m_pObjStrm->SkipExtra(); |
469 | } |
470 | |
471 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | #ifndef INCLUDED_RTL_REF_HXX |
21 | #define INCLUDED_RTL_REF_HXX |
22 | |
23 | #include "sal/config.h" |
24 | |
25 | #include <cassert> |
26 | #include <cstddef> |
27 | #include <functional> |
28 | #ifdef LIBO_INTERNAL_ONLY |
29 | #include <type_traits> |
30 | #endif |
31 | |
32 | #include "sal/types.h" |
33 | |
34 | namespace rtl |
35 | { |
36 | |
37 | |
38 | |
39 | template <class reference_type> |
40 | class Reference |
41 | { |
42 | |
43 | |
44 | reference_type * m_pBody; |
45 | |
46 | |
47 | public: |
48 | |
49 | |
50 | Reference() |
51 | : m_pBody (NULL) |
52 | {} |
53 | |
54 | |
55 | |
56 | |
57 | Reference (reference_type * pBody, __sal_NoAcquire) |
58 | : m_pBody (pBody) |
59 | { |
60 | } |
61 | |
62 | |
63 | |
64 | Reference (reference_type * pBody) |
65 | : m_pBody (pBody) |
66 | { |
67 | if (m_pBody) |
68 | m_pBody->acquire(); |
69 | } |
70 | |
71 | |
72 | |
73 | Reference (const Reference<reference_type> & handle) |
74 | : m_pBody (handle.m_pBody) |
75 | { |
76 | if (m_pBody) |
77 | m_pBody->acquire(); |
78 | } |
79 | |
80 | #ifdef LIBO_INTERNAL_ONLY |
81 | |
82 | |
83 | Reference (Reference<reference_type> && handle) noexcept |
84 | : m_pBody (handle.m_pBody) |
85 | { |
86 | handle.m_pBody = nullptr; |
87 | } |
88 | #endif |
89 | |
90 | #if defined LIBO_INTERNAL_ONLY |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | template< class derived_type > |
98 | inline Reference( |
99 | const Reference< derived_type > & rRef, |
100 | std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 ) |
101 | : m_pBody (rRef.get()) |
102 | { |
103 | if (m_pBody) |
104 | m_pBody->acquire(); |
105 | } |
106 | #endif |
107 | |
108 | |
109 | |
110 | ~Reference() COVERITY_NOEXCEPT_FALSE |
111 | { |
112 | if (m_pBody) |
| 4 | | Assuming field 'm_pBody' is non-null | |
|
| |
113 | m_pBody->release(); |
114 | } |
115 | |
116 | |
117 | |
118 | |
119 | Reference<reference_type> & |
120 | SAL_CALL set (reference_type * pBody) |
121 | { |
122 | if (pBody) |
123 | pBody->acquire(); |
124 | reference_type * const pOld = m_pBody; |
125 | m_pBody = pBody; |
126 | if (pOld) |
127 | pOld->release(); |
128 | return *this; |
129 | } |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | Reference<reference_type> & |
136 | SAL_CALL operator= (const Reference<reference_type> & handle) |
137 | { |
138 | return set( handle.m_pBody ); |
139 | } |
140 | |
141 | #ifdef LIBO_INTERNAL_ONLY |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | Reference<reference_type> & |
148 | operator= (Reference<reference_type> && handle) |
149 | { |
150 | |
151 | if (m_pBody) |
152 | m_pBody->release(); |
153 | m_pBody = handle.m_pBody; |
154 | handle.m_pBody = nullptr; |
155 | return *this; |
156 | } |
157 | #endif |
158 | |
159 | |
160 | |
161 | Reference<reference_type> & |
162 | SAL_CALL operator= (reference_type * pBody) |
163 | { |
164 | return set( pBody ); |
165 | } |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | Reference<reference_type> & SAL_CALL clear() |
175 | { |
176 | if (m_pBody) |
177 | { |
178 | reference_type * const pOld = m_pBody; |
179 | m_pBody = NULL; |
180 | pOld->release(); |
181 | } |
182 | return *this; |
183 | } |
184 | |
185 | |
186 | |
187 | |
188 | |
189 | |
190 | reference_type * SAL_CALL get() const |
191 | { |
192 | return m_pBody; |
193 | } |
194 | |
195 | |
196 | |
197 | |
198 | reference_type * SAL_CALL operator->() const |
199 | { |
200 | assert(m_pBody != NULL); |
201 | return m_pBody; |
202 | } |
203 | |
204 | |
205 | |
206 | |
207 | reference_type & SAL_CALL operator*() const |
208 | { |
209 | assert(m_pBody != NULL); |
210 | return *m_pBody; |
211 | } |
212 | |
213 | |
214 | |
215 | |
216 | bool SAL_CALL is() const |
217 | { |
218 | return (m_pBody != NULL); |
219 | } |
220 | |
221 | #if defined LIBO_INTERNAL_ONLY |
222 | |
223 | |
224 | explicit operator bool() const |
225 | { |
226 | return is(); |
227 | } |
228 | #endif |
229 | |
230 | |
231 | |
232 | bool SAL_CALL operator== (const reference_type * pBody) const |
233 | { |
234 | return (m_pBody == pBody); |
235 | } |
236 | |
237 | |
238 | |
239 | |
240 | bool |
241 | SAL_CALL operator== (const Reference<reference_type> & handle) const |
242 | { |
243 | return (m_pBody == handle.m_pBody); |
244 | } |
245 | |
246 | |
247 | |
248 | |
249 | bool |
250 | SAL_CALL operator!= (const Reference<reference_type> & handle) const |
251 | { |
252 | return (m_pBody != handle.m_pBody); |
253 | } |
254 | |
255 | |
256 | |
257 | |
258 | bool |
259 | SAL_CALL operator< (const Reference<reference_type> & handle) const |
260 | { |
261 | return (m_pBody < handle.m_pBody); |
262 | } |
263 | |
264 | |
265 | |
266 | |
267 | bool |
268 | SAL_CALL operator> (const Reference<reference_type> & handle) const |
269 | { |
270 | return (m_pBody > handle.m_pBody); |
271 | } |
272 | }; |
273 | |
274 | } |
275 | |
276 | #if defined LIBO_INTERNAL_ONLY |
277 | namespace std |
278 | { |
279 | |
280 | |
281 | |
282 | |
283 | |
284 | |
285 | |
286 | template<typename T> |
287 | struct hash<::rtl::Reference<T>> |
288 | { |
289 | std::size_t operator()(::rtl::Reference<T> const & s) const |
290 | { return std::size_t(s.get()); } |
291 | }; |
292 | |
293 | |
294 | } |
295 | |
296 | #endif |
297 | |
298 | #endif /* ! INCLUDED_RTL_REF_HXX */ |
299 | |
300 | |