3 Commits

Author SHA1 Message Date
rexy712
50c7a055ec Updated version 2019-03-30 05:22:11 -07:00
rexy712
6771d00c6e Updated copyright notice 2019-03-30 05:20:53 -07:00
rexy712
71661cd9ad Made rjp_search_members take a 'const char* const*' for search terms 2019-03-30 04:37:06 -07:00
10 changed files with 18 additions and 21 deletions

View File

@@ -4,8 +4,8 @@ include(GNUInstallDirs)
cmake_minimum_required(VERSION 3.0.2)
project(rjp)
set(rjp_VERSION_MAJOR 0)
set(rjp_VERSION_MINOR 5)
set(rjp_VERSION_REVISION 0)
set(rjp_VERSION_MINOR 6)
set(rjp_VERSION_REVISION 2)
set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include)
configure_file(
"${INCLUDE_PATH}/config.h.in"

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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
@@ -137,10 +137,10 @@ size_t rjp_member_name_length(RJP_value* member);
RJP_search_res rjp_search_member(const RJP_value* object, const char* search, size_t skip);
//Search for first occurance of multiple keys. Returns first occurance of each.
//Assumes dest is large enough to hold maximum num items.
size_t rjp_search_members(const RJP_value* object, size_t num, const char** searches, RJP_search_res* dest, size_t skip);
size_t rjp_search_members(const RJP_value* object, size_t num, const char* const* searches, RJP_search_res* dest, size_t skip);
//Search for multiple occurances of multiple keys. Returns pointer to list of matches.
//Returned pointer must be freed using rjp_free
RJP_search_res* rjp_search_members_multi(const RJP_value* object, size_t num, const char** searches, size_t* rsize, size_t skip);
RJP_search_res* rjp_search_members_multi(const RJP_value* object, size_t num, const char* const* searches, size_t* rsize, size_t skip);
//Access first element of a json array
RJP_value* rjp_get_element(const RJP_value* array);
//Access next element of a json array given the previous element

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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
@@ -138,7 +138,7 @@ RJP_search_res rjp_search_member(const RJP_value* object, const char* search, si
return (RJP_search_res){0};
}
size_t rjp_search_members(const RJP_value* object, size_t num, const char** searches, RJP_search_res* dest, size_t skip){
size_t rjp_search_members(const RJP_value* object, size_t num, const char* const* searches, RJP_search_res* dest, size_t skip){
const char** tmp = rjp_alloc(num*sizeof(char*));
for(size_t i = 0;i < num;++i){
tmp[i] = searches[i];
@@ -151,25 +151,22 @@ size_t rjp_search_members(const RJP_value* object, size_t num, const char** sear
for(;member;member = rjp_next_member(member),++objindex){
for(size_t i = 0;i < num;++i){
if(searches[i] == NULL)
if(tmp[i] == NULL)
continue;
if(!strcmp(((RJP_object_member*)member)->name.value, searches[i])){
if(!strcmp(((RJP_object_member*)member)->name.value, tmp[i])){
dest[i].value = member;
dest[i].searchindex = i;
dest[i].objindex = objindex;
searches[i] = NULL;
tmp[i] = NULL;
++matches;
break;
}
}
}
for(size_t i = 0;i < num;++i){
searches[i] = tmp[i];
}
rjp_free(tmp);
return matches;
}
RJP_search_res* rjp_search_members_multi(const RJP_value* object, size_t num, const char** searches, size_t* rsize, size_t skip){
RJP_search_res* rjp_search_members_multi(const RJP_value* object, size_t num, const char* const* searches, size_t* rsize, size_t skip){
RJP_search_res* ret = rjp_alloc(num*sizeof(RJP_search_res));
size_t ret_size = num;
size_t j = 0;

View File

@@ -1,6 +1,6 @@
/**
rjp
Copyright (C) 2018 rexy712
Copyright (C) 2018-2019 rexy712
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