Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-29 10:25:01

0001 
0002 #include "JDatabundle.h"
0003 
0004 
0005 void JDatabundle::SetUniqueName(std::string unique_name) {
0006 
0007     m_unique_name = unique_name;
0008     m_has_short_name = false;
0009 
0010     // Check if unique name follows short name format
0011     auto split = unique_name.find(':');
0012     auto front = unique_name.substr(0, split);
0013     if (front == m_type_name) {
0014         if (split != std::string::npos) {
0015             // "MyTypeName:MyShortName" => m_short_name = "MyShortName"
0016             m_has_short_name = true;
0017             m_short_name = unique_name.substr(split+1);
0018         }
0019         else if (m_type_name.length() == unique_name.length()) {
0020             // "MyTypeName" => m_short_name = ""
0021             m_has_short_name = true;
0022             m_short_name = "";
0023         }
0024         // "MyTypeNameMyShortName" does NOT yield a valid shortname
0025     }
0026 }
0027 
0028 void JDatabundle::SetShortName(std::string short_name) {
0029     m_short_name = short_name;
0030     if (m_short_name.empty()) {
0031         m_unique_name = m_type_name;
0032     }
0033     else {
0034         m_unique_name = m_type_name + ":" + short_name;
0035     }
0036     m_has_short_name = true;
0037 }
0038 
0039 void JDatabundle::SetTypeName(std::string type_name) {
0040     m_type_name = type_name; 
0041     if (m_has_short_name) {
0042         if (m_short_name.empty()) {
0043             m_unique_name = type_name;
0044         }
0045         else {
0046             m_unique_name = type_name + ":" + m_short_name;
0047         }
0048     }
0049 }