12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using Invercargill;
- using Invercargill.Convert;
- using Gee;
- namespace Ppub {
- public class Asset {
- public string name {get; set;}
- public string mimetype {get; set;}
- public uint64 start_location {get; set;}
- public uint64 end_location {get; set;}
- public uint64 size {
- get {
- return end_location - start_location;
- }
- }
- public Vector<string> flags {get; set;}
- public Asset.from_string(string line) {
- var key_value = line.split(": ");
- name = key_value[0];
- var data = key_value[1].split(" ");
- mimetype = data[0];
- start_location = int.parse (data[1]);
- end_location = int.parse (data[2]);
- flags = ate(data).skip(3).to_vector();
- }
- public string to_string() {
- var str = @"$name: $mimetype $start_location $end_location";
- foreach (var flag in flags) {
- str += @" $flag";
- }
- str += "\n";
- return str;
- }
- }
- }
|