Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGNumberEntry.cxx File Reference
#include "TGNumberEntry.h"
#include "KeySymbols.h"
#include "TTimer.h"
#include "TSystem.h"
#include "TGToolTip.h"
#include "TMath.h"
#include "TVirtualX.h"
#include "strlcpy.h"
#include "snprintf.h"
#include <cctype>
#include <iostream>
Include dependency graph for TGNumberEntry.cxx:

Classes

struct  RealInfo_t
 
class  TGRepeatFireButton
 
class  TRepeatTimer
 

Enumerations

enum  ERealStyle { kRSInt = 0 , kRSFrac = 1 , kRSExpo = 2 , kRSFracExpo = 3 }
 

Functions

static void AppendFracZero (char *text, std::size_t textCap, Int_t digits)
 Given a numeric string "xxx.yyy" or "xxx,yyy", makes sure that the fractional part (if present) always has at least digits digits, appending zeroes if needed.
 
static void CheckMinMax (Long_t &l, TGNumberFormat::EStyle style, TGNumberFormat::ELimit limits, Double_t min, Double_t max)
 Check min/max limits for the set value.
 
static void CopyAndSkipGarbage (char *dst, std::size_t dstCap, const char *src, TGNumberFormat::EStyle style, TGNumberFormat::EAttribute attr)
 Copy the string stored in src into dst, skipping some chars depending on the format and style.
 
static char * DIntToStr (char *text, std::size_t textCap, Long_t l, Bool_t Sec, char Del)
 
static char * DIntToStr (char *text, std::size_t textCap, Long_t l, char Del, char Del2)
 For kNESMinSecCent.
 
static void GetNumbers (const char *s, Int_t &Sign, Long_t &n1, Int_t maxd1, Long_t &n2, Int_t maxd2, Long_t &n3, Int_t maxd3, const char *Delimiters)
 
static Long_t GetSignificant (Long_t l, Int_t Max)
 
static ULong_t HexStrToInt (const char *s)
 
static void IncreaseDate (Long_t &l, TGNumberFormat::EStepSize step, Int_t sign)
 Change year/month/day format.
 
static void IncreaseReal (RealInfo_t &ri, Double_t mag, Bool_t logstep, TGNumberFormat::ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
 Convert to double format.
 
static Long_t IntStr (const char *text)
 
static char * IntToHexStr (char *text, std::size_t textCap, ULong_t l)
 
static Bool_t IsGoodChar (char c, TGNumberFormat::EStyle style, TGNumberFormat::EAttribute attr)
 
static Bool_t IsLeapYear (Int_t year)
 
static Long_t MakeDateNumber (const char *, Long_t Day, Long_t Month, Long_t Year)
 Create a number entry with year/month/day information.
 
static char * MIntToStr (char *text, std::size_t textCap, Long_t l, Int_t digits)
 
static Double_t RealToDouble (const RealInfo_t ri)
 Convert to double format.
 
static char * RealToStr (char *text, std::size_t textCap, const RealInfo_t &ri)
 
static Long_t Round (Double_t x)
 
static TString StringInt (Long_t i, Int_t digits)
 
static char * StrInt (char *text, std::size_t textCap, Long_t i, Int_t digits)
 
static Double_t StrToReal (const char *text, RealInfo_t &ri)
 
static Long_t TranslateToNum (const char *text, TGNumberFormat::EStyle style, RealInfo_t &ri)
 Translate a string to a number value.
 
static char * TranslateToStr (char *text, std::size_t textCap, Long_t l, TGNumberFormat::EStyle style, const RealInfo_t &ri)
 Translate a number value to a string.
 
static Long_t Truncate (Double_t x)
 

Variables

const Int_t kDays [13]
 
const Double_t kEpsilon = 1E-12
 

Enumeration Type Documentation

◆ ERealStyle

Enumerator
kRSInt 
kRSFrac 
kRSExpo 
kRSFracExpo 

Definition at line 107 of file TGNumberEntry.cxx.

Function Documentation

◆ AppendFracZero()

static void AppendFracZero ( char * text,
std::size_t textCap,
Int_t digits )
static

Given a numeric string "xxx.yyy" or "xxx,yyy", makes sure that the fractional part (if present) always has at least digits digits, appending zeroes if needed.

Definition at line 578 of file TGNumberEntry.cxx.

◆ CheckMinMax()

static void CheckMinMax ( Long_t & l,
TGNumberFormat::EStyle style,
TGNumberFormat::ELimit limits,
Double_t min,
Double_t max )
static

Check min/max limits for the set value.

Definition at line 790 of file TGNumberEntry.cxx.

◆ CopyAndSkipGarbage()

static void CopyAndSkipGarbage ( char * dst,
std::size_t dstCap,
const char * src,
TGNumberFormat::EStyle style,
TGNumberFormat::EAttribute attr )
static

Copy the string stored in src into dst, skipping some chars depending on the format and style.

The copy is stopped when reaching dstCap-1 copied chars or when finding a null terminator char in src, whatever happens first.

Parameters
src(owned by caller) is the preallocated char buffer to be copied
dst(owned by caller) is a preallocated char buffer where result is stored
dstCapmust match the length of dst buffer and be bigger than 0
stylesee TGNumberFormat::EStyle
attrsee TGNumberFormat::EAttribute
Note
If src is a nullptr, this function is a no-op and returns silently

Definition at line 246 of file TGNumberEntry.cxx.

◆ DIntToStr() [1/2]

static char * DIntToStr ( char * text,
std::size_t textCap,
Long_t l,
Bool_t Sec,
char Del )
static

Definition at line 494 of file TGNumberEntry.cxx.

◆ DIntToStr() [2/2]

static char * DIntToStr ( char * text,
std::size_t textCap,
Long_t l,
char Del,
char Del2 )
static

For kNESMinSecCent.

Definition at line 515 of file TGNumberEntry.cxx.

◆ GetNumbers()

static void GetNumbers ( const char * s,
Int_t & Sign,
Long_t & n1,
Int_t maxd1,
Long_t & n2,
Int_t maxd2,
Long_t & n3,
Int_t maxd3,
const char * Delimiters )
static

Definition at line 530 of file TGNumberEntry.cxx.

◆ GetSignificant()

static Long_t GetSignificant ( Long_t l,
Int_t Max )
static

Definition at line 566 of file TGNumberEntry.cxx.

◆ HexStrToInt()

static ULong_t HexStrToInt ( const char * s)
static

Definition at line 438 of file TGNumberEntry.cxx.

◆ IncreaseDate()

static void IncreaseDate ( Long_t & l,
TGNumberFormat::EStepSize step,
Int_t sign )
static

Change year/month/day format.

Definition at line 1040 of file TGNumberEntry.cxx.

◆ IncreaseReal()

static void IncreaseReal ( RealInfo_t & ri,
Double_t mag,
Bool_t logstep,
TGNumberFormat::ELimit limits = TGNumberFormat::kNELNoLimits,
Double_t min = 0,
Double_t max = 1 )
static

Convert to double format.

Definition at line 871 of file TGNumberEntry.cxx.

◆ IntStr()

static Long_t IntStr ( const char * text)
static

Definition at line 265 of file TGNumberEntry.cxx.

◆ IntToHexStr()

static char * IntToHexStr ( char * text,
std::size_t textCap,
ULong_t l )
static

Definition at line 453 of file TGNumberEntry.cxx.

◆ IsGoodChar()

static Bool_t IsGoodChar ( char c,
TGNumberFormat::EStyle style,
TGNumberFormat::EAttribute attr )
static

Definition at line 170 of file TGNumberEntry.cxx.

◆ IsLeapYear()

static Bool_t IsLeapYear ( Int_t year)
static

Definition at line 163 of file TGNumberEntry.cxx.

◆ MakeDateNumber()

static Long_t MakeDateNumber ( const char * ,
Long_t Day,
Long_t Month,
Long_t Year )
static

Create a number entry with year/month/day information.

Definition at line 609 of file TGNumberEntry.cxx.

◆ MIntToStr()

static char * MIntToStr ( char * text,
std::size_t textCap,
Long_t l,
Int_t digits )
static

Definition at line 461 of file TGNumberEntry.cxx.

◆ RealToDouble()

static Double_t RealToDouble ( const RealInfo_t ri)
static

Convert to double format.

Definition at line 763 of file TGNumberEntry.cxx.

◆ RealToStr()

static char * RealToStr ( char * text,
std::size_t textCap,
const RealInfo_t & ri )
static

Definition at line 298 of file TGNumberEntry.cxx.

◆ Round()

static Long_t Round ( Double_t x)
static

Definition at line 137 of file TGNumberEntry.cxx.

◆ StringInt()

static TString StringInt ( Long_t i,
Int_t digits )
static

Definition at line 289 of file TGNumberEntry.cxx.

◆ StrInt()

static char * StrInt ( char * text,
std::size_t textCap,
Long_t i,
Int_t digits )
static

Definition at line 281 of file TGNumberEntry.cxx.

◆ StrToReal()

static Double_t StrToReal ( const char * text,
RealInfo_t & ri )
static

Definition at line 338 of file TGNumberEntry.cxx.

◆ TranslateToNum()

static Long_t TranslateToNum ( const char * text,
TGNumberFormat::EStyle style,
RealInfo_t & ri )
static

Translate a string to a number value.

Definition at line 636 of file TGNumberEntry.cxx.

◆ TranslateToStr()

static char * TranslateToStr ( char * text,
std::size_t textCap,
Long_t l,
TGNumberFormat::EStyle style,
const RealInfo_t & ri )
static

Translate a number value to a string.

textCap indicates the capacity of text.

Definition at line 710 of file TGNumberEntry.cxx.

◆ Truncate()

static Long_t Truncate ( Double_t x)
static

Definition at line 150 of file TGNumberEntry.cxx.

Variable Documentation

◆ kDays

const Int_t kDays[13]
Initial value:
=
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }

Definition at line 132 of file TGNumberEntry.cxx.

◆ kEpsilon

const Double_t kEpsilon = 1E-12

Definition at line 128 of file TGNumberEntry.cxx.