|
1 | 1 | #include "stdafx.h" |
2 | 2 | #include "struct.h" |
3 | 3 | #include "struct.gson.h" |
4 | | -#include "acl_cpp/serialize/gson_helper.ipp" |
5 | 4 | namespace acl |
6 | 5 | { |
7 | 6 | acl::json_node& gson(acl::json &$json, const kill_req_data_t &$obj) |
@@ -1576,6 +1575,315 @@ namespace acl |
1576 | 1575 | } |
1577 | 1576 |
|
1578 | 1577 |
|
| 1578 | + acl::json_node& gson(acl::json &$json, const signal_req_data_t &$obj) |
| 1579 | + { |
| 1580 | + acl::json_node &$node = $json.create_node(); |
| 1581 | + |
| 1582 | + if (check_nullptr($obj.path)) |
| 1583 | + $node.add_null("path"); |
| 1584 | + else |
| 1585 | + $node.add_text("path", acl::get_value($obj.path)); |
| 1586 | + |
| 1587 | + |
| 1588 | + return $node; |
| 1589 | + } |
| 1590 | + |
| 1591 | + acl::json_node& gson(acl::json &$json, const signal_req_data_t *$obj) |
| 1592 | + { |
| 1593 | + return gson ($json, *$obj); |
| 1594 | + } |
| 1595 | + |
| 1596 | + |
| 1597 | + acl::string gson(const signal_req_data_t &$obj) |
| 1598 | + { |
| 1599 | + acl::json $json; |
| 1600 | + acl::json_node &$node = acl::gson ($json, $obj); |
| 1601 | + return $node.to_string (); |
| 1602 | + } |
| 1603 | + |
| 1604 | + |
| 1605 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_req_data_t &$obj) |
| 1606 | + { |
| 1607 | + acl::json_node *path = $node["path"]; |
| 1608 | + std::pair<bool, std::string> $result; |
| 1609 | + |
| 1610 | + if(!path ||!($result = gson(*path, &$obj.path), $result.first)) |
| 1611 | + return std::make_pair(false, "required [signal_req_data_t.path] failed:{"+$result.second+"}"); |
| 1612 | + |
| 1613 | + return std::make_pair(true,""); |
| 1614 | + } |
| 1615 | + |
| 1616 | + |
| 1617 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_req_data_t *$obj) |
| 1618 | + { |
| 1619 | + return gson($node, *$obj); |
| 1620 | + } |
| 1621 | + |
| 1622 | + |
| 1623 | + std::pair<bool,std::string> gson(const acl::string &$str, signal_req_data_t &$obj) |
| 1624 | + { |
| 1625 | + acl::json _json; |
| 1626 | + _json.update($str.c_str()); |
| 1627 | + if (!_json.finish()) |
| 1628 | + { |
| 1629 | + return std::make_pair(false, "json not finish error"); |
| 1630 | + } |
| 1631 | + return gson(_json.get_root(), $obj); |
| 1632 | + } |
| 1633 | + |
| 1634 | + |
| 1635 | + acl::json_node& gson(acl::json &$json, const signal_req_t &$obj) |
| 1636 | + { |
| 1637 | + acl::json_node &$node = $json.create_node(); |
| 1638 | + |
| 1639 | + if (check_nullptr($obj.cmd)) |
| 1640 | + $node.add_null("cmd"); |
| 1641 | + else |
| 1642 | + $node.add_text("cmd", acl::get_value($obj.cmd)); |
| 1643 | + |
| 1644 | + if (check_nullptr($obj.signum)) |
| 1645 | + $node.add_null("signum"); |
| 1646 | + else |
| 1647 | + $node.add_number("signum", acl::get_value($obj.signum)); |
| 1648 | + |
| 1649 | + if (check_nullptr($obj.data)) |
| 1650 | + $node.add_null("data"); |
| 1651 | + else |
| 1652 | + $node.add_child("data", acl::gson($json, $obj.data)); |
| 1653 | + |
| 1654 | + |
| 1655 | + return $node; |
| 1656 | + } |
| 1657 | + |
| 1658 | + acl::json_node& gson(acl::json &$json, const signal_req_t *$obj) |
| 1659 | + { |
| 1660 | + return gson ($json, *$obj); |
| 1661 | + } |
| 1662 | + |
| 1663 | + |
| 1664 | + acl::string gson(const signal_req_t &$obj) |
| 1665 | + { |
| 1666 | + acl::json $json; |
| 1667 | + acl::json_node &$node = acl::gson ($json, $obj); |
| 1668 | + return $node.to_string (); |
| 1669 | + } |
| 1670 | + |
| 1671 | + |
| 1672 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_req_t &$obj) |
| 1673 | + { |
| 1674 | + acl::json_node *cmd = $node["cmd"]; |
| 1675 | + acl::json_node *signum = $node["signum"]; |
| 1676 | + acl::json_node *data = $node["data"]; |
| 1677 | + std::pair<bool, std::string> $result; |
| 1678 | + |
| 1679 | + if(!cmd ||!($result = gson(*cmd, &$obj.cmd), $result.first)) |
| 1680 | + return std::make_pair(false, "required [signal_req_t.cmd] failed:{"+$result.second+"}"); |
| 1681 | + |
| 1682 | + if(!signum ||!($result = gson(*signum, &$obj.signum), $result.first)) |
| 1683 | + return std::make_pair(false, "required [signal_req_t.signum] failed:{"+$result.second+"}"); |
| 1684 | + |
| 1685 | + if(!data ||!data->get_obj()||!($result = gson(*data->get_obj(), &$obj.data), $result.first)) |
| 1686 | + return std::make_pair(false, "required [signal_req_t.data] failed:{"+$result.second+"}"); |
| 1687 | + |
| 1688 | + return std::make_pair(true,""); |
| 1689 | + } |
| 1690 | + |
| 1691 | + |
| 1692 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_req_t *$obj) |
| 1693 | + { |
| 1694 | + return gson($node, *$obj); |
| 1695 | + } |
| 1696 | + |
| 1697 | + |
| 1698 | + std::pair<bool,std::string> gson(const acl::string &$str, signal_req_t &$obj) |
| 1699 | + { |
| 1700 | + acl::json _json; |
| 1701 | + _json.update($str.c_str()); |
| 1702 | + if (!_json.finish()) |
| 1703 | + { |
| 1704 | + return std::make_pair(false, "json not finish error"); |
| 1705 | + } |
| 1706 | + return gson(_json.get_root(), $obj); |
| 1707 | + } |
| 1708 | + |
| 1709 | + |
| 1710 | + acl::json_node& gson(acl::json &$json, const signal_res_data_t &$obj) |
| 1711 | + { |
| 1712 | + acl::json_node &$node = $json.create_node(); |
| 1713 | + |
| 1714 | + if (check_nullptr($obj.status)) |
| 1715 | + $node.add_null("status"); |
| 1716 | + else |
| 1717 | + $node.add_number("status", acl::get_value($obj.status)); |
| 1718 | + |
| 1719 | + if (check_nullptr($obj.proc_count)) |
| 1720 | + $node.add_null("proc_count"); |
| 1721 | + else |
| 1722 | + $node.add_number("proc_count", acl::get_value($obj.proc_count)); |
| 1723 | + |
| 1724 | + if (check_nullptr($obj.proc_signaled)) |
| 1725 | + $node.add_null("proc_signaled"); |
| 1726 | + else |
| 1727 | + $node.add_number("proc_signaled", acl::get_value($obj.proc_signaled)); |
| 1728 | + |
| 1729 | + if (check_nullptr($obj.proc_ok)) |
| 1730 | + $node.add_null("proc_ok"); |
| 1731 | + else |
| 1732 | + $node.add_number("proc_ok", acl::get_value($obj.proc_ok)); |
| 1733 | + |
| 1734 | + if (check_nullptr($obj.proc_err)) |
| 1735 | + $node.add_null("proc_err"); |
| 1736 | + else |
| 1737 | + $node.add_number("proc_err", acl::get_value($obj.proc_err)); |
| 1738 | + |
| 1739 | + if (check_nullptr($obj.path)) |
| 1740 | + $node.add_null("path"); |
| 1741 | + else |
| 1742 | + $node.add_text("path", acl::get_value($obj.path)); |
| 1743 | + |
| 1744 | + |
| 1745 | + return $node; |
| 1746 | + } |
| 1747 | + |
| 1748 | + acl::json_node& gson(acl::json &$json, const signal_res_data_t *$obj) |
| 1749 | + { |
| 1750 | + return gson ($json, *$obj); |
| 1751 | + } |
| 1752 | + |
| 1753 | + |
| 1754 | + acl::string gson(const signal_res_data_t &$obj) |
| 1755 | + { |
| 1756 | + acl::json $json; |
| 1757 | + acl::json_node &$node = acl::gson ($json, $obj); |
| 1758 | + return $node.to_string (); |
| 1759 | + } |
| 1760 | + |
| 1761 | + |
| 1762 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_res_data_t &$obj) |
| 1763 | + { |
| 1764 | + acl::json_node *status = $node["status"]; |
| 1765 | + acl::json_node *proc_count = $node["proc_count"]; |
| 1766 | + acl::json_node *proc_signaled = $node["proc_signaled"]; |
| 1767 | + acl::json_node *proc_ok = $node["proc_ok"]; |
| 1768 | + acl::json_node *proc_err = $node["proc_err"]; |
| 1769 | + acl::json_node *path = $node["path"]; |
| 1770 | + std::pair<bool, std::string> $result; |
| 1771 | + |
| 1772 | + if(!status ||!($result = gson(*status, &$obj.status), $result.first)) |
| 1773 | + return std::make_pair(false, "required [signal_res_data_t.status] failed:{"+$result.second+"}"); |
| 1774 | + |
| 1775 | + if(!proc_count ||!($result = gson(*proc_count, &$obj.proc_count), $result.first)) |
| 1776 | + return std::make_pair(false, "required [signal_res_data_t.proc_count] failed:{"+$result.second+"}"); |
| 1777 | + |
| 1778 | + if(!proc_signaled ||!($result = gson(*proc_signaled, &$obj.proc_signaled), $result.first)) |
| 1779 | + return std::make_pair(false, "required [signal_res_data_t.proc_signaled] failed:{"+$result.second+"}"); |
| 1780 | + |
| 1781 | + if(!proc_ok ||!($result = gson(*proc_ok, &$obj.proc_ok), $result.first)) |
| 1782 | + return std::make_pair(false, "required [signal_res_data_t.proc_ok] failed:{"+$result.second+"}"); |
| 1783 | + |
| 1784 | + if(!proc_err ||!($result = gson(*proc_err, &$obj.proc_err), $result.first)) |
| 1785 | + return std::make_pair(false, "required [signal_res_data_t.proc_err] failed:{"+$result.second+"}"); |
| 1786 | + |
| 1787 | + if(!path ||!($result = gson(*path, &$obj.path), $result.first)) |
| 1788 | + return std::make_pair(false, "required [signal_res_data_t.path] failed:{"+$result.second+"}"); |
| 1789 | + |
| 1790 | + return std::make_pair(true,""); |
| 1791 | + } |
| 1792 | + |
| 1793 | + |
| 1794 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_res_data_t *$obj) |
| 1795 | + { |
| 1796 | + return gson($node, *$obj); |
| 1797 | + } |
| 1798 | + |
| 1799 | + |
| 1800 | + std::pair<bool,std::string> gson(const acl::string &$str, signal_res_data_t &$obj) |
| 1801 | + { |
| 1802 | + acl::json _json; |
| 1803 | + _json.update($str.c_str()); |
| 1804 | + if (!_json.finish()) |
| 1805 | + { |
| 1806 | + return std::make_pair(false, "json not finish error"); |
| 1807 | + } |
| 1808 | + return gson(_json.get_root(), $obj); |
| 1809 | + } |
| 1810 | + |
| 1811 | + |
| 1812 | + acl::json_node& gson(acl::json &$json, const signal_res_t &$obj) |
| 1813 | + { |
| 1814 | + acl::json_node &$node = $json.create_node(); |
| 1815 | + |
| 1816 | + if (check_nullptr($obj.status)) |
| 1817 | + $node.add_null("status"); |
| 1818 | + else |
| 1819 | + $node.add_number("status", acl::get_value($obj.status)); |
| 1820 | + |
| 1821 | + if (check_nullptr($obj.msg)) |
| 1822 | + $node.add_null("msg"); |
| 1823 | + else |
| 1824 | + $node.add_text("msg", acl::get_value($obj.msg)); |
| 1825 | + |
| 1826 | + if (check_nullptr($obj.data)) |
| 1827 | + $node.add_null("data"); |
| 1828 | + else |
| 1829 | + $node.add_child("data", acl::gson($json, $obj.data)); |
| 1830 | + |
| 1831 | + |
| 1832 | + return $node; |
| 1833 | + } |
| 1834 | + |
| 1835 | + acl::json_node& gson(acl::json &$json, const signal_res_t *$obj) |
| 1836 | + { |
| 1837 | + return gson ($json, *$obj); |
| 1838 | + } |
| 1839 | + |
| 1840 | + |
| 1841 | + acl::string gson(const signal_res_t &$obj) |
| 1842 | + { |
| 1843 | + acl::json $json; |
| 1844 | + acl::json_node &$node = acl::gson ($json, $obj); |
| 1845 | + return $node.to_string (); |
| 1846 | + } |
| 1847 | + |
| 1848 | + |
| 1849 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_res_t &$obj) |
| 1850 | + { |
| 1851 | + acl::json_node *status = $node["status"]; |
| 1852 | + acl::json_node *msg = $node["msg"]; |
| 1853 | + acl::json_node *data = $node["data"]; |
| 1854 | + std::pair<bool, std::string> $result; |
| 1855 | + |
| 1856 | + if(!status ||!($result = gson(*status, &$obj.status), $result.first)) |
| 1857 | + return std::make_pair(false, "required [signal_res_t.status] failed:{"+$result.second+"}"); |
| 1858 | + |
| 1859 | + if(!msg ||!($result = gson(*msg, &$obj.msg), $result.first)) |
| 1860 | + return std::make_pair(false, "required [signal_res_t.msg] failed:{"+$result.second+"}"); |
| 1861 | + |
| 1862 | + if(!data ||!data->get_obj()||!($result = gson(*data->get_obj(), &$obj.data), $result.first)) |
| 1863 | + return std::make_pair(false, "required [signal_res_t.data] failed:{"+$result.second+"}"); |
| 1864 | + |
| 1865 | + return std::make_pair(true,""); |
| 1866 | + } |
| 1867 | + |
| 1868 | + |
| 1869 | + std::pair<bool,std::string> gson(acl::json_node &$node, signal_res_t *$obj) |
| 1870 | + { |
| 1871 | + return gson($node, *$obj); |
| 1872 | + } |
| 1873 | + |
| 1874 | + |
| 1875 | + std::pair<bool,std::string> gson(const acl::string &$str, signal_res_t &$obj) |
| 1876 | + { |
| 1877 | + acl::json _json; |
| 1878 | + _json.update($str.c_str()); |
| 1879 | + if (!_json.finish()) |
| 1880 | + { |
| 1881 | + return std::make_pair(false, "json not finish error"); |
| 1882 | + } |
| 1883 | + return gson(_json.get_root(), $obj); |
| 1884 | + } |
| 1885 | + |
| 1886 | + |
1579 | 1887 | acl::json_node& gson(acl::json &$json, const start_req_data_t &$obj) |
1580 | 1888 | { |
1581 | 1889 | acl::json_node &$node = $json.create_node(); |
|
0 commit comments