summary refs log tree commit diff stats
path: root/lib/frame.cpp
blob: 2a07e5fec8d1028acaa906f0f389228e4d1a3276 (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
#include "frame.h"
#include "database.h"
#include "query.h"

namespace verbly {

  const object frame::objectType = object::frame;

  const std::list<std::string> frame::select = {"frame_id", "group_id", "length"};

  const field frame::id = field::integerField(object::frame, "frame_id");
  const field frame::length = field::integerField(object::frame, "length");

  const field frame::words = field::joinField(object::frame, "group_id", object::word);

  field frame::parts()
  {
    return field::joinField(object::frame, "frame_id", object::part);
  }

  field frame::parts(int index)
  {
    return field::joinWhere(object::frame, "frame_id", object::part, "part_index", index);
  }

  frame::frame(const database& db, hatkirby::row row) : valid_(true)
  {
    id_ = std::get<int>(row[0]);
    groupId_ = std::get<int>(row[1]);
    length_ = std::get<int>(row[2]);

    parts_ = db.parts(*this, verbly::part::index, -1).all();
  }

};