diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-03-30 11:35:03 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-03-30 11:35:03 +0300 |
| commit | 7d95e67308ee0abcce5c7bd66265146d3dfefd74 (patch) | |
| tree | 9c377087518bb53a429151edb6a947fc47e89242 /protocols/Weather | |
| parent | 66821b916cc298111f9e5ddd2684d15ff7909f02 (diff) | |
useful helper JsonReply moved to the core
Diffstat (limited to 'protocols/Weather')
| -rw-r--r-- | protocols/Weather/src/stdafx.h | 17 | ||||
| -rw-r--r-- | protocols/Weather/src/weather_utils.cpp | 39 | ||||
| -rw-r--r-- | protocols/Weather/weather.vcxproj | 1 | ||||
| -rw-r--r-- | protocols/Weather/weather.vcxproj.filters | 3 |
4 files changed, 0 insertions, 60 deletions
diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h index 956ce498b9..96e5410c71 100644 --- a/protocols/Weather/src/stdafx.h +++ b/protocols/Weather/src/stdafx.h @@ -150,20 +150,3 @@ const wchar_t *GetDefaultText(int c); // function from multiwin module
void UpdateMwinData(MCONTACT hContact);
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// utils
-
-class JsonReply
-{
- JSONNode *m_root = nullptr;
- int m_errorCode = 0;
-
-public:
- JsonReply(MHttpResponse *);
- ~JsonReply();
-
- __forceinline int error() const { return m_errorCode; }
- __forceinline JSONNode &data() const { return *m_root; }
- __forceinline operator bool() const { return m_errorCode == 200; }
-};
diff --git a/protocols/Weather/src/weather_utils.cpp b/protocols/Weather/src/weather_utils.cpp deleted file mode 100644 index b37b6bbe9a..0000000000 --- a/protocols/Weather/src/weather_utils.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "stdafx.h" - -JsonReply::JsonReply(MHttpResponse *pReply) -{ - if (pReply == nullptr) { - m_errorCode = 500; - return; - } - - m_errorCode = pReply->resultCode; - - m_root = json_parse(pReply->body); - if (m_root == nullptr) - m_errorCode = 500; - - delete pReply; -} - -JsonReply::~JsonReply() -{ - json_delete(m_root); -} diff --git a/protocols/Weather/weather.vcxproj b/protocols/Weather/weather.vcxproj index 8b18056c59..56a2b52edd 100644 --- a/protocols/Weather/weather.vcxproj +++ b/protocols/Weather/weather.vcxproj @@ -41,7 +41,6 @@ <ClCompile Include="src\weather_svcs.cpp" /> <ClCompile Include="src\weather_update.cpp" /> <ClCompile Include="src\weather_userinfo.cpp" /> - <ClCompile Include="src\weather_utils.cpp" /> <ClInclude Include="src\proto.h" /> <ClInclude Include="src\resource.h" /> <ClInclude Include="src\stdafx.h" /> diff --git a/protocols/Weather/weather.vcxproj.filters b/protocols/Weather/weather.vcxproj.filters index 50c35cce0e..92a72a4653 100644 --- a/protocols/Weather/weather.vcxproj.filters +++ b/protocols/Weather/weather.vcxproj.filters @@ -41,9 +41,6 @@ <ClCompile Include="src\weather_proto.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\weather_utils.cpp"> - <Filter>Source Files</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="src\resource.h"> |
