/usr/include/root/Reflex/internal/LiteralString.h is in libroot-core-dev 5.34.14-1build1.
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 | // @(#)root/reflex:$Id$
// Author: Axel Naumann, 2010
// Copyright CERN, CH-1211 Geneva 23, 2004-2010, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.
#ifndef Reflex_LiteralString
#define Reflex_LiteralString
#include <set>
#include <cstring>
#include <string>
#include "Reflex/Kernel.h"
namespace Reflex {
class RFLX_API LiteralString {
public:
LiteralString(): fLiteral(0), fAllocSize(0) {}
LiteralString(const char* s);
LiteralString(const LiteralString& other);
~LiteralString();
static void Add(const char* s);
static void Remove(const char* s);
LiteralString& operator=(const LiteralString& other);
const char* c_str() const { return fLiteral; }
const char** key() const { return const_cast<const char**>(&fLiteral); }
size_t length() const { return strlen(fLiteral); }
void erase(size_t i);
void ToHeap();
bool IsLiteral() const { return !fAllocSize; }
bool operator<(const LiteralString& other) const {
return strcmp(fLiteral, other.fLiteral) < 0; }
bool operator>(const LiteralString& other) const {
return strcmp(fLiteral, other.fLiteral) > 0; }
bool operator==(const LiteralString& other) const {
return strcmp(fLiteral, other.fLiteral) == 0; }
bool operator!=(const LiteralString& other) const {
return strcmp(fLiteral, other.fLiteral) != 0; }
bool operator<(const char* other) const {
return strcmp(fLiteral, other) < 0; }
bool operator>(const char* other) const {
return strcmp(fLiteral, other) > 0; }
bool operator==(const char* other) const {
return strcmp(fLiteral, other) == 0; }
bool operator!=(const char* other) const {
return strcmp(fLiteral, other) != 0; }
bool operator<(const std::string& other) const {
return other.compare(fLiteral) < 0; }
bool operator>(const std::string& other) const {
return other.compare(fLiteral) > 0; }
bool operator==(const std::string& other) const {
return other.compare(fLiteral) == 0; }
bool operator!=(const std::string& other) const {
return other.compare(fLiteral) != 0; }
LiteralString& operator+=(const LiteralString& other);
LiteralString& operator+=(const std::string& other);
LiteralString& operator+=(const char* other);
char operator[](size_t i) const { return fBuf[i]; }
// operator const std::string&()
private:
void Reserve(size_t size);
void StrDup(const char* s);
void StrCat(const char* s);
union {
const char* fLiteral;
char* fBuf;
};
size_t fAllocSize;
};
}
#endif // Reflex_LiteralString
|