/usr/include/Wt/Payment/OrderItem is in libwt-dev 3.3.3+dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2012 Emweb bvba, Kessel-Lo, Belgium.
*/
#ifndef WT_PAYMENT_ORDER_ITEM_H
#define WT_PAYMENT_ORDER_ITEM_H
#include <string>
#include <Wt/WString>
#include "Wt/Payment/Money"
namespace Wt {
namespace Payment {
/*! \class OrderItem Wt/Payment/OrderItem Wt/Payment/OrderItem
* \brief Describes an item in an order
*
* \if cpp
* Usage example:
* \code
* Wt::Payment::OrderItem item1, item2;
*
* item1.setName("Waffle Maker");
* item1.setNumber("00001");
* item1.setDescription("Emweb FlipSide Belgian Waffle Maker");
* item1.setQuantity(1);
* item1.setUnitCost(Wt::Payment::Money(49, 99, "USD"));
*
* Wt::Payment::Order order;
*
* order.items().push_back(item1);
*
* order.setShipping(Wt::Payment::Money(7, 1, "USD"));
* order.setShippingDiscount(Wt::Payment::Money(-7, 0, "USD"));
* order.setShippingInsurance(Wt::Payment::Money(2, 23, "USD"));
* order.setTax(Wt::Payment::Money(500, 99, "USD"));
* \endcode
* \endif
*
* \sa Order
*
* \ingroup payment
*/
class WT_API OrderItem
{
public:
/*! \brief Sets the item name.
*/
void setName(const WString& name);
/*! \brief Returns item name.
*
* \sa setName()
*/
const WString& name() const { return name_; }
/*! \brief Sets the item number.
*/
void setNumber(const std::string& number);
/*! \brief Returns item number.
*
* \sa setNumber()
*/
std::string number() const { return number_; }
/*! \brief Sets the item description.
*/
void setDescription(const WString& description);
/*! \brief Returns the item description.
*
* \sa setDescription()
*/
const WString& description() const { return description_; }
/*! \brief Sets the item quantity
*
* This is either an integer quantity (number of items) or a
* fractional quantity (e.g. 1.5 times 1 kilogram).
*
* The total price for this item in the order will be the quantity()
* times the unitCost().
*/
void setQuantity(double quantity);
/*! \brief Returns the item quantity
*
* \sa setQuantity()
*/
double quantity() const { return quantity_; }
/*! \brief Changes the item unit cost field
*
* This is the unit cost.
*/
void setUnitCost(const Money& unitCost);
/*! \brief Returns item unit cost
*
* \sa setUnitCost()
*/
Money unitCost() const { return unitCost_; }
/*! \brief Returns the total cost for this order item.
*
* This returns quantity() * unitCost()
*/
Money computeTotal() const;
private:
WString name_, description_;
std::string number_;
double quantity_;
Money unitCost_;
};
}
}
#endif // WT_PAYMENT_ORDERITEM_H_
|