Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleUtil.cxx
Go to the documentation of this file.
1/// \file RNTupleUtil.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch> & Max Orok <maxwellorok@gmail.com>
4/// \date 2020-07-14
5/// \author Vincenzo Eduardo Padulano, CERN
6/// \date 2024-11-08
7/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
8/// is welcome!
9
10/*************************************************************************
11 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
12 * All rights reserved. *
13 * *
14 * For the licensing terms see $ROOTSYS/LICENSE. *
15 * For the list of contributors see $ROOTSYS/README/CREDITS. *
16 *************************************************************************/
17
18#include "ROOT/RNTupleUtil.hxx"
19
20#include "ROOT/RLogger.hxx"
21#include "ROOT/RMiniFile.hxx"
22
23#include <algorithm>
24#include <cctype>
25#include <cstring>
26#include <iostream>
27
29 static RLogChannel sLog("ROOT.NTuple");
30 return sLog;
31}
32
34ROOT::Experimental::Internal::EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
35{
36 using codeAndRepr = std::pair<const char *, const char *>;
37 constexpr static std::array<codeAndRepr, 4> forbiddenChars{codeAndRepr{"\u002E", "."}, codeAndRepr{"\u002F", "/"},
38 codeAndRepr{"\u0020", "space"},
39 codeAndRepr{"\u005C", "\\"}};
40
41 for (auto &&[code, repr] : forbiddenChars) {
42 if (name.find(code) != std::string_view::npos)
43 return R__FAIL(std::string(where) + " name '" + std::string(name) + "' cannot contain character '" + repr +
44 "'.");
45 }
46
47 if (std::count_if(name.begin(), name.end(), [](unsigned char c) { return std::iscntrl(c); }))
48 return R__FAIL(std::string(where) + " name '" + std::string(name) +
49 "' cannot contain character classified as control character. These notably include newline, tab, "
50 "carriage return.");
51
53}
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:290
#define c(i)
Definition RSha256.hxx:101
char name[80]
Definition TGX11.cxx:110
A log configuration for a channel, e.g.
Definition RLogger.hxx:101
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
Definition RError.hxx:194
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.