3 * Copyright (c) 1998-2002
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE regex_cstring.hpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: This is an internal header file, do not include directly.
17 * String support and helper functions, for regular
21 #ifndef BOOST_REGEX_CSTRING_HPP
22 #define BOOST_REGEX_CSTRING_HPP
24 #ifndef BOOST_REGEX_CONFIG_HPP
25 #include <boost/regex/config.hpp>
34 // start by defining some template function aliases for C API functions:
37 template <class charT>
38 std::size_t BOOST_REGEX_CALL re_strlen(const charT *s)
49 inline std::size_t BOOST_REGEX_CALL re_strlen(const char *s)
51 return std::strlen(s);
54 #ifndef BOOST_NO_WREGEX
56 inline std::size_t BOOST_REGEX_CALL re_strlen(const wchar_t *s)
58 return std::wcslen(s);
63 #ifndef BOOST_NO_WREGEX
64 BOOST_REGEX_DECL void BOOST_REGEX_CALL re_transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
66 BOOST_REGEX_DECL void BOOST_REGEX_CALL re_transform(std::string& out, const std::string& in);
68 template <class charT>
69 void BOOST_REGEX_CALL re_trunc_primary(std::basic_string<charT>& s)
71 for(unsigned int i = 0; i < s.size(); ++i)
81 inline char* BOOST_REGEX_CALL re_strcpy(char *s1, const char *s2)
83 #if defined(__BORLANDC__) && defined(strcpy)
84 return ::strcpy(s1, s2);
86 return std::strcpy(s1, s2);
90 #ifndef BOOST_NO_WREGEX
92 inline wchar_t* BOOST_REGEX_CALL re_strcpy(wchar_t *s1, const wchar_t *s2)
94 return std::wcscpy(s1, s2);
100 template <class charT>
101 charT* BOOST_REGEX_CALL re_strdup(const charT* p)
103 charT* buf = new charT[re_strlen(p) + 1];
108 template <class charT>
109 inline void BOOST_REGEX_CALL re_strfree(charT* p)
114 } // namespace re_detail
117 #endif // BOOST_REGEX_CSTRING_HPP