summaryrefslogtreecommitdiff
path: root/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-19 04:46:47 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:27 -0400
commit86dc7effda2426143ba0a20f674cb8523726f54b (patch)
tree21939f790083b6899e57e0a59066b3fc1d4fa474 /amount.h
parentc9d46d1701a5d3417065717da20e67ec41e38988 (diff)
downloadfork-ledger-86dc7effda2426143ba0a20f674cb8523726f54b.tar.gz
fork-ledger-86dc7effda2426143ba0a20f674cb8523726f54b.tar.bz2
fork-ledger-86dc7effda2426143ba0a20f674cb8523726f54b.zip
Added some comments.
Diffstat (limited to 'amount.h')
-rw-r--r--amount.h101
1 files changed, 58 insertions, 43 deletions
diff --git a/amount.h b/amount.h
index 8c4a612d..6f88229b 100644
--- a/amount.h
+++ b/amount.h
@@ -1,33 +1,48 @@
-// amount.h
-
-// Copyright (c) 2003-2007, John Wiegley. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// - Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// - Neither the name of New Artisans LLC nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/**
+ * @file amount.h
+ * @author John Wiegley
+ * @date Wed Apr 18 22:05:53 2007
+ *
+ * @brief Types for handling commoditized math.
+ *
+ * This file contains two of the most basic types in Ledger: amount_t
+ * commodity_t, and annotated_commodity_t. Both the commodity types
+ * share a common base class, commodity_base_t. These four class
+ * together allow Ledger to handle mathematical expressions involving
+ * differing commodities, or in some cases math using no commodities
+ * at all (such as increasing a dollar amount by a multiplier).
+ */
+
+/*
+ * Copyright (c) 2003-2007, John Wiegley. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of New Artisans LLC nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef _AMOUNT_H
#define _AMOUNT_H
@@ -48,22 +63,22 @@
namespace ledger {
-extern bool do_cleanup;
+extern bool do_cleanup;
class commodity_t;
-/** @class amount_t
-
- @brief Encapsulates infinite precision commoditized amounts.
-
- The amount_t class can be used for commoditized infinite precision
- math, and also for uncommoditized math. In the commoditized case,
- commodities will keep track of how they are used, so that they
- always display back to the user in the same fashion as their use.
- However, in all cases precision is kept to an excessive degree
- internally. For uncommoditized numbers, no display truncation is
- ever done.
-*/
+/**
+ * @class amount_t
+ *
+ * @brief Encapsulates infinite-precision commoditized amounts.
+ *
+ * The amount_t class can be used for commoditized infinite-precision
+ * math, and also for uncommoditized math. In the commoditized case,
+ * commodities keep track of how they are used, and will always
+ * display back to the user after the same fashion. For
+ * uncommoditized numbers, no display truncation is ever done.
+ * Internally, precision is always kept to an excessive degree.
+ */
class amount_t
{