aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/ResourceFinder.cc
blob: 74ba671f44a42de3572540efdd91caf01e58ee84 (plain) (blame)
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
#include <qpdf/ResourceFinder.hh>

ResourceFinder::ResourceFinder() :
    saw_bad(false)
{
}

void
ResourceFinder::handleToken(QPDFTokenizer::Token const& token)
{
    if ((token.getType() == QPDFTokenizer::tt_word) &&
        (! this->last_name.empty()))
    {
        this->names.insert(this->last_name);
    }
    else if (token.getType() == QPDFTokenizer::tt_name)
    {
        this->last_name =
            QPDFObjectHandle::newName(token.getValue()).getName();
    }
    else if (token.getType() == QPDFTokenizer::tt_bad)
    {
        saw_bad = true;
    }
    writeToken(token);
}

std::set<std::string> const&
ResourceFinder::getNames() const
{
    return this->names;
}

bool
ResourceFinder::sawBad() const
{
    return this->saw_bad;
}