summaryrefslogtreecommitdiff
path: root/pdfrw/objects/pdfindirect.py
blob: 4df8ac327dc58132bb431c5dfe1cdaf5e2595285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# A part of pdfrw (https://github.com/pmaupin/pdfrw)
# Copyright (C) 2006-2015 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details


class _NotLoaded(object):
    pass


class PdfIndirect(tuple):
    ''' A placeholder for an object that hasn't been read in yet.
        The object itself is the (object number, generation number) tuple.
        The attributes include information about where the object is
        referenced from and the file object to retrieve the real object from.
    '''
    value = _NotLoaded

    def real_value(self, NotLoaded=_NotLoaded):
        value = self.value
        if value is NotLoaded:
            value = self.value = self._loader(self)
        return value