diff --git a/docs/BOSS API Readme.html b/docs/BOSS API Readme.html index bff43ed7..5314fa96 100644 --- a/docs/BOSS API Readme.html +++ b/docs/BOSS API Readme.html @@ -292,7 +292,46 @@ This documentation is a work in progress, covering an API that is also still a w
The api-tester application provides a very simple usage example. Its source code is hosted with the BOSS API source code.
+
The following is a short program that will print out a list of dirty messages for a given plugin.
+#include "api.h"
+#include <cstddef>
+#include <cstring>
+#include <iostream>
+
+int main(int argc, char *argv[]) {
+ boss_db db;
+ unsigned int ret;
+ boss_message * messages;
+ size_t numMessages;
+
+ if (argc != 2) {
+ std::cout << "Invalid args.";
+ return -1;
+ }
+
+ //Creating a database for Oblivion, using path stored in Registry.
+ ret = boss_create_db(&db, BOSS_API_GAME_TES4, NULL);
+
+ //Load a masterlist that's in the current working directory.
+ ret = boss_load_lists(db, "masterlist.yaml", NULL);
+
+ //We only want the messages that are relevant to the current install.
+ ret = boss_eval_lists(db);
+
+ //Now fetch the messages for the plugin given as the program's argument.
+ ret = boss_get_plugin_messages(db, argv[1], &messages, &numMessages);
+
+ //Dirty messages are of the warning type and contain the substring "dirty edits".
+ for (size_t i = 0; i < numMessages; ++i) {
+ if (messages[i].type == BOSS_API_MESSAGE_WARN &&
+ strstr(messages[i].message, "dirty edits") != NULL) {
+ std::cout << messages[i].message << std::endl;
+ }
+ }
+
+ return 0;
+}
+
Thanks go to Lojack and myk002 for significant contributions during planning and beta testing, and to kaburke for beta testing of v2 of the API. diff --git a/src/parsers.h b/src/parsers.h index 63a04cf8..de1d3bc2 100644 --- a/src/parsers.h +++ b/src/parsers.h @@ -291,9 +291,6 @@ namespace boss { // Condition parser/evaluator /////////////////////////////// - /* Still need to add support for bracketing and evaluation of the compound - conditions. */ - namespace qi = boost::spirit::qi; namespace unicode = boost::spirit::unicode; namespace phoenix = boost::phoenix;