LibreOffice Module sw (master)  1
xmlitmpr.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <rtl/ustring.hxx>
21 #include "xmlitmap.hxx"
22 
23 using ::xmloff::token::IsXMLToken;
24 using ::xmloff::token::XML_TOKEN_INVALID;
25 
26 // TODO: optimize this!
28 {
29 public:
31  sal_uInt16 mnCount;
32 };
33 
35  : mpImpl( new SvXMLItemMapEntries_impl )
36 {
37  mpImpl->mpEntries = pEntries;
38 
39  mpImpl->mnCount = 0;
40  while( pEntries->eLocalName != XML_TOKEN_INVALID )
41  {
42  pEntries++;
43  mpImpl->mnCount++;
44  }
45 }
46 
48 {
49 }
50 
51 SvXMLItemMapEntry const * SvXMLItemMapEntries::getByName( sal_uInt16 nNameSpace,
52  const OUString& rString ) const
53 {
54  SvXMLItemMapEntry const * pMap = mpImpl->mpEntries;
55  while( pMap && (pMap->eLocalName != XML_TOKEN_INVALID) )
56  {
57  if( pMap->nNameSpace == nNameSpace &&
58  IsXMLToken( rString, pMap->eLocalName ) )
59  break;
60  pMap++;
61  }
62 
63  return (pMap && (pMap->eLocalName != XML_TOKEN_INVALID)) ? pMap : nullptr;
64 }
65 
66 SvXMLItemMapEntry const & SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const
67 {
68  return mpImpl->mpEntries[nIndex];
69 }
70 
72 {
73  return mpImpl->mnCount;
74 }
75 
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
sal_uInt16 getCount() const
Definition: xmlitmpr.cxx:71
SvXMLItemMapEntry const * getByName(sal_uInt16 nNameSpace, const OUString &rString) const
Definition: xmlitmpr.cxx:51
SvXMLItemMapEntry const & getByIndex(sal_uInt16 nIndex) const
Definition: xmlitmpr.cxx:66
enum::xmloff::token::XMLTokenEnum const eLocalName
Definition: xmlitmap.hxx:45
XML_TOKEN_INVALID
virtual ~SvXMLItemMapEntries() override
Definition: xmlitmpr.cxx:47
std::unique_ptr< SvXMLItemMapEntries_impl > mpImpl
Definition: xmlitmap.hxx:67
SvXMLItemMapEntries(SvXMLItemMapEntry const *pEntrys)
Definition: xmlitmpr.cxx:34
sal_uInt16 const nNameSpace
Definition: xmlitmap.hxx:41
SvXMLItemMapEntry const * mpEntries
Definition: xmlitmpr.cxx:30