+ kiwix-manage new devs.

This commit is contained in:
kelson42 2011-04-20 06:16:41 +00:00
parent 93d5daeb94
commit 08bcb43afb
4 changed files with 27 additions and 0 deletions

View File

@ -47,4 +47,9 @@ namespace kiwix {
return true;
}
bool Library::removeBookByIndex(const unsigned int bookIndex) {
books.erase(books.begin()+bookIndex-1);
return true;
}
}

View File

@ -51,6 +51,7 @@ namespace kiwix {
string current;
bool addBook(const Book &book);
bool removeBookByIndex(const unsigned int bookIndex);
vector <kiwix::Book> books;
};

View File

@ -53,6 +53,25 @@ namespace kiwix {
return result;
}
bool Manager::writeFile(const string path) {
pugi::xml_document doc;
/* Add the library node */
pugi::xml_node libraryNode = doc.append_child("library");
libraryNode.append_attribute("current") = library.current.c_str();
/* Add each book */
/* saving file */
doc.save_file(path.c_str());
return true;
}
bool Manager::removeBookByIndex(const unsigned int bookIndex) {
return this->library.removeBookByIndex(bookIndex);
}
kiwix::Library Manager::cloneLibrary() {
return this->library;
}

View File

@ -40,6 +40,8 @@ namespace kiwix {
~Manager();
bool readFile(const string path);
bool writeFile(const string path);
bool removeBookByIndex(const unsigned int bookIndex);
kiwix::Library cloneLibrary();
protected: