summary refs log tree commit diff stats
path: root/lib/data.cpp
blob: 5a9397bb421d6c15439e4f0fbe77c1097073361c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "verbly.h"

namespace verbly {

  data::data(std::string datafile)
  {
    if (sqlite3_open_v2(datafile.c_str(), &ppdb, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK)
    {
      throw std::invalid_argument(sqlite3_errmsg(ppdb));
    }
  }

  data::data(data&& other)
  {
    ppdb = other.ppdb;
  }

  data& data::operator=(data&& other)
  {
    ppdb = other.ppdb;
  
    return *this;
  }

  data::~data()
  {
    sqlite3_close_v2(ppdb);
  }

  verb_query data::verbs() const
  {
    return verb_query(*this);
  }

  adjective_query data::adjectives() const
  {
    return adjective_query(*this);
  }

  adverb_query data::adverbs() const
  {
    return adverb_query(*this);
  }

  noun_query data::nouns() const
  {
    return noun_query(*this);
  }
  
  frame_query data::frames() const
  {
    return frame_query(*this);
  }
  
  preposition_query data::prepositions() const
  {
    return preposition_query(*this);
  }
  
};