diff --git a/Makefile b/Makefile index 995dd3e..ad64c64 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CXX = clang++ -CXXFLAGS = -std=c++2b +CXXFLAGS = -std=c++2b -Wall -Wextra INSTALL = install INSTALL_DATA = $(INSTALL) -m 644 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..4c0dc5e --- /dev/null +++ b/Rakefile @@ -0,0 +1,148 @@ +require 'active_support' +require 'know/ontology' +require 'rdf/turtle' +require 'stringio' + +include ActiveSupport::Inflector, RDF + +ActiveSupport::Inflector.inflections(:en) do |inflect| + inflect.irregular 'cafe', 'cafes' +end + +task default: %w(codegen) + +HEADER = <<~EOF + /* This is free and unencumbered software released into the public domain. */ + + #pragma once +EOF + +file 'src/know/classes.hpp' => %w(../know.ttl) do |t| + ontology = Know::Ontology.load(t.prerequisites.first) + File.open(t.name, 'w') do |out| + out.puts HEADER + out.puts + ontology.classes.each do |klass| + out.puts %Q[#include "classes/#{klass.cpp_file}"] + end + end +end + +task :codegen => %w(../know.ttl src/know/classes.hpp) do |t| + ontology = Know::Ontology.load(t.prerequisites.first) + ontology.classes.each do |klass| + filename = underscore(klass.name) + File.open("src/know/classes/#{filename}.hpp", 'w') do |out_file| + top, out = StringIO.new, StringIO.new + includes = {} + + includes['cstdint'] = "for std::uint64_t" + includes['ctime'] = "for std::time_t" # TODO + includes['memory'] = "for std::shared_ptr" + includes['string'] = "for std::string" + includes['vector'] = "for std::vector" + + # Generate the `know::$CLASS` class definition: + out.puts <<~EOF + class know::#{klass.cpp_name} { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + + public: + EOF + klass.properties.each do |property| + next if property.cpp_type.nil? + out.puts " #{property.cpp_type} #{property.cpp_name};" + end + out.puts unless klass.properties.empty? + out.puts " inline virtual ~#{klass.cpp_name}() = default;" + + # Generate the `know::$CLASS#clone()` method: + out.puts + out.puts <<~EOF.lines.each { |s| s.prepend(' '*2) }.join + inline virtual shared_ptr<#{klass.cpp_name}> clone() const { + auto clone = std::make_shared<#{klass.cpp_name}>(); + EOF + klass.properties.each do |property| + next if property.cpp_type.nil? + out.puts <<~EOF.lines.each { |s| s.prepend(' '*4) }.join + clone->#{property.cpp_name} = this->#{property.cpp_name}; + EOF + end + out.puts <<~EOF.lines.each { |s| s.prepend(' '*2) }.join + return clone; + } + EOF + + out.puts "};" + + # Begin generating the file header: + top.puts HEADER + + # Generate standard library dependencies: + top.puts unless includes.empty? + includes.each do |header, comment| + header = "<#{header}>" + top.puts "#include #{header.ljust(9)} // #{comment}" + end + + # Generate internal dependencies: + top.puts unless klass.dependencies.empty? + klass.dependencies.each do |dependency| + top.puts "#include \"#{dependency.cpp_name}.hpp\"" + end + + top.puts + top.puts "namespace know {" + top.puts " class #{klass.cpp_name};" + klass.dependencies.each do |dependency| + top.puts " class #{dependency.cpp_name};" + end + top.puts "}" + top.puts + + out_file.write top.string + out_file.write out.string + end + end +end + +class Know::Ontology::Class + def cpp_file + "#{underscore(self.name.to_s)}.hpp" + end + + def cpp_name + case self.name + when :Class then 'class_' + else underscore(self.name.to_s) + end + end + + def cpp_type + "know::#{self.cpp_name}" + end +end + +class Know::Ontology::Property + def cpp_name + name = underscore(self.name.to_s) + name = pluralize(name) unless self.functional? + name + end + + def cpp_type + type = case type = self.range + when ::Know::Ontology::Class then "shared_ptr" + when ::XSD.anyURI then 'string' + when ::XSD.dateTime then 'std::time_t' # TODO + when ::XSD.language then 'string' + when ::XSD.nonNegativeInteger then 'std::uint64_t' + when ::XSD.string then 'string' + else return nil + end + type = "vector<#{type}>" unless self.functional? + type + end +end diff --git a/src/know/classes/activity.hpp b/src/know/classes/activity.hpp index f36b890..0c3a35a 100644 --- a/src/know/classes/activity.hpp +++ b/src/know/classes/activity.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class activity; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class activity; + class event; +} class know::activity { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~activity() = default; + inline virtual ~activity() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/airport.hpp b/src/know/classes/airport.hpp index 760a30c..5530081 100644 --- a/src/know/classes/airport.hpp +++ b/src/know/classes/airport.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class airport; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class airport; + class place; +} class know::airport { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~airport() = default; + inline virtual ~airport() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/appointment.hpp b/src/know/classes/appointment.hpp index 3c1538f..cec6b09 100644 --- a/src/know/classes/appointment.hpp +++ b/src/know/classes/appointment.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class appointment; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class appointment; + class event; +} class know::appointment { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~appointment() = default; + inline virtual ~appointment() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/birth.hpp b/src/know/classes/birth.hpp index 27fdc80..0a01687 100644 --- a/src/know/classes/birth.hpp +++ b/src/know/classes/birth.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class birth; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class birth; + class event; +} class know::birth { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~birth() = default; + inline virtual ~birth() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/birthday.hpp b/src/know/classes/birthday.hpp index c3dcea1..2b4785b 100644 --- a/src/know/classes/birthday.hpp +++ b/src/know/classes/birthday.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class birthday; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class birthday; + class event; +} class know::birthday { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~birthday() = default; + inline virtual ~birthday() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/birthday_party.hpp b/src/know/classes/birthday_party.hpp index 1035e47..732ca9b 100644 --- a/src/know/classes/birthday_party.hpp +++ b/src/know/classes/birthday_party.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class birthday_party; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "party.hpp" + +namespace know { + class birthday_party; + class party; +} class know::birthday_party { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~birthday_party() = default; + inline virtual ~birthday_party() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/buddhist_temple.hpp b/src/know/classes/buddhist_temple.hpp index d49b263..4f79a7e 100644 --- a/src/know/classes/buddhist_temple.hpp +++ b/src/know/classes/buddhist_temple.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class buddhist_temple; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "temple.hpp" + +namespace know { + class buddhist_temple; + class temple; +} class know::buddhist_temple { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~buddhist_temple() = default; + inline virtual ~buddhist_temple() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/cafe.hpp b/src/know/classes/cafe.hpp index e776202..58fd3bf 100644 --- a/src/know/classes/cafe.hpp +++ b/src/know/classes/cafe.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class cafe; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class cafe; + class place; +} class know::cafe { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~cafe() = default; + inline virtual ~cafe() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/church.hpp b/src/know/classes/church.hpp index 6f8feac..673343d 100644 --- a/src/know/classes/church.hpp +++ b/src/know/classes/church.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class church; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "temple.hpp" + +namespace know { + class church; + class temple; +} class know::church { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~church() = default; + inline virtual ~church() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/class.hpp b/src/know/classes/class.hpp index a245ff1..41ed8fc 100644 --- a/src/know/classes/class.hpp +++ b/src/know/classes/class.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class class_; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class class_; + class group; +} class know::class_ { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~class_() = default; + inline virtual ~class_() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/community.hpp b/src/know/classes/community.hpp index 2fd49b4..2f930de 100644 --- a/src/know/classes/community.hpp +++ b/src/know/classes/community.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class community; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class community; + class group; +} class know::community { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~community() = default; + inline virtual ~community() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/company.hpp b/src/know/classes/company.hpp index 521d9da..7832625 100644 --- a/src/know/classes/company.hpp +++ b/src/know/classes/company.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class company; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class company; + class organization; +} class know::company { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~company() = default; + inline virtual ~company() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/conference.hpp b/src/know/classes/conference.hpp index d92ed2b..6c3036c 100644 --- a/src/know/classes/conference.hpp +++ b/src/know/classes/conference.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class conference; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "meeting.hpp" + +namespace know { + class conference; + class meeting; +} class know::conference { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~conference() = default; + inline virtual ~conference() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/congregation.hpp b/src/know/classes/congregation.hpp index d8816f4..9efd7cd 100644 --- a/src/know/classes/congregation.hpp +++ b/src/know/classes/congregation.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class congregation; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class congregation; + class group; +} class know::congregation { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~congregation() = default; + inline virtual ~congregation() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/consortium.hpp b/src/know/classes/consortium.hpp index ce762ca..2a5c5e3 100644 --- a/src/know/classes/consortium.hpp +++ b/src/know/classes/consortium.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class consortium; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class consortium; + class organization; +} class know::consortium { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~consortium() = default; + inline virtual ~consortium() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/corporation.hpp b/src/know/classes/corporation.hpp index ee1233f..b2e39c1 100644 --- a/src/know/classes/corporation.hpp +++ b/src/know/classes/corporation.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class corporation; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class corporation; + class organization; +} class know::corporation { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~corporation() = default; + inline virtual ~corporation() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/death.hpp b/src/know/classes/death.hpp index 446d11e..cc77ab3 100644 --- a/src/know/classes/death.hpp +++ b/src/know/classes/death.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class death; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class death; + class event; +} class know::death { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~death() = default; + inline virtual ~death() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/event.hpp b/src/know/classes/event.hpp index 8cc194a..f3968e5 100644 --- a/src/know/classes/event.hpp +++ b/src/know/classes/event.hpp @@ -2,9 +2,38 @@ #pragma once -namespace know { class event; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" +#include "thing.hpp" + +namespace know { + class event; + class place; + class thing; +} class know::event { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~event() = default; + std::time_t end; + shared_ptr place; + std::time_t start; + + inline virtual ~event() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->end = this->end; + clone->place = this->place; + clone->start = this->start; + return clone; + } }; diff --git a/src/know/classes/family.hpp b/src/know/classes/family.hpp index 30a5a48..5309e8f 100644 --- a/src/know/classes/family.hpp +++ b/src/know/classes/family.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class family; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class family; + class group; +} class know::family { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~family() = default; + inline virtual ~family() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/file.hpp b/src/know/classes/file.hpp index ca2b528..91997f3 100644 --- a/src/know/classes/file.hpp +++ b/src/know/classes/file.hpp @@ -2,9 +2,32 @@ #pragma once -namespace know { class file; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "thing.hpp" + +namespace know { + class file; + class thing; +} class know::file { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~file() = default; + std::uint64_t size_in_bytes; + + inline virtual ~file() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->size_in_bytes = this->size_in_bytes; + return clone; + } }; diff --git a/src/know/classes/government.hpp b/src/know/classes/government.hpp index d1e0fa1..d078ebf 100644 --- a/src/know/classes/government.hpp +++ b/src/know/classes/government.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class government; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class government; + class organization; +} class know::government { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~government() = default; + inline virtual ~government() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/graduation.hpp b/src/know/classes/graduation.hpp index ec7ce24..e06e499 100644 --- a/src/know/classes/graduation.hpp +++ b/src/know/classes/graduation.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class graduation; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class graduation; + class event; +} class know::graduation { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~graduation() = default; + inline virtual ~graduation() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/group.hpp b/src/know/classes/group.hpp index a02ce5f..e961b6a 100644 --- a/src/know/classes/group.hpp +++ b/src/know/classes/group.hpp @@ -2,9 +2,36 @@ #pragma once -namespace know { class group; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "person.hpp" +#include "thing.hpp" + +namespace know { + class group; + class person; + class thing; +} class know::group { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~group() = default; + vector logos; + vector> members; + + inline virtual ~group() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->logos = this->logos; + clone->members = this->members; + return clone; + } }; diff --git a/src/know/classes/hindu_temple.hpp b/src/know/classes/hindu_temple.hpp index 6b31818..1705ef4 100644 --- a/src/know/classes/hindu_temple.hpp +++ b/src/know/classes/hindu_temple.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class hindu_temple; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "temple.hpp" + +namespace know { + class hindu_temple; + class temple; +} class know::hindu_temple { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~hindu_temple() = default; + inline virtual ~hindu_temple() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/holiday.hpp b/src/know/classes/holiday.hpp index ab541c4..3c0968c 100644 --- a/src/know/classes/holiday.hpp +++ b/src/know/classes/holiday.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class holiday; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class holiday; + class event; +} class know::holiday { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~holiday() = default; + inline virtual ~holiday() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/hospital.hpp b/src/know/classes/hospital.hpp index c6c12e9..ddb987b 100644 --- a/src/know/classes/hospital.hpp +++ b/src/know/classes/hospital.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class hospital; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class hospital; + class place; +} class know::hospital { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~hospital() = default; + inline virtual ~hospital() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/hotel.hpp b/src/know/classes/hotel.hpp index 0cfa477..641079f 100644 --- a/src/know/classes/hotel.hpp +++ b/src/know/classes/hotel.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class hotel; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class hotel; + class place; +} class know::hotel { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~hotel() = default; + inline virtual ~hotel() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/landmark.hpp b/src/know/classes/landmark.hpp index 33d86ac..3a966ac 100644 --- a/src/know/classes/landmark.hpp +++ b/src/know/classes/landmark.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class landmark; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class landmark; + class place; +} class know::landmark { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~landmark() = default; + inline virtual ~landmark() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/link.hpp b/src/know/classes/link.hpp index 3506366..f26ba35 100644 --- a/src/know/classes/link.hpp +++ b/src/know/classes/link.hpp @@ -2,9 +2,32 @@ #pragma once -namespace know { class link; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "thing.hpp" + +namespace know { + class link; + class thing; +} class know::link { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~link() = default; + string url; + + inline virtual ~link() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->url = this->url; + return clone; + } }; diff --git a/src/know/classes/meeting.hpp b/src/know/classes/meeting.hpp index 5dfcbc2..a9f6777 100644 --- a/src/know/classes/meeting.hpp +++ b/src/know/classes/meeting.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class meeting; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class meeting; + class event; +} class know::meeting { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~meeting() = default; + inline virtual ~meeting() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/meetup.hpp b/src/know/classes/meetup.hpp index 632c3a4..8d6cd1a 100644 --- a/src/know/classes/meetup.hpp +++ b/src/know/classes/meetup.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class meetup; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "meeting.hpp" + +namespace know { + class meetup; + class meeting; +} class know::meetup { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~meetup() = default; + inline virtual ~meetup() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/mosque.hpp b/src/know/classes/mosque.hpp index d13a4b9..028f7bd 100644 --- a/src/know/classes/mosque.hpp +++ b/src/know/classes/mosque.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class mosque; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "temple.hpp" + +namespace know { + class mosque; + class temple; +} class know::mosque { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~mosque() = default; + inline virtual ~mosque() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/nationality.hpp b/src/know/classes/nationality.hpp index eec7d4f..6620a9c 100644 --- a/src/know/classes/nationality.hpp +++ b/src/know/classes/nationality.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class nationality; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class nationality; + class group; +} class know::nationality { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~nationality() = default; + inline virtual ~nationality() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/organization.hpp b/src/know/classes/organization.hpp index 7e742a6..e0c6dc4 100644 --- a/src/know/classes/organization.hpp +++ b/src/know/classes/organization.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class organization; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "group.hpp" + +namespace know { + class organization; + class group; +} class know::organization { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~organization() = default; + inline virtual ~organization() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/party.hpp b/src/know/classes/party.hpp index e80bfd2..2b9a54d 100644 --- a/src/know/classes/party.hpp +++ b/src/know/classes/party.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class party; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class party; + class event; +} class know::party { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~party() = default; + inline virtual ~party() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/person.hpp b/src/know/classes/person.hpp index 07f6a99..3a611ba 100644 --- a/src/know/classes/person.hpp +++ b/src/know/classes/person.hpp @@ -2,9 +2,134 @@ #pragma once -namespace know { class person; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "birth.hpp" +#include "death.hpp" +#include "group.hpp" +#include "thing.hpp" + +namespace know { + class person; + class birth; + class death; + class group; + class thing; +} class know::person { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~person() = default; + vector accounts; + std::uint64_t age; + vector aliases; + vector> ancestors; + vector> aunts; + shared_ptr birth; + vector> brothers; + vector> children; + vector> colleagues; + vector> cousins; + vector> daughters; + shared_ptr death; + vector> descendants; + vector emails; + shared_ptr father; + vector> grandchildren; + vector> granddaughters; + vector> grandfathers; + vector> grandmothers; + vector> grandparents; + vector> grandsons; + vector honorifics; + vector> husbands; + vector> knows; + vector> member_ofs; + shared_ptr mother; + vector nationalities; + vector> nephews; + vector> niblings; + vector> nieces; + vector> parents; + vector> partners; + vector phones; + vector> piblings; + vector> relatives; + string sex; + vector> siblings; + vector> sisters; + vector> sons; + vector speaks; + vector> spouses; + vector> stepchildren; + vector> stepdaughters; + vector> stepfathers; + vector> stepmothers; + vector> stepparents; + vector> stepsons; + vector> uncles; + vector> wives; + + inline virtual ~person() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->accounts = this->accounts; + clone->age = this->age; + clone->aliases = this->aliases; + clone->ancestors = this->ancestors; + clone->aunts = this->aunts; + clone->birth = this->birth; + clone->brothers = this->brothers; + clone->children = this->children; + clone->colleagues = this->colleagues; + clone->cousins = this->cousins; + clone->daughters = this->daughters; + clone->death = this->death; + clone->descendants = this->descendants; + clone->emails = this->emails; + clone->father = this->father; + clone->grandchildren = this->grandchildren; + clone->granddaughters = this->granddaughters; + clone->grandfathers = this->grandfathers; + clone->grandmothers = this->grandmothers; + clone->grandparents = this->grandparents; + clone->grandsons = this->grandsons; + clone->honorifics = this->honorifics; + clone->husbands = this->husbands; + clone->knows = this->knows; + clone->member_ofs = this->member_ofs; + clone->mother = this->mother; + clone->nationalities = this->nationalities; + clone->nephews = this->nephews; + clone->niblings = this->niblings; + clone->nieces = this->nieces; + clone->parents = this->parents; + clone->partners = this->partners; + clone->phones = this->phones; + clone->piblings = this->piblings; + clone->relatives = this->relatives; + clone->sex = this->sex; + clone->siblings = this->siblings; + clone->sisters = this->sisters; + clone->sons = this->sons; + clone->speaks = this->speaks; + clone->spouses = this->spouses; + clone->stepchildren = this->stepchildren; + clone->stepdaughters = this->stepdaughters; + clone->stepfathers = this->stepfathers; + clone->stepmothers = this->stepmothers; + clone->stepparents = this->stepparents; + clone->stepsons = this->stepsons; + clone->uncles = this->uncles; + clone->wives = this->wives; + return clone; + } }; diff --git a/src/know/classes/place.hpp b/src/know/classes/place.hpp index 07d8743..5eb5eec 100644 --- a/src/know/classes/place.hpp +++ b/src/know/classes/place.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class place; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "thing.hpp" + +namespace know { + class place; + class thing; +} class know::place { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~place() = default; + inline virtual ~place() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/pub.hpp b/src/know/classes/pub.hpp index 9f4929a..4b0364a 100644 --- a/src/know/classes/pub.hpp +++ b/src/know/classes/pub.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class pub; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class pub; + class place; +} class know::pub { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~pub() = default; + inline virtual ~pub() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/restaurant.hpp b/src/know/classes/restaurant.hpp index db8e5fd..77c7281 100644 --- a/src/know/classes/restaurant.hpp +++ b/src/know/classes/restaurant.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class restaurant; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class restaurant; + class place; +} class know::restaurant { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~restaurant() = default; + inline virtual ~restaurant() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/school.hpp b/src/know/classes/school.hpp index d883927..9c49a81 100644 --- a/src/know/classes/school.hpp +++ b/src/know/classes/school.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class school; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class school; + class organization; +} class know::school { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~school() = default; + inline virtual ~school() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/synagogue.hpp b/src/know/classes/synagogue.hpp index 6519abb..de20f6b 100644 --- a/src/know/classes/synagogue.hpp +++ b/src/know/classes/synagogue.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class synagogue; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "temple.hpp" + +namespace know { + class synagogue; + class temple; +} class know::synagogue { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~synagogue() = default; + inline virtual ~synagogue() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/temple.hpp b/src/know/classes/temple.hpp index 455c90c..1a3d661 100644 --- a/src/know/classes/temple.hpp +++ b/src/know/classes/temple.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class temple; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class temple; + class place; +} class know::temple { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~temple() = default; + inline virtual ~temple() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/thing.hpp b/src/know/classes/thing.hpp index a0abc3f..ad6ae81 100644 --- a/src/know/classes/thing.hpp +++ b/src/know/classes/thing.hpp @@ -2,9 +2,42 @@ #pragma once -namespace know { class thing; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "link.hpp" + +namespace know { + class thing; + class link; +} class know::thing { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~thing() = default; + string glyph; + vector ids; + vector> links; + vector names; + vector notes; + vector photos; + + inline virtual ~thing() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + clone->glyph = this->glyph; + clone->ids = this->ids; + clone->links = this->links; + clone->names = this->names; + clone->notes = this->notes; + clone->photos = this->photos; + return clone; + } }; diff --git a/src/know/classes/university.hpp b/src/know/classes/university.hpp index f7cad5c..cf34c76 100644 --- a/src/know/classes/university.hpp +++ b/src/know/classes/university.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class university; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "organization.hpp" + +namespace know { + class university; + class organization; +} class know::university { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~university() = default; + inline virtual ~university() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/venue.hpp b/src/know/classes/venue.hpp index 78aa70b..353868c 100644 --- a/src/know/classes/venue.hpp +++ b/src/know/classes/venue.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class venue; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "place.hpp" + +namespace know { + class venue; + class place; +} class know::venue { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~venue() = default; + inline virtual ~venue() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } }; diff --git a/src/know/classes/wedding.hpp b/src/know/classes/wedding.hpp index 393be7f..6f97df4 100644 --- a/src/know/classes/wedding.hpp +++ b/src/know/classes/wedding.hpp @@ -2,9 +2,29 @@ #pragma once -namespace know { class wedding; } +#include // for std::uint64_t +#include // for std::time_t +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector + +#include "event.hpp" + +namespace know { + class wedding; + class event; +} class know::wedding { + using string = ::std::string; + template using shared_ptr = ::std::shared_ptr; + template using vector = ::std::vector; + public: - virtual ~wedding() = default; + inline virtual ~wedding() = default; + + inline virtual shared_ptr clone() const { + auto clone = std::make_shared(); + return clone; + } };