MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / FromString

Method FromString

src/Core/Transform/Referential.cpp:132–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 }
131
132 Referential Referential::FromString(const std::string& ref)
133 {
134 if (ref == "TopLeft")
135 return Referential::TopLeft;
136 if (ref == "Top")
137 return Referential::Top;
138 if (ref == "TopRight")
139 return Referential::TopRight;
140 if (ref == "Left")
141 return Referential::Left;
142 if (ref == "Center")
143 return Referential::Center;
144 if (ref == "Right")
145 return Referential::Right;
146 if (ref == "BottomLeft")
147 return Referential::BottomLeft;
148 if (ref == "Bottom")
149 return Referential::Bottom;
150 if (ref == "BottomRight")
151 return Referential::BottomRight;
152 std::cmatch regMatch;
153 const std::regex refRegex(
154 R"(Referential<\s*(-?\d+(\.\d+)?)\s*,\s*(-?\d+(\.\d+)?)\s*>)");
155 std::regex_match(ref.c_str(), regMatch, refRegex);
156 if (regMatch.size() == 5)
157 {
158 return Referential(std::stod(regMatch[1]), std::stod(regMatch[3]));
159 }
160 throw Exceptions::UnknownReferential(ref, EXC_INFO);
161 }
162
163 std::ostream& operator<<(std::ostream& os, Referential m)
164 {

Callers

nothing calls this directly

Calls 4

ReferentialClass · 0.85
UnknownReferentialClass · 0.85
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected