Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::BasketContract Class Reference

#include <BasketContract.hpp>

Inheritance diagram for opentxs::BasketContract:
Collaboration diagram for opentxs::BasketContract:

Public Member Functions

EXPORT BasketContract (Basket &basket, OTPseudonym &signer)
 
virtual ~BasketContract ()
 
virtual void CreateContents ()
 
- Public Member Functions inherited from opentxs::OTAssetContract
EXPORT OTAssetContract ()
 
EXPORT OTAssetContract (OTString &name, OTString &foldername, OTString &filename, OTString &strID)
 
virtual EXPORT ~OTAssetContract ()
 
EXPORT bool IsShares () const
 
EXPORT bool AddAccountRecord (const OTAccount &theAccount) const
 
EXPORT bool EraseAccountRecord (const OTIdentifier &theAcctID) const
 
EXPORT bool VisitAccountRecords (AccountVisitor &visitor) const
 
EXPORT bool FormatAmount (int64_t amount, std::string &str_output) const
 
EXPORT bool StringToAmount (int64_t &amount, const std::string &str_input) const
 
EXPORT const OTString & GetBasketInfo () const
 
EXPORT const OTString & GetCurrencyName () const
 
EXPORT const OTString & GetCurrencyFraction () const
 
EXPORT const OTString & GetCurrencySymbol () const
 
EXPORT const OTString & GetCurrencyTLA () const
 
virtual EXPORT bool SaveContractWallet (OTString &strContents) const
 
virtual EXPORT bool SaveContractWallet (std::ofstream &ofs) const
 
virtual EXPORT bool DisplayStatistics (OTString &strContents) const
 
- Public Member Functions inherited from opentxs::OTContract
const char * GetHashType () const
 
void SetIdentifier (const OTIdentifier &theID)
 
EXPORT OTContract ()
 
EXPORT OTContract (const OTString &name, const OTString &foldername, const OTString &filename, const OTString &strID)
 
EXPORT OTContract (const OTString &strID)
 
EXPORT OTContract (const OTIdentifier &theID)
 
void Initialize ()
 
virtual EXPORT ~OTContract ()
 
virtual EXPORT void Release ()
 
EXPORT void Release_Contract ()
 
EXPORT void ReleaseSignatures ()
 
virtual EXPORT bool CreateContract (const OTString &strContract, const OTPseudonym &theSigner)
 
EXPORT bool InsertNym (const OTString &strKeyName, const OTString &strKeyValue)
 
EXPORT void GetName (OTString &strName) const
 
EXPORT void SetName (const OTString &strName)
 
virtual EXPORT bool VerifyContract ()
 
virtual EXPORT void GetIdentifier (OTIdentifier &theIdentifier) const
 
virtual EXPORT void GetIdentifier (OTString &theIdentifier) const
 
EXPORT void GetFilename (OTString &strFilename) const
 
EXPORT void GetFoldername (OTString &strFoldername) const
 
virtual EXPORT bool LoadContract ()
 
EXPORT bool LoadContract (const char *szFoldername, const char *szFilename)
 
EXPORT bool LoadContractFromString (const OTString &theStr)
 
bool LoadContractRawFile ()
 
EXPORT bool ParseRawFile ()
 
EXPORT bool SaveToContractFolder ()
 
EXPORT bool SaveContractRaw (OTString &strOutput) const
 
EXPORT bool RewriteContract (OTString &strOutput) const
 
EXPORT bool SaveContract ()
 
EXPORT bool SaveContract (const char *szFoldername, const char *szFilename)
 
virtual EXPORT void UpdateContents ()
 
EXPORT void CreateInnerContents ()
 
virtual EXPORT bool SaveContents (std::ofstream &ofs) const
 
virtual EXPORT bool SaveContents (OTString &strContents) const
 
virtual EXPORT bool SignContract (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTAsymmetricKey &theKey, OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const char *szFoldername, const char *szFilename, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
virtual EXPORT bool VerifyContractID () const
 
virtual EXPORT void CalculateContractID (OTIdentifier &newID) const
 
virtual EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
virtual EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifyWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTAsymmetricKey &theKey, const OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const char *szFoldername, const char *szFilename, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT const OTAsymmetricKey * GetContractPublicKey () const
 
EXPORT const OTPseudonym * GetContractPublicNym () const
 

Protected Member Functions

virtual int32_t ProcessXMLNode (irr::io::IrrXMLReader *&xml)
 
- Protected Member Functions inherited from opentxs::OTContract
bool LoadContractXML ()
 

Additional Inherited Members

- Static Public Member Functions inherited from opentxs::OTAssetContract
static EXPORT std::string formatLongAmount (int64_t lValue, int32_t nFactor=100, int32_t nPower=2, const char *szCurrencySymbol="", const char *szThousandSeparator=",", const char *szDecimalPoint=".")
 
static EXPORT bool ParseFormatted (int64_t &lResult, const std::string &str_input, int32_t nFactor=100, int32_t nPower=2, const char *szThousandSeparator=",", const char *szDecimalPoint=".")
 
- Static Public Member Functions inherited from opentxs::OTContract
static EXPORT bool DearmorAndTrim (const OTString &strInput, OTString &strOutput, OTString &strFirstLine)
 
static bool AddBookendsAroundContent (OTString &strOutput, const OTString &strContents, const OTString &strContractType, const OTString &strHashType, const listOfSignatures &listSignatures)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTString &strOutput)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTString &strOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool SkipToElement (irr::io::IrrXMLReader *&xml)
 
static bool SkipToTextField (irr::io::IrrXMLReader *&xml)
 
static bool SkipAfterLoadingField (irr::io::IrrXMLReader *&xml)
 
static EXPORT bool SignFlatText (OTString &strFlatText, const OTString &strContractType, const OTPseudonym &theSigner, OTString &strOutput)
 
- Protected Attributes inherited from opentxs::OTAssetContract
OTString m_strBasketInfo
 
OTString m_strIssueCompany
 
OTString m_strIssueEmail
 
OTString m_strIssueContractURL
 
OTString m_strIssueType
 
OTString m_strIssueDate
 
OTString m_strCurrencyName
 
OTString m_strCurrencyType
 
OTString m_strCurrencySymbol
 
OTString m_strCurrencyTLA
 
OTString m_strCurrencyFactor
 
OTString m_strCurrencyDecimalPower
 
OTString m_strCurrencyFraction
 
bool m_bIsCurrency
 
bool m_bIsShares
 
- Protected Attributes inherited from opentxs::OTContract
OTString m_strName
 
OTString m_strFoldername
 
OTString m_strFilename
 
OTIdentifier m_ID
 
OTStringXML m_xmlUnsigned
 
OTString m_strRawFile
 
OTString m_strSigHashType
 
OTString m_strContractType
 
mapOfNyms m_mapNyms
 
listOfSignatures m_listSignatures
 
OTString m_strVersion
 
OTString m_strEntityShortName
 
OTString m_strEntityLongName
 
OTString m_strEntityEmail
 
OTString::Map m_mapConditions
 

Detailed Description

Definition at line 144 of file BasketContract.hpp.

Constructor & Destructor Documentation

opentxs::BasketContract::BasketContract ( Basket &  basket,
OTPseudonym &  signer 
)

Definition at line 150 of file BasketContract.cpp.

151  : OTAssetContract()
152 {
153  // Grab a string copy of the basket information.
154  theBasket.SaveContractRaw(m_strBasketInfo);
155 
156  OTString strTemplate;
157  OTASCIIArmor theBasketArmor(m_strBasketInfo);
158 
159  m_xmlUnsigned.Concatenate("<?xml version=\"%s\"?>\n", "1.0");
160 
161  strTemplate.Concatenate("<basketContract version=\"%s\">\n\n",
162  m_strVersion.Get());
163  strTemplate.Concatenate("<basketInfo>\n%s</basketInfo>\n\n",
164  theBasketArmor.Get());
165 
166  strTemplate.Concatenate("</%s>\n", "basketContract");
167 
168  CreateContract(strTemplate, theSigner);
169 }
virtual EXPORT bool CreateContract(const OTString &strContract, const OTPseudonym &theSigner)
EXPORT void Concatenate(const char *arg,...)
Definition: OTString.cpp:1334
OTStringXML m_xmlUnsigned
Definition: OTContract.hpp:174
EXPORT const char * Get() const
Definition: OTString.cpp:1045
opentxs::BasketContract::~BasketContract ( )
virtual

Definition at line 171 of file BasketContract.cpp.

172 {
173 }

Member Function Documentation

void opentxs::BasketContract::CreateContents ( )
virtual

Reimplemented from opentxs::OTAssetContract.

Definition at line 175 of file BasketContract.cpp.

176 {
177  m_strVersion = "2.0"; // 2.0 since adding credentials.
178 
180  m_xmlUnsigned.Concatenate("<?xml version=\"%s\"?>\n", "1.0");
181 
182  OTASCIIArmor theBasketArmor(m_strBasketInfo);
183 
184  m_xmlUnsigned.Concatenate("<basketContract version=\"%s\">\n\n",
185  m_strVersion.Get());
186  m_xmlUnsigned.Concatenate("<basketInfo>\n%s</basketInfo>\n\n",
187  theBasketArmor.Get());
188 
189  // This is where OTContract scribes m_xmlUnsigned with its keys, conditions,
190  // etc.
192 
193  m_xmlUnsigned.Concatenate("</%s>\n", "basketContract");
194 }
EXPORT void CreateInnerContents()
EXPORT void Concatenate(const char *arg,...)
Definition: OTString.cpp:1334
OTStringXML m_xmlUnsigned
Definition: OTContract.hpp:174
EXPORT const char * Get() const
Definition: OTString.cpp:1045
virtual EXPORT void Release()
Definition: OTString.cpp:765
int32_t opentxs::BasketContract::ProcessXMLNode ( irr::io::IrrXMLReader *&  xml)
protectedvirtual

Reimplemented from opentxs::OTAssetContract.

Definition at line 197 of file BasketContract.cpp.

198 {
199  int32_t nReturnVal = OTContract::ProcessXMLNode(xml);
200 
201  // Here we call the parent class first.
202  // If the node is found there, or there is some error,
203  // then we just return either way. But if it comes back
204  // as '0', then nothing happened, and we'll continue executing.
205  //
206  // -- Note you can choose not to call the parent if
207  // you don't want to use any of those xml tags.
208 
209  if (nReturnVal == 1 || nReturnVal == (-1)) return nReturnVal;
210 
211  OTString strNodeName(xml->getNodeName());
212 
213  if (strNodeName.Compare("basketContract")) {
214  m_strVersion = xml->getAttributeValue("version");
215 
216  otWarn << "\n"
217  "===> Loading XML portion of basket contract into memory "
218  "structures...\n\n"
219  "Digital Basket Contract: " << m_strName
220  << "\nContract version: " << m_strVersion << "\n----------\n";
221  nReturnVal = 1;
222  }
223  else if (strNodeName.Compare("basketInfo")) {
225  otErr << "Error in OTAssetContract::ProcessXMLNode: basketInfo "
226  "field without value.\n";
227  return (-1); // error condition
228  }
229  nReturnVal = 1;
230  }
231 
232  return nReturnVal;
233 }
static EXPORT bool LoadEncodedTextField(irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
OTLOG_IMPORT OTLogStream otWarn
OTLOG_IMPORT OTLogStream otErr
virtual EXPORT int32_t ProcessXMLNode(irr::io::IrrXMLReader *&xml)

The documentation for this class was generated from the following files: