Just a few minor corrections.
This commit is contained in:
parent
5054147043
commit
84ead9153f
4 changed files with 25 additions and 35 deletions
15
acprep
15
acprep
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
PYTHON_HOME="/Library/Frameworks/Python.framework/Versions/2.5"
|
|
||||||
|
|
||||||
# acprep, version 3.0
|
# acprep, version 3.0
|
||||||
#
|
#
|
||||||
# This script configures my ledger source tree on my Mac OS/X machine.
|
# This script configures my ledger source tree on my Mac OS/X machine.
|
||||||
|
|
@ -18,13 +16,14 @@ fi
|
||||||
autoreconf --force --install
|
autoreconf --force --install
|
||||||
|
|
||||||
|
|
||||||
INCDIRS="-I/usr/local/include"
|
INCDIRS="-I/sw/include"
|
||||||
INCDIRS="$INCDIRS -I/usr/local/include/boost"
|
INCDIRS="$INCDIRS -I/usr/local/include"
|
||||||
INCDIRS="$INCDIRS -I/sw/include"
|
|
||||||
INCDIRS="$INCDIRS -I/usr/include/httpd/xml"
|
LIBDIRS="-L/sw/lib"
|
||||||
|
LIBDIRS="$LIBDIRS -L/usr/local/lib"
|
||||||
|
|
||||||
|
PYTHON_HOME="/Library/Frameworks/Python.framework/Versions/2.5"
|
||||||
|
|
||||||
LIBDIRS="-L/usr/local/lib"
|
|
||||||
LIBDIRS="$LIBDIRS -L/sw/lib"
|
|
||||||
|
|
||||||
SYSTEM=`uname -s`
|
SYSTEM=`uname -s`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -770,7 +770,7 @@ void amount_t::annotate_commodity(const annotation_t& details)
|
||||||
throw_(amount_error, "Cannot annotate an amount with no commodity");
|
throw_(amount_error, "Cannot annotate an amount with no commodity");
|
||||||
|
|
||||||
if (commodity().annotated) {
|
if (commodity().annotated) {
|
||||||
this_ann = &commodity().as_annotated();
|
this_ann = &as_annotated_commodity(commodity());
|
||||||
this_base = &this_ann->referent();
|
this_base = &this_ann->referent();
|
||||||
} else {
|
} else {
|
||||||
this_base = &commodity();
|
this_base = &commodity();
|
||||||
|
|
@ -797,7 +797,7 @@ bool amount_t::commodity_annotated() const
|
||||||
throw_(amount_error,
|
throw_(amount_error,
|
||||||
"Cannot determine if an uninitialized amount's commodity is annotated");
|
"Cannot determine if an uninitialized amount's commodity is annotated");
|
||||||
|
|
||||||
assert(! commodity().annotated || commodity().as_annotated().details);
|
assert(! commodity().annotated || as_annotated_commodity(commodity()).details);
|
||||||
return commodity().annotated;
|
return commodity().annotated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -807,10 +807,10 @@ annotation_t amount_t::annotation_details() const
|
||||||
throw_(amount_error,
|
throw_(amount_error,
|
||||||
"Cannot return commodity annotation details of an uninitialized amount");
|
"Cannot return commodity annotation details of an uninitialized amount");
|
||||||
|
|
||||||
assert(! commodity().annotated || commodity().as_annotated().details);
|
assert(! commodity().annotated || as_annotated_commodity(commodity()).details);
|
||||||
|
|
||||||
if (commodity().annotated) {
|
if (commodity().annotated) {
|
||||||
annotated_commodity_t& ann_comm(commodity().as_annotated());
|
annotated_commodity_t& ann_comm(as_annotated_commodity(commodity()));
|
||||||
return ann_comm.details;
|
return ann_comm.details;
|
||||||
}
|
}
|
||||||
return annotation_t();
|
return annotation_t();
|
||||||
|
|
@ -829,7 +829,7 @@ amount_t amount_t::strip_annotations(const bool _keep_price,
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
amount_t t(*this);
|
amount_t t(*this);
|
||||||
t.set_commodity(commodity().as_annotated().
|
t.set_commodity(as_annotated_commodity(commodity()).
|
||||||
strip_annotations(_keep_price, _keep_date, _keep_tag));
|
strip_annotations(_keep_price, _keep_date, _keep_tag));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,18 +123,6 @@ commodity_t::operator bool() const
|
||||||
return this != parent().null_commodity;
|
return this != parent().null_commodity;
|
||||||
}
|
}
|
||||||
|
|
||||||
annotated_commodity_t& commodity_t::as_annotated()
|
|
||||||
{
|
|
||||||
assert(annotated);
|
|
||||||
return downcast<annotated_commodity_t>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const annotated_commodity_t& commodity_t::as_annotated() const
|
|
||||||
{
|
|
||||||
assert(annotated);
|
|
||||||
return downcast<const annotated_commodity_t>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool commodity_t::symbol_needs_quotes(const string& symbol)
|
bool commodity_t::symbol_needs_quotes(const string& symbol)
|
||||||
{
|
{
|
||||||
for (const char * p = symbol.c_str(); *p; p++)
|
for (const char * p = symbol.c_str(); *p; p++)
|
||||||
|
|
@ -302,7 +290,7 @@ bool annotated_commodity_t::operator==(const commodity_t& comm) const
|
||||||
if (! comm.annotated)
|
if (! comm.annotated)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (details != comm.as_annotated().details)
|
if (details != as_annotated_commodity(comm).details)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -540,8 +528,7 @@ commodity_pool_t::find(const string& symbol, const annotation_t& details)
|
||||||
string name = make_qualified_name(*comm, details);
|
string name = make_qualified_name(*comm, details);
|
||||||
|
|
||||||
if (commodity_t * ann_comm = find(name)) {
|
if (commodity_t * ann_comm = find(name)) {
|
||||||
assert(ann_comm->annotated &&
|
assert(ann_comm->annotated && as_annotated_commodity(*ann_comm).details);
|
||||||
ann_comm->as_annotated().details);
|
|
||||||
return ann_comm;
|
return ann_comm;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -602,7 +589,7 @@ commodity_t * commodity_pool_t::find_or_create(commodity_t& comm,
|
||||||
assert(! name.empty());
|
assert(! name.empty());
|
||||||
|
|
||||||
if (commodity_t * ann_comm = find(name)) {
|
if (commodity_t * ann_comm = find(name)) {
|
||||||
assert(ann_comm->annotated && ann_comm->as_annotated().details);
|
assert(ann_comm->annotated && as_annotated_commodity(*ann_comm).details);
|
||||||
return ann_comm;
|
return ann_comm;
|
||||||
}
|
}
|
||||||
return create(comm, details, name);
|
return create(comm, details, name);
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,11 @@
|
||||||
* This file contains one of the most basic types in Ledger:
|
* This file contains one of the most basic types in Ledger:
|
||||||
* commodity_t, and its annotated cousin, annotated_commodity_t.
|
* commodity_t, and its annotated cousin, annotated_commodity_t.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _COMMODITY_H
|
#ifndef _COMMODITY_H
|
||||||
#define _COMMODITY_H
|
#define _COMMODITY_H
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
class annotated_commodity_t;
|
|
||||||
|
|
||||||
class commodity_t
|
class commodity_t
|
||||||
: public delegates_flags<>,
|
: public delegates_flags<>,
|
||||||
public equality_comparable1<commodity_t, noncopyable>
|
public equality_comparable1<commodity_t, noncopyable>
|
||||||
|
|
@ -128,9 +125,6 @@ public:
|
||||||
return *parent_;
|
return *parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
annotated_commodity_t& as_annotated();
|
|
||||||
const annotated_commodity_t& as_annotated() const;
|
|
||||||
|
|
||||||
string base_symbol() const {
|
string base_symbol() const {
|
||||||
return base->symbol;
|
return base->symbol;
|
||||||
}
|
}
|
||||||
|
|
@ -297,6 +291,16 @@ public:
|
||||||
const annotation_t& info);
|
const annotation_t& info);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline annotated_commodity_t&
|
||||||
|
as_annotated_commodity(commodity_t& commodity) {
|
||||||
|
return downcast<annotated_commodity_t>(commodity);
|
||||||
|
}
|
||||||
|
inline const annotated_commodity_t&
|
||||||
|
as_annotated_commodity(const commodity_t& commodity) {
|
||||||
|
return downcast<const annotated_commodity_t>(commodity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct compare_amount_commodities {
|
struct compare_amount_commodities {
|
||||||
bool operator()(const amount_t * left, const amount_t * right) const;
|
bool operator()(const amount_t * left, const amount_t * right) const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue