Skip to content

Commit

Permalink
Bump version to v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Jun 10, 2024
1 parent 4f07952 commit 24608c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

cmake_minimum_required(VERSION 3.14)

project(jsonrpcpp VERSION 1.3.4 LANGUAGES CXX)
project(jsonrpcpp VERSION 1.4.0 LANGUAGES CXX)
set(PROJECT_DESCRIPTION "C++ JSON-RPC 2.0 library")
set(PROJECT_URL "https://github.com/badaix/jsonrpcpp")

Expand Down
25 changes: 20 additions & 5 deletions include/jsonrpcpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_( )/ ___) / \ ( ( \( _ \( _ \ / __)( ) ( )
/ \) \\___ \( O )/ / ) / ) __/( (__(_ _)(_ _)
\____/(____/ \__/ \_)__)(__\_)(__) \___)(_) (_)
version 1.3.4
version 1.4.0
https://github.com/badaix/jsonrpcpp
This file is part of jsonrpc++
Expand All @@ -22,7 +22,10 @@
#ifndef JSON_RPC_HPP
#define JSON_RPC_HPP

#include "json.hpp"
// nlohmann-json
#include <json.hpp>

// standard headers
#include <cstring>
#include <exception>
#include <string>
Expand Down Expand Up @@ -151,6 +154,11 @@ class Id : public Entity
return string_id_;
}

bool operator<(const Id& other) const
{
return (to_json() < other.to_json());
}

protected:
value_t type_;
int int_id_;
Expand Down Expand Up @@ -185,6 +193,8 @@ class Parameter : public NullableEntity
bool has(const std::string& key) const;
bool has(size_t idx) const;

void add(const std::string& key, const Json& value);

template <typename T>
T get(const std::string& key) const
{
Expand Down Expand Up @@ -686,11 +696,16 @@ inline Parameter::Parameter(const std::string& key1, const Json& value1, const s
{
param_map[key1] = value1;
if (!key2.empty())
param_map[key2] = value2;
add(key2, value2);
if (!key3.empty())
param_map[key3] = value3;
add(key3, value3);
if (!key4.empty())
param_map[key4] = value4;
add(key4, value4);
}

inline void Parameter::add(const std::string& key, const Json& value)
{
param_map[key] = value;
}

inline void Parameter::parse_json(const Json& json)
Expand Down

0 comments on commit 24608c4

Please sign in to comment.