mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:30:05 +00:00 
			
		
		
		
	Settings variable abstract base, additional validation, and reading/writing JSON
This commit is contained in:
		
							parent
							
								
									1ad67de71b
								
							
						
					
					
						commit
						46c4dd3780
					
				
					 7 changed files with 408 additions and 17 deletions
				
			
		
							
								
								
									
										54
									
								
								scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| #include <scwx/qt/settings/settings_variable_base.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace settings | ||||
| { | ||||
| 
 | ||||
| static const std::string logPrefix_ = | ||||
|    "scwx::qt::settings::settings_variable_base"; | ||||
| 
 | ||||
| class SettingsVariableBase::Impl | ||||
| { | ||||
| public: | ||||
|    explicit Impl(const std::string& name) : name_ {name} {} | ||||
| 
 | ||||
|    ~Impl() {} | ||||
| 
 | ||||
|    const std::string name_; | ||||
| }; | ||||
| 
 | ||||
| SettingsVariableBase::SettingsVariableBase(const std::string& name) : | ||||
|     p(std::make_unique<Impl>(name)) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| SettingsVariableBase::~SettingsVariableBase() = default; | ||||
| 
 | ||||
| SettingsVariableBase::SettingsVariableBase(SettingsVariableBase&&) noexcept = | ||||
|    default; | ||||
| 
 | ||||
| SettingsVariableBase& | ||||
| SettingsVariableBase::operator=(SettingsVariableBase&&) noexcept = default; | ||||
| 
 | ||||
| std::string SettingsVariableBase::name() const | ||||
| { | ||||
|    return p->name_; | ||||
| } | ||||
| 
 | ||||
| bool SettingsVariableBase::Equals(const SettingsVariableBase& o) const | ||||
| { | ||||
|    return p->name_ == o.p->name_; | ||||
| } | ||||
| 
 | ||||
| bool operator==(const SettingsVariableBase& lhs, | ||||
|                 const SettingsVariableBase& rhs) | ||||
| { | ||||
|    return typeid(lhs) == typeid(rhs) && lhs.Equals(rhs); | ||||
| } | ||||
| 
 | ||||
| } // namespace settings
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat