Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
640552ab
Unverified
Commit
640552ab
authored
Nov 22, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dependency on libzeep
parent
faee1848
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
42 deletions
+55
-42
CMakeLists.txt
+0
-6
README.md
+0
-3
cmake/cifppConfig.cmake.in
+1
-8
include/cif++/text.hpp
+54
-25
No files found.
CMakeLists.txt
View file @
640552ab
...
@@ -222,12 +222,6 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY})
...
@@ -222,12 +222,6 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY})
include
(
FindAtomic
)
include
(
FindAtomic
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
STDCPPATOMIC_LIBRARY
}
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
STDCPPATOMIC_LIBRARY
}
)
if
(
MSVC
)
# this dependency can go once MSVC supports std::experimental::is_detected
find_package
(
zeep 5.1.8 REQUIRED
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES zeep::zeep
)
endif
()
# Create a revision file, containing the current git version info
# Create a revision file, containing the current git version info
include
(
VersionString
)
include
(
VersionString
)
write_version_header
(
${
PROJECT_SOURCE_DIR
}
/src/ LIB_NAME
"LibCIFPP"
)
write_version_header
(
${
PROJECT_SOURCE_DIR
}
/src/ LIB_NAME
"LibCIFPP"
)
...
...
README.md
View file @
640552ab
...
@@ -87,9 +87,6 @@ Other requirements are:
...
@@ -87,9 +87,6 @@ Other requirements are:
is the package
`zlib1g-dev`
.
is the package
`zlib1g-dev`
.
-
[
boost
](
https://www.boost.org
)
.
-
[
boost
](
https://www.boost.org
)
.
When building using MS Visual Studio, you will also need
[
libzeep
](
https://github.com/mhekkel/libzeep
)
since MSVC does not yet provide a C++ template required by libcifpp.
The Boost libraries are only needed in case you want to build the test
The Boost libraries are only needed in case you want to build the test
code or if you are using GCC. That last condition is due to a long
code or if you are using GCC. That last condition is due to a long
standing bug in the implementation of std::regex. It simply crashes
standing bug in the implementation of std::regex. It simply crashes
...
...
cmake/cifppConfig.cmake.in
View file @
640552ab
...
@@ -2,18 +2,11 @@
...
@@ -2,18 +2,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
# Note that this set_and_check needs te be executed before
# find_dependency of Eigen3, otherwise the path is
# not found....
set_and_check(CIFPP_SHARE_DIR "@PACKAGE_CIFPP_DATA_DIR@")
set_and_check(CIFPP_SHARE_DIR "@PACKAGE_CIFPP_DATA_DIR@")
include(CMakeFindDependencyMacro)
include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(Threads)
find_dependency(ZLIB REQUIRED)
find_dependency(ZLIB REQUIRED)
if(MSVC)
find_dependency(zeep REQUIRED)
endif()
check_required_components(cifpp)
check_required_components(cifpp)
include/cif++/text.hpp
View file @
640552ab
...
@@ -38,15 +38,44 @@
...
@@ -38,15 +38,44 @@
#include <vector>
#include <vector>
#if __has_include(<experimental/type_traits>)
#if __has_include(<experimental/type_traits>)
#include <experimental/type_traits>
#include <experimental/type_traits>
namespace
std_experimental
=
std
::
experimental
;
#else
#else
// sub optimal, but replicating the same code is worse
#include <zeep/type-traits.hpp>
// A quick hack to work around the missing is_detected in MSVC
namespace
std_experimental
{
namespace
detail
{
template
<
class
AlwaysVoid
,
template
<
class
...
>
class
Op
,
class
...
Args
>
struct
detector
{
using
value_t
=
std
::
false_type
;
};
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
struct
detector
<
std
::
void_t
<
Op
<
Args
...
>>
,
Op
,
Args
...
>
{
using
value_t
=
std
::
true_type
;
};
}
// namespace detail
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
using
is_detected
=
typename
detail
::
detector
<
void
,
Op
,
Args
...
>::
value_t
;
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
const
auto
is_detected_v
=
is_detected
<
Op
,
Args
...
>::
value
;
}
// namespace std_experimental
#endif
#endif
/**
/**
* \file text.hpp
* \file text.hpp
*
*
* Various text manipulating routines
* Various text manipulating routines
*/
*/
...
@@ -82,15 +111,15 @@ void to_upper(std::string &s);
...
@@ -82,15 +111,15 @@ void to_upper(std::string &s);
/**
/**
* @brief Join the strings in the range [ @a a, @a e ) using
* @brief Join the strings in the range [ @a a, @a e ) using
* @a sep as separator
* @a sep as separator
*
*
* Example usage:
* Example usage:
*
*
* @code {.cpp}
* @code {.cpp}
* std::vector<std::string> v{ "aap", "noot", "mies" };
* std::vector<std::string> v{ "aap", "noot", "mies" };
*
*
* assert(cif::join(v.begin(), v.end(), ", ") == "aap, noot, mies");
* assert(cif::join(v.begin(), v.end(), ", ") == "aap, noot, mies");
* @endcode
* @endcode
*
*
*/
*/
template
<
typename
IterType
>
template
<
typename
IterType
>
std
::
string
join
(
IterType
b
,
IterType
e
,
std
::
string_view
sep
)
std
::
string
join
(
IterType
b
,
IterType
e
,
std
::
string_view
sep
)
...
@@ -121,15 +150,15 @@ std::string join(IterType b, IterType e, std::string_view sep)
...
@@ -121,15 +150,15 @@ std::string join(IterType b, IterType e, std::string_view sep)
/**
/**
* @brief Join the strings in the array @a arr using @a sep as separator
* @brief Join the strings in the array @a arr using @a sep as separator
*
*
* Example usage:
* Example usage:
*
*
* @code {.cpp}
* @code {.cpp}
* std::list<std::string> v{ "aap", "noot", "mies" };
* std::list<std::string> v{ "aap", "noot", "mies" };
*
*
* assert(cif::join(v, ", ") == "aap, noot, mies");
* assert(cif::join(v, ", ") == "aap, noot, mies");
* @endcode
* @endcode
*
*
*/
*/
template
<
typename
V
>
template
<
typename
V
>
std
::
string
join
(
const
V
&
arr
,
std
::
string_view
sep
)
std
::
string
join
(
const
V
&
arr
,
std
::
string_view
sep
)
...
@@ -139,20 +168,20 @@ std::string join(const V &arr, std::string_view sep)
...
@@ -139,20 +168,20 @@ std::string join(const V &arr, std::string_view sep)
/**
/**
* @brief Split the string in @a s based on the characters in @a separators
* @brief Split the string in @a s based on the characters in @a separators
*
*
* Each of the characters in @a separators induces a split.
* Each of the characters in @a separators induces a split.
*
*
* When suppress_empty is true, empty strings are not produced in the
* When suppress_empty is true, empty strings are not produced in the
* resulting array.
* resulting array.
*
*
* Example:
* Example:
*
*
* @code {.cpp}
* @code {.cpp}
* auto v = cif::split("aap:noot,,mies", ":,", true);
* auto v = cif::split("aap:noot,,mies", ":,", true);
*
*
* assert(v == std::vector{"aap", "noot", "mies"});
* assert(v == std::vector{"aap", "noot", "mies"});
* @endcode
* @endcode
*
*
*/
*/
template
<
typename
StringType
=
std
::
string_view
>
template
<
typename
StringType
=
std
::
string_view
>
std
::
vector
<
StringType
>
split
(
std
::
string_view
s
,
std
::
string_view
separators
,
bool
suppress_empty
=
false
)
std
::
vector
<
StringType
>
split
(
std
::
string_view
s
,
std
::
string_view
separators
,
bool
suppress_empty
=
false
)
...
@@ -183,7 +212,7 @@ std::vector<StringType> split(std::string_view s, std::string_view separators, b
...
@@ -183,7 +212,7 @@ std::vector<StringType> split(std::string_view s, std::string_view separators, b
/**
/**
* @brief Replace all occurrences of @a what in string @a s with the string @a with
* @brief Replace all occurrences of @a what in string @a s with the string @a with
*
*
* The string @a with may be empty in which case each occurrence of @a what is simply
* The string @a with may be empty in which case each occurrence of @a what is simply
* deleted.
* deleted.
*/
*/
...
@@ -270,7 +299,6 @@ struct iless
...
@@ -270,7 +299,6 @@ struct iless
}
}
};
};
/// iset is a std::set of std::string but with a comparator that
/// iset is a std::set of std::string but with a comparator that
/// ignores character case.
/// ignores character case.
using
iset
=
std
::
set
<
std
::
string
,
iless
>
;
using
iset
=
std
::
set
<
std
::
string
,
iless
>
;
...
@@ -290,12 +318,12 @@ inline char tolower(int ch)
...
@@ -290,12 +318,12 @@ inline char tolower(int ch)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
/** \brief return a tuple consisting of the category and item name for @a tag
/** \brief return a tuple consisting of the category and item name for @a tag
*
*
* The category name is stripped of its leading underscore character.
* The category name is stripped of its leading underscore character.
*
*
* If no dot character was found, the category name is empty. That's for
* If no dot character was found, the category name is empty. That's for
* cif 1.0 formatted data.
* cif 1.0 formatted data.
*/
*/
std
::
tuple
<
std
::
string
,
std
::
string
>
split_tag_name
(
std
::
string_view
tag
);
std
::
tuple
<
std
::
string
,
std
::
string
>
split_tag_name
(
std
::
string_view
tag
);
...
@@ -307,7 +335,7 @@ std::string cif_id_for_number(int number);
...
@@ -307,7 +335,7 @@ std::string cif_id_for_number(int number);
// --------------------------------------------------------------------
// --------------------------------------------------------------------
/** \brief custom word wrapping routine.
/** \brief custom word wrapping routine.
*
*
* Wrap the text in @a text based on a maximum line width @a width using
* Wrap the text in @a text based on a maximum line width @a width using
* a dynamic programming approach to get the most efficient filling of
* a dynamic programming approach to get the most efficient filling of
* the space.
* the space.
...
@@ -574,10 +602,10 @@ using from_chars_function = decltype(std::from_chars(std::declval<const char *>(
...
@@ -574,10 +602,10 @@ using from_chars_function = decltype(std::from_chars(std::declval<const char *>(
/**
/**
* @brief Helper to select the best implementation of charconv based on availability of the
* @brief Helper to select the best implementation of charconv based on availability of the
* function in the std:: namespace
* function in the std:: namespace
*
*
* @tparam T The type for which we want to find a from_chars/to_chars function
* @tparam T The type for which we want to find a from_chars/to_chars function
*/
*/
template
<
typename
T
>
template
<
typename
T
>
using
selected_charconv
=
typename
std
::
conditional_t
<
std
::
experimental
::
is_detected_v
<
from_chars_function
,
T
>
,
std_charconv
<
T
>
,
my_charconv
<
T
>>
;
using
selected_charconv
=
typename
std
::
conditional_t
<
std
_
experimental
::
is_detected_v
<
from_chars_function
,
T
>
,
std_charconv
<
T
>
,
my_charconv
<
T
>>
;
}
//
namespace
cif
}
//
namespace
cif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment