/* The Meta_File class can be used independently or as part of the MiniDB project. Copyright (C) 2007 Hossein Hakimzadeh Comments and bug fixes can be sent to hhakimza@iusb.edu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef META_FILE_H #define META_FILE_H #define CLOSED 0 #define OPEN_FOR_READ 1 #define OPEN_FOR_WRITE 2 #define FALSE 0 #define TRUE 1 #define ON 1 #define OFF 0 class Meta_File { char FileName[256]; // *.dta char RecordSeparator; // defaulted to '~' char FieldSeparator; // defaulted to '^' char TagSeparator; unsigned long CurrentFileLocation; unsigned long EOFLocation; int Verbose; // Verbose flag (ON / OFF) public: Meta_File(char *filename, char field_separator, char record_separator, char tag_separator);//Constructor ~Meta_File(); // Destructor void SetRecordSeparator(char separator); // Default separator = '~' void SetFieldSeparator(char separator); // Default separator = '^' void SetTagSeparator(char separator); // Default separator = '=' void Initialize(void); unsigned long SetCurrentFileLocation(unsigned long ); unsigned long FileSize(); int WriteMetaTag(char *a_tag); // Write/Append a meta-tag int WriteMetaRecord(char *a_record); // Write/Append a record int WriteXMLMetaTag(char *a_tag); // Write/Append a meta-tag int WriteXMLMetaRecord(char *a_record); // Write/Append a record int ReadMetaTag(char *a_tag); int ReadMetaRecord(char *a_record); int UnPackRecord(char *a_record, char *fields[]); // UnPack the record into separate fields int PackRecord(char *a_record, char *fields[]); // Pack the Fields into a record void DumpMetaFile(void); }; #endif