mmsstv/Hamlog5.h
2013-07-05 15:15:14 -05:00

120 lines
3.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMSSTV.
// MMSSTV 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.
// MMSSTV 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—pHamlog Ver5̃hƒ‰ƒCƒ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; // ƒwƒbƒ_<C692>î•ñ
ULONG m_RecMax; // ƒŒƒR<C692>[ƒh<C692>
USHORT m_FilMax; // ƒtƒB<C692>ƒh<C692>
USHORT m_RecWidth; // ƒŒƒR<C692>[ƒhÌ•<C38C>
USHORT m_FilOff; // ƒwƒbƒ_ƒIƒtƒZƒbƒg
FILE *m_fp;
AnsiString m_StrTable[HamlogDBMAX]; // ƒe<C692>[ƒuƒ¼Ì”z—ñ
USHORT m_PosTable[HamlogDBMAX]; // ƒtƒB<C692>ƒhˆÊuÌ”z—ñ
USHORT m_LenTable[HamlogDBMAX]; // ƒtƒB<C692>ƒh·³Ì”z—ñ
char m_TypeTable[HamlogDBMAX]; // Œ^<5E>î•ñÌ”z—ñ
BOOL m_OpenFlag; // ƒtƒ@ƒCƒƒI<C692>[ƒvƒ“ƒtƒ‰ƒO
ULONG m_Index; // ƒV<C692>[ƒNŽžÌƒCƒ“ƒfƒbƒNƒX
ULONG m_Pos; // ƒV<C692>[ƒNŽžÌƒtƒ@ƒCƒˆÊu
LPSTR m_bp; // ƒoƒbƒtƒ@‚̃|ƒCƒ“ƒ^
BOOL m_WriteFlag; // <20>«<E2809A>žÝƒtƒ‰ƒO
BOOL SetupHeader(void); // ƒwƒbƒ_ƒZƒbƒgƒAƒbƒ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