This file is indexed.

/usr/include/zeep/http/webapp/el.hpp is in libzeep-dev 3.0.2-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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
// Copyright Maarten L. Hekkelman, Radboud University 2008-2011.
//   Distributed under the Boost Software License, Version 1.0.
//      (See accompanying file LICENSE_1_0.txt or copy at
//            http://www.boost.org/LICENSE_1_0.txt)
//
// expression language support
//

#pragma once

#include <map>

#include <boost/range.hpp>
#include <boost/cstdint.hpp>

#include <zeep/http/request.hpp>
#include <zeep/exception.hpp>

#ifndef LIBZEEP_DOXYGEN_INVOKED
typedef boost::int8_t		int8;
typedef boost::uint8_t		uint8;
typedef boost::int16_t		int16;
typedef boost::uint16_t		uint16;
typedef boost::int32_t		int32;
typedef boost::uint32_t		uint32;
typedef boost::int64_t		int64;
typedef boost::uint64_t		uint64;
#endif

namespace zeep {
namespace http {
namespace el
{

namespace detail
{
class object_impl;
class object_iterator_impl;
};

class scope;

/// This zeep::http::el::object class is a bridge to the `el` expression language.

class object
{
  public:

	/// object can have one of these basic types:
	enum object_type
	{
		null_type,
		array_type,
		struct_type,
		number_type,
		string_type
	};

				object();
				object(const object& o);
	explicit	object(detail::object_impl* impl);
				~object();
				
				/// create an array object
	explicit	object(const std::vector<object>& v);
	explicit	object(const std::vector<std::string>& v);

				/// construct an object directly from some basic types
	explicit	object(bool v);
	explicit	object(int8 v);
	explicit	object(uint8 v);
	explicit	object(int16 v);
	explicit	object(uint16 v);
	explicit	object(int32 v);
	explicit	object(uint32 v);
	explicit	object(int64 v);
	explicit	object(uint64 v);
	explicit	object(float v);
	explicit	object(double v);
	explicit	object(const char* v);
	explicit	object(const std::string& v);

	object&		operator=(const object& o);

				/// assign an array object
	object&		operator=(const std::vector<object>& v);
	object&		operator=(const std::vector<std::string>& v);

				/// and assign some basic types
	object&		operator=(bool v);
	object&		operator=(int8 v);
	object&		operator=(uint8 v);
	object&		operator=(int16 v);
	object&		operator=(uint16 v);
	object&		operator=(int32 v);
	object&		operator=(uint32 v);
	object&		operator=(int64 v);
	object&		operator=(uint64 v);
	object&		operator=(float v);
	object&		operator=(double v);
	object&		operator=(const char* v);
	object&		operator=(const std::string& v);

	object_type	type() const;

	template<typename T>
	T			as() const;

	const object operator[](const std::string& name) const;
	const object operator[](const char* name) const;
	const object operator[](const object& index) const;

	object&		operator[](const std::string& name);
	object&		operator[](const char* name);
	object&		operator[](const object& index);
	
	size_t		count() const;
	bool		empty() const;

	bool		operator<(const object& rhs) const;
	bool		operator==(const object& rhs) const;

	template<class ObjectType>
	class basic_iterator : public std::iterator<std::forward_iterator_tag, ObjectType>
	{
	  public:
		typedef typename std::iterator<std::forward_iterator_tag, ObjectType>	base_type;
		typedef typename base_type::reference									reference;
		typedef typename base_type::pointer										pointer;

						basic_iterator();
						basic_iterator(const basic_iterator& other);
						basic_iterator(detail::object_impl* a);
						basic_iterator(detail::object_impl* a, int);
						basic_iterator(const detail::object_impl* a);
						basic_iterator(const detail::object_impl* a, int);
						~basic_iterator();
		
		basic_iterator&	operator=(const basic_iterator& other);
		
		reference		operator*() const;
		pointer			operator->() const;

		basic_iterator&	operator++();
		basic_iterator	operator++(int);

		bool			operator==(const basic_iterator& other) const;
		bool			operator!=(const basic_iterator& other) const;

	  private:
		detail::object_iterator_impl*
						m_impl;
	};

	typedef basic_iterator<object>			iterator;
	typedef basic_iterator<const object>	const_iterator;

	iterator			begin()								{ return iterator(m_impl); }
	iterator			end()								{ return iterator(m_impl, -1); }

	const_iterator		begin() const						{ return const_iterator(m_impl); }
	const_iterator		end() const							{ return const_iterator(m_impl, -1); }

	friend iterator			range_begin(object& x)			{ return x.begin(); }
	friend iterator			range_end(object& x)			{ return x.end(); }
	friend const_iterator	range_begin(const object& x)	{ return x.begin(); }
	friend const_iterator	range_end(const object& x)		{ return x.end(); }

	friend std::ostream& operator<<(std::ostream& lhs, const object& rhs);
	
	std::string			toJSON() const;

  private:

	friend object operator+(const object& a, const object& b);
	friend object operator-(const object& a, const object& b);
	friend object operator*(const object& a, const object& b);
	friend object operator%(const object& a, const object& b);
	friend object operator/(const object& a, const object& b);
	friend object operator-(const object& a);

	class detail::object_impl*	m_impl;
};

/// \brief Process the text in \a text and return `true` if the result is
///        not empty, zero or false.
///
///	The expression in \a text is processed and if the result of this
/// expression is empty, false or zero then `false` is returned.
/// \param scope  The scope for this el script
/// \param text   The el script
/// \return       The result of the script
bool process_el(const scope& scope, std::string& text);

/// \brief Process the text in \a text. The result is put in \a result
///
///	The expression in \a text is processed and the result is returned
/// in \a result.
/// \param scope  The scope for this el script
/// \param text   The el script
/// \return       The result of the script
void evaluate_el(const scope& scope, const std::string& text, object& result);

/// \brief Process the text in \a text and replace it with the result
///
///	The expressions found in \a text are processed and the output of
/// 				the processing is used as a replacement value for the expressions.
/// \param scope  The scope for the el scripts
/// \param text   The text optionally containing el scripts.
/// \return       Returns true if \a text was changed.
bool evaluate_el(const scope& scope, const std::string& text);

// --------------------------------------------------------------------

class scope
{
  public:
					scope(const request& req);
	explicit		scope(const scope& next);

	template<typename T>
	void			put(const std::string& name, const T& value);

	template<typename ForwardIterator>
	void			put(const std::string& name, ForwardIterator begin, ForwardIterator end);

	const object&	lookup(const std::string& name) const;
	const object&	operator[](const std::string& name) const;

	object&			lookup(const std::string& name);
	object&			operator[](const std::string& name);

	const request&	get_request() const;

  private:

	friend std::ostream& operator<<(std::ostream& lhs, const scope& rhs);

	scope&			operator=(const scope&);

	typedef std::map<std::string,object> data_map;

	data_map		m_data;
	scope*			m_next;
	const request*	m_req;
};

/// for debugging purposes
std::ostream& operator<<(std::ostream& lhs, const scope& rhs);

template<typename T>
inline
void scope::put(
	const std::string&	name,
	const T&		value)
{
	m_data[name] = object(value);
}

template<>
inline
void scope::put(
	const std::string&	name,
	const object&	value)
{
	m_data[name] = value;
}

template<typename ForwardIterator>
inline
void scope::put(
	const std::string&	name,
	ForwardIterator	begin,
	ForwardIterator	end)
{
	std::vector<object> elements;
	while (begin != end)
		elements.push_back(object(*begin++));
	m_data[name] = object(elements);
}

// --------------------------------------------------------------------

namespace detail
{

class object_iterator_impl;

class object_impl
{
  public:

	void					reference()						{ ++m_refcount; }
	void					release()						{ if (--m_refcount == 0) delete this; }

	object::object_type		type() const					{ return m_type; }
	bool					is_null() const					{ return m_type == object::null_type; }
	bool					is_array() const				{ return m_type == object::array_type; }
	bool					is_struct() const				{ return m_type == object::struct_type; }
	bool					is_number() const				{ return m_type == object::number_type; }
	bool					is_string() const				{ return m_type == object::string_type; }

	virtual void			print(std::ostream& os) const = 0;
	virtual int				compare(object_impl* rhs) const = 0;

	virtual int64			to_int() const;
	virtual double			to_double() const;
	virtual std::string		to_str() const;
	virtual std::string		to_JSON() const;

	friend class object;

  protected:

							object_impl(object::object_type type = object::null_type)
								: m_refcount(1)
								, m_type(type)
							{
							}

	virtual					~object_impl()
							{
							}

  private:
							object_impl(const object_impl&);
	object_impl&			operator=(const object_impl&);

	int32					m_refcount;
	object::object_type		m_type;
};

class base_array_object_impl : public object_impl
{
  public:

	virtual size_t			count() const = 0;

	virtual object_iterator_impl*
							create_iterator(bool begin) const = 0;

	virtual object&			at(uint32 ix);
	virtual const object	at(uint32 ix) const;

  protected:
							base_array_object_impl()
								: object_impl(object::array_type)
							{
							}
};

class base_struct_object_impl : public object_impl
{
  public:

	virtual object&			field(const std::string& name) = 0;
	virtual const object	field(const std::string& name) const = 0;

  protected:
							base_struct_object_impl()
								: object_impl(object::struct_type)
							{
							}
};

class object_iterator_impl
{
  public:

	void			reference()						{ ++m_refcount; }
	void			release()						{ if (--m_refcount == 0) delete this; }

					object_iterator_impl()
						: m_refcount(1)				{}
	
	virtual void	increment() = 0;
	virtual object&	dereference() = 0;
	virtual bool	equal(const object_iterator_impl* other) = 0;

  protected:
	virtual			~object_iterator_impl()			{}

  private:
	int				m_refcount;
};

}

// --------------------------------------------------------------------

template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator()
	: m_impl(nullptr)
{
}

template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator(const basic_iterator& o)
	: m_impl(o.m_impl)
{
	if (m_impl != nullptr)
		m_impl->reference();
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator(detail::object_impl* a)
	: m_impl(nullptr)
{
	detail::base_array_object_impl* impl = dynamic_cast<detail::base_array_object_impl*>(a);
	if (impl != nullptr)
		m_impl = impl->create_iterator(true);
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator(detail::object_impl* a, int)
	: m_impl(nullptr)
{
	detail::base_array_object_impl* impl = dynamic_cast<detail::base_array_object_impl*>(a);
	if (impl != nullptr)
		m_impl = impl->create_iterator(false);
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator(const detail::object_impl* a)
	: m_impl(nullptr)
{
	const detail::base_array_object_impl* impl = dynamic_cast<const detail::base_array_object_impl*>(a);
	if (impl != nullptr)
		m_impl = impl->create_iterator(true);
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>::basic_iterator(const detail::object_impl* a, int)
	: m_impl(nullptr)
{
	const detail::base_array_object_impl* impl = dynamic_cast<const detail::base_array_object_impl*>(a);
	if (impl != nullptr)
		m_impl = impl->create_iterator(false);
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>::~basic_iterator()
{
	if (m_impl != nullptr)
		m_impl->release();
}
		
template<class ObjectType>
object::basic_iterator<ObjectType>& object::basic_iterator<ObjectType>::operator=(const basic_iterator& o)
{
	if (this != &o)
	{
		if (m_impl != nullptr)
			m_impl->release();
		m_impl = o.m_impl;
		if (m_impl != nullptr)
			m_impl->reference();
	}
	return *this;
}
		
template<class ObjectType>
typename object::basic_iterator<ObjectType>::reference object::basic_iterator<ObjectType>::operator*() const
{
	if (m_impl == nullptr)
		throw exception("dereferencing invalid object iterator");
	return m_impl->dereference();
}

template<class ObjectType>
typename object::basic_iterator<ObjectType>::pointer object::basic_iterator<ObjectType>::operator->() const
{
	if (m_impl == nullptr)
		throw exception("dereferencing invalid object iterator");
	return &m_impl->dereference();
}

template<class ObjectType>
object::basic_iterator<ObjectType>& object::basic_iterator<ObjectType>::operator++()
{
	if (m_impl == nullptr)
		throw exception("incrementing invalid object iterator");
	m_impl->increment();
	return *this;
}

template<class ObjectType>
object::basic_iterator<ObjectType> object::basic_iterator<ObjectType>::operator++(int)
{
	if (m_impl == nullptr)
		throw exception("incrementing invalid object iterator");

	basic_iterator<ObjectType> iter(*this);
	m_impl->increment();
	return iter;
}

template<class ObjectType>
bool object::basic_iterator<ObjectType>::operator==(const basic_iterator& o) const
{
	bool result;
	if (m_impl == nullptr and o.m_impl == nullptr)
		result = true;
	else if (m_impl == nullptr or o.m_impl == nullptr)
		throw exception("invalid object iterators");
	else
		result = m_impl->equal(o.m_impl);
	return result;
}

template<class ObjectType>
bool object::basic_iterator<ObjectType>::operator!=(const basic_iterator& o) const
{
	bool result;
	if (m_impl == nullptr and o.m_impl == nullptr)
		result = false;
	else if (m_impl == nullptr or o.m_impl == nullptr)
		throw exception("invalid object iterators");
	else
		result = not m_impl->equal(o.m_impl);
	return result;
}


}
}
}

#ifndef LIBZEEP_DOXYGEN_INVOKED
// enable foreach (.., array object)
namespace boost
{
    // specialize range_mutable_iterator and range_const_iterator in namespace boost
    template<>
    struct range_mutable_iterator<zeep::http::el::object>
    {
        typedef zeep::http::el::object::iterator type;
    };

    template<>
    struct range_const_iterator<zeep::http::el::object>
    {
        typedef zeep::http::el::object::const_iterator type;
    };
}
#endif