upd: first version of booksystem

This commit is contained in:
2023-12-14 03:01:37 +00:00
parent db4830d7d9
commit 7ca2b28548
6 changed files with 230 additions and 9 deletions

View File

@ -28,6 +28,7 @@ class BookDataBase {
public:
void Open(std::string file_name);
bool HaveISBN(const std::string &ISBN);
bool HaveISBN(const std::string &ISBN,BookItemClass &ret);
void CreateEmptyBook(const std::string &ISBN);
void QueryBook(const std::string &ISBN, const std::string &name,
const std::string &author, const std::string &keyword,

View File

@ -226,6 +226,18 @@ class DriveArray {
first_vacant_data_index;
first_vacant_data_index = index;
}
void FetchAll(std::vector<T> &vec) noexcept {
vec.clear();
for (int i = 1; i <= total_block_number; ++i) {
BlockType *blk_ptr = OrderBlock(i);
for (int j = 0; j < kDataPerBlock; ++j) {
if (blk_ptr->data[j].next_vacant_data_index == -1) {
vec.push_back(blk_ptr->data[j].val);
}
}
}
}
};
#endif // PROTECTOR_DRIVEARRAY_HPP

View File

@ -27,5 +27,5 @@ bool CommandModifyLexer(const std::string &command, std::string &ISBN,
bool CommandImportLexer(const std::string &command, int &quantity,
double &total_cost);
bool CommandShowfinanceLexer(const std::string &command,int &count);
bool KeyWordSpliter(const std::string &keyword, std::vector<std::string> &words);
bool KeyWordSpliter(const std::string &keyword, std::vector<std::string> &words,bool allow_empty=false);
#endif // PROTECTOR_LEXER_H