This file is indexed.

/usr/include/odil/pdu/UserInformation.txx is in libodil-dev 0.8.0-4build1.

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
/*************************************************************************
 * odil - Copyright (C) Universite de Strasbourg
 * Distributed under the terms of the CeCILL-B license, as published by
 * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 * for details.
 ************************************************************************/

#ifndef _bb325c55_d983_41e3_b6c4_e3b957baedba
#define _bb325c55_d983_41e3_b6c4_e3b957baedba

#include "odil/pdu/UserInformation.h"

#include <algorithm>
#include <initializer_list>
#include <istream>
#include <iterator>
#include <sstream>
#include <vector>

#include "odil/Exception.h"
#include "odil/pdu/Item.h"
#include "odil/pdu/MaximumLength.h"
#include "odil/pdu/Object.h"
#include "odil/pdu/UserIdentityAC.h"
#include "odil/pdu/UserIdentityRQ.h"

namespace odil
{

namespace pdu
{

template<typename TObject>
std::vector<TObject>
UserInformation
::get_sub_items() const
{
    auto const iterators = this->_find_sub_items<TObject>();

    std::vector<TObject> result;
    result.reserve(iterators.size());
    std::transform(
        iterators.begin(), iterators.end(), std::back_inserter(result),
        [](Items::const_iterator const & it)
        {
            std::stringstream stream;
            stream << *it;
            return TObject(stream);
        }
    );

    return result;
}

template<typename TObject>
void
UserInformation
::set_sub_items(std::vector<TObject> const & sub_items)
{
    auto const & old_items = this->_item.as_items("User-data");
    std::vector<Item> new_items;

    auto old_items_iterator = old_items.begin();
    while(old_items_iterator != old_items.end() &&
        old_items_iterator->as_unsigned_int_8("Item-type") < TObject::type)
    {
        new_items.push_back(*old_items_iterator);
        ++old_items_iterator;
    }

    std::transform(
        sub_items.begin(), sub_items.end(), std::back_inserter(new_items),
        [](Object const & object) { return object.get_item(); });

    while(old_items_iterator != old_items.end() &&
        old_items_iterator->as_unsigned_int_8("Item-type") == TObject::type)
    {
        ++old_items_iterator;
    }

    while(old_items_iterator != old_items.end())
    {
        new_items.push_back(*old_items_iterator);
        ++old_items_iterator;
    }

    this->_item.as_items("User-data") = new_items;

    this->_item.as_unsigned_int_16("Item-length") = this->_compute_length();
}

template<typename TObject>
void
UserInformation
::delete_sub_items()
{
    auto const & old_items = this->_item.as_items("User-data");
    std::vector<Item> new_items;
    std::copy_if(
        old_items.begin(), old_items.end(), std::back_inserter(new_items),
        [](Item const & item)
        {
            return item.as_unsigned_int_8("Item-type") != TObject::type;
        }
    );

    this->_item.as_items("User-data") = new_items;

    this->_item.as_unsigned_int_16("Item-length") = this->_compute_length();
}

template<typename TObject>
std::vector<UserInformation::Items::const_iterator>
UserInformation
::_find_sub_items() const
{
    std::vector<Items::const_iterator> result;

    auto const & sub_items = this->_item.as_items("User-data");
    auto iterator = sub_items.begin();
    for(; iterator != sub_items.end(); ++iterator)
    {
        if(iterator->as_unsigned_int_8("Item-type") == TObject::type)
        {
            result.push_back(iterator);
        }
    }

    return result;
}

template<typename TObject>
std::vector<UserInformation::Items::iterator>
UserInformation
::_find_sub_items()
{
    std::vector<Items::iterator> result;

    auto & sub_items = this->_item.as_items("User-data");
    auto iterator = sub_items.begin();
    for(; iterator != sub_items.end(); ++iterator)
    {
        if(iterator->as_unsigned_int_8("Item-type") == TObject::type)
        {
            result.push_back(iterator);
        }
    }

    return result;
}

}

}

#endif // _bb325c55_d983_41e3_b6c4_e3b957baedba