This file is indexed.

/usr/include/facter/facts/value.hpp is in facter-dev 3.10.0-4.

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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
 * @file
 * Declares the base fact value type.
 */
#pragma once

#include "../export.h"
#include <string>
#include <functional>
#include <memory>
#include <iostream>

// Forward declare needed yaml-cpp classes.
namespace YAML {
    class Emitter;
}

// Forward delcare needed rapidjson classes.
namespace rapidjson {
    class CrtAllocator;
    template <typename Encoding, typename Allocator> class GenericValue;
    template <typename Encoding, typename Allocator, typename StackAllocator> class GenericDocument;
    template<typename CharType> struct UTF8;
}

extern "C" {
    /**
     * Simple structure to store enumeration callbacks.
     */
    typedef struct _enumeration_callbacks enumeration_callbacks;
}

namespace facter { namespace facts {

    /**
     * Typedef for RapidJSON allocator.
     */
    typedef typename rapidjson::CrtAllocator json_allocator;
    /**
     * Typedef for RapidJSON value.
     */
    typedef typename rapidjson::GenericValue<rapidjson::UTF8<char>, json_allocator> json_value;
    /**
     * Typedef for RapidJSON document.
     */
    typedef typename rapidjson::GenericDocument<rapidjson::UTF8<char>, json_allocator, json_allocator> json_document;

    /**
     * Base class for values.
     * This type can be moved but cannot be copied.
     */
    struct LIBFACTER_EXPORT value
    {
        /**
         * Constructs a value.
         * @param hidden True if the fact is hidden from output by default or false if not.
         */
        value(bool hidden = false) :
            _hidden(hidden),
            _weight(0)
        {
        }

        /**
         * Destructs a value.
         */
        virtual ~value() = default;

        /**
         * Moves the given value into this value.
         * @param other The value to move into this value.
         */
        // Visual Studio 12 still doesn't allow default for move constructor.
        value(value&& other)
        {
            _hidden = other._hidden;
            _weight = other._weight;
        }

        /**
         * Moves the given value into this value.
         * @param other The value to move into this value.
         * @return Returns this value.
         */
        // Visual Studio 12 still doesn't allow default for move assignment.
        value& operator=(value&& other)
        {
            _hidden = other._hidden;
            _weight = other._weight;
            return *this;
        }

        /**
         * Determines if the value is hidden from output by default.
         * @return Returns true if the value is hidden from output by default or false if it is not.
         */
        bool hidden() const
        {
            return _hidden;
        }

        /**
         * Gets the weight of the fact.
         * @return Returns the weight of the fact.
         */
        size_t weight() const
        {
            return _weight;
        }

        /**
         * Sets the weight of the fact.
         * @param weight The weight of the fact.
         */
        void weight(size_t weight)
        {
            _weight = weight;
        }

        /**
         * Converts the value to a JSON value.
         * @param allocator The allocator to use for creating the JSON value.
         * @param value The returned JSON value.
         */
        virtual void to_json(json_allocator& allocator, json_value& value) const = 0;

        /**
          * Writes the value to the given stream.
          * @param os The stream to write to.
          * @param quoted True if string values should be quoted or false if not.
          * @param level The current indentation level.
          * @returns Returns the stream being written to.
          */
        virtual std::ostream& write(std::ostream& os, bool quoted = true, unsigned int level = 1) const = 0;

        /**
          * Writes the value to the given YAML emitter.
          * @param emitter The YAML emitter to write to.
          * @returns Returns the given YAML emitter.
          */
        virtual YAML::Emitter& write(YAML::Emitter& emitter) const = 0;

     private:
        value(value const&) = delete;
        value& operator=(value const&) = delete;

        bool _hidden;
        size_t _weight;
    };

    /**
     * Utility function for making a value.
     * @tparam T The type of the value being constructed.
     * @tparam Args The variadic types for the value's constructor.
     * @param args The arguments to the value's constructor.
     * @return Returns a unique pointer to the constructed value.
     */
    template<typename T, typename ...Args>
    std::unique_ptr<T> make_value(Args&& ...args)
    {
        return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
    }

}}  // namespace facter::facts