This file is indexed.

/usr/include/scribus/desaxe/actions.h is in scribus-dev 1.4.6+dfsg-2.

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
/*
 *  actions.h
 *  
 *
 *  Created by Andreas Vox on 02.06.06.
 *  Copyright 2006 under GPL2. All rights reserved.
 *
 */


#ifndef ACTIONS_H
#define ACTIONS_H

#include <map>
#include <string>
#include "digester.h"

namespace desaxe {

/**
 *   Action / Action_body follow the handle/body pattern. This allows to omit the
 *   new operator when creating Action expressions and make dynamic memory handling
 *   more secure. 
 *   Base class for the body of all actions. Usually Digester calls these methods,
 *   but subclasses are also allowed to call those methods if they know what they are
 *   doing...
 */
class Action_body
{
protected:
	Action_body() :                     dig(NULL)  {}
	virtual ~Action_body()                         {}
	virtual void begin(const Xml_string&, Xml_attr) {} 
                                               
	virtual void end(const Xml_string&)             {}
	virtual void chars(const Xml_string&)           {}

	Digester* dig;
private:
	int refs;
	friend class Action;
};



/**
 *   Actions do all the real work when digesting XML files: creating new objects,
 *   setting attributes, calling methods. Each Action gets control two or more times
 *   for each time the corresponding rule triggers: 1 x begin(), 0- x chars(), 1 x end().
 *   They come in two basic flavors: Generators create a new object in their begin()
 *   method and put it on the object stack. Other Actions use objects on the stack,
 *   XML attributes or XML text to store this data in other objects. This is usually
 *   done in the end() method.
 *   Warning: end() methods are called in reverse order. This is to ensure that they
 *   see exactly the same stack content as their corresponging begin() method.
 *   This is the handle class which delegates to the body
 */
class Action
{
public:
	inline Digester* digester()                { return body->dig; }
	inline void setDigester(Digester* dig)     { body->dig = dig; }
	
	inline void begin(const Xml_string& tag, Xml_attr attr) 
	                                           { body->begin(tag, attr); }
	inline void end(const Xml_string& tag)     { body->end(tag); }
	inline void chars(const Xml_string& data)  { body->chars(data); }

	// Handle stuff:
	Action(const Action& other)
	{
		body = other.body;
		body->refs++;
	}
	virtual ~Action()                          
	{
		if (--body->refs == 0)
			delete body;
	}
	Action& operator=(const Action& other)
	{
		if (body != other.body) {
			if (--body->refs == 0)
				delete body;
			body = other.body;
			++body->refs;
		}
		return *this;
	}

protected:
	Action(Action_body* body_)
	{
		body = body_;
		body->refs = 1;
	}
	
	Action_body* body;

private:
	Action();  // not defined
};


class Dummy {};

/**
 * This class implements typed constructors. They are in a subclass since
 * we don't want the type arguments in Action itself.
 * Use "class MyAction : public MakeAction<MyAction_body> {} " to define
 * your own Actions. You have to implement MyAction constructors if you
 * want constructors with arguments.
 */
template <class Body, class Arg1=Dummy, class Arg2=Dummy, class Arg3=Dummy, class Arg4=Dummy, class Arg5=Dummy>
struct MakeAction : public Action 
{
	MakeAction() : Action(new Body()) {}
	MakeAction(Arg1 a1) : Action(new Body(a1)) {}
	MakeAction(Arg1 a1, Arg2 a2) : Action(new Body(a1, a2)) {}
	MakeAction(Arg1 a1, Arg2 a2, Arg3 a3) : Action(new Body(a1, a2, a3)) {}
	MakeAction(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) : Action(new Body(a1, a2, a3, a4)) {}
	MakeAction(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) : Action(new Body(a1, a2, a3, a4, a5)) {}
};



/** 
 *   Abstract class for actions which leave a new object on the stack
 *   The begin() method is defined in subclasses and puts the object on stack,
 *   the generic end() method removes this object from stack.
 */
template<class Type>
class Generator_body : public Action_body
{
public:
	virtual Type* eval(Digester* dig_, const Xml_string& tag, Xml_attr attr)
	{
		dig = dig_;
		begin(tag, attr);
		Type* res;
		res = dig->template top<Type>();
		end(tag);
		return res;
	}
protected:
	virtual void end(const Xml_string& ) { dig->pop(); }
};



/**
 * Generators have their own handle class, which is a subclass of Action
 */
template<class Type>
class Generator : public Action
{
public:
	Type* eval(Digester* dig, const Xml_string& tag, Xml_attr attr)
	{
		return static_cast<Generator_body<Type>*>(body)->eval(dig, tag, attr);
	}

protected:
	Generator(Generator_body<Type>* body_) : Action(body_) {}
};


/**
 * This class implements typed constructors. They are in a subclass since
 * we don't want the type arguments in Generator itself.
 * Use "class MyGenerator : public MakeGenerator<MyGenarator_body, MyType> {} " to 
 * define your own generators. You have to implement MyGenerator constructors if you
 * want constructors with arguments.
 */
template <class Body, class Obj_Type, class Arg1=Dummy, class Arg2=Dummy, class Arg3=Dummy>
struct MakeGenerator : public Generator<Obj_Type> 
{
	MakeGenerator() : Generator<Obj_Type>(new Body()) {}
	MakeGenerator(Arg1 a) : Generator<Obj_Type>(new Body(a)) {}
	MakeGenerator(Arg1 a1, Arg2 a2) : Generator<Obj_Type>(new Body(a1, a2)) {}
	MakeGenerator(Arg1 a1, Arg2 a2, Arg3 a3) : Generator<Obj_Type>(new Body(a1, a2, a3)) {}
};

} // namespace

#endif