| 938 | } |
| 939 | |
| 940 | db::LayerMap |
| 941 | LayerMap::from_string_file_format (const std::string &s) |
| 942 | { |
| 943 | db::LayerMap lm; |
| 944 | // NOTE: this should be outside the normal layer index range of a Layout and below |
| 945 | // the space reserved for placeholders. With numbers like this we don't get messed |
| 946 | // up with existing layers. |
| 947 | unsigned int l = std::numeric_limits<unsigned int>::max () / 2; |
| 948 | |
| 949 | int lnr = 0; |
| 950 | |
| 951 | try { |
| 952 | |
| 953 | std::vector<std::string> lines = tl::split (s, "\n"); |
| 954 | |
| 955 | for (std::vector<std::string>::const_iterator line = lines.begin (); line != lines.end (); ++line) { |
| 956 | |
| 957 | ++lnr; |
| 958 | |
| 959 | tl::Extractor ex (line->c_str ()); |
| 960 | if (ex.test ("#") || ex.test ("//")) { |
| 961 | // ignore comments |
| 962 | } else { |
| 963 | |
| 964 | if (! ex.at_end ()) { |
| 965 | lm.add_expr (ex, l); |
| 966 | if (ex.test ("#") || ex.test ("//")) { |
| 967 | // ignore comments |
| 968 | } else { |
| 969 | ex.expect_end (); |
| 970 | } |
| 971 | ++l; |
| 972 | } |
| 973 | |
| 974 | } |
| 975 | |
| 976 | } |
| 977 | |
| 978 | } catch (tl::Exception &ex) { |
| 979 | throw tl::Exception (ex.msg () + tl::to_string (tr (" in line ")) + tl::to_string (lnr)); |
| 980 | } |
| 981 | |
| 982 | return lm; |
| 983 | } |
| 984 | |
| 985 | } |
| 986 |
nothing calls this directly
no test coverage detected