mirror of https://github.com/KLayout/klayout.git
Adding the description option to library declaration files
This commit is contained in:
parent
a39bc587c1
commit
9b2d1fe0be
|
|
@ -253,6 +253,15 @@ define("B", "b.gds");</pre>
|
|||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<p><b>description</b>: Specifies a description for that library.
|
||||
</p>
|
||||
|
||||
<pre>define("A", "a.gds", description="Library A");</pre>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</doc>
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ public:
|
|||
for (auto k = kwargs->begin (); k != kwargs->end (); ++k) {
|
||||
|
||||
static const std::string replicate_key ("replicate");
|
||||
static const std::string description_key ("description");
|
||||
static const std::string technology_key ("technology");
|
||||
static const std::string technologies_key ("technologies");
|
||||
|
||||
|
|
@ -327,6 +328,10 @@ public:
|
|||
|
||||
fi.replicate = k->second.to_bool ();
|
||||
|
||||
} else if (k->first == description_key) {
|
||||
|
||||
fi.description = k->second.to_string ();
|
||||
|
||||
} else if (k->first == technology_key) {
|
||||
|
||||
fi.tech.clear ();
|
||||
|
|
@ -465,6 +470,7 @@ LibraryController::read_libs (const std::vector<LibraryController::LibFileInfo>
|
|||
|
||||
std::unique_ptr<db::FileBasedLibrary> lib (new db::FileBasedLibrary (lib_path, im->name));
|
||||
lib->set_technologies (im->tech);
|
||||
lib->set_description (im->description);
|
||||
lib->set_replicate (im->replicate);
|
||||
|
||||
tl::log << "Reading library '" << lib_path << "'";
|
||||
|
|
@ -493,6 +499,7 @@ LibraryController::read_libs (const std::vector<LibraryController::LibFileInfo>
|
|||
LibInfo li;
|
||||
li.name = libname;
|
||||
li.time = fi.lastModified ();
|
||||
li.description = im->description;
|
||||
li.tech = im->tech;
|
||||
li.replicate = im->replicate;
|
||||
new_lib_files.insert (std::make_pair (lib_path, li));
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public:
|
|||
{
|
||||
LibFileInfo () : name (), path (), replicate (true) { }
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string path;
|
||||
std::set<std::string> tech;
|
||||
bool replicate;
|
||||
|
|
@ -135,8 +136,9 @@ private slots:
|
|||
private:
|
||||
struct LibInfo
|
||||
{
|
||||
LibInfo () : name (), time (), tech (), replicate (true) { }
|
||||
LibInfo () : name (), description (), time (), tech (), replicate (true) { }
|
||||
std::string name;
|
||||
std::string description;
|
||||
QDateTime time;
|
||||
std::set<std::string> tech;
|
||||
bool replicate;
|
||||
|
|
|
|||
|
|
@ -37,11 +37,13 @@ TEST (1)
|
|||
EXPECT_EQ (file_info[0].name, "");
|
||||
EXPECT_EQ (file_info[0].path, tl::combine_path (tl::absolute_path (lib_file), "noname.gds"));
|
||||
EXPECT_EQ (file_info[0].replicate, true);
|
||||
EXPECT_EQ (file_info[0].description, "");
|
||||
EXPECT_EQ (tl::join (file_info[0].tech.begin (), file_info[0].tech.end (), ","), "T1");
|
||||
|
||||
EXPECT_EQ (file_info[1].name, "L2");
|
||||
EXPECT_EQ (file_info[1].path, tl::absolute_file_path (lib_file) + ".zzz");
|
||||
EXPECT_EQ (file_info[1].replicate, true);
|
||||
EXPECT_EQ (file_info[1].description, "Library L2");
|
||||
EXPECT_EQ (file_info[1].tech.size (), size_t (0));
|
||||
|
||||
EXPECT_EQ (file_info[2].name, "L3");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# A comment
|
||||
define("noname.gds");
|
||||
define("L2", file + ".zzz", technology = "");
|
||||
define("L2", file + ".zzz", technology = "", description = "Library L2");
|
||||
define("L3", "subdir/l3.gds", technologies = [ "T2", "T3" ], replicate = false);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue