File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ class LIBYANG_CPP_EXPORT Module {
7777 std::string name () const ;
7878 std::optional<std::string> revision () const ;
7979 std::string ns () const ;
80+ std::optional<std::string> org () const ;
8081 bool implemented () const ;
8182 bool featureEnabled (const std::string& featureName) const ;
8283 std::vector<Feature> features () const ;
Original file line number Diff line number Diff line change @@ -75,6 +75,20 @@ std::string Module::ns() const
7575 return m_module->ns ;
7676}
7777
78+ /* *
79+ * @brief Returns the (optional) organization of the module.
80+ *
81+ * Wraps `lys_module::org`.
82+ */
83+ std::optional<std::string> Module::org () const
84+ {
85+ if (!m_module->org ) {
86+ return std::nullopt ;
87+ }
88+
89+ return m_module->org ;
90+ }
91+
7892/* *
7993 * @brief Checks whether the module is implemented (or just imported).
8094 *
Original file line number Diff line number Diff line change @@ -388,9 +388,11 @@ TEST_CASE("context")
388388 REQUIRE (modules.at (6 ).ns () == " urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext" );
389389 REQUIRE (modules.at (7 ).name () == " mod1" );
390390 REQUIRE (modules.at (7 ).ns () == " http://example.com" );
391+ REQUIRE (*modules.at (7 ).org () == " CESNET" );
391392 REQUIRE (*modules.at (7 ).revision () == " 2021-11-15" );
392393 REQUIRE (modules.at (8 ).name () == " test" );
393394 REQUIRE (modules.at (8 ).ns () == " http://example.com" );
395+ REQUIRE (modules.at (8 ).org () == std::nullopt );
394396 REQUIRE (modules.at (8 ).revision () == std::nullopt );
395397 }
396398
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ module mod1 {
22 namespace "http://example.com" ;
33 prefix "mod" ;
44
5+ organization "CESNET" ;
6+
57 revision "2021-11-15" ;
68
79 feature "feature1" ;
You can’t perform that action at this time.
0 commit comments