mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-05 21:07:50 +00:00
40 lines
672 B
C++
40 lines
672 B
C++
#include <qpdf/ObjTable.hh>
|
|
|
|
struct Test
|
|
{
|
|
int value{0};
|
|
};
|
|
|
|
class Table: public ObjTable<Test>
|
|
{
|
|
public:
|
|
Table()
|
|
{
|
|
initialize(5);
|
|
}
|
|
|
|
void
|
|
test()
|
|
{
|
|
for (int i = 0; i < 10; ++i) {
|
|
(*this)[i].value = 2 * i;
|
|
(*this)[1000 + i].value = 2 * (1000 + i);
|
|
}
|
|
|
|
forEach([](auto i, auto const& item) -> void {
|
|
std::cout << std::to_string(i) << " : " << std::to_string(item.value) << "\n";
|
|
});
|
|
|
|
std::cout << "2000 : " << std::to_string((*this)[2000].value) << "\n";
|
|
}
|
|
};
|
|
|
|
int
|
|
main()
|
|
{
|
|
Table().test();
|
|
|
|
std::cout << "object table tests done\n";
|
|
return 0;
|
|
}
|