29 #include <glibmm/refptr.h> 30 #include <glibmm/dispatcher.h> 31 #include <giomm/file.h> 40 using util::MemoryBlockList;
41 using util::MemoryBlockNode;
52 bool M_saw_carriage_return;
53 size_t M_line_wrapped;
54 int M_number_of_lines;
55 size_t M_number_of_characters;
57 unsigned char const* M_search_table;
58 unsigned char const* M_search_table_storeR;
59 static unsigned char* S_state_tables[11];
65 Database(
void) : M_buffer(NULL), M_saw_carriage_return(false), M_line_wrapped(0),
66 M_number_of_lines(0), M_number_of_characters(0), M_state(white_space) { }
75 virtual std::string
get_path(
void)
const = 0;
77 int number_of_lines(
void)
const {
return M_number_of_lines; }
78 size_t number_of_characters(
void)
const {
return M_number_of_characters; }
83 typedef sigc::slot<void, size_t> SlotOpenFinished;
88 static size_t const S_buffer_size = 6 * 4096 - 64;
90 Glib::RefPtr<Gio::File> M_file;
91 Glib::RefPtr<Gio::Cancellable> M_cancellable;
93 Glib::RefPtr<Gio::FileInputStream> M_file_input_stream;
94 SlotOpenFinished M_slot_open_finished;
95 Glib::Thread* M_read_thread;
96 Glib::Dispatcher M_processing_finished;
98 static Glib::RefPtr<Database> open(std::string
const& path, SlotOpenFinished
const& slot)
101 DatabaseSeekable(std::string
const& path, SlotOpenFinished
const& slot_open_finished) :
102 M_file(Gio::File::create_for_path(path)), M_cancellable(Gio::Cancellable::create()),
103 M_bytes_read(0), M_slot_open_finished(slot_open_finished) { load(); }
107 void read_async_open_ready(Glib::RefPtr<Gio::AsyncResult>& result);
108 static void read_async_ready(GObject* source_object, GAsyncResult* async_res, gpointer user_data);
109 void read_async_ready(GObject* source_object, GAsyncResult* async_res);
110 void need_more_data(
void);
111 void processing_finished(
void);
114 virtual std::string
get_path(
void)
const { M_file->get_path(); }
117 void read_thread(
void);
123 #endif // PGNDATABASE_H A namespace for all chess related objects that are not related to the GUI.
Glib::RefPtr< MemoryBlockNode > M_new_block
Database(void)
Constructor.
virtual std::string get_path(void) const =0
Return the path name of the database.
This file contains the declaration of class MemoryBlockList.
MemoryBlockList * M_buffer
Linked list of blocks with valid data.
This file contains the declaration of class Referenceable.
void process_next_data_block(char const* data, size_t size)
Process next data block.