vjson.hpp

//vov
#ifndef VJSON_HPP
#define VJSON_HPP #include <iostream>
#include <string>
#include "json.hpp" using vJson=nlohmann::json; bool vJsonFromFile(vJson &json_data,const std::string& fname) {
std::fstream ifs(fname,std::fstream::in);
try {
ifs>>json_data;
}
catch(std::exception &e) {
std::cout<<"["<<__FUNCTION__<<"]"<<e.what()<<"\n";
ifs.close();
return false;
}
ifs.close();
return true;
} bool vJsonToFile(vJson &json_data,const std::string& fname) {
std::fstream ofs(fname,std::fstream::out);
try {
ofs<<json_data.dump(4);
}
catch(std::exception &e) {
std::cout<<"["<<__FUNCTION__<<"]"<<e.what()<<"\n";
return false;
}
ofs.close();
return true;
} bool vJsonHasKey(vJson &json_data,const std::string &key) {
return (json_data.find(key)!=json_data.end())?true:false;
} #endif
上一篇:SharePoint 2013 版本功能对比


下一篇:Sharepoint 2013与Sharepoint 2016的功能对比