This file is indexed.

/usr/include/ola/strings/Format.h is in libola-dev 0.9.8-1.

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
/*
 * 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
 *
 * Format.h
 * Formatting functions for basic types.
 * Copyright (C) 2005 Simon Newton
 */

/**
 * @file Format.h
 * @brief Formatting functions for basic types.
 */

#ifndef INCLUDE_OLA_STRINGS_FORMAT_H_
#define INCLUDE_OLA_STRINGS_FORMAT_H_

#include <stdint.h>
#include <ola/strings/FormatPrivate.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <ostream>
#include <sstream>
#include <string>

namespace ola {
namespace strings {

/**
 * @brief Convert an int to a string.
 * @param i the int to convert
 * @return the string representation of the int
 */
std::string IntToString(int i);

/**
 * @brief Convert an unsigned int to a string.
 * @param i the unsigned int to convert
 * @return The string representation of the unsigned int
 */
std::string IntToString(unsigned int i);

/**
 * @brief Convert a value to a hex string.
 *
 * Automatic constructor for _ToHex that deals with widths
 * @tparam T the type of value to convert
 * @param v the value to convert
 * @param prefix show the 0x prefix
 * @return A _ToHex struct representing the value, output it to an ostream to
 *     use it.
 * @note We only currently support unsigned ints due to a lack of requirement
 * for anything else
 */
template<typename T>
_ToHex<T> ToHex(T v, bool prefix = true) {
  return _ToHex<T>(v, (std::numeric_limits<T>::digits / HEX_BIT_WIDTH), prefix);
}

/**
 * @brief Output the _ToHex type to an ostream
 */
template <typename T>
std::ostream& operator<<(std::ostream &out, const ola::strings::_ToHex<T> &i) {
  std::ios::fmtflags flags(out.flags());  // Store the current format flags
  // In C++, you only get the 0x on non-zero values, so we have to explicitly
  // add it for all values if we want it
  if (i.prefix) {
    out << "0x";
  }
  out << std::setw(i.width) << std::hex << std::setfill('0')
      << ola::strings::_HexCast(i.value);
  out.flags(flags);  // Put the format flags back to normal
  return out;
}

/**
 * @brief Write binary data to an ostream in a human readable form.
 *
 * @param out the ostream to write to
 * @param data pointer to the data
 * @param length length of the data
 * @param indent the number of spaces to prefix each line with
 * @param byte_per_line the number of bytes to display per line
 *
 * @note The data is printed in two columns, hex on the left, ascii on the
 * right. Non ascii values are printed as `.'
 */
void FormatData(std::ostream *out,
                const uint8_t *data,
                unsigned int length,
                unsigned int indent = 0,
                unsigned int byte_per_line = 8);
}  // namespace strings
}  // namespace ola
#endif  // INCLUDE_OLA_STRINGS_FORMAT_H_