Added option to compile with google btree instead of map
This commit is contained in:
parent
39bcdbbdc8
commit
7be48f5117
|
@ -15,7 +15,7 @@ AM_CPPFLAGSINVALID = -DPC_REMOVE_INVALID
|
|||
endif
|
||||
|
||||
if BUILD_WITH_BTREE
|
||||
AM_CPPFLAGSBTREE = -DBUILD_WITH_BTREE
|
||||
AM_CPPFLAGSBTREE = -DBUILD_WITH_BTREE -std=c++11
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = $(AM_CPPFLAGSBTREE) $(AM_CPPFLAGSINVALID)
|
||||
|
|
29
configure.ac
29
configure.ac
|
@ -91,26 +91,33 @@ if test "x$enable_btree" == "xyes"; then
|
|||
|
||||
AC_CHECK_TOOL([MERCURIAL], [hg], [no])
|
||||
|
||||
AM_CONDITIONAL([HAVE_HG_BIN], [test "x${MERCURIAL}" = "xhg"])
|
||||
|
||||
AC_MSG_CHECKING([for ${srcdir}/cpp-btree/btree.h])
|
||||
if test "x${MERCURIAL}" = "xhg"; then
|
||||
have_hg_bin=1
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_BTREE_H], [test -f ${srcdir}/cpp-btree/btree.h])
|
||||
AC_MSG_CHECKING([for ${srcdir}/cpp-btree/btree_map.h])
|
||||
|
||||
AM_COND_IF([HAVE_BTREE_H],
|
||||
[AC_MSG_RESULT([found])
|
||||
have_btree_h=1],
|
||||
[AC_MSG_RESULT([no])])
|
||||
if test -f ${srcdir}/cpp-btree/btree_map.h; then
|
||||
have_btree_h=1
|
||||
AC_MSG_RESULT([found.])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
if test x$have_btree_h = x1 && ! test ${HAVE_HG_BIN}; then
|
||||
if test "x$have_btree_h" = "x1"; then
|
||||
AC_VERBOSE([Using already existing btree.])
|
||||
AM_CONDITIONAL([BUILD_WITH_BTREE], [true])
|
||||
elif ${HAVE_HG_BIN} && test x$have_btree_h != x1; then
|
||||
AC_VERBOSE([Downloading btree headers with mercurial])
|
||||
elif test "x$have_hg_bin" = "x1"; then
|
||||
AC_VERBOSE([
|
||||
* Downloading btree headers with mercurial
|
||||
])
|
||||
|
||||
$(which hg) clone https://code.google.com/p/cpp-btree/
|
||||
AM_CONDITIONAL([BUILD_WITH_BTREE], [true])
|
||||
else
|
||||
AC_VERBOSE([
|
||||
* Could not find hg in $PATH
|
||||
* Could not find hg in your PATH
|
||||
* Building with STL maps instead of Google Btree
|
||||
])
|
||||
AM_CONDITIONAL([BUILD_WITH_BTREE], [false])
|
||||
|
|
|
@ -6,16 +6,13 @@ using namespace pipecolors;
|
|||
|
||||
int main(void) {
|
||||
|
||||
char buffer[128];
|
||||
char * buf;
|
||||
char buffer[256];
|
||||
int num = 5;
|
||||
const char* str = "My number is";
|
||||
const char* str2 = "|10My number is|07";
|
||||
int len = pcprintf("|01%s |41|09%d|39\n", str, num);
|
||||
int len = pcprintf("|01%s |09%d|39\n", str, num);
|
||||
pcprintf("|10Length of Len is : |15|30%d\n|07", len);
|
||||
int len2 = pcsprintf(buffer, "%s %d\n", str2, num);
|
||||
printf("\n%s %d\n", buffer, len2);
|
||||
int len3 = asprintf(&buf, "%s %d\n", str2, num);
|
||||
printf("\n%s %d\n", buf, len3);
|
||||
return 0;
|
||||
}
|
|
@ -27,14 +27,18 @@
|
|||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdarg>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
#include "pipecolors.h"
|
||||
|
||||
namespace pipecolors {
|
||||
|
||||
//typedef btree::btree_map<std::string, std::string> colors;
|
||||
#ifndef BUILD_WITH_BTREE
|
||||
#include <map>
|
||||
typedef std::map<std::string, std::string> colorMap;
|
||||
#else
|
||||
#include "cpp-btree/btree_map.h"
|
||||
typedef btree::btree_map<std::string, std::string> colorMap;
|
||||
#endif
|
||||
|
||||
colorMap getColors() {
|
||||
colorMap colors;
|
||||
|
|
Loading…
Reference in New Issue