📄 refer.h
字号:
//---------------------------------------------------------------------------
#ifndef ReferH
#define ReferH
//#include <iostream.h>
//#include <iomanip.h>
//#include <fstream.h>
const char *MT_FATALERROR = "Fatal Error";
const char *MT_MODIFYINGERROR = "Modifying Reference Database Error";
const char *MT_GENERALERROR = "General Error";
const char *MT_WARNING = "Warning";
const char *MI_CONTINUE = ".\nContinue to Run ANYWAY or terminate the application?";
const char *MI_READFAILED = "Failed when reading reference records from disk. The application will have to be closed.\nCheck your file!";
const char *MI_READHEADFAILED = "Failed when reading reference database head information from disk.\nThe disk may be demaged and the pplication will have to be closed.";
const char *MI_WRITEFAILED = "Failed when writing reference records to disk. The application will have to be closed.\nCheck your file!";
const char *MI_WRITEHEADFAILED = "Failed when writing reference database head information to disk. The application will have to be closed.\nCheck your file!";
const char *MI_NOMEMORY = "No sufficient memory to load Refererce Database. The application will have to be closed.\nYou can try it again later.";
const char *MI_CANNOTMODIFY = "No sufficient memory to modify Refererce Database.\nYou can try it again later.";
const char *MI_APPENDFAILED = "No sufficient memory to append new record. Cancel to terminate this operation, Retry to do it again.";
const char *MI_INSERTFAILED = "No sufficient memory to insert new record. Cancel to terminate this operation, Retry to do it again.";
const char *MI_CHANGEFAILED = "Changing record failed. Cancel to terminate this operation, Retry to do it again.";
const char *MI_DELETEFAILED = "Deleting record failed. Cancel to terminate this operation, Retry to do it again.";
const char *MI_DELETEABSFAILED = "physically delete record failed. Cancel to terminate this operation, Retry to do it again.";
const char *MI_UNDELETEFAILED = "Undeleting record failed. Cancel to terminate this operation, Retry to do it again.";
const char *MI_PACKFAILED = "Packing reference database failed. Cancel to terminate this operation, Retry to do it again.";
const char *MI_NORECORDFAILED = "No record exists. Use Append to add it?";
const char *MI_NOPARSER = "No parser file 'wordlist.txt'.\nSystem has to shut down parser function. You should not input abbreviations in Book, technical report, proceedings and Journal edit boxes.";
const char *MI_SAVECHANGE = "Record has been changed. Save it now? You can choose No, and save it later.";
const unsigned __int32 MAGIC_REFER = 0x20666572; // "ref "
const unsigned __int32 MAGIC_DELETED_REFER = 0x206C6564; // "del "
const unsigned __int32 MAGIC_DATABASE = 0x20626472; // "rdb "
enum TReferType
{
rtBooks, rtPapersInBook, rtPapersInJournal, rtPapersInProceedings,
rtProceedings, rtTechnicalReports, rtNotes, rtOthers
};
enum TStatus
{
msAppend, msAdd, msDelete, msInsert, msPack,
msCriteria, msFind, msSave, msOutput, msNone
};
struct TReplaceGrammer
{
AnsiString asOriginal;
AnsiString asRepalced;
};
struct TPublicationDate
{
unsigned __int16 nYear;
unsigned __int16 nMonth;
};
struct TVolumeAndNumber
{
unsigned __int8 nVolume;
unsigned __int8 nNumber;
};
struct TStartAndEndPage
{
unsigned __int16 nStart;
unsigned __int16 nEnd;
};
struct TReferRecord
{
unsigned __int32 nMagic; // Flag, "ref " for the normal; "del " for the deleted
unsigned __int32 nId; // Id Number for the reference, which can not be edited
TReferType eReferType; // Reference's type, such as Papers or Journal etc.
char sReserved[3]; // Unused
unsigned __int32 nLength; // The length of the reference
unsigned __int32 nOffset; // From the beginning to current reference
unsigned __int8 nCrossReferIndex; // CRI, such as "Rau1993a"
unsigned __int8 nAuthors; // Authors' name length
unsigned __int16 nTitle; // Title's name length
unsigned __int16 nJournal; // Journal's name length
TVolumeAndNumber vnVolumeAndNumber; // Vol. and No., typed by unsigned __int16 both
unsigned __int16 nProceedings; // Proceedings' name length
unsigned __int16 nConferencePlace;
unsigned __int16 nConferenceDate;
unsigned __int16 nBook; // Book's name length
unsigned __int8 nEditors; // Editors' name length, if books or proceedings have
unsigned __int16 nTechnicalReport; // No ISBN or publication number
unsigned __int16 nNote; // Some discuss results or notes
TPublicationDate ymPublicationDate; // Year and Month of publication
TStartAndEndPage sePages; // page from nStart to nEnd
unsigned __int8 nKeywordsNumber; // How many keywords are?
unsigned __int16 nKeywords; // keywords' length
unsigned __int32 nAbstract; // Abstract's length
unsigned __int32 nReserved[4]; // Unused
AnsiString asCrossReferIndex; // CRI Contents
AnsiString asAuthors; // Authors' name, seperated with ", "
AnsiString asTitle; // Title
AnsiString asJournal; // Journal's name
AnsiString asProceedings; // Proceedings' name
AnsiString asConferencePlace; // Where the Conference opened
AnsiString asConferenceDate; // When the conference opened
AnsiString asBook; // Book's name
AnsiString asEditors; // Editors' name if have
AnsiString asTechnicalReport; // Title of the technical report
AnsiString asNote; // Title of the note
AnsiString asKeywords; // keywords
AnsiString asAbstract; // Brief abstract
// unsigned __int32 nTail;
};
struct TReferRecModifying
{
bool bMagic; // Flag, "ref " for the normal; "del " for the deleted
bool bId; // Id Number for the reference, which can not be edited
bool bReferType; // Reference's type, such as Papers or Journal etc.
bool bReserved1[3]; // Unused
bool bLength; // The length of the reference
bool bOffset; // From the beginning to current reference
bool bCrossReferIndex; // CRI, such as "Rau1993a"
bool bAuthors; // Authors' name length
bool bTitle; // Title's name length
bool bJournal; // Journal's name length
bool bVolume; // Vol. and No., typed by unsigned __int16 both
bool bNumber;
bool bProceedings; // Proceedings' name length
bool bConferencePlace;
bool bConferenceDate;
bool bBook; // Book's name length
bool bEditors; // Editors' name length, if books or proceedings have
bool bTechnicalReport; // No ISBN or publication number
bool bNote; // Some discuss results or notes
bool bPubYear; // Year and Month of publication
bool bPubMonth; // Year and Month of publication
bool bStartPage; // page from nStart to nEnd
bool bEndPage; // page from nStart to nEnd
bool bKeywords; // keywords' length
bool bAbstract; // Abstract's length
bool bReserved2[4]; // Unused
};
struct TReferLink
{
TReferRecord *pReferRecord;
TReferLink *pNext;
TReferLink *pPrevious;
};
struct TReferDatabaseHeader
{
unsigned __int32 nMagic; // The reference database's flag, "rdb "
unsigned __int32 nCount; // References' total number
unsigned __int32 nId; // Identification of the reference database
unsigned __int32 nIndex; // Entrance to index file, unused
unsigned __int32 nOffset; // The first reference's position from beginning
unsigned __int32 nReserved[4]; // Unused
// TReferLink *pReferLink; // Link of all references in database
};
class TReferenceStream : public Classes::TFileStream
{
// friend class TMainRefer;
private:
AnsiString m_asFileName;
// TReferLink *m_prlCurrReferLink;
// TReferLink *m_prlFirstReferLink;
// TReferLink *m_prlLastReferLink;
// TReferDatabase m_rdReferDatabase;
bool m_bModified;
public:
__fastcall TReferenceStream( const System::AnsiString FileName, Word Mode );
// virtual __fastcall ~TReferenceStream();
private:
protected:
// void __fastcall SetSize(int NewSize);
public:
int __fastcall Seek( int Offset, Word Origin );
int __fastcall Read( void *Buffer, int Count );
int __fastcall Write( const void *Buffer, int Count );
int __fastcall ReadReferDatabaseHeader( TReferDatabaseHeader *prdHeader );
int __fastcall WriteReferDatabaseHeader( TReferDatabaseHeader *prdHeader );
int __fastcall ReadReferRecord( TReferRecord *pRef );
int __fastcall WriteReferRecord( TReferRecord *pRef );
// int __fastcall Read();
// int __fastcall Write();
// int __fastcall ReadAll();
// int __fastcall WriteAll();
};
//---------------------------------------------------------------------------
//extern TReferenceStream *pReferenceStream;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -