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
|
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include <string>
#include <set>
#include <exception>
#include <iostream>
class Order{
protected:
const string m_StationName,m_Expires, m_ReportedTime, m_OrderID;
const int m_Region, m_Station, m_Security, m_Range, m_Price, m_VolRemain, m_MinVolume;
public:
//constructor
Order(string orderID, string station, string expires,string reported, int region, int station,int security, int range, int price, int volremain, int minvolume){
m_OrderID = orderID;
m_StationName = station;
m_Expires = expires;
m_ReportedTime = reported;
m_Region = region;
m_Station = station;
m_Security = security;
m_Range = range;
m_Price = price;
m_VolRemain = volremain;
m_MinVolume = minvolume;
}
const string getStationName(){return m_StationName;};
const string getExpires(){return m_Expires;};
const string getReportedTime(){return m_ReportedTime;};
const int getRegion(){return m_Region;};
const int getStation(){return m_Station;};
const int getSecurity(){return m_Security;};
const int getRange(){return m_Range;};
const int getPrice(){return m_Price;};
const int getVolRemain(){return m_VolRemain;};
const int getMinVolume(){return m_MinVolume;};
};
class MarketItem{
protected:
const int m_ItemID, m_Hours, m_Minqty;
const string m_ItemName;
//unigue Order IDs
std::set<Order> m_SellOrders, m_BuyOrders;
public:
//get the data from the XML parser and extract the data
void load(int);
const int getItemID(){return m_ItemID;};
const int getHours(){return m_Hours;};
const int getMinqty(){return m_ItemName;};
string getItemName(){return m_ItemName;};
//they don't need to change thereof const &
const std::set<Order>& getSellOrders(){return const std::set<Order>& temp = m_SellOrders;};
const std::set<Order>& getBuyOrders(){return const std::set<Order>& temp = m_BuyOrders;};
};
void marketItem::load(int itemID){
using boost::property_tree::ptree
ptree pt;
read_xml( ,pt)
//load all the values
m_ItemID = pt.get<std::int>("quicklook.item");
m_ItemName = pt.get<std::string>("quicklook.itemname");
m_Hours = pt.get<std::int>("quicklook.hours");
m_Minqty = pt.get<std::int>("quicklook.minqty");
//this is where the problem is:
BOOST_FOREACH(ptree::value_type &v, pt.get_child("quicklook.sell_orders")){
}
}
|