Metodo char2freqname per avere il nome completo della frequenza a partire dal codice
git-svn-id: svn://10.65.10.50/trunk@5328 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6f3dcd713d
commit
5f8a049c87
@ -10,20 +10,36 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// Funzioni di utilita' comune
|
||||
///////////////////////////////////////////////////////////
|
||||
#define FREQ_CODES " GSQ12346A"
|
||||
|
||||
TFrequenza_statistiche char2frequency(char c)
|
||||
{
|
||||
const TFixed_string list(" GSQ12346A");
|
||||
const TFixed_string list(FREQ_CODES);
|
||||
TFrequenza_statistiche f = TFrequenza_statistiche(list.find(c));
|
||||
return f;
|
||||
}
|
||||
|
||||
char frequency2char(TFrequenza_statistiche f)
|
||||
{
|
||||
const char* list = " GSQ12346A";
|
||||
const char* list = FREQ_CODES;
|
||||
return list[f];
|
||||
}
|
||||
|
||||
TString & char2freqname(char c)
|
||||
{
|
||||
static TString16 s;
|
||||
const TFixed_string list(FREQ_CODES);
|
||||
TToken_string std_descr("Giorno|Settimana|Quindicina|Mese|"
|
||||
"Bimestre|Trimestre|Quadrimestre|Semestre|Anno");
|
||||
s= std_descr.get(list.find(c)-1);
|
||||
return s;
|
||||
}
|
||||
|
||||
int last_period(const TDate & d, TFrequenza_statistiche f)
|
||||
{
|
||||
return last_period(d.year(),f);
|
||||
}
|
||||
|
||||
int last_period(int anno, TFrequenza_statistiche f)
|
||||
{
|
||||
int n = 0;
|
||||
|
@ -21,10 +21,12 @@ enum TFrequenza_statistiche { fs_nulla, fs_giornaliera,
|
||||
fs_trimestrale, fs_quadrimestrale,
|
||||
fs_semestrale, fs_annuale };
|
||||
|
||||
// Converte una carattere in una frequenza delle statisitiche
|
||||
//@cmember Converte una carattere in una frequenza delle statisitiche
|
||||
TFrequenza_statistiche char2frequency(char c);
|
||||
//Converte una frequenza delle statisitiche in un carattere
|
||||
//@cmember Converte una frequenza delle statisitiche in un carattere
|
||||
char frequency2char(TFrequenza_statistiche f);
|
||||
//@cmember Converte una carattere nel nome completo della frequenza
|
||||
TString & char2freqname(char c);
|
||||
|
||||
//Arrotondamento di una data alla frequenza specificata
|
||||
const TDate& floor(TDate& data, TFrequenza_statistiche freq);
|
||||
@ -35,6 +37,7 @@ int divide(TFrequenza_statistiche f1, TFrequenza_statistiche f2);
|
||||
|
||||
//Ritorna l'ultimo periodo di un anno (primo = 1)
|
||||
int last_period(int anno, TFrequenza_statistiche freq);
|
||||
int last_period(const TDate & d, TFrequenza_statistiche f);
|
||||
|
||||
//Ritorna la parte "periodo" di una data (l'anno si ottiene da year())
|
||||
int date2period(const TDate& data, TFrequenza_statistiche freq);
|
||||
|
Loading…
x
Reference in New Issue
Block a user