Added some comments.
This commit is contained in:
parent
c9d46d1701
commit
86dc7effda
1 changed files with 57 additions and 42 deletions
95
amount.h
95
amount.h
|
|
@ -1,33 +1,48 @@
|
||||||
// amount.h
|
/**
|
||||||
|
* @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.
|
/*
|
||||||
//
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// met:
|
* 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 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
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
// documentation and/or other materials provided with the distribution.
|
* 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
|
* - Neither the name of New Artisans LLC nor the names of its
|
||||||
// this software without specific prior written permission.
|
* 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
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* (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
|
#ifndef _AMOUNT_H
|
||||||
#define _AMOUNT_H
|
#define _AMOUNT_H
|
||||||
|
|
@ -52,17 +67,17 @@ extern bool do_cleanup;
|
||||||
|
|
||||||
class commodity_t;
|
class commodity_t;
|
||||||
|
|
||||||
/** @class amount_t
|
/**
|
||||||
|
* @class amount_t
|
||||||
@brief Encapsulates infinite precision commoditized amounts.
|
*
|
||||||
|
* @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,
|
* The amount_t class can be used for commoditized infinite-precision
|
||||||
commodities will keep track of how they are used, so that they
|
* math, and also for uncommoditized math. In the commoditized case,
|
||||||
always display back to the user in the same fashion as their use.
|
* commodities keep track of how they are used, and will always
|
||||||
However, in all cases precision is kept to an excessive degree
|
* display back to the user after the same fashion. For
|
||||||
internally. For uncommoditized numbers, no display truncation is
|
* uncommoditized numbers, no display truncation is ever done.
|
||||||
ever done.
|
* Internally, precision is always kept to an excessive degree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class amount_t
|
class amount_t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue