This file is indexed.

/usr/include/snapper/AsciiFile.h is in libsnapper-dev 0.5.4-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
/*
 * Copyright (c) [2004-2015] Novell, Inc.
 *
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as published
 * by the Free Software Foundation.
 *
 * This program 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 General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, contact Novell, Inc.
 *
 * To contact Novell about this file by physical or electronic mail, you may
 * find current contact information at www.novell.com.
 */


#ifndef SNAPPER_ASCII_FILE_H
#define SNAPPER_ASCII_FILE_H


#include <string>
#include <vector>
#include <map>

#include "snapper/Exception.h"


namespace snapper
{
    using std::string;
    using std::vector;
    using std::map;


    class AsciiFileReader
    {
    public:

	AsciiFileReader(int fd);
	AsciiFileReader(FILE* file);
	AsciiFileReader(const string& filename);
	~AsciiFileReader();

	bool getline(string& line);

    private:

	FILE* file;
	char* buffer;
	size_t len;

    };


    class AsciiFile
    {
    public:

	explicit AsciiFile(const char* name, bool remove_empty = false);
	explicit AsciiFile(const string& name, bool remove_empty = false);

	string name() const { return Name_C; }

	void setName(const string& name) { AsciiFile::Name_C = name; }

	void reload();
	bool save();

	void logContent() const;

	void clear() { Lines_C.clear(); }
	void push_back(const string& line) { Lines_C.push_back(line); }

	vector<string>& lines() { return Lines_C; }
	const vector<string>& lines() const { return Lines_C; }

    protected:

	vector<string> Lines_C;

    private:

	string Name_C;
	bool remove_empty;

    };


    class SysconfigFile : protected AsciiFile
    {
    public:

	struct InvalidKeyException : public Exception
	{
	    explicit InvalidKeyException() : Exception("invalid key") {}
	};

	SysconfigFile(const char* name) : AsciiFile(name), modified(false) {}
	SysconfigFile(const string& name) : AsciiFile(name), modified(false) {}
	virtual ~SysconfigFile() { if (modified) save(); }

	void setName(const string& name) { AsciiFile::setName(name); }

	void save();

	virtual void checkKey(const string& key) const;

	virtual void setValue(const string& key, bool value);
	bool getValue(const string& key, bool& value) const;

	virtual void setValue(const string& key, const char* value);
	virtual void setValue(const string& key, const string& value);
	bool getValue(const string& key, string& value) const;

	virtual void setValue(const string& key, const vector<string>& values);
	bool getValue(const string& key, vector<string>& values) const;

	map<string, string> getAllValues() const;

    private:

	bool modified;

    };

}


#endif