#if !defined(__alffutil_h) // Sentry, use file only if it's not already included.
#define __alffutil_h
/*  Project Biblio-Tec

	 SUBSYSTEM:    TEC30r.dll Library (TecLib)
	 FILE:         alffutil.h
	 AUTHOR:       Alcindo Ferreira Filho

	 OVERVIEW:
	 ALFFUtil, ALFFTime and ALFFDate Classes definition, utilities
    methods, date and time classes that hide some S.O. APIs or
    correspondent OWL classes.

    COPYRIGHT:    © 1998-2005
                  Alcindo Ferreira Filho
                  <alcindo@inttec.com.br>

    LICENSE:      Biblio-Tec license (BiblTec.txt)
*/
#include "alffobj.h"
#include <cstring.h>
#include <classlib/date.h>
#include <classlib/time.h>
#include <openssl/asn1.h>    // From OpenSSL Library

class _TECLIBCLASS ALFFTime : public ALFFObject
{
  public:
    ALFFTime();  // current time
    ALFFTime(int hour, int min, int sec=0);
   ~ALFFTime();
    char far* GetClassName() {return "ALFFTime";}
    unsigned int hour;
    unsigned int minute;
    unsigned int second;
    int getGMTToLocal();
  protected:
};

class _TECLIBCLASS ALFFDate : public ALFFTime
{
  public:
    ALFFDate();
    ALFFDate(int d, int m, int y);
    ALFFDate(const tm* tm);
    ALFFDate(const ALFFTime& time );
    ALFFDate(const ASN1_TIME* asn1Time);
   ~ALFFDate();
    char far* GetClassName() {return "ALFFDate";}
    enum  DateFormat {
          None,
          pt_BR,
          en_US
    };
    unsigned int      day;
    unsigned int      month;
    unsigned int      year;
    string   getDayOfWeek(DateFormat fmt, int day=-1);
    string   getDate(DateFormat fmt);           // "%02d/%02d/%04d"
    string   getDateTime(DateFormat fmt);      	// "%02d/%02d/%04d - %02d:%02d:%02d h"
    string   getDateTimeString(DateFormat fmt); // "%s,\r\n%02d/%02d/%04d - %02d:%02d:%02d h"
    string   getLocalTimeStamp(DateFormat fmt);
    int      CompareTo (ALFFDate& otherDate);
  private:
    TDate*  hiddenDate;

};


class _TECLIBCLASS ALFFUtil : public ALFFObject
{
  public:
    ALFFUtil();
   ~ALFFUtil();
   char far* GetClassName() {return "ALFFUtil";}
#define MAXHEXBUFFERSIZE 1024
    string getHexPrintable(unsigned char* fromBuffer, long length,
                           int lineLen, char* separator = NULL);
    string getHexPrintableDump(char *buffer,int length, int bytesPerLine,
                              bool convertToAsc = false,
                              char* tabEbcAsc = NULL);
    string replaceString(const string source, const char* toFind,
                         const char* replaceWith, int& numFound);
  protected:
};
#endif  //
