mmvari/Hamlog5.h

120 lines
3.5 KiB
C
Raw Normal View History

2013-07-05 22:09:45 +02:00
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMVARI.
// MMVARI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// MMVARI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License along with MMTTY. If not, see
// <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------------------------------------------------------------------------
#ifndef Hamlog5H
#define Hamlog5H
// MMQSL<53>pHamlog Ver5<72>̃h<CC83><68><EFBFBD>C<EFBFBD>o
#include "ComLib.h"
#include "LogFile.h"
extern const LPCSTR g_Hamlog5Key[];
extern const BYTE g_Hamlog5Len[];
typedef enum {
itemhamlog5CALLS,
itemhamlog5IGN,
itemhamlog5DATE,
itemhamlog5TIME,
itemhamlog5CODE,
itemhamlog5GL,
itemhamlog5QSL,
itemhamlog5FLAG,
itemhamlog5HIS,
itemhamlog5MY,
itemhamlog5FREQ,
itemhamlog5MODE,
itemhamlog5NAME,
itemhamlog5QTH,
itemhamlog5RMK1,
itemhamlog5RMK2,
}HAMLOG5_ITEMS;
#define bithamlog5DX 8
#define bithamlog5NorOdr 1
#define bithamlog5RevOdr 2
#pragma pack(1)
typedef struct {
BYTE Type;
BYTE Year;
BYTE Mon;
BYTE Day;
ULONG RecMax;
USHORT FilOff;
USHORT RecWidth;
BYTE dm1[20];
}hamlog5DBHD;
typedef struct {
char Name[11];
BYTE Type;
BYTE dm1[4];
BYTE Len;
BYTE dm2[15];
}hamlog5DBRHD;
#pragma pack()
#define HamlogDBMAX 16
class CHamlog5
{
private:
BOOL m_fCreate;
hamlog5DBHD m_Head; // <20>w<EFBFBD>b<EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>
ULONG m_RecMax; // <20><><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD><68>
USHORT m_FilMax; // <20>t<EFBFBD>B<EFBFBD>[<5B><><EFBFBD>h<EFBFBD><68>
USHORT m_RecWidth; // <20><><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>̕<EFBFBD>
USHORT m_FilOff; // <20>w<EFBFBD>b<EFBFBD>_<EFBFBD>I<EFBFBD>t<EFBFBD>Z<EFBFBD>b<EFBFBD>g
FILE *m_fp;
AnsiString m_StrTable[HamlogDBMAX]; // <20>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>̔z<CC94><7A>
USHORT m_PosTable[HamlogDBMAX]; // <20>t<EFBFBD>B<EFBFBD>[<5B><><EFBFBD>h<EFBFBD>ʒu<CA92>̔z<CC94><7A>
USHORT m_LenTable[HamlogDBMAX]; // <20>t<EFBFBD>B<EFBFBD>[<5B><><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>̔z<CC94><7A>
char m_TypeTable[HamlogDBMAX]; // <20>^<5E><><EFBFBD><EFBFBD><EFBFBD>̔z<CC94><7A>
BOOL m_OpenFlag; // <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD>t<EFBFBD><74><EFBFBD>O
ULONG m_Index; // <20>V<EFBFBD>[<5B>N<EFBFBD><4E><EFBFBD>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X
ULONG m_Pos; // <20>V<EFBFBD>[<5B>N<EFBFBD><4E><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD>ʒu
LPSTR m_bp; // <20>o<EFBFBD>b<EFBFBD>t<EFBFBD>@<40>̃|<7C>C<EFBFBD><43><EFBFBD>^
BOOL m_WriteFlag; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>݃t<DD83><74><EFBFBD>O
BOOL SetupHeader(void); // <20>w<EFBFBD>b<EFBFBD>_<EFBFBD>Z<EFBFBD>b<EFBFBD>g<EFBFBD>A<EFBFBD>b<EFBFBD>v
BOOL MakeHeader(const LPCSTR _NT[], const BYTE _LT[]);
public:
CHamlog5();
~CHamlog5();
BOOL Open(LPCSTR Name, BOOL fMsg);
BOOL Create(LPCSTR Name);
void Close(void);
inline ULONG GetRCount(void){return m_RecMax;};
inline USHORT GetFCount(void){return m_FilMax;};
AnsiString *GetStrBase(void){return m_StrTable;};
BOOL Seek(ULONG Index);
BOOL IsData(void);
BOOL GetData(USHORT SubIndex, AnsiString &cs);
BOOL GetData(USHORT SubIndex, LPSTR pStore);
BOOL SetData(USHORT SubIndex, LPCSTR p);
BOOL SetBinary(USHORT SubIndex, LPBYTE p);
int GetData(USHORT SubIndex, LPBYTE pData, int len);
BOOL Update(void);
void DecodeData(SDMMLOG *sp);
void EncodeData(SDMMLOG *sp);
};
void __fastcall GetHamlog5FieldsLen(AnsiString &as);
void __fastcall SetHamlog5FieldsLen(AnsiString &as);
#endif