Commit d5cbec33 authored by amdmi3's avatar amdmi3
Browse files

A C++ implementation of the HOCON configuration file format.

WWW: https://github.com/puppetlabs/cpp-hocon

PR:		213763
Submitted by:	jslagle@gmail.com
parent d9be2389
......@@ -320,6 +320,7 @@
SUBDIR += covtool
SUBDIR += cpan-upload
SUBDIR += cpan-upload-http
SUBDIR += cpp-hocon
SUBDIR += cpp-netlib
SUBDIR += cppcheck
SUBDIR += cppi
......
# $FreeBSD$
PORTNAME= cpp-hocon
PORTVERSION= 0.1.4
CATEGORIES= devel
MAINTAINER= jslagle@gmail.com
COMMENT= C++ configuration library
LICENSE= APACHE20
LIB_DEPENDS= libboost_system.so:devel/boost-libs \
libleatherman_util.so:devel/leatherman
USE_GITHUB= yes
GH_ACCOUNT= puppetlabs
USES= cmake
CMAKE_ARGS= -DCPP_HOCON_SHARED:BOOL=ON
.include <bsd.port.mk>
TIMESTAMP = 1477237793
SHA256 (puppetlabs-cpp-hocon-0.1.4_GH0.tar.gz) = 2274b99dc098122b6e3d2c8d23173d21893555190c5a008e5a9a7d84875c7275
SIZE (puppetlabs-cpp-hocon-0.1.4_GH0.tar.gz) = 157988
--- lib/CMakeLists.txt.orig 2016-09-23 20:45:10 UTC
+++ lib/CMakeLists.txt
@@ -75,20 +75,23 @@ set(PROJECT_SOURCES
## Without the intermediate target, unexported symbols can't be tested.
add_library(libprojectsrc OBJECT ${PROJECT_SOURCES})
set_target_properties(libprojectsrc PROPERTIES POSITION_INDEPENDENT_CODE true)
-
-add_library(lib${PROJECT_NAME} $<TARGET_OBJECTS:libprojectsrc>)
-set_target_properties(lib${PROJECT_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
-target_link_libraries(lib${PROJECT_NAME}
+if(CPP_HOCON_SHARED)
+ add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:libprojectsrc>)
+else()
+ add_library(${PROJECT_NAME} $<TARGET_OBJECTS:libprojectsrc>)
+endif()
+set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
+target_link_libraries(${PROJECT_NAME}
${LEATHERMAN_LIBRARIES}
${Boost_LIBRARIES}
)
# Generate the export header for restricting symbols exported from the library.
# Restricting symbols has several advantages, noted at https://gcc.gnu.org/wiki/Visibility.
-symbol_exports(lib${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/inc/hocon/export.h")
+symbol_exports(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/inc/hocon/export.h")
# This correctly handles DLL installation on Windows.
-leatherman_install(lib${PROJECT_NAME})
+leatherman_install(${PROJECT_NAME})
install(DIRECTORY inc/hocon DESTINATION include)
add_subdirectory(tests)
--- lib/inc/hocon/config.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config.hpp
@@ -169,7 +169,7 @@ namespace hocon {
* interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
- class LIBCPP_HOCON_EXPORT config : public config_mergeable, public std::enable_shared_from_this<config> {
+ class CPP_HOCON_EXPORT config : public config_mergeable, public std::enable_shared_from_this<config> {
friend class config_object;
friend class config_value;
friend class config_parseable;
--- lib/inc/hocon/config_include_context.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_include_context.hpp
@@ -18,7 +18,7 @@ namespace hocon {
* interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
- class LIBCPP_HOCON_EXPORT config_include_context {
+ class CPP_HOCON_EXPORT config_include_context {
public:
/**
* Tries to find a name relative to whatever is doing the including, for
--- lib/inc/hocon/config_includer.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_includer.hpp
@@ -12,7 +12,7 @@ namespace hocon {
* customize handling of {@code include} statements in config files. You may
* also want to implement {@link config_includer_file} and {@link config_includer_URL}, or not.
*/
- class LIBCPP_HOCON_EXPORT config_includer {
+ class CPP_HOCON_EXPORT config_includer {
public:
/**
* Returns a new includer that falls back to the given includer. This is how
--- lib/inc/hocon/config_includer_file.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_includer_file.hpp
@@ -11,7 +11,7 @@ namespace hocon {
* If you do not implement this but do implement {@link config_includer},
* attempts to load files will use the default includer.
*/
- class LIBCPP_HOCON_EXPORT config_includer_file {
+ class CPP_HOCON_EXPORT config_includer_file {
public:
/**
* Parses another item to be included. The returned object typically would
--- lib/inc/hocon/config_list.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_list.hpp
@@ -34,7 +34,7 @@ namespace hocon {
*
*/
- class LIBCPP_HOCON_EXPORT config_list : public config_value {
+ class CPP_HOCON_EXPORT config_list : public config_value {
public:
config_list(shared_origin origin) : config_value(move(origin)) {}
--- lib/inc/hocon/config_mergeable.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_mergeable.hpp
@@ -5,7 +5,7 @@
namespace hocon {
- class LIBCPP_HOCON_EXPORT config_mergeable {
+ class CPP_HOCON_EXPORT config_mergeable {
friend class config_value;
public:
/**
--- lib/inc/hocon/config_object.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_object.hpp
@@ -8,7 +8,7 @@
namespace hocon {
- class LIBCPP_HOCON_EXPORT config_object : public config_value {
+ class CPP_HOCON_EXPORT config_object : public config_value {
friend class config;
friend class config_value;
friend class simple_config_object;
--- lib/inc/hocon/config_origin.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_origin.hpp
@@ -36,7 +36,7 @@ namespace hocon {
*
* @return string describing the origin
*/
- LIBCPP_HOCON_EXPORT virtual std::string const& description() const = 0;
+ CPP_HOCON_EXPORT virtual std::string const& description() const = 0;
/**
* Returns a {@code ConfigOrigin} based on this one, but with the given
@@ -55,7 +55,7 @@ namespace hocon {
* @param lineNumber the new line number
* @return the created ConfigOrigin
*/
- LIBCPP_HOCON_EXPORT virtual shared_origin with_line_number(int line_number) const = 0;
+ CPP_HOCON_EXPORT virtual shared_origin with_line_number(int line_number) const = 0;
/**
* Returns a line number where the value or exception originated. This will
@@ -63,7 +63,7 @@ namespace hocon {
*
* @return line number or -1 if none is available
*/
- LIBCPP_HOCON_EXPORT virtual int line_number() const = 0;
+ CPP_HOCON_EXPORT virtual int line_number() const = 0;
/**
* Returns any comments that appeared to "go with" this place in the file.
@@ -75,7 +75,7 @@ namespace hocon {
* @return any comments that seemed to "go with" this origin, empty list if
* none
*/
- LIBCPP_HOCON_EXPORT virtual std::vector<std::string> const& comments() const = 0;
+ CPP_HOCON_EXPORT virtual std::vector<std::string> const& comments() const = 0;
/**
* Returns a {@code config_origin} based on this one, but with the given
@@ -92,7 +92,7 @@ namespace hocon {
* @param comments the comments used on the returned origin
* @return the config_origin with the given comments
*/
- LIBCPP_HOCON_EXPORT virtual shared_origin with_comments(std::vector<std::string> comments) const = 0;
+ CPP_HOCON_EXPORT virtual shared_origin with_comments(std::vector<std::string> comments) const = 0;
};
} // namespace hocon
--- lib/inc/hocon/config_parse_options.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_parse_options.hpp
@@ -22,7 +22,7 @@ namespace hocon {
*
* ClassLoader is Java-specific, so it was not ported to C++.
*/
- class LIBCPP_HOCON_EXPORT config_parse_options {
+ class CPP_HOCON_EXPORT config_parse_options {
public:
/**
* Gets an instance of <code>config_parse_options</code> with all fields
--- lib/inc/hocon/config_parseable.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_parseable.hpp
@@ -16,7 +16,7 @@ namespace hocon {
* interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
- class LIBCPP_HOCON_EXPORT config_parseable {
+ class CPP_HOCON_EXPORT config_parseable {
public:
/**
* Parse whatever it is. The options should come from
--- lib/inc/hocon/config_render_options.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_render_options.hpp
@@ -17,7 +17,7 @@ namespace hocon {
* config_render_options().set_comments(false)
* </pre>
*/
- class LIBCPP_HOCON_EXPORT config_render_options {
+ class CPP_HOCON_EXPORT config_render_options {
public:
/** Leaving the default arguments will result in a verbose rendering,
* which contains comments and therefore is not valid JSON.
--- lib/inc/hocon/config_resolve_options.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_resolve_options.hpp
@@ -27,7 +27,7 @@ namespace hocon {
* environment variables or other external system information. (Right now,
* environment variables are the only example.)
*/
- class LIBCPP_HOCON_EXPORT config_resolve_options {
+ class CPP_HOCON_EXPORT config_resolve_options {
public:
/**
* Returns the default resolve options. By default the system environment
--- lib/inc/hocon/config_value.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_value.hpp
@@ -36,7 +36,7 @@ namespace hocon {
* Also, this interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
- class LIBCPP_HOCON_EXPORT config_value : public config_mergeable, public std::enable_shared_from_this<config_value> {
+ class CPP_HOCON_EXPORT config_value : public config_mergeable, public std::enable_shared_from_this<config_value> {
friend class token;
friend class value;
friend class default_transformer;
--- lib/inc/hocon/config_value_factory.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/config_value_factory.hpp
@@ -2,9 +2,10 @@
#include "types.hpp"
#include "export.h"
+#include <string>
namespace hocon {
- class LIBCPP_HOCON_EXPORT config_value_factory {
+ class CPP_HOCON_EXPORT config_value_factory {
public:
/**
* Creates a {@link ConfigValue} from a plain value, which may be
--- lib/inc/hocon/parser/config_document.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/parser/config_document.hpp
@@ -23,7 +23,7 @@ namespace hocon {
* Also, this interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
- class LIBCPP_HOCON_EXPORT config_document {
+ class CPP_HOCON_EXPORT config_document {
public:
/**
* Returns a new config_document that is a copy of the current config_document,
--- lib/inc/hocon/parser/config_document_factory.hpp.orig 2016-09-23 20:45:10 UTC
+++ lib/inc/hocon/parser/config_document_factory.hpp
@@ -18,11 +18,11 @@ namespace hocon { namespace config_docum
* parse options to control how the file is interpreted
* @return the parsed configuration
*/
- LIBCPP_HOCON_EXPORT std::shared_ptr<config_document> parse_file(std::string input_file_path,
+ CPP_HOCON_EXPORT std::shared_ptr<config_document> parse_file(std::string input_file_path,
config_parse_options options);
/** Parses a file into a config_document instance using default options. */
- LIBCPP_HOCON_EXPORT std::shared_ptr<config_document> parse_file(std::string input_file_path);
+ CPP_HOCON_EXPORT std::shared_ptr<config_document> parse_file(std::string input_file_path);
/**
* Parses a string which should be valid HOCON or JSON.
@@ -31,9 +31,9 @@ namespace hocon { namespace config_docum
* @param options parse options
* @return the parsed configuration
*/
- LIBCPP_HOCON_EXPORT std::shared_ptr<config_document> parse_string(std::string s, config_parse_options options);
+ CPP_HOCON_EXPORT std::shared_ptr<config_document> parse_string(std::string s, config_parse_options options);
/** Parses a string into a config_document instance using default options. */
- LIBCPP_HOCON_EXPORT std::shared_ptr<config_document> parse_string(std::string s);
+ CPP_HOCON_EXPORT std::shared_ptr<config_document> parse_string(std::string s);
}} // namespace hocon::config_document_factory
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment