This file is indexed.

/usr/include/libdap/D4Attributes.h is in libdap-dev 3.19.1-2build1.

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
165
166
167
168
// -*- mode: c++; c-basic-offset:4 -*-

// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.

// Copyright (c) 2013 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.

#ifndef _d4attributes_h
#define _d4attributes_h 1

#include <string>
#include <vector>

#include "DapObj.h"
#include "D4AttributeType.h"
#include "XMLWriter.h"

using namespace std;

namespace libdap
{

class AttrTable;
class D4Attributes;

class D4Attribute : public DapObj {
    string d_name;
    D4AttributeType d_type;    // Attributes are limited to the simple types

    // If d_type is attr_container_c is true, use d_attributes to read
    // the contained attributes, otherwise use d_values to read the vector
    // of values.
    D4Attributes *d_attributes;

    // IF d_type is attr_otherxml_c, the first string in d_values holds the
    // XML, otherwise, the strings hold attributes of type d_type.
    vector<string> d_values;

    // perform a deep copy
    void m_duplicate(const D4Attribute &src);

public:
    typedef vector<string>::iterator D4AttributeIter;
    typedef vector<string>::const_iterator D4AttributeCIter;

    D4Attribute() : d_name(""), d_type(attr_null_c), d_attributes(0) {}
    D4Attribute(const string &name, D4AttributeType type)
        : d_name(name), d_type(type), d_attributes(0) {}

    D4Attribute(const D4Attribute &src);
    ~D4Attribute();
    D4Attribute &operator=(const D4Attribute &rhs);

    string name() const { return d_name; }
    void set_name(const string &name) { d_name = name; }

    D4AttributeType type() const { return d_type; }
    void set_type(D4AttributeType type) { d_type = type; }

    void add_value(const string &value) { d_values.push_back(value); }
    void add_value_vector(const vector<string> &values) { d_values = values; }

    D4AttributeIter value_begin() { return d_values.begin(); }
    D4AttributeIter value_end() { return d_values.end(); }

    unsigned int num_values() const { return d_values.size(); }
    string value(unsigned int i) const { return d_values[i]; }

    D4Attributes *attributes();

    void print_dap4(XMLWriter &xml) const;

    virtual void dump(ostream &strm) const;
};

class D4Attributes : public DapObj {
public:
    typedef vector<D4Attribute*>::iterator D4AttributesIter;
    typedef vector<D4Attribute*>::const_iterator D4AttributesCIter;

private:
    vector<D4Attribute*> d_attrs;

    void m_duplicate(const D4Attributes &src) {
        D4AttributesCIter i = src.d_attrs.begin();
        while (i != src.d_attrs.end()) {
            d_attrs.push_back(new D4Attribute(**i++));    // deep copy
        }
    }

    D4Attribute *find_depth_first(const string &name, D4AttributesIter i);

public:

    D4Attributes() {}
    D4Attributes(const D4Attributes &rhs) {
        m_duplicate(rhs);
    }

    virtual ~D4Attributes() {
        D4AttributesIter i = d_attrs.begin();
        while(i != d_attrs.end()) {
            delete *i++;
        }
    }

    D4Attributes &operator=(const D4Attributes &rhs) {
        if (this == &rhs) return *this;
        m_duplicate(rhs);
        return *this;
    }

    void transform_to_dap4(AttrTable &at);

    AttrTable *get_AttrTable(const std::string name);
    static void load_AttrTable(AttrTable *d2_attr_table, D4Attributes *d4_attrs);

    bool empty() const { return d_attrs.empty(); }

    void add_attribute(D4Attribute *attr) {
        d_attrs.push_back(new D4Attribute(*attr));
    }
    void add_attribute_nocopy(D4Attribute *attr) {
        d_attrs.push_back(attr);
    }

    /// Get an iterator to the start of the enumerations
    D4AttributesIter attribute_begin() { return d_attrs.begin(); }

    /// Get an iterator to the end of the enumerations
    D4AttributesIter attribute_end() { return d_attrs.end(); }

    D4Attribute *find(const string &name);
    D4Attribute *get(const string &fqn);

    // D4Attribute *find_container(const string &name);
    // D4Attribute *get_container(const string &fqn);

    // Might add erase()

    void print_dap4(XMLWriter &xml) const;

    virtual void dump(ostream &strm) const;
};

string D4AttributeTypeToString(D4AttributeType at);
D4AttributeType StringToD4AttributeType(string s);

} // namespace libdap

#endif // _d4attributes_h