Added some comments.
This commit is contained in:
parent
c9d46d1701
commit
86dc7effda
1 changed files with 57 additions and 42 deletions
99
amount.h
99
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.
|
||||
//
|
||||
// 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.
|
||||
/*
|
||||
* 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue