chris-website/source/project.d

47 lines
1.2 KiB
D

import std.array;
import std.algorithm;
import dyaml;
import vibe.vibe;
import page;
import utils;
/**
* Represents a project, like an unfinished application
*/
class Project : Page {
protected string m_state;
protected string[] m_platforms;
protected string[] m_technologies;
protected string m_icon;
protected string[] m_images;
/**
* Creates a project from a file
*/
this(string file) {
super(file);
}
@safe
override protected void loadHeader(Node headerNode) {
super.loadHeader(headerNode);
this.m_state = headerNode.getOr!string("state", "unknown");
this.m_platforms = headerNode.getOr!(Node[])("platforms", [])
.map!(x => x.get!string).array;
this.m_technologies = headerNode.getOr!(Node[])("technologies", [])
.map!(x => x.get!string).array;
this.m_icon = headerNode.getOr!string("icon", "");
this.m_images = headerNode.getOr!(Node[])("images", [])
.map!(x => x.get!string).array;
}
@property string state() { return m_state; }
@property string[] platforms() { return m_platforms; }
@property string[] technologies() { return m_technologies; }
@property string icon() { return m_icon; }
@property string[] images() { return m_images; }
}