mymoneysecurity.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           mymoneysecurity.h  -  description
00003                              -------------------
00004     begin                : Tue Jan 29 2002
00005     copyright            : (C) 2000-2002 by Michael Edwardes
00006     email                : mte@users.sourceforge.net
00007                            Javier Campos Morales <javi_c@users.sourceforge.net>
00008                            Felix Rodriguez <frodriguez@users.sourceforge.net>
00009                            John C <thetacoturtle@users.sourceforge.net>
00010                            Thomas Baumgart <ipwizard@users.sourceforge.net>
00011                            Kevin Tambascio <ktambascio@users.sourceforge.net>
00012  ***************************************************************************/
00013 
00014 /***************************************************************************
00015  *                                                                         *
00016  *   This program is free software; you can redistribute it and/or modify  *
00017  *   it under the terms of the GNU General Public License as published by  *
00018  *   the Free Software Foundation; either version 2 of the License, or     *
00019  *   (at your option) any later version.                                   *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef MYMONEYSECURITY_H
00024 #define MYMONEYSECURITY_H
00025 
00026 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029 
00030 // ----------------------------------------------------------------------------
00031 // QT Includes
00032 
00033 #include <qdatetime.h>
00034 #include <qmap.h>
00035 
00036 // ----------------------------------------------------------------------------
00037 // KDE Includes
00038 
00039 // ----------------------------------------------------------------------------
00040 // Project Includes
00041 
00042 #include <kmymoney/export.h>
00043 #include <kmymoney/mymoneymoney.h>
00044 #include <kmymoney/mymoneyutils.h>
00045 #include <kmymoney/mymoneyobject.h>
00046 #include <kmymoney/mymoneykeyvaluecontainer.h>
00047 
00056 class KMYMONEY_EXPORT MyMoneySecurity : public MyMoneyObject, public MyMoneyKeyValueContainer
00057 {
00058 public:
00059   MyMoneySecurity();
00060   MyMoneySecurity(const QString& id, const MyMoneySecurity& equity);
00061   MyMoneySecurity(const QString& id, const QString& name, const QString& symbol = QString(), const int partsPerUnit = 100, const int smallestCashFraction = 100, const int smallestAccountFraction = 0);
00062   MyMoneySecurity(const QDomElement& node);
00063   virtual ~MyMoneySecurity();
00064 
00065   bool operator < (const MyMoneySecurity&) const;
00066 
00070   bool operator == (const MyMoneySecurity&) const;
00071 
00078   bool operator != (const MyMoneySecurity& r) const { return !(*this == r); }
00079 
00080 public:
00081   typedef enum {
00082     SECURITY_STOCK,
00083     SECURITY_MUTUALFUND,
00084     SECURITY_BOND,
00085     SECURITY_CURRENCY,
00086     SECURITY_NONE
00087   } eSECURITYTYPE;
00088 
00089   const QString& name() const                 { return m_name; }
00090   void           setName(const String& str)   { m_name = str; }
00091 
00092   const QString&  tradingSymbol() const               { return m_tradingSymbol; }
00093   void            setTradingSymbol(const String& str) { m_tradingSymbol = str; }
00094 
00095         eSECURITYTYPE securityType() const                { return m_securityType; }
00096   void          setSecurityType(const eSECURITYTYPE& s)   { m_securityType = s; }
00097         bool    isCurrency(void) const { return m_securityType == SECURITY_CURRENCY; };
00098 
00099   const QString& tradingMarket() const  { return m_tradingMarket; }
00100   void           setTradingMarket(const QString& str) { m_tradingMarket = str; }
00101 
00102   const QString& tradingCurrency(void) const { return m_tradingCurrency; };
00103   void           setTradingCurrency(const QString& str) { m_tradingCurrency = str; };
00104 
00105   int smallestAccountFraction(void) const { return m_smallestAccountFraction; };
00106   void setSmallestAccountFraction(const int sf) { m_smallestAccountFraction = sf; };
00107 
00108   int partsPerUnit(void) const { return m_partsPerUnit; };
00109   int smallestCashFraction(void) const { return m_smallestCashFraction; };
00110 
00111   void setPartsPerUnit(const int ppu) { m_partsPerUnit = ppu; };
00112   void setSmallestCashFraction(const int sf) { m_smallestCashFraction = sf; };
00113 
00114   void writeXML(QDomDocument& document, QDomElement& parent) const;
00115 
00125   bool hasReferenceTo(const QString& id) const;
00126 
00136   static QString securityTypeToString(const MyMoneySecurity::eSECURITYTYPE securityType);
00137 
00138 
00139 protected:
00140   QString               m_name;
00141   QString               m_tradingSymbol;
00142   QString               m_tradingMarket;
00143   QString               m_tradingCurrency;
00144   eSECURITYTYPE         m_securityType;
00145   int                   m_smallestAccountFraction;
00146   int                   m_smallestCashFraction;
00147   int                   m_partsPerUnit;
00148 };
00149 
00150 #endif

Generated on Wed Jan 26 13:03:18 2011 for KMyMoney by  doxygen 1.5.6