抛弃GdCpp*.dll/pdb历史重新建库。libhv和Sqlite的dll保留
This commit is contained in:
51
staticOnly/json/jsonCVWrapper.cpp
Normal file
51
staticOnly/json/jsonCVWrapper.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "pch.h"
|
||||
|
||||
void to_json(jsonobj& j, const cv::Point& p)
|
||||
{
|
||||
j["x"] = p.x;
|
||||
j["y"] = p.y;
|
||||
}
|
||||
void from_json(const jsonobj& j, cv::Point& p)
|
||||
{
|
||||
tryRead(j, "x", p.x);
|
||||
tryRead(j, "y", p.y);
|
||||
}
|
||||
|
||||
void to_json(jsonobj& j, const cv::Point2f& p)
|
||||
{
|
||||
j["x"] = p.x;
|
||||
j["y"] = p.y;
|
||||
}
|
||||
void from_json(const jsonobj& j, cv::Point2f& p)
|
||||
{
|
||||
tryRead(j, "x", p.x);
|
||||
tryRead(j, "y", p.y);
|
||||
}
|
||||
|
||||
|
||||
void to_json(jsonobj& j, const cv::Size& p)
|
||||
{
|
||||
j["w"] = p.width;
|
||||
j["h"] = p.height;
|
||||
}
|
||||
void from_json(const jsonobj& j, cv::Size& p)
|
||||
{
|
||||
tryRead(j, "w", p.width);
|
||||
tryRead(j, "h", p.height);
|
||||
}
|
||||
|
||||
void to_json(jsonobj& j, const cv::Rect& p)
|
||||
{
|
||||
j["x"] = p.x;
|
||||
j["y"] = p.y;
|
||||
j["w"] = p.width;
|
||||
j["h"] = p.height;
|
||||
}
|
||||
|
||||
void from_json(const jsonobj& j, cv::Rect& p)
|
||||
{
|
||||
tryRead(j, "x", p.x);
|
||||
tryRead(j, "y", p.y);
|
||||
tryRead(j, "w", p.width);
|
||||
tryRead(j, "h", p.height);
|
||||
}
|
||||
90
staticOnly/json/jsonVCWrapper.cpp
Normal file
90
staticOnly/json/jsonVCWrapper.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "json/jsonVCWrapper.h"
|
||||
|
||||
bool toWstring(const jsonobj& j, std::wstring& dst)
|
||||
{
|
||||
if (j.is_string()) { // 判断是否为string类型的数据,避免get函数抛出异常
|
||||
dst = utf8_16(j.get<std::string>());
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
|
||||
|
||||
void to_json(jsonobj& j, const CString& p) {
|
||||
j = CStringToUtf8(p);
|
||||
}
|
||||
|
||||
void from_json(const jsonobj& j, CString& p) {
|
||||
if (j.is_string()) { // 判断是否为string类型的数据,避免get函数抛出异常
|
||||
p = CStringFromUtf8(j.get<std::string>());
|
||||
}
|
||||
else {
|
||||
// 没法返回错误
|
||||
}
|
||||
}
|
||||
|
||||
#else // 未测试
|
||||
|
||||
void to_json(jsonobj& j, const CString& p) {
|
||||
j = Utf8ToGbk((LPCSTR)p);
|
||||
}
|
||||
|
||||
void from_json(const jsonobj& j, CString& p) {
|
||||
if (j.is_string()) { // 判断是否为string类型的数据,避免get函数抛出异常
|
||||
p = Utf8ToGbk(j.get<std::string>()).c_str();
|
||||
}
|
||||
else {
|
||||
// 没法返回错误
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void to_json(jsonobj& j, const CPoint& p)
|
||||
{
|
||||
j["x"] = p.x;
|
||||
j["y"] = p.y;
|
||||
}
|
||||
|
||||
void from_json(const jsonobj& j, CPoint& p)
|
||||
{
|
||||
readWithDefault(j, "x", p.x, 0);
|
||||
readWithDefault(j, "y", p.y, 0);
|
||||
}
|
||||
|
||||
void to_json(jsonobj& j, const CSize& p)
|
||||
{
|
||||
j["cx"] = p.cx;
|
||||
j["cy"] = p.cy;
|
||||
}
|
||||
void from_json(const jsonobj& j, CSize& p)
|
||||
{
|
||||
readWithDefault(j, "cx", p.cx, 0);
|
||||
readWithDefault(j, "cy", p.cy, 0);
|
||||
}
|
||||
|
||||
void to_json(jsonobj& j, const CRect& p)
|
||||
{
|
||||
j["x"] = p.left;
|
||||
j["y"] = p.top;
|
||||
j["w"] = p.right-p.left;
|
||||
j["h"] = p.bottom-p.top;
|
||||
}
|
||||
void from_json(const jsonobj& j, CRect& p)
|
||||
{
|
||||
int w, h;
|
||||
readWithDefault(j, "x", p.left, 0);
|
||||
readWithDefault(j, "y", p.top, 0);
|
||||
readWithDefault(j, "w", w, 0);
|
||||
readWithDefault(j, "h", h, 0);
|
||||
p.right = p.left + w;
|
||||
p.bottom = p.top + h;
|
||||
}
|
||||
0
staticOnly/json/与openCV相关,不宜编译到dll.txt
Normal file
0
staticOnly/json/与openCV相关,不宜编译到dll.txt
Normal file
Reference in New Issue
Block a user