61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
#include <utility>
|
|
|
|
#include "matador/object/schema_node.hpp"
|
|
|
|
namespace matador::object {
|
|
|
|
schema_node::schema_node(schema &tree)
|
|
: schema_(tree)
|
|
, info_(std::make_unique<null_info>(*this))
|
|
{}
|
|
|
|
std::string schema_node::name() const {
|
|
return name_;
|
|
}
|
|
|
|
std::type_index schema_node::type_index() const {
|
|
return info_->type_index();
|
|
}
|
|
|
|
void schema_node::append(const std::shared_ptr<schema_node> &sibling) {
|
|
sibling->parent_ = parent_;
|
|
|
|
// sibling->previous_sibling_ = this;
|
|
// sibling->next_sibling_ = next_sibling_;
|
|
// next_sibling_ = sibling;
|
|
// sibling->next_sibling_->previous_sibling_ = sibling;
|
|
// sibling->depth = depth;
|
|
|
|
// if (!parent_) {
|
|
// sibling->op_first = new object_proxy();
|
|
// sibling->op_last = sibling->op_marker = new object_proxy();
|
|
// sibling->op_first->link(sibling->op_last);
|
|
// } else {
|
|
// throw object_exception("failed to add node as sibling: node has no parent");
|
|
// }
|
|
}
|
|
|
|
void schema_node::insert(const std::shared_ptr<schema_node> &child) {
|
|
// child->parent_ = this;
|
|
// child->previous_sibling_ = last_child_->previous_sibling_;
|
|
// child->next_sibling_ = last_child_;
|
|
// last_child_->previous_sibling_->next_sibling_ = child;
|
|
// last_child_->previous_sibling_ = child;
|
|
// set depth
|
|
// child->depth = depth + 1;
|
|
// set object proxy pointer
|
|
// 1. first
|
|
// if (op_first->next() == op_last) {
|
|
// // node hasn't any serializable (proxy)
|
|
// child->op_first = op_first;
|
|
// } else {
|
|
// // node has some objects (proxy)
|
|
// child->op_first = op_last->prev();
|
|
// }
|
|
// // 2. marker
|
|
// child->op_marker = op_last;
|
|
// // 3. last
|
|
// child->op_last = op_last;
|
|
}
|
|
}
|