Coverage Report

Created: 2026-09-14 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libstaroffice/src/lib/StarItem.cxx
Line
Count
Source
1
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3
/* libstaroffice
4
* Version: MPL 2.0 / LGPLv2+
5
*
6
* The contents of this file are subject to the Mozilla Public License Version
7
* 2.0 (the "License"); you may not use this file except in compliance with
8
* the License or as specified alternatively below. You may obtain a copy of
9
* the License at http://www.mozilla.org/MPL/
10
*
11
* Software distributed under the License is distributed on an "AS IS" basis,
12
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
* for the specific language governing rights and limitations under the
14
* License.
15
*
16
* Major Contributor(s):
17
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20
* Copyright (C) 2006, 2007 Andrew Ziem
21
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22
*
23
*
24
* All Rights Reserved.
25
*
26
* For minor contributions see the git repository.
27
*
28
* Alternatively, the contents of this file may be used under the terms of
29
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30
* in which case the provisions of the LGPLv2+ are applicable
31
* instead of those above.
32
*/
33
34
#include <sstream>
35
36
#include <librevenge/librevenge.h>
37
38
#include "StarAttribute.hxx"
39
40
#include "StarItem.hxx"
41
42
bool StarItemSet::add(std::shared_ptr<StarItem> item)
43
10.7M
{
44
10.7M
  if (!item) return false;
45
10.7M
  if (m_whichToItemMap.find(item->m_which)!=m_whichToItemMap.end()) {
46
7.79M
    STOFF_DEBUG_MSG(("StarItemSet::add: oops, item %d already exists\n", item->m_which));
47
7.79M
  }
48
10.7M
  m_whichToItemMap[item->m_which]=item;
49
10.7M
  return true;
50
10.7M
}
51
52
std::string StarItemSet::printChild() const
53
0
{
54
0
  if (m_whichToItemMap.empty()) return "";
55
0
  libstoff::DebugStream o;
56
0
  o << "Attrib=[";
57
0
  for (auto const &it : m_whichToItemMap) {
58
0
    if (!it.second || !it.second->m_attribute) {
59
0
      o << "_,";
60
0
      continue;
61
0
    }
62
0
    it.second->m_attribute->printData(o);
63
0
    o << ",";
64
0
  }
65
0
  o << "],";
66
0
  return o.str();
67
0
}
68
69
std::ostream &operator<<(std::ostream &o, StarItemStyle const &style)
70
0
{
71
0
  for (int i=0; i<4; ++i) {
72
0
    if (style.m_names[i].empty()) continue;
73
0
    static char const* const wh[]= {"name","parent","follow","help"};
74
0
    o << wh[i] << "=" << style.m_names[i].cstr() << ",";
75
0
  }
76
0
  switch (style.m_family&0xff) {
77
0
  case 0:
78
0
    break;
79
0
  case 1:
80
0
    o << "char[family],";
81
0
    break;
82
0
  case 2:
83
0
    o << "para[family],";
84
0
    break;
85
0
  case 4:
86
0
    o << "frame[family],";
87
0
    break;
88
0
  case 8:
89
0
    o << "page[family],";
90
0
    break;
91
0
  case 0x10:
92
0
    o << "pseudo[family],";
93
0
    break;
94
0
  case 0xFE:
95
0
    o << "*[family],";
96
0
    break;
97
0
  default:
98
0
    STOFF_DEBUG_MSG(("StarItemPoolInternal::StarItemStyle::operator<< unexpected family\n"));
99
0
    o << "###family=" << std::hex << (style.m_family&0xff) << std::dec << ",";
100
0
    break;
101
0
  }
102
0
  if (style.m_family&0xFF00) // find 0xaf
103
0
    o << "#family[high]=" << std::hex << (style.m_family>>8) << std::dec << ",";
104
0
  if (style.m_mask) o << "mask=" << std::hex << style.m_mask << std::dec << ",";
105
0
  if (style.m_helpId) o << "help[id]=" << style.m_helpId << ",";
106
#if 0
107
  o << style.m_itemSet.printChild();
108
#endif
109
0
  return o;
110
0
}
111
112
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: