HatchKeeper  0.90
The Free Open-Source Egg Incubation Software
HK_Documents.cpp
Go to the documentation of this file.
1 /******************************************************************/
8 #include "../headers/Documents.h"
9 
12 
15 {
19 
20  return ExportHKBF(Filename,Batches,Groups,Types, Breeds, Schedules);
21 }
22 
23 
26 {
27  tinyxml2::XMLDocument doc;
28 
29  tinyxml2::XMLNode * root = doc.NewElement("HatchKeeper");
30 
31  doc.InsertFirstChild(root);
32 
33  //App Data
34  HK_Info info;
35  tinyxml2::XMLElement * tmp = doc.NewElement("Version");
36  tmp->SetText(info.GetVersion().c_str());
37  root->InsertEndChild(tmp);
38 
39 
40  //Check For Batches
41  if(Batches.GetCount() > 0) {
42  //Number Of Batches
43  tinyxml2::XMLElement * batchNum = doc.NewElement("Batches");
44  batchNum->SetAttribute("Count",Batches.GetCount());
45  root->InsertEndChild(batchNum);
46 
47  //Batch Data
48  for(int a = 0; a < Batches.GetCount(); a++) {
49  //Create A New Batch
50  tinyxml2::XMLElement * batchdata = doc.NewElement("Batch");
51  batchNum->InsertEndChild(batchdata);
52 
53  //Name
54  tmp = doc.NewElement("Name");
55  tmp->SetText(Batches.GetName(a).c_str());
56  batchdata->InsertEndChild(tmp);
57 
58  //Type
59  tmp = doc.NewElement("Type");
60  tmp->SetText(Batches.GetType(a).c_str());
61  batchdata->InsertEndChild(tmp);
62 
63  //Breed
64  tmp = doc.NewElement("Breed");
65  tmp->SetText(Batches.GetBreed(a).c_str());
66  batchdata->InsertEndChild(tmp);
67 
68  //Eggs
69  tmp = doc.NewElement("Eggs");
70  tmp->SetText(Batches.GetEggs(a));
71  batchdata->InsertEndChild(tmp);
72 
73  //Fertile
74  tmp = doc.NewElement("Fertile");
75  tmp->SetText(Batches.GetFertile(a));
76  batchdata->InsertEndChild(tmp);
77 
78  //Chicks
79  tmp = doc.NewElement("Chicks");
80  tmp->SetText(Batches.GetChicks(a));
81  batchdata->InsertEndChild(tmp);
82 
83  //Comments
84  tmp = doc.NewElement("Comments");
85  tmp->SetText(Batches.GetComments(a).c_str());
86  batchdata->InsertEndChild(tmp);
87 
88  //Incubator
89  tmp = doc.NewElement("Incubator");
90  tmp->SetText(Batches.GetIncubator(a).c_str());
91  batchdata->InsertEndChild(tmp);
92 
93  //Group
94  tmp = doc.NewElement("Group");
95  tmp->SetText(Batches.GetGroup(a).c_str());
96  batchdata->InsertEndChild(tmp);
97 
98  //Start Date
99  tmp = doc.NewElement("Start");
100  tmp->SetText(Batches.GetStart(a).ToSortable("/").c_str());
101  batchdata->InsertEndChild(tmp);
102 
103  //Candle Date
104  tmp = doc.NewElement("Candle");
105  tmp->SetText(Batches.GetCandle(a).ToSortable("/").c_str());
106  batchdata->InsertEndChild(tmp);
107 
108  //Lockdown Date
109  tmp = doc.NewElement("Lockdown");
110  tmp->SetText(Batches.GetLockdown(a).ToSortable("/").c_str());
111  batchdata->InsertEndChild(tmp);
112 
113  //Hatch Date
114  tmp = doc.NewElement("Hatch");
115  tmp->SetText(Batches.GetHatch(a).ToSortable("/").c_str());
116  batchdata->InsertEndChild(tmp);
117 
118  //Adv Status
119  tmp = doc.NewElement("Adv");
120  tmp->SetText(Batches.GetAdv(a));
121  batchdata->InsertEndChild(tmp);
122 
123  if(Batches.GetAdv(a) == 1) {
124 
125  //Get Advanced Data
126  HK_Advanced AdvData = Batches.GetAdvanced(a);
127 
128  //Create Advanced Tag
129  tinyxml2::XMLElement * advanced = doc.NewElement("Advanced");
130  advanced->SetAttribute("EggCount", AdvData.GetEggCount());
131  advanced->SetAttribute("WeightUnit", AdvData.GetUnit());
132  batchdata->InsertEndChild(advanced);
133 
134  for(int b = 0; b < AdvData.GetEggCount(); b++) {
135  //Egg Tag
136  tinyxml2::XMLElement * egg = doc.NewElement("Egg");
137  advanced->InsertEndChild(egg);
138 
139  //Tags
140  tmp = doc.NewElement("Tag1");
141  tmp->SetText(AdvData.GetEgg(b).GetTag1().c_str());
142  egg->InsertEndChild(tmp);
143 
144  tmp = doc.NewElement("Tag2");
145  tmp->SetText(AdvData.GetEgg(b).GetTag2().c_str());
146  egg->InsertEndChild(tmp);
147 
148  tmp = doc.NewElement("Tag3");
149  tmp->SetText(AdvData.GetEgg(b).GetTag3().c_str());
150  egg->InsertEndChild(tmp);
151 
152  //Fertile Status
153  tmp = doc.NewElement("Fertile");
154  tmp->SetText(AdvData.GetEgg(b).GetFertile());
155  egg->InsertEndChild(tmp);
156 
157  //Pipped Status
158  tmp = doc.NewElement("Pipped");
159  tmp->SetText(AdvData.GetEgg(b).GetPipped());
160  egg->InsertEndChild(tmp);
161 
162  //Result
163  tmp = doc.NewElement("Result");
164  tmp->SetText(AdvData.GetEgg(b).GetResult());
165  egg->InsertEndChild(tmp);
166 
167  //Result Date
168  tmp = doc.NewElement("Date");
169  tmp->SetText(AdvData.GetEgg(b).GetDate().ToSortable("/").c_str());
170  egg->InsertEndChild(tmp);
171 
172  //Comments
173  tmp = doc.NewElement("Comments");
174  tmp->SetText(AdvData.GetEgg(b).GetComments().c_str());
175  egg->InsertEndChild(tmp);
176 
177  //Days
178  tinyxml2::XMLElement * days = doc.NewElement("Days");
179  days->SetAttribute("DayCount", AdvData.GetEgg(b).GetDays());
180  egg->InsertEndChild(days);
181 
182  for(int c = 0; c < AdvData.GetEgg(b).GetDays(); c++) {
183  vector<HK_Weight> weights = AdvData.GetEgg(b).GetDayWeight();
184  vector<string> comms = AdvData.GetEgg(b).GetDayComments();
185 
186  //Create Day Tag
187  tinyxml2::XMLElement * day = doc.NewElement("Day");
188  days->InsertEndChild(day);
189 
190  //Day Weight
191  tmp = doc.NewElement("Weight");
192  tmp->SetText(weights[c].GetString().c_str());
193  day->InsertEndChild(tmp);
194 
195  //Day Comments
196  tmp = doc.NewElement("Comments");
197  tmp->SetText(comms[c].c_str());
198  day->InsertEndChild(tmp);
199  }
200  }
201  }
202  }
203  }
204 
205  //Group Info
206  if(Groups.GetCount() > 0) {
207  tinyxml2::XMLElement * grps = doc.NewElement("Groups");
208  root->InsertEndChild(grps);
209 
210  for(int a = 0; a < Groups.GetCount(); a++) {
211  tinyxml2::XMLElement * grp = doc.NewElement("Group");
212  grp->SetAttribute("Comments",Groups.GetText(a).c_str());
213  grp->SetText(Groups.GetName(a).c_str());
214  grps->InsertEndChild(grp);
215  }
216  }
217 
218  //Type Info
219  if(Types.GetCount() > 0) {
220  tinyxml2::XMLElement * typs = doc.NewElement("Types");
221  root->InsertEndChild(typs);
222 
223  for(int a = 0; a < Types.GetCount(); a++) {
224  tinyxml2::XMLElement * typ = doc.NewElement("Type");
225  typ->SetAttribute("Days",to_string(Types.GetNumber(a)).c_str());
226  typ->SetText(Types.GetName(a).c_str());
227  typs->InsertEndChild(typ);
228  }
229  }
230 
231  //Breed Info
232  if(Breeds.GetCount() > 0) {
233  tinyxml2::XMLElement * bres = doc.NewElement("Breeds");
234  root->InsertEndChild(bres);
235 
236  for(int a = 0; a < Breeds.GetCount(); a++) {
237  tinyxml2::XMLElement * bre = doc.NewElement("Breed");
238  bre->SetAttribute("Type",Breeds.GetText(a).c_str());
239  bre->SetAttribute("Days",Breeds.GetNumber(a));
240  bre->SetText(Breeds.GetName(a).c_str());
241  bres->InsertEndChild(bre);
242  }
243  }
244 
245  //Schedules Info
246  if(Schedules.GetCount() > 0) {
247  tinyxml2::XMLElement * schs = doc.NewElement("Schedules");
248  root->InsertEndChild(schs);
249 
250  for(int a = 0; a < Schedules.GetCount(); a++) {
251  tinyxml2::XMLElement * sch = doc.NewElement("Schedule");
252  sch->SetAttribute("Date",Schedules.GetDate(a).ToSortable("/").c_str());
253  sch->SetText(Schedules.GetName(a).c_str());
254  schs->InsertEndChild(sch);
255  }
256  }
257 
258 
259  if(doc.SaveFile(Filename.c_str()) != tinyxml2::XML_SUCCESS)
260  return false;
261  return true;
262 }
263 
272 {
273  string path,line;
274  int version,BNumber,count1, Int1, Int2, Int3,a;
275  string tenStars = "**********",GName, GComment, Str1;
276  HK_Batch Batch;
277  HK_Date Date;
278  vector<string> SQL;
279 
280  //Setup tinyxml
281  tinyxml2::XMLDocument doc;
282 
283  if(doc.LoadFile(Filename.c_str()) == tinyxml2::XML_SUCCESS) {
284  tinyxml2::XMLNode * root = doc.FirstChildElement("HatchKeeper");
285 
286  if(root == nullptr)
287  return SQL;
288 
289  tinyxml2::XMLElement * version = root->FirstChildElement("Version");
290  int ver;
291  version->QueryIntText(&ver);
292 
293  tinyxml2::XMLElement * batches = root->FirstChildElement("Batches");
294 
295  //Check For Batches To Import
296  if(batches != nullptr) {
297  for(tinyxml2::XMLElement * batch = batches->FirstChildElement("Batch"); batch != NULL; batch = batch->NextSiblingElement()) {
298  HK_Batch Batch;
299 
300  //Name
301  tinyxml2::XMLElement * tmp = batch->FirstChildElement("Name");
302 
303  if(Batches->IsValidName(tmp->GetText()))
304  Batch.SetName(tmp->GetText());
305  else
306  continue;
307 
308  //Set ID
309  Batch.SetID(Batches->GetValidID());
310 
311  //Type
312  tmp = batch->FirstChildElement("Type");
313  Batch.SetType(tmp->GetText());
314 
315  //Breed
316  tmp = batch->FirstChildElement("Breed");
317  Batch.SetBreed(tmp->GetText());
318 
319  //Eggs
320  int eggs;
321  tmp = batch->FirstChildElement("Eggs");
322  tmp->QueryIntText(&eggs);
323  Batch.SetEggs(eggs);
324 
325  //Fertile
326  int fertile;
327  tmp = batch->FirstChildElement("Fertile");
328  tmp->QueryIntText(&fertile);
329  Batch.SetFertile(fertile);
330 
331  //Chicks
332  int chicks;
333  tmp = batch->FirstChildElement("Chicks");
334  tmp->QueryIntText(&chicks);
335  Batch.SetChicks(chicks);
336 
337  //Comments
338  tmp = batch->FirstChildElement("Comments");
339  Batch.SetComments(tmp->GetText());
340 
341  //Incubator
342  tmp = batch->FirstChildElement("Incubator");
343  Batch.SetIncubator(tmp->GetText());
344 
345  //Group
346  tmp = batch->FirstChildElement("Group");
347  Batch.SetGroup(tmp->GetText());
348 
349  //Start Date
350  tmp = batch->FirstChildElement("Start");
351  Batch.SetStart(HK_Date(tmp->GetText()));
352 
353  //Candle Date
354  tmp = batch->FirstChildElement("Candle");
355  Batch.SetCandle(HK_Date(tmp->GetText()));
356 
357  //Lockdown Date
358  tmp = batch->FirstChildElement("Lockdown");
359  Batch.SetLockdown(HK_Date(tmp->GetText()));
360 
361  //Hatch Date
362  tmp = batch->FirstChildElement("Hatch");
363  Batch.SetHatch(HK_Date(tmp->GetText()));
364 
365  //Adv Status
366  int advStat;
367  tmp = batch->FirstChildElement("Adv");
368  tmp->QueryIntText(&advStat);
369  Batch.SetAdv(advStat);
370 
371  //Advanced Data
372  if(advStat == 1) {
373 
374  HK_Advanced Adv;
375  HK_Egg Egg;
376 
377  tinyxml2::XMLElement * advanced = batch->FirstChildElement("Advanced");
378  Adv.SetUnit(advanced->IntAttribute("WeightUnit",0));
379 
380  for(tinyxml2::XMLElement * egg = advanced->FirstChildElement("Egg"); egg != NULL; egg = egg->NextSiblingElement()) {
381 
382  //Tags
383  tmp = egg->FirstChildElement("Tag1");
384  Egg.SetTag1(tmp->GetText());
385 
386  tmp = egg->FirstChildElement("Tag2");
387  Egg.SetTag2(tmp->GetText());
388 
389  tmp = egg->FirstChildElement("Tag3");
390  Egg.SetTag3(tmp->GetText());
391 
392  //Result Date
393  tmp = egg->FirstChildElement("Date");
394  Egg.SetDate(HK_Date(tmp->GetText()));
395 
396  //Comments
397  tmp = egg->FirstChildElement("Comments");
398  Egg.SetComments(tmp->GetText());
399 
400  int tempInt;
401 
402  //Fertile Status
403  tmp = egg->FirstChildElement("Fertile");
404  tmp->QueryIntText(&tempInt);
405  Egg.SetFertile(tempInt);
406 
407  //Pipped Status
408  tmp = egg->FirstChildElement("Pipped");
409  tmp->QueryIntText(&tempInt);
410  Egg.SetPipped(tempInt);
411 
412  //Result
413  tmp = egg->FirstChildElement("Result");
414  tmp->QueryIntText(&tempInt);
415  Egg.SetResult(tempInt);
416 
417  //Days
418  tinyxml2::XMLElement * days = egg->FirstChildElement("Days");
419 
420  HK_Weight tmpWeight;
421  vector<HK_Weight> weights;
422  vector<string> comms;
423 
424  for(tinyxml2::XMLElement * day = days->FirstChildElement("Day"); day != NULL; day = day->NextSiblingElement()) {
425  tmp = day->FirstChildElement("Weight");
426  tmpWeight.Set(tmp->GetText());
427  weights.push_back(tmpWeight);
428 
429  tmp = day->FirstChildElement("Comments");
430  comms.push_back(tmp->GetText());
431  }
432 
433  Egg.SetDayWeight(weights);
434  Egg.SetDayComments(comms);
435  weights.clear();
436  comms.clear();
437 
438  Adv.AddEgg(Egg);
439  }
440  Adv.SetID(Batch.GetID());
441  Batch.SetAdvanced(Adv);
442  }
443  vector<string> tempSQL = Batch.GetSQL();
444  SQL.insert(SQL.end(),tempSQL.begin(),tempSQL.end());
445  Batches->Add(Batch);
446  }
447  }
448 
449  //Import Group(s)
450  tinyxml2::XMLElement * grps = root->FirstChildElement("Groups");
451  if(grps != nullptr) {
452  for(tinyxml2::XMLElement * grp = grps->FirstChildElement("Group"); grp != NULL; grp = grp->NextSiblingElement("Group")) {
453  if(!Groups->IsValidName(grp->GetText()))
454  continue; //Skip
455 
456  int id = Groups->GetValidID();
457  Groups->Add(grp->GetText(),id,grp->Attribute("Comments",0));
458  SQL.push_back("INSERT INTO Groups VALUES(" + to_string(id) + ",'" + grp->GetText() + "','"+grp->Attribute("Comments",0) +"');");
459  }
460  }
461 
462  //Import Types
463  tinyxml2::XMLElement * typs = root->FirstChildElement("Types");
464  if(typs != nullptr) {
465  for(tinyxml2::XMLElement * typ = typs->FirstChildElement("Type"); typ != NULL; typ = typ->NextSiblingElement("Type")) {
466 
467  if(!Types->IsValidName(typ->GetText()))
468  continue; //Skip
469 
470  int id = Types->GetValidID();
471 
472  Types->Add(typ->GetText(),id,typ->Attribute("Days",0));
473 
474  SQL.push_back("INSERT INTO Types VALUES(" + to_string(id) + ",'"+ typ->GetText() +"',"+ typ->Attribute("Days",0) +");");
475  }
476  }
477 
478  //Import Breeds
479  tinyxml2::XMLElement * brds = root->FirstChildElement("Breeds");
480  if(typs != nullptr) {
481  for(tinyxml2::XMLElement * brd = brds->FirstChildElement("Breed"); brd != NULL; brd = brd->NextSiblingElement("Breed")) {
482 
483  if(!Breeds->IsValidName(brd->GetText()))
484  continue; //Skip
485 
486  int id = Breeds->GetValidID();
487 
488  Breeds->Add(brd->GetText(),id,brd->Attribute("Type",0),brd->IntAttribute("Days",0));
489 
490  SQL.push_back("INSERT INTO Breeds VALUES(" + to_string(id) + ",'"+ brd->GetText() +"','"+ brd->Attribute("Type",0) +"',"+ brd->Attribute("Days",0) +" );");
491  }
492  }
493 
494  //Import Schedules
495  tinyxml2::XMLElement * schs = root->FirstChildElement("Schedules");
496  if(typs != nullptr) {
497  for(tinyxml2::XMLElement * sch = schs->FirstChildElement("Schedule"); sch != NULL; sch = sch->NextSiblingElement("Schedule")) {
498 
499  if(!Schedules->IsValidName(sch->GetText()))
500  continue; //Skip
501 
502  int id = Schedules->GetValidID();
503 
504  Schedules->Add(sch->GetText(),id,sch->Attribute("Date",0));
505 
506  SQL.push_back("INSERT INTO Schedules VALUES(" + to_string(id) + ",'"+ sch->GetText() +"',"+ sch->Attribute("Date",0) +");");
507  }
508  }
509  }
510  else {
511  //Legacy Code
512  streambuf *cinBackup = cin.rdbuf();
513  ifstream inFile(Filename.c_str());
514 
515  if(inFile.fail()) {
516  cout<<"Log: Error Reading .hkbf File!"<<endl;
517  return SQL;
518  }
519  else
520  cout<<"Log: Reading .hkbf File: "<<Filename<<endl;
521 
522  cin.rdbuf(inFile.rdbuf());
523 
524  cin>>version;
525 
526  switch(version) {
527  case 70: {
528 
529  a = 0;
530  while(a < 2) {
531  getline(cin, Str1);
532  a++;
533  }
534  Batch.SetName(Str1);
535 
536  cin>>Int1;
537  Batch.SetEggs(Int1);
538 
539  a = 0;
540  while(a < 2) {
541  getline(cin, Str1);
542  a++;
543  }
544  Batch.SetType(Str1);
545 
546  cin>>Int1>>Int2>>Int3;
547  Date.SetDate(Int1, Int2, Int3);
548  Batch.SetStart(Date);
549 
550  cin>>Int1>>Int2>>Int3;
551  Date.SetDate(Int1, Int2, Int3);
552  Batch.SetCandle(Date);
553 
554  cin>>Int1>>Int2>>Int3;
555  Date.SetDate(Int1, Int2, Int3);
556  Batch.SetLockdown(Date);
557 
558  cin>>Int1>>Int2>>Int3;
559  Date.SetDate(Int1, Int2, Int3);
560  Batch.SetHatch(Date);
561 
562  cin>>Int1;
563  Batch.SetFertile(Int1);
564 
565  cin>>Int1;
566  Batch.SetChicks(Int1);
567 
568  a = 0;
569  while(a < 2) {
570  getline(cin, Str1);
571  a++;
572  }
573  Batch.SetBreed(Str1);
574 
575  Str1 = "";
576  while(getline(cin, line)) {
577  if(a == 0) {
578  a++;
579  continue;
580  }
581  Str1 += line + "\n";
582  }
583 
584  Batch.SetComments(Str1);
585  Batch.SetGroup("None");
586  Batch.SetRemind(0);
587  Batch.SetAdv(0);
588  Batch.SetID(Batches->GetValidID());
589  Batches->Add(Batch);
590  vector<string> tempSQL = Batch.GetSQL();
591  SQL.insert(SQL.end(),tempSQL.begin(),tempSQL.end());
592  break;
593  }
594  case 80: {
595  cin>>BNumber;
596 
597  if(BNumber == 1) {
598  //A One Batch File
599  a = 0;
600  while(a < 2) { getline(cin, Str1);a++;}
601  Batch.SetName(Str1);
602 
603  cin>>Int1;
604  Batch.SetEggs(Int1);
605 
606  a = 0;
607  while(a < 2){ getline(cin, Str1);a++; }
608  Batch.SetType(Str1);
609 
610  cin>>Int1>>Int2>>Int3;
611  Date.SetDate(Int1, Int2, Int3);
612  Batch.SetStart(Date);
613 
614  cin>>Int1>>Int2>>Int3;
615  Date.SetDate(Int1, Int2, Int3);
616  Batch.SetCandle(Date);
617 
618  cin>>Int1>>Int2>>Int3;
619  Date.SetDate(Int1, Int2, Int3);
620  Batch.SetLockdown(Date);
621 
622  cin>>Int1>>Int2>>Int3;
623  Date.SetDate(Int1, Int2, Int3);
624  Batch.SetHatch(Date);
625 
626  cin>>Int1;
627  Batch.SetFertile(Int1);
628 
629  cin>>Int1;
630  Batch.SetChicks(Int1);
631 
632  a = 0;
633  while(a < 2){ getline(cin, Str1); a++; }
634  Batch.SetBreed(Str1);
635 
636  a = 0;
637  while(a < 1){ getline(cin, Str1); a++; }
638  Batch.SetGroup(Str1);
639 
640 
641  Str1 = "";
642  while(getline(cin, line)){ Str1 += line + "\n"; }
643  Batch.SetComments(Str1);
644 
645  Batch.SetRemind(0);
646  Batch.SetAdv(0);
647 
648  Batch.SetID(Batches->GetValidID());
649  Batches->Add(Batch);
650  vector<string> tempSQL = Batch.GetSQL();
651  SQL.insert(SQL.end(),tempSQL.begin(),tempSQL.end());
652  break;
653  }
654  else {
655  //Import A Group Of Batches
656 
657  a = 0;
658  while(a < 2){ getline(cin, GName); a++; }
659 
660  for(count1 = 0; count1 < BNumber;count1++) {
661 
662  getline(cin, Str1);
663  if(Batches->IsValidName(Str1))
664  Batch.SetName(Str1);
665  else
666  Batch.SetName(Str1 + "_Imported");
667 
668  cin>>Int1;
669  Batch.SetEggs(Int1);
670 
671  a = 0;
672  while(a < 2){ getline(cin, Str1);a++; }
673  Batch.SetType(Str1);
674 
675  cin>>Int1>>Int2>>Int3;
676  Date.SetDate(Int1, Int2, Int3);
677  Batch.SetStart(Date);
678 
679  cin>>Int1>>Int2>>Int3;
680  Date.SetDate(Int1, Int2, Int3);
681  Batch.SetCandle(Date);
682 
683  cin>>Int1>>Int2>>Int3;
684  Date.SetDate(Int1, Int2, Int3);
685  Batch.SetLockdown(Date);
686 
687  cin>>Int1>>Int2>>Int3;
688  Date.SetDate(Int1, Int2, Int3);
689  Batch.SetHatch(Date);
690 
691  cin>>Int1;
692  Batch.SetFertile(Int1);
693 
694  cin>>Int1;
695  Batch.SetChicks(Int1);
696 
697  a = 0;
698  while(a < 2){ getline(cin, Str1); a++; }
699  Batch.SetBreed(Str1);
700 
701  getline(cin, Str1);
702  Batch.SetGroup(Str1);
703 
704  Str1 = "";
705  a = 0;
706  while(getline(cin, line)) {
707  if(a == 0) {
708  a++;
709  continue;
710  }
711  if(line == tenStars)
712  break;
713 
714  Str1 += line + "\n";
715  }
716  Batch.SetComments(Str1);
717 
718  Batch.SetRemind(0);
719  Batch.SetAdv(0);
720  Batch.SetID(Batches->GetValidID());
721  Batches->Add(Batch);
722  vector<string> tempSQL = Batch.GetSQL();
723  SQL.insert(SQL.end(),tempSQL.begin(),tempSQL.end());
724  }
725 
726  //Get Group Comments
727  while(getline(cin, line)) {
728  if(line == tenStars)
729  break;
730 
731  GComment += line + "\n";
732  }
733 
734  if(!Groups->IsValidName(GName))
735  break; //Skip
736 
737  int id = Groups->GetValidID();
738  Groups->Add(GName,id,GComment);
739  SQL.push_back("INSERT INTO Groups VALUES(" + to_string(id) + ",'" + GName + "','" + GComment + "');");
740  }
741  break;
742  }
743  }
744  cin.rdbuf(cinBackup);
745  inFile.close();
746 
747  return SQL;
748  }
749 }
750 
753 {
754  //Dates
755  HK_Date S = Batch.GetStart();
756  HK_Date C = Batch.GetCandle();
757  HK_Date L = Batch.GetLockdown();
758  HK_Date H = Batch.GetHatch();
759 
760  string Report = "\t" + Batch.GetName() + "\n\n" \
761  "Type:..................." + Batch.GetType() + "\n\n" \
762  "Breed:.................." + Batch.GetBreed() + "\n\n" \
763  "Start Date:............." + S.ToReadable("/",Settings.GetInt("DateMode")) + "\n" \
764  "Candle Date:............" + C.ToReadable("/",Settings.GetInt("DateMode")) + "\n" \
765  "Lockdown:..............." + L.ToReadable("/",Settings.GetInt("DateMode")) + "\n" \
766  "Hatch Date:............." + H.ToReadable("/",Settings.GetInt("DateMode")) + "\n\n" \
767  "Number Of Eggs:........." + to_string(Batch.GetEggs()) + "\n\n" \
768  "Number Fertile:........." + to_string(Batch.GetFertile()) + "\n" \
769  "Percent Were Fertile:..." + to_string(Batch.PercentFertile()) + "%\n\n" \
770  "Chicks Hatched:........." + to_string(Batch.GetChicks()) + "\n" \
771  "Percent of Total:......." + to_string(Batch.PercentOfTotal()) + "%\n" \
772  "Unhatched of Total:....." + to_string(Batch.PercentOfTotalUnhatched()) + "%\n" \
773  "Percent of Fertile:....." + to_string(Batch.PercentOfFertile()) + "%\n\n" \
774  "\nComments:\n" + Batch.GetComments();
775 
776  if(Batch.GetAdv() == 1) {
777  HK_Advanced Adv = Batch.GetAdvanced();
778  HK_Egg Egg;
779 
780  Report += "\n\n********************************************************\n" \
781  "Egg Data For " + Batch.GetName() + "\n" \
782  "********************************************************\n\n";
783 
784  vector<string> Tag1 = Settings.GetArray("Tag1");
785  vector<string> Tag2 = Settings.GetArray("Tag2");
786  vector<string> Tag3 = Settings.GetArray("Tag3");
787 
788  for(int A = 0; A < Batch.GetEggs(); A++){
789  Egg = Adv.GetEgg(A);
790 
791  Report += "Egg " + to_string(A+1) + ":\n\n";
792 
793  //Tags
794  if(Tag1[0] == Egg.GetTag1())
795  Report += Tag1[0] + " : Not Set\n";
796  else
797  Report += Tag1[0] + " : " + Egg.GetTag1() + "\n";
798 
799  if(Tag2[0] == Egg.GetTag2())
800  Report += Tag2[0] + " : Not Set\n";
801  else
802  Report += Tag2[0] + " : " + Egg.GetTag2() + "\n";
803 
804  if(Tag3[0] == Egg.GetTag3())
805  Report += Tag3[0] + " : Not Set\n";
806  else
807  Report += Tag3[0] + " : " + Egg.GetTag3() + "\n";
808 
809  //Fertile/Pipped
810  if(Egg.GetFertile() == 0)
811  Report += "Fertile: False\n";
812  else
813  Report += "Fertile: True\n";
814 
815  if(Egg.GetPipped() == 0)
816  Report += "Pipped: False\n\n";
817  else
818  Report += "Pipped: True\n\n";
819 
820 
821  //Result
822  if(Egg.GetResult() == -1){
823  Report += "Unknown Result: " + Egg.GetDate().ToReadable("/",Settings.GetInt("DateMode")) + "\n\n";
824  }else if(Egg.GetResult() == 0){
825  Report += "Hatched: " + Egg.GetDate().ToReadable("/",Settings.GetInt("DateMode")) + "\n\n";
826  }else
827  Report += "Quit: " + Egg.GetDate().ToReadable("/",Settings.GetInt("DateMode")) + "\n\n";
828 
829  //Egg Comments
830  Report += "Egg Comments:\n" + Egg.GetComments() + "\n\n";
831 
832  //Days
833  Report += "Day: Weight: % Lost: Comments\n" \
834  "________________________________________________________\n";
835 
836  for(int Day = 0; Day < Egg.GetDays(); Day++) {
837  Report += to_string(Day + 1) + " " + Egg.GetDayWeight()[Day].GetString();
838  if(Batch.GetAdvanced().GetUnit() == 0)
839  Report += "oz";
840  else
841  Report += "g ";
842  Report += " " + to_string(Egg.CalcDayLoss(Day));
843  Report += "% " + Egg.GetDayComments()[Day] + "\n";
844  Report += "________________________________________________________\n";
845  }
846  Report += "Total % Weight Lost: " + to_string(Egg.CalcTotalLoss()) + "%\n\n";
847 
848  }
849  Report += "Avg % Weight Loss For All Eggs In Batch: " + to_string(Adv.CalcAvgLoss()) + "%\n\n";
850  }
851 
852  return Report;
853 }
854 
857 {
858  //Border And Layout
859  string HTML = "<table border='10' width='100%'><tr><td width='50%'>";
860  HTML += "<table style='width:100%;'>";
861  HTML += "<tr><td>Name</td><td>" + Batch.GetName() + "</td></tr>";
862  HTML += "<tr><td>Type</td><td>" + Batch.GetType() + "</td></tr>";
863  HTML += "<tr><td>Breed</td><td>" + Batch.GetBreed() + "</td></tr>";
864  HTML += "<tr><td><hr/></td><td><hr/></td></tr>";
865  HTML += "<tr><td>Start Date</td><td>" + Batch.GetStart().ToReadable("/",Settings.GetInt("DateMode")) + "</td></tr>";
866  HTML += "<tr><td>Candle Date</td><td>" + Batch.GetCandle().ToReadable("/",Settings.GetInt("DateMode")) + "</td></tr>";
867  HTML += "<tr><td>Lockdown</td><td>" + Batch.GetLockdown().ToReadable("/",Settings.GetInt("DateMode")) + "</td></tr>";
868  HTML += "<tr><td>Hatch Date</td><td>" + Batch.GetHatch().ToReadable("/",Settings.GetInt("DateMode")) + "</td></tr>";
869  HTML += "<tr><td><hr/></td><td><hr/></td></tr>";
870  HTML += "<tr><td>Number Of Eggs</td><td>" + to_string(Batch.GetEggs()) + "</td></tr>";
871  HTML += "<tr><td>Number Fertile</td><td>" + to_string(Batch.GetFertile()) + "</td></tr>";
872  HTML += "<tr><td>% Were Fertile</td><td>" + to_string(Batch.PercentFertile()) + "%</td></tr>";
873  HTML += "<tr><td><hr/></td><td><hr/></td></tr>";
874  HTML += "<tr><td>Chicks Hatched</td><td>" + to_string( Batch.GetChicks()) + "</td></tr>";
875  HTML += "<tr><td>% Of Fertile Hatched</td><td>" + to_string(Batch.PercentOfFertile()) + "%</td></tr>";
876  HTML += "<tr><td>% Of Total Hatched</td><td>" + to_string(Batch.PercentOfTotal()) + "%</td></tr>";
877  HTML += "<tr><td>% Of Total Unhatched </td><td>" + to_string(Batch.PercentOfTotalUnhatched()) + "%</td></tr>";
878  HTML += "</table></td><td><table width='100%'><tr>";
879  HTML += "<td style='width:50%;text-align:left'><p>0%</p></td>";
880  HTML += "<td style='width:50%;text-align:right'><p>100%</p></td>";
881  HTML += "</tr></table>";
882 
883  //Graphs
884  HTML += "<label>% Were Fertile</label><hr width='";
885  if(Batch.PercentFertile() < 1)
886  HTML +="1%' size='20'/>";
887  else
888  HTML += to_string(Batch.PercentFertile()) + "%' size='20'/>";
889 
890  HTML += "<label>% Of Fertile Hatched</label><hr width='";
891  if(Batch.PercentOfFertile() < 1)
892  HTML +="1%' size='20'/>";
893  else
894  HTML += to_string(Batch.PercentOfFertile()) + "%' size='20'/>";
895 
896  HTML += "<label>% Of Total Hatched</label><hr width='";
897  if(Batch.PercentOfTotal() < 1)
898  HTML +="1%' size='20'/>";
899  else
900  HTML += to_string(Batch.PercentOfTotal()) + "%' size='20'/>";
901 
902  HTML += "<label>% Of Total Unhatched</label><hr width='";
903  if(Batch.PercentOfTotalUnhatched() < 1)
904  HTML +="1%' size='20'/>";
905  else
906  HTML += to_string(Batch.PercentOfTotalUnhatched()) + "%' size='20'/>";
907 
908  HTML += "</td></tr><tr><td colspan='2'>"+Batch.GetComments();
909  HTML += "<hr/><hr/><hr/><hr/></td></tr>";
910 
911  if(Batch.GetAdv() == 1){
912  HK_Advanced Adv = Batch.GetAdvanced();
913  HK_Egg Egg;
914 
915  string TD1, TD2;
916  vector<string> Tag1 = Settings.GetArray("Tag1");
917  vector<string> Tag2 = Settings.GetArray("Tag2");
918  vector<string> Tag3 = Settings.GetArray("Tag3");
919 
920  for(int A = 0; A < Adv.GetEggCount(); A++) {
921 
922  Egg = Adv.GetEgg(A);
923  //Reset
924  TD1 = "";
925  TD2 = "";
926 
927  //Egg
928  TD1 += "<tr valign='top'><td colspan='2'>Egg:</td><td colspan='2'>" + to_string(A+1) + "</td></tr>";
929 
930  //Tags
931  if(Tag1[0] == Egg.GetTag1())
932  TD1 += "<tr valign='top'><td colspan='2'>"+Tag1[0]+":</td><td colspan='2'>Not Set</td></tr>";
933  else
934  TD1 += "<tr valign='top'><td colspan='2'>"+Tag1[0]+":</td><td colspan='2'>"+Egg.GetTag1()+"</td></tr>";
935 
936  if(Tag2[0] == Egg.GetTag2())
937  TD1 += "<tr valign='top'><td colspan='2'>"+Tag2[0]+":</td><td colspan='2'>Not Set</td></tr>";
938  else
939  TD1 += "<tr valign='top'><td colspan='2'>"+Tag2[0]+":</td><td colspan='2'>"+Egg.GetTag2()+"</td></tr>";
940 
941  if(Tag3[0] == Egg.GetTag3())
942  TD1 += "<tr valign='top'><td colspan='2'>"+Tag3[0]+":</td><td colspan='2'>Not Set</td></tr>";
943  else
944  TD1 += "<tr valign='top'><td colspan='2'>"+Tag3[0]+":</td><td colspan='2'>"+Egg.GetTag3()+"</td></tr>";
945 
946  TD1 += "<tr><td colspan='2'><hr/></td><td colspan='2'><hr/></td></tr>" \
947  "<tr><td>Day:</td><td>Weight:</td><td>% Lost:</td><td>Comments</td></tr>";
948 
949  //Start Filling td2
950 
951  //Fertile/Pipped
952  if(Egg.GetFertile() == 0)
953  TD2 += "<tr><td colspan='2'>Fertile:</td><td colspan='2'>False</td></tr>";
954  else
955  TD2 += "<tr><td colspan='2'>Fertile:</td><td colspan='2'>True</td></tr>";
956 
957  if(Egg.GetPipped() == 0)
958  TD2 += "<tr><td colspan='2'>Pipped:</td><td colspan='2'>False</td></tr>";
959  else
960  TD2 += "<tr><td colspan='2'>Pipped:</td><td colspan='2'>True</td></tr>";
961 
962  //Result
963  TD2 += "<tr><td colspan='2'>";
964  if(Egg.GetResult() == -1){
965  TD2 += "Unknown Result:";
966  }else if(Egg.GetResult() == 0){
967  TD2 += "Hatched:";
968  }else
969  TD2 += "Quit:";
970 
971  TD2 += "</td><td colspan='2'>" + Egg.GetDate().ToReadable("/",Settings.GetInt("DateMode")) + \
972  "</td></tr><tr><td colspan='2'>Comments:</td><td colspan='2'>" + Egg.GetComments() + \
973  "</tr><tr><td colspan='2'><hr/></td><td colspan='2'><hr/></td></tr>" \
974  "<tr><td>Day:</td><td>Weight:</td><td>% Lost:</td><td>Comments</td></tr>";
975 
976  for(int Day = 0; Day < Egg.GetDays(); Day++){
977  if((Day % 2) == 0){
978  TD1 += "<tr><td>" + to_string(Day + 1) + "</td><td>" + Egg.GetDayWeight()[Day].GetString();
979  if(Batch.GetAdvanced().GetUnit() == 0)
980  TD1 += "oz";
981  else
982  TD1 += "g ";
983  TD1 += "</td><td>" + to_string(Egg.CalcDayLoss(Day)) + \
984  "%</td><td>" + Egg.GetDayComments()[Day] + "</td></tr>";
985  }else{
986  TD2 += "<tr><td>" + to_string(Day + 1) + "</td><td>" + Egg.GetDayWeight()[Day].GetString();
987  if(Batch.GetAdvanced().GetUnit() == 0)
988  TD2 += "oz";
989  else
990  TD2 += "g ";
991  TD2 += "</td><td>" + to_string(Egg.CalcDayLoss(Day)) + \
992  "</td><td>" + Egg.GetDayComments()[Day] + "</td></tr>";
993  }
994  }
995  TD1 += "<tr><td colspan='2'>Total % Weight Lost:</td><td colspan='2'>" + \
996  to_string(Egg.CalcTotalLoss()) + "%</td></tr>";
997 
998  //Spacers
999  TD2 += "<tr><td colspan='2'><hr/></td><td colspan='2'><hr/></td></tr>";
1000 
1001  if((Egg.GetDays() % 2) != 0)
1002  TD2 += "<tr><td colspan='2'><hr/></td><td colspan='2'><hr/></td></tr>";
1003 
1004  //Assemble
1005  HTML += "<tr><td valign='top' ><table>" + TD1 + "</table><td><table valign='top' >" + \
1006  TD2 + "</table></td></tr>";
1007  }
1008  }
1009 
1010 
1011  HTML += "</table>";
1012 
1013  return HTML;
1014 
1015 }
1016 
1018 string HK_Documents::GroupTextReport(HK_Batches GrBatches, string GroupName, string Comments, HK_KeyValue Settings)
1019 {
1020  //Write Header
1021  string Report = "********************************************************";
1022  Report += "\nReport For Group: " + GroupName + "\n\n";
1023  Report += "********************************************************\n\n";
1024 
1025  //Write Batches
1026  for(int A = 0; A < GrBatches.GetCount(); A++) {
1027  Report += BatchTextReport(GrBatches.GetBatch(A),Settings);
1028  Report += "\n\n********************************************************\n\n";
1029  }
1030  //Write Averges
1031  Report += "Averages For This Group:\n\n";
1032  Report += "********************************************************\n\n";
1033  Report += "Total Eggs In This Group = " + to_string(GrBatches.TotalEggs()) + "\n";
1034  Report += "Total Chicks From This Group = " + to_string(GrBatches.TotalChicks()) + "\n";
1035  Report += "Average % Were Fertile = " + to_string(GrBatches.AvgFertile()) + "%\n";
1036  Report += "Average % Of Fertile Hatched = " + to_string(GrBatches.AvgFertileHatch()) + "%\n";
1037  Report += "Average % Of Total Hatched = " + to_string(GrBatches.AvgTotalHatch()) + "%\n";
1038  Report += "Average % Of Total Unhatched = " + to_string(GrBatches.AvgTotalUnHatch()) + "%\n";
1039 
1040  //Write Comments
1041  Report += "\n********************************************************\n";
1042  Report += "Group Comments:\n";
1043  Report += "********************************************************\n\n";
1044  Report += "\n" + Comments + "\n\n";
1045 
1046  HK_Date Today;
1047  Report += "\n\n\nAutomatically Generated By HatchKeeper On: " + Today.ToReadable("/",Settings.GetInt("DateMode"));
1048 
1049  return Report;
1050 }
1051 
1052 string HK_Documents::GroupHTMLReport(HK_Batches GrBatches, string GroupName, string Comments, HK_KeyValue Settings)
1053 {
1054  string Report = "<html><head><title>Group: " + GroupName;
1055  Report += " Report</title></head><body><table width='100%' ><tr><td><h1 style='text-align:center;'>Group: ";
1056  Report += GroupName + " Report</h1></td></tr>";
1057 
1058  for(int A = 0; A < GrBatches.GetCount(); A++)
1059  Report += "<tr><td>" + BatchHTMLReport(GrBatches.GetBatch(A),Settings) + "</td></tr>";
1060 
1061  //Group Data
1062  Report += "<tr><td><table border='10' width='100%' >";
1063  Report += "<tr><td colspan='2' style='text-align:center'><h2>Group Statisics</h2></td></tr>";
1064  Report += "<tr><td>" + to_string(GrBatches.TotalEggs()) + " Total Eggs In Group</td>";
1065  Report += "<td>" + to_string(GrBatches.TotalChicks()) + " Total Chicks In Group</td></tr><tr>";
1066  Report += "<td>" + to_string(GrBatches.AvgFertile()) + "% (Avg) Were Fertile</td>";
1067  Report += "<td>" + to_string(GrBatches.AvgFertileHatch()) + "% (Avg) Of Fertile Hatched</td></tr><tr>";
1068  Report += "<td>" + to_string(GrBatches.AvgTotalHatch()) + "% (Avg) Of Total Hatched</td>";
1069  Report += "<td>" + to_string(GrBatches.AvgTotalUnHatch()) + "% (Avg) Of Total Unhatched</td></tr>";
1070  Report += "<tr><td colspan='2'>Group Comments:\n"+ Comments + "</td></tr>";
1071  Report += "</table></body></html>";
1072 
1073  return Report;
1074 }
1075 
1077 string HK_Documents::BatchICal(HK_Batch Batch, bool DatesOnly)
1078 {
1079 #ifdef __WXMSW__
1080  string calEnd = "\n";
1081 #endif //Windows port.
1082 
1083 #ifndef __WXMSW__
1084  string calEnd = "\r\n";
1085 #endif //All the other ports.
1086 
1087  //Replaces All Spaces In Name To "_"
1088  string ModName = Batch.GetName();
1089 
1090  for(unsigned int A = 0; A < ModName.length(); A++)
1091  if(ModName[A] == ' ')
1092  ModName[A] = '_';
1093 
1094 
1095  //Dates
1096  HK_Date S = Batch.GetStart();
1097  HK_Date C = Batch.GetCandle();
1098  HK_Date L = Batch.GetLockdown();
1099  HK_Date H = Batch.GetHatch();
1100  HK_Date I; //Increment
1101  HK_Date Today;
1102 
1103  string iCal;
1104 
1105  if(!DatesOnly) {
1106  iCal += "BEGIN:VCALENDAR" + calEnd;
1107  iCal += "PRODID:-//HatchKeeper//HatchKeeper-v0.80.0//EN" + calEnd;
1108  iCal += "VERSION:2.0" + calEnd;
1109  iCal += "CALSCALE:GREGORIAN" + calEnd;
1110  iCal += "X-WR-CALNAME:" + Batch.GetName() + calEnd;
1111  iCal += "X-WR-CALDESC:This Was Automatically Generated by HatchKeeper" + calEnd;
1112  }
1113  //Write Start Date
1114  I = S;
1115  I.AddDays(1);
1116  iCal += "BEGIN:VEVENT" + calEnd;
1117  iCal += "DTSTART;VALUE=DATE:" + S.ToSortable("") + calEnd;
1118  iCal += "DTEND;VALUE=DATE:" + I.ToSortable("") + calEnd;
1119  iCal += "DTSTAMP:" + Today.ToSortable("") + calEnd;
1120  iCal += "UID:" + ModName + S.ToSortable("") + calEnd;
1121  iCal += "CREATED:" + Today.ToSortable("") + calEnd;
1122  iCal += "DESCRIPTION: Start Date For " + Batch.GetName() + calEnd;
1123  iCal += "LAST-MODIFIED:" + Today.ToSortable("") + calEnd;
1124  iCal += "LOCATION:" + calEnd;
1125  iCal += "SEQUENCE:0" + calEnd;
1126  iCal += "STATUS:CONFIRMED" + calEnd;
1127  iCal += "SUMMARY:Start Date for " + Batch.GetName() + calEnd;
1128  iCal += "TRANSP:TRANSPARENT" + calEnd;
1129  iCal += "END:VEVENT" + calEnd;
1130 
1131  //Write Candle Date
1132  I = C;
1133  I.AddDays(1);
1134 
1135  iCal += "BEGIN:VEVENT" + calEnd;
1136  iCal += "DTSTART;VALUE=DATE:" + C.ToSortable("") + calEnd;
1137  iCal += "DTEND;VALUE=DATE:" + I.ToSortable("") + calEnd;
1138  iCal += "DTSTAMP:" + Today.ToSortable("") + calEnd;
1139  iCal += "UID:" + to_string(C.GetDay()) + ModName + to_string(C.GetMonth()) + to_string(C.GetYear()) + calEnd;
1140  iCal += "CREATED:" + Today.ToSortable("") + calEnd;
1141  iCal += "DESCRIPTION: Candle Date For " + Batch.GetName() + calEnd;
1142  iCal += "LAST-MODIFIED:" + Today.ToSortable("") + calEnd;
1143  iCal += "LOCATION:" + calEnd;
1144  iCal += "SEQUENCE:0" + calEnd;
1145  iCal += "STATUS:CONFIRMED" + calEnd;
1146  iCal += "SUMMARY:Candle Date For " + Batch.GetName() + calEnd;
1147  iCal += "TRANSP:TRANSPARENT" + calEnd;
1148  iCal += "END:VEVENT" + calEnd;
1149 
1150  //Write lockdown/Remove from turner date
1151  I = L;
1152  I.AddDays(1);
1153 
1154  iCal += "BEGIN:VEVENT" + calEnd;
1155  iCal += "DTSTART;VALUE=DATE:" + L.ToSortable("") + calEnd;
1156  iCal += "DTEND;VALUE=DATE:" + I.ToSortable("") + calEnd;
1157  iCal += "DTSTAMP:" + Today.ToSortable("") + calEnd;
1158  iCal += "UID:" + to_string(L.GetDay()) + to_string(L.GetMonth()) + ModName + to_string(L.GetYear()) + calEnd;
1159  iCal += "CREATED:" + Today.ToSortable("") + calEnd;
1160  iCal += "DESCRIPTION: Lockdown For " + Batch.GetName() + calEnd;
1161  iCal += "LAST-MODIFIED:" + Today.ToSortable("") + calEnd;
1162  iCal += "LOCATION:" + calEnd;
1163  iCal += "SEQUENCE:0" + calEnd;
1164  iCal += "STATUS:CONFIRMED" + calEnd;
1165  iCal += "SUMMARY:Lockdown/Remove Turners For " + Batch.GetName() + calEnd;
1166  iCal += "TRANSP:TRANSPARENT" + calEnd;
1167  iCal += "END:VEVENT" + calEnd;
1168 
1169  //Write Hatch Date
1170  I = H;
1171  I.AddDays(1);
1172 
1173  iCal += "BEGIN:VEVENT" + calEnd;
1174  iCal += "DTSTART;VALUE=DATE:" + H.ToSortable("") + calEnd;
1175  iCal += "DTEND;VALUE=DATE:" + I.ToSortable("") + calEnd;
1176  iCal += "DTSTAMP:" + Today.ToSortable("") + calEnd;
1177  iCal += "UID:" + H.ToSortable("") + ModName + calEnd;
1178  iCal += "CREATED:" + Today.ToSortable("") + calEnd;
1179  iCal += "DESCRIPTION: Hatch Date For " + Batch.GetName() + calEnd;
1180  iCal += "LAST-MODIFIED:" + Today.ToSortable("") + calEnd;
1181  iCal += "LOCATION:" + calEnd;
1182  iCal += "SEQUENCE:0" + calEnd;
1183  iCal += "STATUS:CONFIRMED" + calEnd;
1184  iCal += "SUMMARY:Hatch Date for " + Batch.GetName() + calEnd;
1185  iCal += "TRANSP:TRANSPARENT" + calEnd;
1186  iCal += "END:VEVENT" + calEnd;
1187 
1188  //Write the ending
1189  if(!DatesOnly)
1190  iCal += "END:VCALENDAR" + calEnd;
1191 
1192  return iCal;
1193 
1194 }
1195 
1197 string HK_Documents::GroupICal(HK_Batches GrBatches, string GroupName)
1198 {
1199 #ifdef __WXMSW__
1200  string calEnd = "\n";
1201 #endif //Windows port.
1202 
1203 #ifndef __WXMSW__
1204  string calEnd = "\r\n";
1205 #endif //All the other ports.
1206 
1207  string iCal = "BEGIN:VCALENDAR" + calEnd;
1208  iCal += "PRODID:-//HatchKeeper//HatchKeeper-v0.80.0//EN" + calEnd;
1209  iCal += "VERSION:2.0" + calEnd;
1210  iCal += "CALSCALE:GREGORIAN" + calEnd;
1211  iCal += "X-WR-CALNAME:" + GroupName + calEnd;
1212  iCal += "X-WR-CALDESC:This Was Automatically Generated by HatchKeeper" + calEnd;
1213 
1214  for(int A = 0; A < GrBatches.GetCount(); A++)
1215  iCal += BatchICal(GrBatches.GetBatch(A), true);
1216 
1217  iCal += "END:VCALENDAR" + calEnd;
1218  return iCal;
1219 }
1220 
1223 {
1224  bool markDate; //if a day has a event Maybe replace with empty()?
1225  vector<string> Events; //stores events
1226  int a,count1, count2; //misc counters
1227  int datesPerDay = 0; //If there are more dates than 3, add <br />
1228 
1229  string n1[42]; //holds number to be printed to cal
1230  string r1[42]; //holds events as a string
1231 
1232  //cycle through empty blocks
1233  for(count1 = 0; count1 < CalDate.StartDayOfWeek(); count1++) {
1234  n1[count1] = " ";
1235  r1[count1] = " ";
1236  }
1237 
1238  //start at day one
1239  int Day = 1;
1240  HK_Date Date;
1241 
1242  for(count2 = count1; Day <= CalDate.DaysInMonth(); count2++) {
1243 
1244  n1[count2] = to_string(Day);
1245  r1[count2] = "";
1246  markDate = false;
1247 
1248  for(a = 0; a < Batches.GetCount(); a++) {
1249  Date.SetDate(Day,CalDate.GetMonth(),CalDate.GetYear());
1250 
1251  if(Date.IsEqual(Batches.GetStart(a))) {
1252  Events.push_back("Day " + to_string(Day) + ": Start Date For " + Batches.GetName(a));
1253 
1254  if(datesPerDay == 3)
1255  r1[count2] = r1[count2] + "<br />";
1256 
1257  r1[count2] = r1[count2] + " SD,";
1258  markDate = true;
1259  datesPerDay++;
1260  }
1261 
1262 
1263  if(Date.IsEqual(Batches.GetCandle(a))) {
1264  Events.push_back("Day " + to_string(Day) + ": Candle Date For " + Batches.GetName(a));
1265 
1266  if(datesPerDay == 3)
1267  r1[count2] = r1[count2] + "<br />";
1268 
1269  r1[count2] = r1[count2] + " CD,";
1270  markDate = true;
1271  datesPerDay++;
1272  }
1273 
1274  if(Date.IsEqual(Batches.GetLockdown(a))) {
1275  Events.push_back("Day " + to_string(Day) + ": Lockdown Date For " + Batches.GetName(a));
1276 
1277  if(datesPerDay == 3)
1278  r1[count2] = r1[count2] + "<br />";
1279 
1280  r1[count2] = r1[count2] + " LD,";
1281  markDate = true;
1282  datesPerDay++;
1283  }
1284 
1285  if(Date.IsEqual(Batches.GetHatch(a))) {
1286  Events.push_back("Day " + to_string(Day) + ": Hatch Date For " + Batches.GetName(a));
1287 
1288  if(datesPerDay == 3)
1289  r1[count2] = r1[count2] + "<br />";
1290 
1291  r1[count2] = r1[count2] + " HD,";
1292  markDate = true;
1293  datesPerDay++;
1294  }
1295  }
1296 
1297  if(!markDate)
1298  r1[count2] = " ";
1299 
1300  if(datesPerDay <= 3)// if <= 3 add a breakline for better formatting
1301  r1[count2] = r1[count2] + "<br />";
1302 
1303  datesPerDay = 0;//reset
1304  Day++;
1305  }
1306 
1307  //cycle through remaining empty blocks
1308  for(count1 = count2; count1 < 42; count1++){
1309  n1[count1] = " ";
1310  r1[count1] = " ";
1311  }
1312 
1313 
1314  //Write header
1315  string HTML = "<html>\n<head>\n<title>HatchKeeper Calendar</title>";
1316  HTML += "</head>\n<body>";
1317  HTML += "<p><small>SD = Start Date.</small> <small>CD = Candle Date.</small> <small>LD = Lockdown Date.</small> <small>HD = Hatch Date.</small></p>";
1318 
1319  HTML += "<table align='center' width='100%' border='3'>";
1320  HTML += "<tr>";
1321  HTML += "<td><pre> Sun </pre></td>";
1322  HTML += "<td><pre> Mon </pre></td>";
1323  HTML += "<td><pre> Tue </pre></td>";
1324  HTML += "<td><pre> Wed </pre></td>";
1325  HTML += "<td><pre> Thu </pre></td>";
1326  HTML += "<td><pre> Fri </pre></td>";
1327  HTML += "<td><pre> Sat </pre></td>";
1328  HTML += "</tr>";
1329  HTML += "<tr>";
1330  HTML += "<td>" + n1[0] + "<br /> <small>" + r1[0] + " </small> </td>";
1331  HTML += "<td>" + n1[1] + "<br /> <small>" + r1[1] + " </small> </td>";
1332  HTML += "<td>" + n1[2] + "<br /> <small>" + r1[2] + " </small> </td>";
1333  HTML += "<td>" + n1[3] + "<br /> <small>" + r1[3] + " </small> </td>";
1334  HTML += "<td>" + n1[4] + "<br /> <small>" + r1[4] + " </small> </td>";
1335  HTML += "<td>" + n1[5] + "<br /> <small>" + r1[5] + " </small> </td>";
1336  HTML += "<td>" + n1[6] + "<br /> <small>" + r1[6] + " </small> </td>";
1337  HTML += "</tr>";
1338  HTML += "<tr>";
1339  HTML += "<td>" + n1[7] + "<br /> <small>" + r1[7] + " </small> </td>";
1340  HTML += "<td>" + n1[8] + "<br /> <small>" + r1[8] + " </small> </td>";
1341  HTML += "<td>" + n1[9] + "<br /> <small>" + r1[9] + " </small> </td>";
1342  HTML += "<td>" + n1[10] + "<br /> <small>" + r1[10] + " </small> </td>";
1343  HTML += "<td>" + n1[11] + "<br /> <small>" + r1[11] + " </small> </td>";
1344  HTML += "<td>" + n1[12] + "<br /> <small>" + r1[12] + " </small> </td>";
1345  HTML += "<td>" + n1[13] + "<br /> <small>" + r1[13] + " </small> </td>";
1346  HTML += "</tr>";
1347  HTML += "<tr>";
1348  HTML += "<td>" + n1[14] + "<br /> <small>" + r1[14] + " </small> </td>";
1349  HTML += "<td>" + n1[15] + "<br /> <small>" + r1[15] + " </small> </td>";
1350  HTML += "<td>" + n1[16] + "<br /> <small>" + r1[16] + " </small> </td>";
1351  HTML += "<td>" + n1[17] + "<br /> <small>" + r1[17] + " </small> </td>";
1352  HTML += "<td>" + n1[18] + "<br /> <small>" + r1[18] + " </small> </td>";
1353  HTML += "<td>" + n1[19] + "<br /> <small>" + r1[19] + " </small> </td>";
1354  HTML += "<td>" + n1[20] + "<br /> <small>" + r1[20] + " </small> </td>";
1355  HTML += "</tr>";
1356  HTML += "<tr>";
1357  HTML += "<td>" + n1[21] + "<br /> <small>" + r1[21] + " </small> </td>";
1358  HTML += "<td>" + n1[22] + "<br /> <small>" + r1[22] + " </small> </td>";
1359  HTML += "<td>" + n1[23] + "<br /> <small>" + r1[23] + " </small> </td>";
1360  HTML += "<td>" + n1[24] + "<br /> <small>" + r1[24] + " </small> </td>";
1361  HTML += "<td>" + n1[25] + "<br /> <small>" + r1[25] + " </small> </td>";
1362  HTML += "<td>" + n1[26] + "<br /> <small>" + r1[26] + " </small> </td>";
1363  HTML += "<td>" + n1[27] + "<br /> <small>" + r1[27] + " </small> </td>";
1364  HTML += "</tr>";
1365  HTML += "<tr>";
1366  HTML += "<td>" + n1[28] + "<br /> <small>" + r1[28] + " </small> </td>";
1367  HTML += "<td>" + n1[29] + "<br /> <small>" + r1[29] + " </small> </td>";
1368  HTML += "<td>" + n1[30] + "<br /> <small>" + r1[30] + " </small> </td>";
1369  HTML += "<td>" + n1[31] + "<br /> <small>" + r1[31] + " </small> </td>";
1370  HTML += "<td>" + n1[32] + "<br /> <small>" + r1[32] + " </small> </td>";
1371  HTML += "<td>" + n1[33] + "<br /> <small>" + r1[33] + " </small> </td>";
1372  HTML += "<td>" + n1[34] + "<br /> <small>" + r1[34] + " </small> </td>";
1373  HTML += "</tr>";
1374  HTML += "<tr>";
1375  HTML += "<td>" + n1[35] + "<br /> <small>" + r1[35] + " </small> </td>";
1376  HTML += "<td>" + n1[36] + "<br /> <small>" + r1[36] + " </small> </td>";
1377  HTML += "<td>" + n1[37] + "<br /> <small>" + r1[37] + " </small> </td>";
1378  HTML += "<td>" + n1[38] + "<br /> <small>" + r1[38] + " </small> </td>";
1379  HTML += "<td>" + n1[39] + "<br /> <small>" + r1[39] + " </small> </td>";
1380  HTML += "<td>" + n1[40] + "<br /> <small>" + r1[40] + " </small> </td>";
1381  HTML += "<td>" + n1[41] + "<br /> <small>" + r1[41] + " </small> </td>";
1382  HTML += "</tr>\n</table>\n</p>";
1383 
1384  HTML += "<p>Dates For This Month</p>\n <ul align='center'>";
1385 
1386  for(a = 0; a < Events.size(); a++)
1387  HTML += "<li><small>" + Events[a] + "</small></li>";
1388 
1389  HTML += "</ul></ul>\n</p>\n</body>\n</html>";
1390 
1391  return HTML;
1392 }
HK_KeyValue Settings
Definition: Declare.h:36
HK_Date Today
Definition: Declare.h:33
HK_Batches Batches
Definition: Declare.h:44
HK_Storage Types
Definition: Declare.h:38
HK_Storage Breeds
Definition: Declare.h:37
HK_Storage Groups
Definition: Declare.h:41
HK_Storage Schedules
Definition: Declare.h:39
A Class For Managing Multiple HK_Egg Instances.
Definition: Advanced.h:20
HK_Egg GetEgg(int Select)
Returns The Selected Egg.
Definition: HK_Advanced.cpp:50
int GetEggCount()
Returns The Number Of Eggs.
Definition: HK_Advanced.cpp:52
void AddEgg(HK_Egg Egg)
Adds An HK_Egg To HK_AdvEggs Vector.
Definition: HK_Advanced.cpp:40
void SetID(int ID)
Sets ID.
int CalcAvgLoss()
Returns The Average Weight Loss For All Eggs In Batch.
Definition: HK_Advanced.cpp:14
void SetUnit(int Unit)
Sets Weight Unit Used.
int GetUnit()
Returns Weight Unit.
Definition: HK_Advanced.cpp:44
Holds Data For One Batch, Includes Basic Set/Get Methods.
Definition: Batch.h:22
int PercentOfTotal()
Returns The Percentage Of Total Eggs That Hatched.
Definition: HK_Batch.cpp:290
void SetAdv(int Adv)
Sets Batch Advanced Status.
Definition: HK_Batch.cpp:130
int PercentFertile()
Returns The Percentage Of Eggs That Were Fertile.
Definition: HK_Batch.cpp:278
void SetID(int ID)
Sets Batch ID.
Definition: HK_Batch.cpp:100
void SetAdvanced(HK_Advanced Adv)
Sets Batch Advanced Data.
Definition: HK_Batch.cpp:132
void SetCandle(HK_Date Candle)
Sets Batch Candle Date.
Definition: HK_Batch.cpp:122
int GetChicks()
Returns Number Of Hatched Eggs In Batch, If Advanced Is Enabled It Returns HK_Advanced::GetChicks()
Definition: HK_Batch.cpp:166
HK_Date GetCandle()
Returns Batch Candle Date.
Definition: HK_Batch.cpp:177
vector< string > GetSQL()
Returns An SQL String To Set Batch In Database.
Definition: HK_Batch.cpp:190
string GetName()
Returns Batch Name.
Definition: HK_Batch.cpp:142
int GetFertile()
Returns Number Of Fertile Eggs In Batch, If Advanced Is Enabled It Returns HK_Advanced::GetFertile()
Definition: HK_Batch.cpp:157
void SetFertile(int Fertile)
Sets Batch Fertile Eggs.
Definition: HK_Batch.cpp:116
void SetName(string Name)
Sets Batch Name.
Definition: HK_Batch.cpp:102
HK_Date GetStart()
Returns Batch Start Date.
Definition: HK_Batch.cpp:175
void SetRemind(int Remind)
Sets Batch Remind Status For Notifications.
Definition: HK_Batch.cpp:128
int GetEggs()
Returns Number Of Eggs In Batch.
Definition: HK_Batch.cpp:154
void SetType(string Type)
Sets Batch Type.
Definition: HK_Batch.cpp:104
void SetIncubator(string Incubator)
Sets Batch Incubator.
Definition: HK_Batch.cpp:112
HK_Date GetLockdown()
Returns Batch Lockdown Date.
Definition: HK_Batch.cpp:179
void SetChicks(int Chicks)
Sets Batch Hatched Eggs.
Definition: HK_Batch.cpp:118
void SetComments(string Comments)
Sets Batch Comments.
Definition: HK_Batch.cpp:110
string GetComments()
Returns Batch Comments.
Definition: HK_Batch.cpp:150
void SetBreed(string Breed)
Sets Batch Breed.
Definition: HK_Batch.cpp:106
string GetBreed()
Returns Batch Breed.
Definition: HK_Batch.cpp:146
void SetHatch(HK_Date Hatch)
Sets Batch Hatch Date.
Definition: HK_Batch.cpp:126
void SetEggs(int Eggs)
Sets Batch Eggs.
Definition: HK_Batch.cpp:114
int PercentOfTotalUnhatched()
Returns The Percentage Of Total Eggs That Didn't Hatch.
Definition: HK_Batch.cpp:302
int PercentOfFertile()
Returns The Percentage Of Fertile Eggs That Hatched.
Definition: HK_Batch.cpp:284
void SetStart(HK_Date Start)
Sets Batch Start Date.
Definition: HK_Batch.cpp:120
int GetID()
Returns Batch ID.
Definition: HK_Batch.cpp:140
HK_Advanced GetAdvanced()
Returns Batch Advanced Egg Data.
Definition: HK_Batch.cpp:187
int GetAdv()
Returns Batch Advanced Status.
Definition: HK_Batch.cpp:185
string GetType()
Returns Batch Type.
Definition: HK_Batch.cpp:144
void SetLockdown(HK_Date Lockdown)
Sets Batch Lockdown Date.
Definition: HK_Batch.cpp:124
void SetGroup(string Group)
Sets Batch Group.
Definition: HK_Batch.cpp:108
HK_Date GetHatch()
Returns Batch Hatch Date.
Definition: HK_Batch.cpp:181
A Class For Managing Mulitple HK_Batch Objects.
Definition: Batches.h:22
HK_Advanced GetAdvanced(int Select)
Returns Advanced Egg Data Selected Batch.
Definition: HK_Batches.cpp:93
HK_Date GetHatch(int Select)
Returns Hatch Date For Selected Batch.
Definition: HK_Batches.cpp:87
HK_Date GetStart(int Select)
Returns Start Date For Selected Batch.
Definition: HK_Batches.cpp:81
void Add(HK_Batch Batch)
Adds Another HK_Batch.
Definition: HK_Batches.cpp:15
int AvgTotalUnHatch()
Returns Average Percentage Of Total Eggs That Did Not Hatch In This HK_Batches Instance.
Definition: HK_Batches.cpp:181
int AvgFertileHatch()
Returns Average Percentage Of Fertile Eggs That Hatched In This HK_Batches Instance.
Definition: HK_Batches.cpp:172
string GetIncubator(int Select)
Returns Batch Incubator For Selected Batch.
Definition: HK_Batches.cpp:73
int GetAdv(int Select)
Returns Advanced Status For Selected Batch.
Definition: HK_Batches.cpp:91
int GetValidID()
Returns An ID That Isn't Used By Any HK_Batch In This HK_Batches Instance.
Definition: HK_Batches.cpp:194
int AvgFertile()
Returns Average Percentage Of Eggs Fertile In This HK_Batches Instance.
Definition: HK_Batches.cpp:154
int GetChicks(int Select)
Returns Number Of Hatched Eggs For Selected Batch.
Definition: HK_Batches.cpp:79
int GetFertile(int Select)
Returns Number Of Fertile Eggs For Selected Batch.
Definition: HK_Batches.cpp:77
HK_Date GetCandle(int Select)
Returns Candle Date For Selected Batch.
Definition: HK_Batches.cpp:83
int TotalEggs()
Returns Total Number Of Eggs In This HK_Batches Instance.
Definition: HK_Batches.cpp:136
string GetType(int Select)
Returns Batch Type For Selected Batch.
Definition: HK_Batches.cpp:65
int AvgTotalHatch()
Returns Average Percentage Of Total Eggs That Hatched In This HK_Batches Instance.
Definition: HK_Batches.cpp:163
HK_Batch GetBatch(int Select)
Returns The Selected Batch.
Definition: HK_Batches.cpp:55
bool IsValidName(string Name)
Returns True If Name Isn't Already In Use.
Definition: HK_Batches.cpp:216
string GetGroup(int Select)
Returns Batch Group For Selected Batch.
Definition: HK_Batches.cpp:69
int GetEggs(int Select)
Returns Number Of Eggs For Selected Batch.
Definition: HK_Batches.cpp:75
int GetCount()
Returns The Number Of Batches Stored.
Definition: HK_Batches.cpp:191
HK_Date GetLockdown(int Select)
Returns Lockdown Date For Selected Batch.
Definition: HK_Batches.cpp:85
string GetComments(int Select)
Returns Batch Comments For Selected Batch.
Definition: HK_Batches.cpp:71
int TotalChicks()
Returns Total Number Of Chicks In This HK_Batches Instance.
Definition: HK_Batches.cpp:145
string GetName(int Select)
Returns Batch Name For Selected Batch.
Definition: HK_Batches.cpp:63
string GetBreed(int Select)
Returns Batch Breed For Selected Batch.
Definition: HK_Batches.cpp:67
A Class For Managing Dates.
Definition: Date.h:25
int GetMonth()
Returns Month Value.
Definition: HK_Date.cpp:60
std::string ToSortable(std::string Separator)
Generate A Sortable String For Database.
Definition: HK_Date.cpp:163
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
Definition: HK_Date.cpp:132
int StartDayOfWeek()
Returns What Day Of The Week This HK_Date Month Starts.
Definition: HK_Date.cpp:411
bool AddDays(int Days)
Adds Days To This HK_Date.
Definition: HK_Date.cpp:70
int GetDay()
Returns Day Value.
Definition: HK_Date.cpp:57
bool IsEqual(HK_Date Date)
Checks To See If The Input Date Is Same As Stored Date.
Definition: HK_Date.cpp:325
int DaysInMonth()
Returns The Number Of Days In HK_Month. LeapYear Is Checked.
Definition: HK_Date.cpp:432
bool SetDate(int Days, int Month, int Year)
Sets Day, Month, and Year.
Definition: HK_Date.cpp:32
int GetYear()
Returns Year Value.
Definition: HK_Date.cpp:63
HK_Documents()
Constructor.
string BatchTextReport(HK_Batch Batch, HK_KeyValue Settings)
Returns A Text Batch Report For Archiving Batch Data.
string BatchICal(HK_Batch Batch, bool DatesOnly)
Generates iCal Text With Batch Data.
vector< string > ImportHKBF(string Filename, HK_Batches *Batches, HK_Storage *Groups, HK_Storage *Types, HK_Storage *Breeds, HK_Storage *Schedules)
Tries Reading And Generating HK_Batch Objects From HKBF.
string GroupHTMLReport(HK_Batches GrBatches, string GroupName, string Comments, HK_KeyValue Settings)
string GroupTextReport(HK_Batches GrBatches, string GroupName, string Comments, HK_KeyValue Settings)
Generates A Text Group Report For Archiving.
string GroupICal(HK_Batches GrBatches, string GroupName)
Generates iCal Text With Group Data.
string BatchHTMLReport(HK_Batch Batch, HK_KeyValue Settings)
Returns An HTML String For Printing Reports.
string HTMLCalendar(HK_Date Selection, HK_Batches Batches)
Generates A HTML Calendar For This HK_Month Using Dates From Batches.
bool ExportHKBF(string Filename, HK_Batches Batches, HK_Storage Groups)
Overloaded: Exports Multiple Batches, and a Group To A hkbf(xml) File.
A Class For Storing And Retieving Data For One Egg.
Definition: Egg.h:24
int GetResult()
Returns -1 If No Result, 0 If Hatched, And 2 If Egg Quit.
Definition: HK_Egg.cpp:58
string GetComments()
Returns Egg Comments.
Definition: HK_Egg.cpp:64
int CalcDayLoss(int Day)
Returns The Percentage Of Weight Lost From Previous Weighing.
Definition: HK_Egg.cpp:24
void SetDayWeight(vector< HK_Weight > Weight)
Sets Weight For All Days.
Definition: HK_Egg.cpp:153
void SetDate(HK_Date Date)
Sets Result Date.
Definition: HK_Egg.cpp:149
void SetComments(string Comments)
Sets Egg Comments.
Definition: HK_Egg.cpp:151
int GetDays()
Returns The Number Of Days For This Egg.
Definition: HK_Egg.cpp:62
string GetTag2()
Returns Tag 2 As A String.
Definition: HK_Egg.cpp:50
int CalcTotalLoss()
Returns The Total Percentage Of Weight Lost By This Egg.
Definition: HK_Egg.cpp:38
void SetResult(int Result)
Sets Result Status.
Definition: HK_Egg.cpp:147
HK_Date GetDate()
Returns The Date For The Result.
Definition: HK_Egg.cpp:60
string GetTag3()
Returns Tag 3 As A String.
Definition: HK_Egg.cpp:52
void SetTag3(string Tag)
Sets The Third Tag.
Definition: HK_Egg.cpp:141
void SetTag1(string Tag)
Sets The First Tag.
Definition: HK_Egg.cpp:137
void SetFertile(int Fertile)
Sets Fertile Status.
Definition: HK_Egg.cpp:143
vector< string > GetDayComments()
Returns An Array Containing A Comment For Every Day.
Definition: HK_Egg.cpp:68
vector< HK_Weight > GetDayWeight()
Returns An Array Containing A Weight For Every Day.
Definition: HK_Egg.cpp:66
void SetPipped(int Pipped)
Sets Pip Status.
Definition: HK_Egg.cpp:145
void SetTag2(string Tag)
Sets The Second Tag.
Definition: HK_Egg.cpp:139
int GetPipped()
Returns 0 If Egg Is Not Pipped And 1 If It Is.
Definition: HK_Egg.cpp:56
string GetTag1()
Returns Tag 1 As A String.
Definition: HK_Egg.cpp:48
int GetFertile()
Returns 0 If Egg Is Not Fertile And 1 If It Is.
Definition: HK_Egg.cpp:54
void SetDayComments(vector< string > Comments)
Sets Comments For All Days.
Definition: HK_Egg.cpp:157
Version And Other Information For HatchKeeper.
Definition: Info.h:22
std::string GetVersion()
Returns The Version Of HatchKeeper.
Definition: HK_Info.cpp:15
A Key and Value Type Storage.
Definition: KeyValue.h:25
vector< string > GetArray(int Selection)
Returns The Selected Value As An Array Of Strings.
int GetInt(int Selection)
Returns The Selected Setting Value As An Integer.
Definition: HK_KeyValue.cpp:49
A Class For Storing Values.
Definition: Storage.h:26
bool IsValidName(string Name)
Returns True If Name Isn't Already In Use.
Definition: HK_Storage.cpp:128
HK_Date GetDate(int Select)
Returns The Selected Stored Date.
Definition: HK_Storage.cpp:71
int GetValidID()
Returns A Valid ID For Adding Entries To The Database.
Definition: HK_Storage.cpp:106
int GetCount()
Returns The Number Of Elements Stored.
Definition: HK_Storage.cpp:101
int GetNumber(int Select)
Returns The Selected Stored Number.
Definition: HK_Storage.cpp:96
string GetName(int Select)
Returns The Selected Stored Name.
Definition: HK_Storage.cpp:61
string GetText(int Select)
Returns The Selected Stored Text.
Definition: HK_Storage.cpp:91
void Add(string Name, int ID, HK_Date Date, string Text, int Number)
Adds An Item To Storage.
Definition: HK_Storage.cpp:15
A Class For Managing Data For One Weight.
Definition: Weight.h:24
void Set(float Weight)
Sets The Weight Value Using A Float.
Definition: HK_Weight.cpp:52