Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TObjString.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Fons Rademakers 12/11/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TObjString
13#define ROOT_TObjString
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TObjString //
19// //
20// Collectable string class. This is a TObject containing a TString. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TObject.h"
25#include "TString.h"
26
27
28class TObjString : public TObject {
29
30private:
31 TString fString; // wrapped TString
32
33public:
34 TObjString(const char *s = "") : fString(s) { }
36 Int_t Compare(const TObject *obj) const override;
37 TString CopyString() const { return fString; }
38 const char *GetName() const override { return fString; }
39 ULong_t Hash() const override { return fString.Hash(); }
40 void FillBuffer(char *&buffer) { fString.FillBuffer(buffer); }
41 void Print(Option_t *) const override { Printf("TObjString = %s", (const char*)fString); }
42 Bool_t IsSortable() const override { return kTRUE; }
43 Bool_t IsEqual(const TObject *obj) const override;
44 void ReadBuffer(char *&buffer) { fString.ReadBuffer(buffer); }
45 void SetString(const char *s) { fString = s; }
46 const TString &GetString() const { return fString; }
47 Int_t Sizeof() const { return fString.Sizeof(); }
48 TString &String() { return fString; }
49
50 ClassDefOverride(TObjString,1) //Collectable string class
51};
52
53#endif
54
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2481
Collectable string class.
Definition TObjString.h:28
TObjString(const char *s="")
Definition TObjString.h:34
Bool_t IsEqual(const TObject *obj) const override
Return kTRUE if the argument has the same content as this object.
void FillBuffer(char *&buffer)
Definition TObjString.h:40
void ReadBuffer(char *&buffer)
Definition TObjString.h:44
const TString & GetString() const
Definition TObjString.h:46
Int_t Compare(const TObject *obj) const override
String compare the argument with this object.
Int_t Sizeof() const
Definition TObjString.h:47
TString & String()
Definition TObjString.h:48
TString CopyString() const
Definition TObjString.h:37
TString fString
Definition TObjString.h:31
ULong_t Hash() const override
Return hash value for this object.
Definition TObjString.h:39
void Print(Option_t *) const override
This method must be overridden when a class wants to print itself.
Definition TObjString.h:41
void SetString(const char *s)
Definition TObjString.h:45
const char * GetName() const override
Returns name of object.
Definition TObjString.h:38
Bool_t IsSortable() const override
Definition TObjString.h:42
~TObjString()
TObjString destructor.
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:670
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
Definition TString.cxx:1288
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
Definition TString.cxx:1379
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
Definition TString.cxx:1309