hikyuu2/hikyuu_cpp/hikyuu/MarketInfo.cpp

52 lines
1.4 KiB
C++
Raw Normal View History

2015-01-07 01:26:14 +08:00
/*
* MarketInfo.cpp
*
* Created on: 2011-12-5
* Author: fasiondog
*/
#include "MarketInfo.h"
2016-04-03 00:08:31 +08:00
#include "utilities/util.h"
2015-01-07 01:26:14 +08:00
namespace hku {
2019-11-10 19:45:57 +08:00
HKU_API std::ostream& operator<<(std::ostream& os, const MarketInfo& market) {
if (Null<MarketInfo>() == market) {
2015-01-07 01:26:14 +08:00
os << "MarketInfo()";
return os;
}
string split(", ");
2019-08-01 22:54:59 +08:00
#if defined(_MSC_VER) && (PY_VERSION_HEX >= 0x03000000)
2019-11-10 19:45:57 +08:00
os << "MarketInfo(" << market.market() << split << utf8_to_gb(market.name()) << split
<< utf8_to_gb(market.description()) << split << market.code() << split << market.lastDate()
<< ")";
2016-04-03 00:08:31 +08:00
#else
2015-01-07 01:26:14 +08:00
os << "MarketInfo(" << market.market() << split << market.name() << split
2019-11-10 19:45:57 +08:00
<< market.description() << split << market.code() << split << market.lastDate() << ")";
2016-04-03 00:08:31 +08:00
#endif
2015-01-07 01:26:14 +08:00
return os;
}
2016-04-03 00:08:31 +08:00
string MarketInfo::toString() const {
std::stringstream os;
if (m_market == "") {
os << "MarketInfo()";
return os.str();
}
string split(", ");
2019-11-10 19:45:57 +08:00
os << "MarketInfo(" << m_market << split << m_name << split << m_description << split << m_code
<< split << m_lastDate << ")";
2016-04-03 00:08:31 +08:00
return os.str();
}
2019-11-10 19:45:57 +08:00
MarketInfo::MarketInfo() {}
2015-01-07 01:26:14 +08:00
2019-11-10 19:45:57 +08:00
MarketInfo::MarketInfo(const string& market, const string& name, const string& description,
const string& code, const Datetime& lastDate)
: m_market(market), m_name(name), m_description(description), m_code(code), m_lastDate(lastDate) {}
2015-01-07 01:26:14 +08:00
2019-11-10 19:45:57 +08:00
} // namespace hku