Logo ROOT   6.18/05
Reference Guide
RStyleReader.hxx
Go to the documentation of this file.
1/// \file ROOT/RStyleReader.hxx
2/// \ingroup Gpad ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2017-09-29
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RStyleReader
17#define ROOT7_RStyleReader
18
19#include <ROOT/RStringView.hxx>
20#include <ROOT/RStyle.hxx>
21
22#include <string>
23#include <unordered_map>
24#include <vector>
25
26namespace ROOT {
27namespace Experimental {
28namespace Internal {
29/** \class ROOT::Experimental::RStyleReader
30 Reads the attribute config values from `.rootstylerc`. If the style entry is not found there, tries `~/.rootstylerc`
31 and finally `$ROOTSYS/etc/system.rootstylerc`.
32 */
34public:
35 /// Key is the style name.
36 using AllStyles_t = std::unordered_map<std::string, RStyle>;
37
38private:
39 /// Collection of attributes to read into.
41
42public:
43 RStyleReader(AllStyles_t &attrs): fAttrs(attrs) {}
44
45 /// Reads the attribute config values from `.rootstylerc`. If the style entry is not found there, tries
46 /// `~/.rootstylerc` and finally `$ROOTSYS/etc/system.rootstylerc`.
47 ///
48 ///\param[out] target - collection to read into.
49 void ReadDefaults();
50
51 /// Adds attributes specified in `filename` to those already existing in `fAttrs`.
52 /// Overwrites values for attributes that already exist in `attrs`!
53 /// \returns `true` on success, `false` if the file cannot be found or the syntax is wrong.
54 /// Prints an error if the syntax is wrong (but not if the file does not exist).
55 bool AddFromStyleFile(const std::string &filename);
56};
57} // namespace Internal
58} // namespace Experimental
59} // namespace ROOT
60
61#endif
void ReadDefaults()
Reads the attribute config values from .rootstylerc.
std::unordered_map< std::string, RStyle > AllStyles_t
Key is the style name.
AllStyles_t & fAttrs
Collection of attributes to read into.
bool AddFromStyleFile(const std::string &filename)
Adds attributes specified in filename to those already existing in fAttrs.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21