This file is indexed.

/usr/include/osmium/output.hpp is in libosmium-dev 0.0~20140910-9a069af-1+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef OSMIUM_OUTPUT_HPP
#define OSMIUM_OUTPUT_HPP

/*

Copyright 2012 Jochen Topf <jochen@topf.org> and others (see README).

This file is part of Osmium (https://github.com/joto/osmium).

Osmium is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License or (at your option) the GNU
General Public License as published by the Free Software Foundation, either
version 3 of the Licenses, or (at your option) any later version.

Osmium is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License and the GNU
General Public License for more details.

You should have received a copy of the Licenses along with Osmium. If not, see
<http://www.gnu.org/licenses/>.

*/

#include <map>

#include <osmium/osmfile.hpp>
#include <osmium/handler.hpp>

namespace Osmium {

    /**
     * @brief Classes for writing %OSM files.
     */
    namespace Output {

        class Base : public Osmium::Handler::Base {

        protected:

            Osmium::OSMFile m_file;
            std::string m_generator;

            int fd() {
                return m_file.fd();
            }

        public:

            Base(const Osmium::OSMFile& file) :
                Osmium::Handler::Base(),
                m_file(file),
                m_generator("Osmium (http://wiki.openstreetmap.org/wiki/Osmium)") {
                m_file.open_for_output();
            }

            virtual ~Base() {
            }

            virtual void init(Osmium::OSM::Meta&) = 0;
            virtual void node(const shared_ptr<Osmium::OSM::Node const>&) = 0;
            virtual void way(const shared_ptr<Osmium::OSM::Way const>&) = 0;
            virtual void relation(const shared_ptr<Osmium::OSM::Relation const>&) = 0;
            virtual void final() = 0;

            void set_generator(const std::string& generator) {
                m_generator = generator;
            }

        }; // class Base

        /**
         * This factory class is used to register file output formats and open
         * output files in these formats. You should not use this class directly.
         * Instead use the Osmium::Output::open() function.
         */
        class Factory {

        public:

            typedef Osmium::Output::Base*(*create_output_t)(const Osmium::OSMFile&);

        private:

            typedef std::map<Osmium::OSMFile::FileEncoding*, create_output_t> encoding2create_t;

            Factory() :
                m_callbacks() {}

        public:

            static Factory& instance() {
                static Factory factory;
                return factory;
            }

            bool register_output_format(Osmium::OSMFile::FileEncoding* encoding, create_output_t create_function) {
                return m_callbacks.insert(encoding2create_t::value_type(encoding, create_function)).second;
            }

            bool unregister_output_format(Osmium::OSMFile::FileEncoding* encoding) {
                return m_callbacks.erase(encoding) == 1;
            }

            Osmium::Output::Base* create_output(const Osmium::OSMFile& file) {
                encoding2create_t::iterator it = m_callbacks.find(file.encoding());

                if (it != m_callbacks.end()) {
                    return (it->second)(file);
                }

                throw Osmium::OSMFile::FileEncodingNotSupported();
            }

        private:

            encoding2create_t m_callbacks;

        }; // class Factory

        /**
         */
        class Handler : public Osmium::Handler::Forward<Osmium::Output::Base> {

        public:

            Handler(const Osmium::OSMFile& file) :
                Osmium::Handler::Forward<Osmium::Output::Base>(*Osmium::Output::Factory::instance().create_output(file)) {
            }

            ~Handler() {
                delete &next_handler();
            }

            void set_generator(const std::string& generator) {
                next_handler().set_generator(generator);
            }

        }; // Handler

    } // namespace Output

} // namespace Osmium

#endif // OSMIUM_OUTPUT_HPP