Read Project, Version and Info fields from json-tariff-files
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
#include "configuration.h"
 | 
					#include "configuration.h"
 | 
				
			||||||
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// <inheritdoc/>
 | 
					/// <inheritdoc/>
 | 
				
			||||||
MemberType Configuration::IdentifyJsonMember(const char* member_name)
 | 
					MemberType Configuration::IdentifyJsonMember(const char* member_name)
 | 
				
			||||||
@@ -87,13 +88,24 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
 | 
				
			|||||||
			const char* mb_name = i->name.GetString();
 | 
								const char* mb_name = i->name.GetString();
 | 
				
			||||||
            if (mb_name == NULL) continue;
 | 
					            if (mb_name == NULL) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // if (!document[mb_name].IsArray()) {
 | 
					            if (document[mb_name].IsString()) {
 | 
				
			||||||
                std::string const _mb_name(mb_name);
 | 
					                QString const _mb_name(mb_name);
 | 
				
			||||||
                if (_mb_name == "version" || _mb_name == "project" ||
 | 
					                if (_mb_name.startsWith("Project", Qt::CaseInsensitive)) {
 | 
				
			||||||
                    _mb_name == "zone" || _mb_name == "info") {
 | 
					                    cfg->project.project = document[mb_name].GetString();
 | 
				
			||||||
 | 
					                    qDebug() << "PROJECT" << cfg->project.project;
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            // }
 | 
					                if (_mb_name.startsWith("Version", Qt::CaseInsensitive)) {
 | 
				
			||||||
 | 
					                    cfg->project.version = document[mb_name].GetString();
 | 
				
			||||||
 | 
					                    qDebug() << "VERSION" << cfg->project.version;
 | 
				
			||||||
 | 
					                    continue;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (_mb_name.startsWith("Info", Qt::CaseInsensitive)) {
 | 
				
			||||||
 | 
					                    cfg->project.info = document[mb_name].GetString();
 | 
				
			||||||
 | 
					                    qDebug() << "INFO" << cfg->project.info;
 | 
				
			||||||
 | 
					                    continue;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//printf(" -%s\n", mb_name);
 | 
								//printf(" -%s\n", mb_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user