Fix windows compile due to rsversion JSON API

This commit is contained in:
Gioacchino Mazzurco 2019-11-28 16:29:10 +01:00
parent 6bae8237e1
commit 5bf8792bc5
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
7 changed files with 37 additions and 80 deletions

View file

@ -17,8 +17,6 @@
* *
*******************************************************************************/
#include "jsonapi.h"
#include <string>
#include <sstream>
#include <memory>
@ -26,6 +24,9 @@
#include <vector>
#include <openssl/crypto.h>
#include "jsonapi.h"
#include "util/rsjson.h"
#include "retroshare/rsfiles.h"
#include "util/radix64.h"
@ -36,6 +37,7 @@
#include "util/rsurl.h"
#include "util/rstime.h"
#include "retroshare/rsevents.h"
#include "retroshare/rsversion.h"
// Generated at compile time
#include "jsonapi-includes.inl"
@ -644,3 +646,14 @@ void JsonApiServer::runloop()
RsInfo() << __PRETTY_FUNCTION__ << " finished!" << std::endl;
}
/*static*/ void RsJsonApi::version(
uint32_t& major, uint32_t& minor, uint32_t& mini, std::string& extra,
std::string& human )
{
major = RS_MAJOR_VERSION;
minor = RS_MINOR_VERSION;
mini = RS_MINI_VERSION;
extra = RS_EXTRA_VERSION;
human = RS_HUMAN_READABLE_VERSION;
}

View file

@ -172,8 +172,6 @@ HEADERS += plugins/pluginmanager.h \
HEADERS += $$PUBLIC_HEADERS
SOURCES *= services/rsversion.cxx
################################# Linux ##########################################
linux-* {
CONFIG += link_pkgconfig

View file

@ -158,5 +158,17 @@ public:
*/
virtual bool isAuthTokenValid(const std::string& token) = 0;
/**
* @brief Write version information to given paramethers
* @jsonapi{development,unauthenticated}
* @param[out] major storage
* @param[out] minor storage
* @param[out] mini storage
* @param[out] extra storage
* @param[out] human storage
*/
static void version( uint32_t& major, uint32_t& minor, uint32_t& mini,
std::string& extra, std::string& human );
virtual ~RsJsonApi() = default;
};

View file

@ -79,35 +79,3 @@ constexpr auto RS_HUMAN_READABLE_VERSION =
RS_PRIVATE_STRINGIFY(RS_MAJOR_VERSION) "." \
RS_PRIVATE_STRINGIFY(RS_MINOR_VERSION) "." \
RS_PRIVATE_STRINGIFY(RS_MINI_VERSION) RS_EXTRA_VERSION;
#include <stdint.h>
#include <string>
/**
* Helper to expose version information to JSON API.
* From C++ you should use directly the macro and constants defined upstair
* @jsonapi{development}
*/
class RsVersion
{
public:
/**
* @brief Write version information to given paramethers
* @jsonapi{development,unauthenticated}
* @param[out] major storage
* @param[out] minor storage
* @param[out] mini storage
* @param[out] extra storage
* @param[out] human storage
*/
static void version( uint32_t& major, uint32_t& minor, uint32_t& mini,
std::string& extra, std::string& human );
};
/**
* Pointer to global instance of RsVersion, for the sake of JSON API, from C++
* you can use directly the macro and constants defined upstair
* @jsonapi{development}
*/
extern RsVersion* rsVersion;

View file

@ -1,35 +0,0 @@
/*******************************************************************************
* *
* libretroshare: retroshare core library *
* *
* Copyright (C) 2019 Gioacchino Mazzurco <gio@eigenlab.org> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "retroshare/rsversion.h"
/*extern*/ RsVersion* rsVersion = new RsVersion;
/*static*/ void RsVersion::version(
uint32_t& major, uint32_t& minor, uint32_t& mini, std::string& extra,
std::string& human )
{
major = RS_MAJOR_VERSION;
minor = RS_MINOR_VERSION;
mini = RS_MINI_VERSION;
extra = RS_EXTRA_VERSION;
human = RS_HUMAN_READABLE_VERSION;
}