@@ -106,38 +106,6 @@ CMConverter::from_string (const std::string &s, edt::combine_mode_type &m)
106106 }
107107}
108108
109- // -----------------------------------------------------------------------------
110- // ACConverter implementation
111-
112- std::string
113- ACConverter::to_string (const lay::angle_constraint_type &m)
114- {
115- if (m == lay::AC_Any) {
116- return " any" ;
117- } else if (m == lay::AC_Diagonal) {
118- return " diagonal" ;
119- } else if (m == lay::AC_Ortho) {
120- return " ortho" ;
121- } else {
122- return " " ;
123- }
124- }
125-
126- void
127- ACConverter::from_string (const std::string &tt, lay::angle_constraint_type &m)
128- {
129- std::string t (tl::trim (tt));
130- if (t == " any" ) {
131- m = lay::AC_Any;
132- } else if (t == " diagonal" ) {
133- m = lay::AC_Diagonal;
134- } else if (t == " ortho" ) {
135- m = lay::AC_Ortho;
136- } else {
137- m = lay::AC_Any;
138- }
139- }
140-
141109// -----------------------------------------------------------------------------
142110// PathExtConverter implementation
143111
@@ -174,130 +142,5 @@ PathExtConverter::from_string (const std::string &tt, edt::path_ext_type &m)
174142 }
175143}
176144
177- // -----------------------------------------------------------------------------
178- // HAlignConverter implementation
179-
180- std::string
181- HAlignConverter::to_string (db::HAlign a)
182- {
183- if (a == db::HAlignCenter) {
184- return " center" ;
185- } else if (a == db::HAlignLeft) {
186- return " left" ;
187- } else if (a == db::HAlignRight) {
188- return " right" ;
189- } else {
190- return " " ;
191- }
192- }
193-
194- void
195- HAlignConverter::from_string (const std::string &tt, db::HAlign &a)
196- {
197- std::string t (tl::trim (tt));
198- if (t == " center" ) {
199- a = db::HAlignCenter;
200- } else if (t == " left" ) {
201- a = db::HAlignLeft;
202- } else if (t == " right" ) {
203- a = db::HAlignRight;
204- } else {
205- a = db::NoHAlign;
206- }
207- }
208-
209- // -----------------------------------------------------------------------------
210- // VAlignConverter implementation
211-
212- std::string
213- VAlignConverter::to_string (db::VAlign a)
214- {
215- if (a == db::VAlignCenter) {
216- return " center" ;
217- } else if (a == db::VAlignBottom) {
218- return " bottom" ;
219- } else if (a == db::VAlignTop) {
220- return " top" ;
221- } else {
222- return " " ;
223- }
224- }
225-
226- void
227- VAlignConverter::from_string (const std::string &tt, db::VAlign &a)
228- {
229- std::string t (tl::trim (tt));
230- if (t == " center" ) {
231- a = db::VAlignCenter;
232- } else if (t == " bottom" ) {
233- a = db::VAlignBottom;
234- } else if (t == " top" ) {
235- a = db::VAlignTop;
236- } else {
237- a = db::NoVAlign;
238- }
239- }
240-
241- // -----------------------------------------------------------------------------
242- // EditGridConverter implementation
243-
244- std::string
245- EditGridConverter::to_string (const db::DVector &eg)
246- {
247- if (eg == db::DVector ()) {
248- return " global" ;
249- } else if (eg.x () < 1e-6 ) {
250- return " none" ;
251- } else if (fabs (eg.x () - eg.y ()) < 1e-6 ) {
252- return tl::to_string (eg.x ());
253- } else {
254- return tl::to_string (eg.x ()) + " ," + tl::to_string (eg.y ());
255- }
256- }
257-
258- void
259- EditGridConverter::from_string (const std::string &s, db::DVector &eg)
260- {
261- tl::Extractor ex (s.c_str ());
262-
263- double x = 0 , y = 0 ;
264- if (ex.test (" global" )) {
265- eg = db::DVector ();
266- } else if (ex.test (" none" )) {
267- eg = db::DVector (-1.0 , -1.0 );
268- } else if (ex.try_read (x)) {
269- y = x;
270- if (ex.test (" ," )) {
271- ex.try_read (y);
272- }
273- eg = db::DVector (x, y);
274- }
275- }
276-
277- void
278- EditGridConverter::from_string_picky (const std::string &s, db::DVector &eg)
279- {
280- tl::Extractor ex (s.c_str ());
281-
282- if (ex.test (" global" )) {
283- eg = db::DVector ();
284- } else if (ex.test (" none" )) {
285- eg = db::DVector (-1.0 , -1.0 );
286- } else {
287- double x = 0.0 , y = 0.0 ;
288- ex.read (x);
289- if (ex.test (" ," )) {
290- ex.read (y);
291- } else {
292- y = x;
293- }
294- if (x < 1e-6 || y < 1e-6 ) {
295- throw tl::Exception (tl::to_string (tr (" The grid must be larger than zero" )));
296- }
297- eg = db::DVector (x, y);
298- }
299- ex.expect_end ();
300- }
301-
302145}
303146
0 commit comments