mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-08 06:15:23 +00:00
Remove methods ObjTable::initialize
This commit is contained in:
parent
0d08f65cb8
commit
4badc78aea
@ -2077,8 +2077,8 @@ void
|
||||
QPDFWriter::initializeTables(size_t extra)
|
||||
{
|
||||
auto size = QIntC::to_size(QPDF::Writer::tableSize(m->pdf) + 100) + extra;
|
||||
m->obj.initialize(size);
|
||||
m->new_obj.initialize(size);
|
||||
m->obj.resize(size);
|
||||
m->new_obj.resize(size);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -99,15 +99,6 @@ class ObjTable: public std::vector<T>
|
||||
return element(id);
|
||||
}
|
||||
|
||||
void
|
||||
initialize(size_t idx)
|
||||
{
|
||||
if (std::vector<T>::size() > 0 || !sparse_elements.empty()) {
|
||||
throw ::std::logic_error("ObjTable accessed before initialization");
|
||||
}
|
||||
resize(++idx);
|
||||
}
|
||||
|
||||
void
|
||||
resize(size_t a_size)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ class Table: public ObjTable<Test>
|
||||
public:
|
||||
Table()
|
||||
{
|
||||
initialize(5);
|
||||
resize(5);
|
||||
}
|
||||
|
||||
void
|
||||
@ -20,9 +20,19 @@ class Table: public ObjTable<Test>
|
||||
(*this)[i].value = 2 * i;
|
||||
(*this)[1000 + i].value = 2 * (1000 + i);
|
||||
}
|
||||
for (int i: {50, 60, 70, 98, 99, 100, 101, 150, 198, 199, 200, 201}) {
|
||||
(*this)[i].value = 2 * i;
|
||||
}
|
||||
resize(100);
|
||||
for (int i: {1, 99, 100, 105, 110, 120, 220}) {
|
||||
(*this)[i].value = 3 * i;
|
||||
}
|
||||
resize(200);
|
||||
|
||||
forEach([](auto i, auto const& item) -> void {
|
||||
std::cout << std::to_string(i) << " : " << std::to_string(item.value) << "\n";
|
||||
if (item.value) {
|
||||
std::cout << std::to_string(i) << " : " << std::to_string(item.value) << "\n";
|
||||
}
|
||||
});
|
||||
|
||||
std::cout << "2000 : " << std::to_string((*this)[2000].value) << "\n";
|
||||
|
@ -1,5 +1,4 @@
|
||||
0 : 0
|
||||
1 : 2
|
||||
1 : 3
|
||||
2 : 4
|
||||
3 : 6
|
||||
4 : 8
|
||||
@ -8,6 +7,22 @@
|
||||
7 : 14
|
||||
8 : 16
|
||||
9 : 18
|
||||
50 : 100
|
||||
60 : 120
|
||||
70 : 140
|
||||
98 : 196
|
||||
99 : 297
|
||||
100 : 300
|
||||
101 : 202
|
||||
105 : 315
|
||||
110 : 330
|
||||
120 : 360
|
||||
150 : 300
|
||||
198 : 396
|
||||
199 : 398
|
||||
200 : 400
|
||||
201 : 402
|
||||
220 : 660
|
||||
1000 : 2000
|
||||
1001 : 2002
|
||||
1002 : 2004
|
||||
|
Loading…
Reference in New Issue
Block a user