File: objdump.h

package info (click to toggle)
oxref 0.90.10-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 400 kB
  • sloc: cpp: 786; makefile: 141
file content (74 lines) | stat: -rw-r--r-- 1,664 bytes parent folder | download | duplicates (4)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef INCLUDED_OBJDUMP_
#define INCLUDED_OBJDUMP_

#include <iterator>
#include <bobcat/process>

class ObjDump
{
    FBB::Process d_process;

    public:
        class const_iterator;

        const_iterator begin();
        const_iterator end();

        class const_iterator: 
                public std::iterator<std::input_iterator_tag, std::string>
        {
            friend const_iterator ObjDump::begin();
            friend const_iterator ObjDump::end();

            FBB::Process *d_process;

            mutable bool d_iterate;
            mutable std::string d_line;

            const_iterator(FBB::Process *process, bool iterate);

            public:
                const_iterator &operator++();
                bool operator==(const_iterator const &other) const;
                bool operator!=(const_iterator const &other) const;
                std::string const &operator*() const;
                std::string const *operator->() const;
        };

        ObjDump();
        void start();
};

inline void ObjDump::start()
{
    d_process.start();
}

inline ObjDump::const_iterator ObjDump::begin()
{
    return const_iterator(&d_process, true);
}

inline ObjDump::const_iterator ObjDump::end()
{
    return const_iterator(&d_process, false);
}

inline bool ObjDump::const_iterator::operator!=(const_iterator const &rhs)
                                                                        const
{
    return not (*this == rhs);
}

inline std::string const &ObjDump::const_iterator::operator*() const
{
    return d_line;
}

inline std::string const *ObjDump::const_iterator::operator->() const
{
    return &d_line;
}

        
#endif