/usr/include/Synopsis/PTree/Writer.hh is in libsynopsis0.12-dev 0.12-8.
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 | //
// Copyright (C) 2004 Stefan Seefeld
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
#ifndef Synopsis_PTree_Writer_hh_
#define Synopsis_PTree_Writer_hh_
#include <Synopsis/PTree.hh>
#include <sstream>
namespace Synopsis
{
namespace PTree
{
class Writer : private Visitor
{
public:
Writer(std::ostream &os);
unsigned long write(Node const *);
private:
virtual void visit(Atom *);
virtual void visit(List *);
virtual void visit(Brace *);
void newline();
std::ostream &my_os;
size_t my_indent;
unsigned long my_lines;
};
inline std::string reify(Node const *p)
{
if (!p) return "";
else if (p->is_atom()) return std::string(p->position(), p->length());
std::ostringstream oss;
Writer writer(oss);
writer.write(p);
return oss.str();
}
}
}
#endif
|