Logo ROOT   6.12/07
Reference Guide
TDrawingOptsReader.cxx
Go to the documentation of this file.
1 /// \file TDrawingOptsReader.cxx
2 /// \ingroup Gpad ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2017-09-26
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 #include "TDrawingOptsReader.hxx" // in src/
17 
18 #include <ROOT/TColor.hxx>
19 #include <ROOT/TLogger.hxx>
20 
21 #include <TROOT.h>
22 #include <TSystem.h>
23 
24 using namespace ROOT::Experimental;
25 using namespace ROOT::Experimental::Internal;
26 
27 namespace {
28 }
29 
31 {
32  Attrs_t ret;
34  reader.AddFromStyleFile(std::string(TROOT::GetEtcDir().Data()) + "/system.rootstylerc");
35  reader.AddFromStyleFile(gSystem->GetHomeDirectory() + "/.rootstylerc");
36  reader.AddFromStyleFile(".rootstylerc");
37  return ret;
38 }
39 
42 {
43  auto iAttr = fAttrs.find(std::string(attr));
44  if (iAttr == fAttrs.end())
45  return deflt;
47 }
48 
49 long long TDrawingOptsReader::ParseInt(std::string_view /*attr*/, long long /*deflt*/,
50  std::vector<std::string_view> /*opts*/ /*= {}*/)
51 {
52  // TODO: implement!
53  return 0;
54 }
55 
56 double TDrawingOptsReader::ParseFP(std::string_view /*attr*/, double /*deflt*/)
57 {
58  // TODO: implement!
59  return 0.;
60 }
61 
63 {
64  // TODO - implement!
65  return false;
66 }
long long ParseInt(std::string_view attr, long long deflt, std::vector< std::string_view > opts={})
Parse an integer attribute, or if opts is given, return the index of the string from the options file...
basic_string_view< char > string_view
Definition: RStringView.h:35
Attrs_t & fAttrs
Attributes to operate on.
bool AddFromStyleFile(std::string_view filename)
Adds attributes specified in filename to those already existing in fAttrs.
virtual std::string GetHomeDirectory(const char *userName=0) const
Return the user&#39;s home directory.
Definition: TSystem.cxx:893
TColor ParseColor(std::string_view attr, const TColor &deflt)
Parse a TColor from attr&#39;s value.
std::unordered_map< std::string, std::string > Attrs_t
static constexpr PredefinedRGB kBlack
Definition: TColor.hxx:189
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition: TROOT.cxx:2905
static Attrs_t ReadDefaults()
Reads the attribute config values from .rootstylerc.
double ParseFP(std::string_view attr, double deflt)
Parse a floating point attribute.
A color: Red|Green|Blue|Alpha, or a position in a TPalette.
Definition: TColor.hxx:27