Loading backends/CMakeLists.txt +17 −0 Original line number Diff line number Diff line Loading @@ -20,3 +20,20 @@ if(${YAML_FOUND}) install(TARGETS yamlconf DESTINATION lib/confplus/backend) endif() find_package(INIPARSER REQUIRED) if(${INIPARSER_FOUND}) set( inisrc ini/ini.cpp ) add_library(iniconf SHARED ${inisrc}) set_target_properties(iniconf PROPERTIES PREFIX "") set_target_properties(iniconf PROPERTIES OUTPUT_NAME ini) target_include_directories(iniconf PUBLIC ${YAML_INCLUDE_DIRS}) target_link_libraries(iniconf ${YAML_LIBRARIES} confplus dl) install(TARGETS iniconf DESTINATION lib/confplus/backend) endif() backends/ini/ini.cpp 0 → 100644 +64 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2024, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <iostream> #include <string> #include "ini.h" #include "conf.h" confplus::Ini::Ini(){ Dict=nullptr; } confplus::Ini::~Ini(){ } const char* confplus::Ini::getName(){ return "ini"; } const char* confplus::Ini::getVersion(){ return "0.1"; } const char* confplus::Ini::getAuthor(){ return "Jan Koester"; } void confplus::Ini::saveConfig(const char *path,const Config *conf){ } void confplus::Ini::loadConfig(const char *path,Config *conf){ if(Dict) iniparser_freedict(Dict); Dict=iniparser_load(path); } backends/ini/ini.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2024, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <iniparser.h> #include "backend.h" namespace confplus { class Config; class Ini : public BackendApi{ public: const char* getName(); const char* getVersion(); const char* getAuthor();; void loadConfig(const char *path,Config *conf); void saveConfig(const char *path,const Config *conf); Ini(); virtual ~Ini(); private: dictionary *Dict; }; }; extern "C" confplus::BackendApi* create() { return new confplus::Ini(); } extern "C" void destroy(confplus::BackendApi* p) { delete p; } Loading
backends/CMakeLists.txt +17 −0 Original line number Diff line number Diff line Loading @@ -20,3 +20,20 @@ if(${YAML_FOUND}) install(TARGETS yamlconf DESTINATION lib/confplus/backend) endif() find_package(INIPARSER REQUIRED) if(${INIPARSER_FOUND}) set( inisrc ini/ini.cpp ) add_library(iniconf SHARED ${inisrc}) set_target_properties(iniconf PROPERTIES PREFIX "") set_target_properties(iniconf PROPERTIES OUTPUT_NAME ini) target_include_directories(iniconf PUBLIC ${YAML_INCLUDE_DIRS}) target_link_libraries(iniconf ${YAML_LIBRARIES} confplus dl) install(TARGETS iniconf DESTINATION lib/confplus/backend) endif()
backends/ini/ini.cpp 0 → 100644 +64 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2024, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <iostream> #include <string> #include "ini.h" #include "conf.h" confplus::Ini::Ini(){ Dict=nullptr; } confplus::Ini::~Ini(){ } const char* confplus::Ini::getName(){ return "ini"; } const char* confplus::Ini::getVersion(){ return "0.1"; } const char* confplus::Ini::getAuthor(){ return "Jan Koester"; } void confplus::Ini::saveConfig(const char *path,const Config *conf){ } void confplus::Ini::loadConfig(const char *path,Config *conf){ if(Dict) iniparser_freedict(Dict); Dict=iniparser_load(path); }
backends/ini/ini.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2024, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <iniparser.h> #include "backend.h" namespace confplus { class Config; class Ini : public BackendApi{ public: const char* getName(); const char* getVersion(); const char* getAuthor();; void loadConfig(const char *path,Config *conf); void saveConfig(const char *path,const Config *conf); Ini(); virtual ~Ini(); private: dictionary *Dict; }; }; extern "C" confplus::BackendApi* create() { return new confplus::Ini(); } extern "C" void destroy(confplus::BackendApi* p) { delete p; }