#include "notion.h" namespace verbly { namespace generator { int notion::nextId_ = 0; notion::notion( part_of_speech partOfSpeech) : id_(nextId_++), partOfSpeech_(partOfSpeech) { } notion::notion( part_of_speech partOfSpeech, int wnid) : id_(nextId_++), partOfSpeech_(partOfSpeech), wnid_(wnid), hasWnid_(true) { } void notion::incrementNumOfImages() { if (!hasWnid_ || (partOfSpeech_ != part_of_speech::noun)) { throw std::domain_error("Notion is not a noun with wnid"); } numOfImages_++; } void notion::setPrepositionGroups(std::list groups) { if (partOfSpeech_ != part_of_speech::preposition) { throw std::domain_error("Notion is not a preposition"); } prepositionGroups_ = groups; } hatkirby::database& operator<<(hatkirby::database& db, const notion& arg) { // First, serialize the notion { std::list fields; fields.emplace_back("notion_id", arg.getId()); fields.emplace_back("part_of_speech", static_cast(arg.getPartOfSpeech())); if (arg.hasWnid()) { fields.emplace_back("wnid", arg.getWnid()); if (arg.getPartOfSpeech() == part_of_speech::noun) { fields.emplace_back("images", arg.getNumOfImages()); } } db.insertIntoTable("notions", std::move(fields)); } // Next, serialize the is_a relationship if this is a preposition if (arg.getPartOfSpeech() == part_of_speech::preposition) { for (std::string group : arg.getPrepositionGroups()) { db.insertIntoTable( "is_a", { { "notion_id", arg.getId() }, { "groupname", group } }); } } return db; } }; }; rooms/Plaza%20Entrance.txtpb?h=v8.0.4&id=a825f800a04334ac8a4338c5fe88d7bbce49c022'>commit diff stats
blob: 0bc60a76d7ad5baf35cdcb8a2eecd1810adcb137 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
name: "Plaza Entrance"
panels {
  name: "GEE"
  path: "Panels/Door Openers/green_se"
  clue: "gee"
  answer: "green"
  symbols: SPARKLES
}
panels {
  name: "SEA"
  path: "Panels/Door Openers/white_nw2"
  clue: "sea"
  answer: "search"
  symbols: SPARKLES
}
ports {
  name: "PLAZA"
  path: "Components/Warps/worldport5"
}