*** no comment ***
This commit is contained in:
parent
90975c27d0
commit
6c7e35dc17
6 changed files with 85 additions and 74 deletions
|
|
@ -70,7 +70,7 @@ libledger_la_CPPFLAGS += -DHAVE_LIBOFX=1
|
||||||
libledger_la_SOURCES += src/ofx.cc
|
libledger_la_SOURCES += src/ofx.cc
|
||||||
endif
|
endif
|
||||||
if DEBUG
|
if DEBUG
|
||||||
libledger_la_CPPFLAGS += -DFULL_DEBUG
|
libledger_la_CPPFLAGS += -DDEBUG_MODE
|
||||||
endif
|
endif
|
||||||
if HAVE_BOOST_PYTHON
|
if HAVE_BOOST_PYTHON
|
||||||
libledger_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1
|
libledger_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ host_triplet = @host@
|
||||||
@HAVE_XMLPARSE_TRUE@am__append_5 = src/gnucash.cc
|
@HAVE_XMLPARSE_TRUE@am__append_5 = src/gnucash.cc
|
||||||
@HAVE_LIBOFX_TRUE@am__append_6 = -DHAVE_LIBOFX=1
|
@HAVE_LIBOFX_TRUE@am__append_6 = -DHAVE_LIBOFX=1
|
||||||
@HAVE_LIBOFX_TRUE@am__append_7 = src/ofx.cc
|
@HAVE_LIBOFX_TRUE@am__append_7 = src/ofx.cc
|
||||||
@DEBUG_TRUE@am__append_8 = -DFULL_DEBUG
|
@DEBUG_TRUE@am__append_8 = -DDEBUG_MODE
|
||||||
@HAVE_BOOST_PYTHON_TRUE@am__append_9 = -DUSE_BOOST_PYTHON=1
|
@HAVE_BOOST_PYTHON_TRUE@am__append_9 = -DUSE_BOOST_PYTHON=1
|
||||||
@HAVE_BOOST_PYTHON_TRUE@am__append_10 = src/pyinterp.cc
|
@HAVE_BOOST_PYTHON_TRUE@am__append_10 = src/pyinterp.cc
|
||||||
@USE_PCH_TRUE@am__append_11 = system.hh.gch
|
@USE_PCH_TRUE@am__append_11 = system.hh.gch
|
||||||
|
|
|
||||||
10
acprep
10
acprep
|
|
@ -49,12 +49,18 @@ fi
|
||||||
# since there are no clients except a GUI tool which might use it (and
|
# since there are no clients except a GUI tool which might use it (and
|
||||||
# that is built again anyway by Xcode).
|
# that is built again anyway by Xcode).
|
||||||
SWITCHES="--disable-shared --enable-pch"
|
SWITCHES="--disable-shared --enable-pch"
|
||||||
|
CPPFLAGS="$INCDIRS"
|
||||||
|
LDFLAGS="$LIBDIRS"
|
||||||
|
|
||||||
|
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--debug)
|
--debug)
|
||||||
SWITCHES="$SWITCHES --enable-debug"
|
SWITCHES="$SWITCHES --enable-debug"
|
||||||
|
if [ -f /usr/local/lib/libstlportstlg.a ]; then
|
||||||
|
CPPFLAGS="-I/usr/local/include/stlport -D_STLP_DEBUG $CPPFLAGS"
|
||||||
|
#LDFLAGS="-lstlportstlg $LDFLAGS"
|
||||||
|
fi
|
||||||
CXXFLAGS="$CXXFLAGS -g" ;;
|
CXXFLAGS="$CXXFLAGS -g" ;;
|
||||||
|
|
||||||
--prof | --perf)
|
--prof | --perf)
|
||||||
|
|
@ -96,5 +102,5 @@ if [ -d "$HOME/Products" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$HERE/configure" --srcdir="$HERE" \
|
"$HERE/configure" --srcdir="$HERE" \
|
||||||
CPPFLAGS="$INCDIRS" CXXFLAGS="$CXXFLAGS $local_cxxflags" \
|
CPPFLAGS="$CPPFLAGS" CXXFLAGS="$CXXFLAGS $local_cxxflags" \
|
||||||
LDFLAGS="$LIBDIRS" $SWITCHES "$@"
|
LDFLAGS="$LDFLAGS" $SWITCHES "$@"
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,8 @@ commodity_pool_t::commodity_pool_t() : default_commodity(NULL)
|
||||||
|
|
||||||
commodity_t * commodity_pool_t::create(const string& symbol)
|
commodity_t * commodity_pool_t::create(const string& symbol)
|
||||||
{
|
{
|
||||||
shared_ptr<commodity_base_t> base_commodity(new commodity_base_t(symbol));
|
shared_ptr<commodity_t::base_t>
|
||||||
|
base_commodity(new commodity_t::base_t(symbol));
|
||||||
std::auto_ptr<commodity_t> commodity(new commodity_t(this, base_commodity));
|
std::auto_ptr<commodity_t> commodity(new commodity_t(this, base_commodity));
|
||||||
|
|
||||||
DEBUG("amounts.commodities", "Creating base commodity " << symbol);
|
DEBUG("amounts.commodities", "Creating base commodity " << symbol);
|
||||||
|
|
|
||||||
|
|
@ -45,20 +45,14 @@
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
#define COMMODITY_STYLE_DEFAULTS 0x0000
|
class commodity_t
|
||||||
#define COMMODITY_STYLE_SUFFIXED 0x0001
|
: public equality_comparable1<commodity_t, noncopyable>
|
||||||
#define COMMODITY_STYLE_SEPARATED 0x0002
|
{
|
||||||
#define COMMODITY_STYLE_EUROPEAN 0x0004
|
class base_t : public noncopyable
|
||||||
#define COMMODITY_STYLE_THOUSANDS 0x0008
|
|
||||||
#define COMMODITY_STYLE_NOMARKET 0x0010
|
|
||||||
#define COMMODITY_STYLE_BUILTIN 0x0020
|
|
||||||
|
|
||||||
class commodity_base_t : public noncopyable
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend class commodity_pool_t;
|
friend class commodity_pool_t;
|
||||||
friend class commodity_t;
|
friend class commodity_t;
|
||||||
friend class annotated_commodity_t;
|
|
||||||
|
|
||||||
typedef std::map<const moment_t, amount_t> history_map;
|
typedef std::map<const moment_t, amount_t> history_map;
|
||||||
typedef std::pair<const moment_t, amount_t> history_pair;
|
typedef std::pair<const moment_t, amount_t> history_pair;
|
||||||
|
|
@ -70,6 +64,14 @@ private:
|
||||||
|
|
||||||
typedef uint_least8_t flags_t;
|
typedef uint_least8_t flags_t;
|
||||||
|
|
||||||
|
#define COMMODITY_STYLE_DEFAULTS 0x00
|
||||||
|
#define COMMODITY_STYLE_SUFFIXED 0x01
|
||||||
|
#define COMMODITY_STYLE_SEPARATED 0x02
|
||||||
|
#define COMMODITY_STYLE_EUROPEAN 0x04
|
||||||
|
#define COMMODITY_STYLE_THOUSANDS 0x08
|
||||||
|
#define COMMODITY_STYLE_NOMARKET 0x10
|
||||||
|
#define COMMODITY_STYLE_BUILTIN 0x20
|
||||||
|
|
||||||
flags_t flags;
|
flags_t flags;
|
||||||
string symbol;
|
string symbol;
|
||||||
amount_t::precision_t precision;
|
amount_t::precision_t precision;
|
||||||
|
|
@ -80,38 +82,33 @@ private:
|
||||||
optional<amount_t> larger;
|
optional<amount_t> larger;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit commodity_base_t()
|
explicit base_t()
|
||||||
: flags(COMMODITY_STYLE_DEFAULTS), precision(0) {
|
: flags(COMMODITY_STYLE_DEFAULTS), precision(0) {
|
||||||
TRACE_CTOR(commodity_base_t, "");
|
TRACE_CTOR(base_t, "");
|
||||||
}
|
}
|
||||||
explicit commodity_base_t
|
explicit base_t
|
||||||
(const string& _symbol,
|
(const string& _symbol,
|
||||||
amount_t::precision_t _precision = 0,
|
amount_t::precision_t _precision = 0,
|
||||||
unsigned int _flags = COMMODITY_STYLE_DEFAULTS)
|
unsigned int _flags = COMMODITY_STYLE_DEFAULTS)
|
||||||
: flags(_flags), symbol(_symbol), precision(_precision) {
|
: flags(_flags), symbol(_symbol), precision(_precision) {
|
||||||
TRACE_CTOR(commodity_base_t,
|
TRACE_CTOR(base_t,
|
||||||
"const string&, amount_t::precision_t, unsigned int");
|
"const string&, amount_t::precision_t, unsigned int");
|
||||||
}
|
}
|
||||||
~commodity_base_t() {
|
~base_t() {
|
||||||
TRACE_DTOR(commodity_base_t);
|
TRACE_DTOR(base_t);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class annotated_commodity_t;
|
|
||||||
|
|
||||||
class commodity_t
|
|
||||||
: public equality_comparable1<commodity_t, noncopyable>
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static bool symbol_needs_quotes(const string& symbol);
|
static bool symbol_needs_quotes(const string& symbol);
|
||||||
|
|
||||||
typedef commodity_base_t::flags_t flags_t;
|
typedef base_t::flags_t flags_t;
|
||||||
typedef commodity_base_t::history_t history_t;
|
typedef base_t::history_t history_t;
|
||||||
typedef commodity_base_t::history_map history_map;
|
typedef base_t::history_map history_map;
|
||||||
typedef commodity_base_t::history_pair history_pair;
|
typedef base_t::history_pair history_pair;
|
||||||
typedef uint_least32_t ident_t;
|
typedef uint_least32_t ident_t;
|
||||||
|
|
||||||
shared_ptr<commodity_base_t> base;
|
shared_ptr<base_t> base;
|
||||||
|
|
||||||
commodity_pool_t * parent_;
|
commodity_pool_t * parent_;
|
||||||
ident_t ident;
|
ident_t ident;
|
||||||
|
|
@ -121,7 +118,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit commodity_t(commodity_pool_t * _parent,
|
explicit commodity_t(commodity_pool_t * _parent,
|
||||||
const shared_ptr<commodity_base_t>& _base)
|
const shared_ptr<base_t>& _base)
|
||||||
: base(_base), parent_(_parent), annotated(false) {
|
: base(_base), parent_(_parent), annotated(false) {
|
||||||
TRACE_CTOR(commodity_t, "");
|
TRACE_CTOR(commodity_t, "");
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +231,8 @@ struct annotation_t : public equality_comparable<annotation_t>
|
||||||
optional<moment_t> date;
|
optional<moment_t> date;
|
||||||
optional<string> tag;
|
optional<string> tag;
|
||||||
|
|
||||||
explicit annotation_t(const optional<amount_t>& _price = optional<amount_t>(),
|
explicit annotation_t
|
||||||
|
(const optional<amount_t>& _price = optional<amount_t>(),
|
||||||
const optional<moment_t>& _date = optional<moment_t>(),
|
const optional<moment_t>& _date = optional<moment_t>(),
|
||||||
const optional<string>& _tag = optional<string>())
|
const optional<string>& _tag = optional<string>())
|
||||||
: price(_price), date(_date), tag(_tag) {}
|
: price(_price), date(_date), tag(_tag) {}
|
||||||
|
|
@ -267,7 +265,9 @@ inline std::ostream& operator<<(std::ostream& out, const annotation_t& details)
|
||||||
|
|
||||||
class annotated_commodity_t
|
class annotated_commodity_t
|
||||||
: public commodity_t,
|
: public commodity_t,
|
||||||
equality_comparable1<annotated_commodity_t, noncopyable>
|
equality_comparable<annotated_commodity_t,
|
||||||
|
equality_comparable2<annotated_commodity_t, commodity_t,
|
||||||
|
noncopyable> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
commodity_t * ptr;
|
commodity_t * ptr;
|
||||||
|
|
@ -284,6 +284,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool operator==(const commodity_t& comm) const;
|
virtual bool operator==(const commodity_t& comm) const;
|
||||||
|
virtual bool operator==(const annotated_commodity_t& comm) const {
|
||||||
|
return *this == static_cast<commodity_t&>(comm);
|
||||||
|
}
|
||||||
|
|
||||||
commodity_t& referent() {
|
commodity_t& referent() {
|
||||||
return *ptr;
|
return *ptr;
|
||||||
|
|
@ -306,7 +309,6 @@ struct compare_amount_commodities {
|
||||||
|
|
||||||
class commodity_pool_t : public noncopyable
|
class commodity_pool_t : public noncopyable
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
/**
|
/**
|
||||||
* The commodities collection in commodity_pool_t maintains pointers
|
* The commodities collection in commodity_pool_t maintains pointers
|
||||||
* to all the commodities which have ever been created by the user,
|
* to all the commodities which have ever been created by the user,
|
||||||
|
|
@ -332,6 +334,8 @@ public:
|
||||||
> commodities_t;
|
> commodities_t;
|
||||||
|
|
||||||
commodities_t commodities;
|
commodities_t commodities;
|
||||||
|
|
||||||
|
public:
|
||||||
commodity_t * null_commodity;
|
commodity_t * null_commodity;
|
||||||
commodity_t * default_commodity;
|
commodity_t * default_commodity;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _UTILS_H
|
#ifndef _UTILS_H
|
||||||
#define _UTILS_H
|
#define _UTILS_H
|
||||||
|
|
||||||
#if defined(FULL_DEBUG)
|
#if defined(DEBUG_MODE)
|
||||||
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE 1
|
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE 1
|
||||||
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING 1
|
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -13,13 +13,13 @@
|
||||||
* Default values
|
* Default values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FULL_DEBUG)
|
#if defined(DEBUG_MODE)
|
||||||
#define VERIFY_ON 1
|
#define VERIFY_ON 1
|
||||||
#define TRACING_ON 1
|
#define TRACING_ON 1
|
||||||
#define DEBUG_ON 1
|
#define DEBUG_ON 1
|
||||||
#define TIMERS_ON 1
|
#define TIMERS_ON 1
|
||||||
#define FREE_MEMORY 1
|
#define FREE_MEMORY 1
|
||||||
#elif defined(NO_DEBUG)
|
#elif defined(NDEBUG)
|
||||||
#define NO_ASSERTS 1
|
#define NO_ASSERTS 1
|
||||||
#define NO_LOGGING 1
|
#define NO_LOGGING 1
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue