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

Method get_css

src/lay/lay/layHelpSource.cc:542–1114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540}
541
542std::string
543HelpSource::get_css (const std::string &u)
544{
545 std::ifstream t (tl::to_string (QDir (tl::to_qstring (lay::ApplicationBase::instance()->inst_path ())).absoluteFilePath (QString::fromUtf8 ("help_format.css"))).c_str ());
546 if (t.good ()) {
547 std::string c;
548 while (t.good ()) {
549 std::string l;
550 std::getline (t, l);
551 c += l + "\n";
552 }
553 return c;
554 }
555
556 QResource res (resource_url (QUrl::fromEncoded (u.c_str ()).path ()));
557 if (res.size () == 0) {
558 throw tl::Exception (tl::to_string (QObject::tr ("No data found for resource ")) + u);
559 }
560
561 QByteArray data;
562#if QT_VERSION >= 0x60000
563 if (res.compressionAlgorithm () == QResource::ZlibCompression) {
564#else
565 if (res.isCompressed ()) {
566#endif
567 data = qUncompress ((const unsigned char *)res.data (), (int)res.size ());
568 } else {
569 data = QByteArray ((const char *)res.data (), (int)res.size ());
570 }
571
572 return std::string (data.constData (), data.size ());
573}
574
575std::string
576HelpSource::get (const std::string &u)
577{
578 BrowserOutline ol;
579 return process (get_dom (u), u, ol);
580}
581
582BrowserOutline
583HelpSource::get_outline (const std::string &u)
584{
585 BrowserOutline ol;
586 process (get_dom (u), u, ol);
587 return ol;
588}
589
590void
591HelpSource::search_completers (const std::string &string, std::list<std::string> &completers)
592{
593 size_t n = 0;
594 const size_t max_completers = 100;
595
596 // first produce all hits with match
597 for (std::vector <IndexEntry>::const_iterator i = m_index.begin (); i < m_index.end () && n < max_completers; ++i) {
598 if (i->normalized_key.find (string) != std::string::npos) {
599 completers.push_back (i->key);

Callers

nothing calls this directly

Calls 15

to_qstringFunction · 0.85
inst_pathMethod · 0.80
instanceFunction · 0.70
resource_urlFunction · 0.70
to_stringFunction · 0.50
QDirClass · 0.50
ExceptionClass · 0.50
trFunction · 0.50
QByteArrayClass · 0.50
stringFunction · 0.50
c_strMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected