//待验证
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
class TJS
{
public:
templete<typename T1>
static bool isValidFn(const Json::Value& m_js, T1 t1)
{
return isValid(m_js, t1);
}
templete<typename T1, typename T2>
static bool isValidFn(const Json::Value& m_js, T1 t1, T2 t2)
{
return isValid(m_js, t1)
&& isValid(m_js[t1], t2)
}
templete<typename T1, typename T2, typename T3>
static bool isValidFn(const Json::Value& m_js, T1 t1, T2 t2, T3 t3)
{
return isValid(m_js, t1)
&& isValid(m_js[t1], t2)
&& isValid(m_js[t1][t2], t3)
}
templete<typename T1, typename T2, typename T3, typename T4>
static bool isValidFn(const Json::Value& m_js, T1 t1, T2 t2, T3 t3, T4 t4)
{
return isValid(m_js, t1)
&& isValid(m_js[t1], t2)
&& isValid(m_js[t1][t2], t3)
&& isValid(m_js[t1][t2][t3], t4)
}
templete<typename T1, typename T2, typename T3, typename T4, typename T5>
static bool isValidFn(const Json::Value& m_js, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
{
return isValid(m_js, t1)
&& isValid(m_js[t1], t2)
&& isValid(m_js[t1][t2], t3)
&& isValid(m_js[t1][t2][t3], t4)
&& isValid(m_js[t1][t2][t3][t4], t5)
}
templete<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
static bool isValidFn(const Json::Value& m_js, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
{
return isValid(m_js, t1)
&& isValid(m_js[t1], t2)
&& isValid(m_js[t1][t2], t3)
&& isValid(m_js[t1][t2][t3], t4)
&& isValid(m_js[t1][t2][t3][t4], t5)
&& isValid(m_js[t1][t2][t3][t4][t5], t6)
}
private:
templete<typename T>
static bool isValid(const Json::Value& js, T t)
{
js.isArray(js) ? (js.size() > t ? true : false) ? isMember(t) : ture ? false;
}
};
int main()
{
Json::Value jstemp = Json::Value::null;
jstemp[1][2]["factory"]["name"][5]["lol"] = "test";
tjs::isValidFn(jstemp, 1, 2, "factory");
return 0;
}