MCPcopy Create free account
hub / github.com/KLayout/klayout / WidthConverter

Class WidthConverter

src/laybasic/laybasic/layLayerProperties.cc:1708–1727  ·  view source on GitHub ↗

* @brief A helper class for XML parser: convert a string to a integer index and vice versa (with -1 being a blank string) */

Source from the content-addressed store, hash-verified

1706 * @brief A helper class for XML parser: convert a string to a integer index and vice versa (with -1 being a blank string)
1707 */
1708struct WidthConverter
1709{
1710 std::string to_string (int b) const
1711 {
1712 if (b < 0) {
1713 return "";
1714 } else {
1715 return tl::to_string (b);
1716 }
1717 }
1718
1719 void from_string (const std::string &s, int &b) const
1720 {
1721 if (s.empty ()) {
1722 b = -1;
1723 } else {
1724 tl::from_string (s.c_str (), b);
1725 }
1726 }
1727};
1728
1729/**
1730 * @brief A helper class for XML parser: convert a string to a integer index and vice versa

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected