This file is indexed.

/usr/include/ola/messaging/MessagePrinter.h is in libola-dev 0.10.3.nojsmin-2+deb9u1.

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
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * MessagePrinter.h
 * Print the contents of a message.
 * Copyright (C) 2011 Simon Newton
 */

#ifndef INCLUDE_OLA_MESSAGING_MESSAGEPRINTER_H_
#define INCLUDE_OLA_MESSAGING_MESSAGEPRINTER_H_

#include <ola/messaging/MessageVisitor.h>
#include <string>
#include <sstream>

namespace ola {
namespace messaging {


/**
 * The base class for all message printers.
 */
class MessagePrinter: public MessageVisitor {
 public:
    virtual ~MessagePrinter() {}

    std::string AsString(const class Message *message);

    virtual void Visit(const BoolMessageField*) {}
    virtual void Visit(const IPV4MessageField*) {}
    virtual void Visit(const MACMessageField*) {}
    virtual void Visit(const UIDMessageField*) {}
    virtual void Visit(const StringMessageField*) {}
    virtual void Visit(const BasicMessageField<uint8_t>*) {}
    virtual void Visit(const BasicMessageField<uint16_t>*) {}
    virtual void Visit(const BasicMessageField<uint32_t>*) {}
    virtual void Visit(const BasicMessageField<int8_t>*) {}
    virtual void Visit(const BasicMessageField<int16_t>*) {}
    virtual void Visit(const BasicMessageField<int32_t>*) {}
    virtual void Visit(const GroupMessageField*) {}
    virtual void PostVisit(const GroupMessageField*) {}

 protected:
    std::ostringstream& Stream() { return m_str; }
    virtual void PostStringHook() {}
    virtual std::string TransformLabel(const std::string &label) {
      return label;
    }

 private:
    std::ostringstream m_str;
};


/**
 * The generic printer returns key: value fields.
 */
class GenericMessagePrinter: public MessagePrinter {
 public:
    GenericMessagePrinter(unsigned int indent_size = DEFAULT_INDENT,
                          unsigned int initial_indent = 0)
        : m_indent(initial_indent),
          m_indent_size(indent_size) {
    }
    ~GenericMessagePrinter() {}

    virtual void Visit(const BoolMessageField*);
    virtual void Visit(const IPV4MessageField*);
    virtual void Visit(const MACMessageField*);
    virtual void Visit(const UIDMessageField*);
    virtual void Visit(const StringMessageField*);
    virtual void Visit(const BasicMessageField<uint8_t>*);
    virtual void Visit(const BasicMessageField<uint16_t>*);
    virtual void Visit(const BasicMessageField<uint32_t>*);
    virtual void Visit(const BasicMessageField<int8_t>*);
    virtual void Visit(const BasicMessageField<int16_t>*);
    virtual void Visit(const BasicMessageField<int32_t>*);
    virtual void Visit(const GroupMessageField*);
    virtual void PostVisit(const GroupMessageField*);

    static const unsigned int DEFAULT_INDENT = 2;

 private:
    unsigned int m_indent, m_indent_size;

    void AppendUInt(const std::string &name,
                    unsigned int value,
                    const std::string &label,
                    int8_t multipler);
    void AppendInt(const std::string &name,
                   int value,
                   const std::string &label,
                   int8_t multipler);
    void AppendMultipler(int8_t multipler);
};
}  // namespace messaging
}  // namespace ola
#endif  // INCLUDE_OLA_MESSAGING_MESSAGEPRINTER_H_