void FSNewsView2::onClickBookMark(CAControl* btn, CCPoint point) { //加入标签 BookMarkInfo *bookmarkinfo = new BookMarkInfo(); ChapterInfo *curChapterInfo = FSDataManager::GetInstance().getNewsManager()->getCurChapterInfo(); // int dff= this->getChapterInfo()->getNewsID(); bookmarkinfo->setChapterID(curChapterInfo->getChapterID()); bookmarkinfo->setNewsID(curChapterInfo->getNewsID()); string strMarkDigest; // if (curFSNewsView2->getCurContent().length()>10) { // strMarkDigest = curFSNewsView2->getCurContent().substr(0,10); // } // else // { // strMarkDigest = m_curContent; // } int curPage = curFSNewsView2->listView->getCurrPage(); bookmarkinfo->setMarkDigest(curFSNewsView2->getDigestForMark()); double contentSize = (double)curFSNewsView2->m_aryContent.size(); double curPageDouble = (double)(curPage+1); double chapterPrecent = curPageDouble/contentSize; chapterPrecent = roundEx(chapterPrecent, 4); // double chapterPrecent = 1; char chrChapterPrecent[50] = ""; sprintf(chrChapterPrecent,"%.4lf",chapterPrecent); bookmarkinfo->setMarkProgress(chrChapterPrecent); bool flag = FSDataManager::GetInstance().getNewsManager()->addBookMarkInfo(bookmarkinfo); string strTitle = "提示"; string strClose="关闭"; string strContent; if (!flag) { //加入失败 strContent = "已经有重复的标签"; } else { strContent = "添加标签成功"; } CAAlertView* alertView = CAAlertView::createWithText(strTitle.c_str(), strContent.c_str(), strClose.c_str(),NULL); alertView->show(); }
void IRound::_calculate(const Indicator& data) { size_t total = data.size(); m_discard = data.discard(); if (m_discard >= total) { m_discard = total; return; } int n = getParam<int>("ndigits"); for (size_t i = m_discard; i < total; ++i) { _set(roundEx(data[i], n), i); } }
void FSNewsView2::saveProgress(float dt) { ChapterInfo *curChapterInfo = FSDataManager::GetInstance().getNewsManager()->getCurChapterInfo(); int curPage = curFSNewsView2->listView->getCurrPage(); double contentSize = (double)curFSNewsView2->m_aryContent.size(); double curPageDouble = (double)(curPage+1); double chapterPrecent = curPageDouble/contentSize; chapterPrecent = roundEx(chapterPrecent, 4); char chrChapterPrecent[50] = ""; sprintf(chrChapterPrecent,"%.4lf",chapterPrecent); FSDataManager::GetInstance().getNewsManager()->setPageProgress(curChapterInfo->getChapterID(), chrChapterPrecent); }
HKU_API std::ostream & operator<<(std::ostream& os, const PositionRecord& record) { Stock stock = record.stock; int precision = 2; std::string market(""), code(""), name(""); if(!stock.isNull()){ market = stock.market(); code = stock.code(); #if defined(BOOST_WINDOWS) && (PY_VERSION_HEX >= 0x03000000) name = utf8_to_gb(stock.name()); #else name = stock.name(); #endif } else { precision = stock.precision(); } price_t costPrice = 0.0; if (record.number != 0.0) { costPrice = roundEx((record.buyMoney - record.sellMoney) / record.number, precision); } string strip(", "); os << std::fixed; os.precision(precision); os << "Position(" << market << strip << code << strip << name << strip << record.takeDatetime << strip << record.cleanDatetime << strip << record.number << strip << costPrice << strip << record.stoploss << strip << record.goalPrice << strip << record.totalNumber << strip << record.buyMoney << strip << record.totalCost << strip << record.totalRisk << strip << record.sellMoney << ")"; os.unsetf(std::ostream::floatfield); os.precision(); return os; }
string PositionRecord::toString() const { int precision = 2; std::string market(""), code(""), name(""); if(!stock.isNull()){ market = stock.market(); code = stock.code(); name = stock.name(); } else { precision = stock.precision(); } price_t costPrice = 0.0; if (number != 0.0) { costPrice = roundEx((buyMoney - sellMoney) / number, precision); } string strip(", "); std::stringstream os; os << std::fixed; os.precision(precision); os << "Position(" << market << strip << code << strip << name << strip << takeDatetime << strip << cleanDatetime << strip << number << strip << costPrice << strip << stoploss << strip << goalPrice << strip << totalNumber << strip << buyMoney << strip << totalCost << strip << totalRisk << strip << sellMoney << ")"; os.unsetf(std::ostream::floatfield); os.precision(); return os.str(); }