MCPcopy Create free account
hub / github.com/DFHack/dfhack / Deserialize

Method Deserialize

plugins/autoclothing.cpp:108–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 }
107
108 void Deserialize(string s) {
109 std::stringstream stream(s);
110 string loadedJob;
111 stream >> loadedJob;
112 FOR_ENUM_ITEMS(job_type, job) {
113 if (ENUM_KEY_STR(job_type, job) == loadedJob) {
114 jobType = job;
115 break;
116 }
117 }
118 string loadedItem;
119 stream >> loadedItem;
120 FOR_ENUM_ITEMS(item_type, item) {
121 if (ENUM_KEY_STR(item_type, item) == loadedItem) {
122 itemType = item;
123 break;
124 }
125 }
126 stream >> item_subtype;
127 stream >> material_category.whole;
128 stream >> needed_per_citizen;
129 }
130
131 //FIXME: when C++23, use std::expected here
132 static std::optional<ClothingRequirement> createFromParameters(color_ostream &out, vector<string> &parameters)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected