This file is indexed.

/usr/include/simgear/props/propertyObject.hxx is in libsimgear-dev 3.4.0-3.

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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
// Copyright (C) 2010  James Turner - zakalawe@mac.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//

#ifndef SG_PROPERTY_OBJECT
#define SG_PROPERTY_OBJECT

#include <simgear/props/props.hxx>

namespace simgear
{

class PropertyObjectBase
{
public:
  static void setDefaultRoot(SGPropertyNode* aRoot);
  
  PropertyObjectBase();
  
  PropertyObjectBase(const PropertyObjectBase& aOther);
    
  PropertyObjectBase(const char* aChild);
  
  PropertyObjectBase(SGPropertyNode* aNode, const char* aChild = NULL);
  
  SGPropertyNode* node(bool aCreate) const;

  /**
   * Resolve the property node, or throw an exception if it could not
   * be resolved.
   */
  SGPropertyNode* getOrThrow() const;
protected:
  mutable const char* _path;

  /**
   * Important - if _path is NULL, this is the actual prop.
   * If path is non-NULL, this is the parent which path should be resolved
   * against (or NULL, if _path is absolute). Use node() instead of accessing
   * this directly, and the above is handled automatically. 
   */
  mutable SGPropertyNode* _prop;
};

template <typename T>
class PropertyObject : PropertyObjectBase
{
public:
  PropertyObject()
  {}
  
  /**
   * Create from path relative to the default root, and option default value
   */
  explicit PropertyObject(const char* aChild) :
    PropertyObjectBase(aChild)
  { }
  
  /**
   * Create from a node, with optional relative path
   */
  explicit PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
    PropertyObjectBase(aNode, aChild)
  {
  
  }
  
// copy-constructor
  PropertyObject(const PropertyObject<T>& aOther) :
    PropertyObjectBase(aOther)
  {
  }

// create() form creates the property immediately
  static PropertyObject<T> create(const char* aPath, T aValue)
  {
    PropertyObject<T> p(aPath);
    p = aValue;
    return p;
  }
  
  static PropertyObject<T> create(SGPropertyNode* aNode, T aValue)
  {
    PropertyObject<T> p(aNode);
    p = aValue;
    return p;
  }

  static PropertyObject<T> create(SGPropertyNode* aNode, const char* aChild, T aValue)
  {
    PropertyObject<T> p(aNode, aChild);
    p = aValue;
    return p;
  }
  
// conversion operators
  operator T () const
  {
    return getOrThrow()->template getValue<T>();
  }

  T operator=(const T& aValue)
  {
    SGPropertyNode* n = PropertyObjectBase::node(true);
    if( !n )
      return aValue;

    n->setValue<T>(aValue);
    return aValue;
  }

#define SG_DEF_ASSIGN_OP(op)\
  T operator op##=(const T rhs)\
  {\
    SGPropertyNode* n = getOrThrow();\
    T new_val = n->getValue<T>() op rhs;\
    n->setValue<T>(new_val);\
    return new_val;\
  }

  SG_DEF_ASSIGN_OP(+)
  SG_DEF_ASSIGN_OP(-)
  SG_DEF_ASSIGN_OP(*)
  SG_DEF_ASSIGN_OP(/)
  SG_DEF_ASSIGN_OP(%)
  SG_DEF_ASSIGN_OP(>>)
  SG_DEF_ASSIGN_OP(<<)
  SG_DEF_ASSIGN_OP(&)
  SG_DEF_ASSIGN_OP(^)
  SG_DEF_ASSIGN_OP(|)

#undef SG_DEF_ASSIGN_OP

  SGPropertyNode* node() const
  {
    return PropertyObjectBase::node(false);
  }
}; // of template PropertyObject


// specialization for const char* / std::string

template <>
class PropertyObject<std::string> : PropertyObjectBase
{
public:
  explicit PropertyObject(const char* aChild) :
    PropertyObjectBase(aChild)
  { }
  

  
  explicit PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
    PropertyObjectBase(aNode, aChild)
  {
  
  }
  
// copy-constructor
  PropertyObject(const PropertyObject<std::string>& aOther) :
    PropertyObjectBase(aOther)
  {
  }

// create form
  static PropertyObject<std::string> create(const char* aPath, const std::string& aValue)
  {
    PropertyObject<std::string> p(aPath);
    p = aValue;
    return p;
  }
  
  static PropertyObject<std::string> create(SGPropertyNode* aNode, const std::string& aValue)
  {
    PropertyObject<std::string> p(aNode);
    p = aValue;
    return p;
  }

  static PropertyObject<std::string> create(SGPropertyNode* aNode, const char* aChild, const std::string& aValue)
  {
    PropertyObject<std::string> p(aNode, aChild);
    p = aValue;
    return p;
  }
  
  
  operator std::string () const
  {
    return getOrThrow()->getStringValue();
  }
  
  const char* operator=(const char* aValue)
  {
    SGPropertyNode* n = PropertyObjectBase::node(true);
    if (!n) {
      return aValue;
    }
    
    n->setStringValue(aValue);
    return aValue;
  }
  
  std::string operator=(const std::string& aValue)
  {
    SGPropertyNode* n = PropertyObjectBase::node(true);
    if (!n) {
      return aValue;
    }
    
    n->setStringValue(aValue);
    return aValue;
  }
  
  bool operator==(const char* value) const
  {
    std::string s(*this);
    return (s == value);    
  }

  bool operator==(const std::string& value) const
  {
    std::string s(*this);
    return (s == value);    
  }

  SGPropertyNode* node() const
  {
    return PropertyObjectBase::node(false);
  }
private:
};

} // of namespace simgear

typedef simgear::PropertyObject<double> SGPropObjDouble;
typedef simgear::PropertyObject<bool> SGPropObjBool;
typedef simgear::PropertyObject<std::string> SGPropObjString;
typedef simgear::PropertyObject<long> SGPropObjInt;

#endif