本文整理汇总了C++中Comment类的典型用法代码示例。如果您正苦于以下问题:C++ Comment类的具体用法?C++ Comment怎么用?C++ Comment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Comment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: comment
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool FocalMechanism::updateChild(Object* child) {
Comment* commentChild = Comment::Cast(child);
if ( commentChild != NULL ) {
Comment* commentElement = comment(commentChild->index());
if ( commentElement != NULL ) {
*commentElement = *commentChild;
commentElement->update();
return true;
}
return false;
}
MomentTensor* momentTensorChild = MomentTensor::Cast(child);
if ( momentTensorChild != NULL ) {
MomentTensor* momentTensorElement
= MomentTensor::Cast(PublicObject::Find(momentTensorChild->publicID()));
if ( momentTensorElement && momentTensorElement->parent() == this ) {
*momentTensorElement = *momentTensorChild;
momentTensorElement->update();
return true;
}
return false;
}
return false;
}
示例2: bool
void
Decoder::decodeTextSection(MoveNode* node, ByteStream& text)
{
for ( ; node; node = node->next())
{
if (node->hasSupplement())
{
if (uint8_t flag = node->commentFlag())
{
mstl::string buf;
Comment comment;
if (flag & comm::Ante)
{
text.get(buf);
comment.swap(buf, bool(flag & comm::Ante_Eng), bool(flag & comm::Ante_Oth));
node->setComment(comment, move::Ante);
}
if (flag & comm::Post)
{
text.get(buf);
comment.swap(buf, bool(flag & comm::Post_Eng), bool(flag & comm::Post_Oth));
node->setComment(comment, move::Post);
}
}
for (unsigned i = 0; i < node->variationCount(); ++i)
decodeTextSection(node->variation(i), text);
}
}
}
示例3: visitComment
void Writer::visitComment(const Comment& comment) const
{
if(d_preservecomments && d_commentchar && ( !comment.isDeleted() || d_preservedeleted ))
{
*d_outputstream << d_commentchar << comment.getComment() << "\n";
}
}
示例4: GetWindowRect
void LineEditDialog::handleInitDialogMsg(HWND p_dlg) {
s8 str[1024];
ModuleInfo* info = g_dbg->code_window()->GetCurModule();
if (info == NULL) return;
RECT rect;
GetWindowRect(p_dlg, &rect);
SetWindowPos(p_dlg, NULL, rect.left, rect.top - (rect.bottom - rect.top + 20), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
u32 va = info->addr() + g_dbg->code_window()->select() * 4;
u32 opcode = *((u32*)VA2PA(va));
sprintf(str, "%08x", opcode);
SetDlgItemText(p_dlg, IDC_OPCODE, str);
g_dbg->setFontToFixed(GetDlgItem(p_dlg, IDC_OPCODE));
disasm_plain(va, opcode, str);
SetDlgItemText(p_dlg, IDC_ASM, str);
g_dbg->setFontToFixed(GetDlgItem(p_dlg, IDC_ASM));
Comment* comment = g_dbg->find_comment(va);
SetDlgItemText(p_dlg, IDC_COMMENT, comment ? comment->text() : "");
Label* label = g_dbg->find_codelabel(va);
SetDlgItemText(p_dlg, IDC_LABEL, label ? label->text() : "");
SetFocus(GetDlgItem(p_dlg, IDC_LABEL));
}
示例5: Comment
Comment * Comment::create(const JsonObject &data, QObject *parent)
{
if (!isValid(data)) {
return 0;
}
Comment * comment = new Comment(parent);
comment->setData(data, false);
return comment;
}
示例6: GetComment
void PrettyGherkin::AppendOriginalComment(int currentLineNo)
{
Comment* pComment = GetComment(m_noOfNextCommentToAppend);
while ((pComment != nullptr) && (pComment->Location().Line() < currentLineNo))
{
m_FormattedFeature
.append(pComment->Text())
.append(NEWLINE);
m_noOfNextCommentToAppend++;
pComment = GetComment(m_noOfNextCommentToAppend);
}
}
示例7: comment
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Pick::updateChild(Object* child) {
Comment* commentChild = Comment::Cast(child);
if ( commentChild != NULL ) {
Comment* commentElement = comment(commentChild->index());
if ( commentElement != NULL ) {
*commentElement = *commentChild;
return true;
}
return false;
}
return false;
}
示例8: comment
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StationMagnitude::updateChild(Object* child) {
Comment* commentChild = Comment::Cast(child);
if ( commentChild != NULL ) {
Comment* commentElement = comment(commentChild->index());
if ( commentElement != NULL ) {
*commentElement = *commentChild;
commentElement->update();
return true;
}
return false;
}
return false;
}
示例9: addCommentFromWeb
//парсит комментарии из треда.
void addCommentFromWeb(Container* parent, string thread) {
Container* currentParent = parent;
int parentIDEndPos = 0;
do {
//current comment id
string commentIDBeginTag = "<div id='cmtbar";
int commentIdBeginPos = thread.find(commentIDBeginTag, parentIDEndPos);
if (commentIdBeginPos == -1)
return; //no comments
commentIdBeginPos += commentIDBeginTag.length();
int commentIdEndPos = thread.find("'", commentIdBeginPos);
string str_currCommentID = thread.substr(commentIdBeginPos,
commentIdEndPos - commentIdBeginPos);
int currCommentID = atoi(str_currCommentID.c_str());
//current comment text
string commentBeginTag = "<div class='talk-comment-box'>";
string commentEndTag = "<p style='margin: 0.7em 0 0.2em 0'>";
int commentBeginPos = thread.find(commentBeginTag, commentIdEndPos)
+ commentBeginTag.length();
int commentEndPos = thread.find(commentEndTag, commentBeginPos);
string currCommentText = thread.substr(commentBeginPos,
commentEndPos - commentBeginPos);
//current comment parent id
string replyBeginTag = "?replyto";
int replyTagBeginPos = thread.find(replyBeginTag, commentEndPos)
+ replyBeginTag.length();
int parentIDBeginPos = thread.find("#t", replyTagBeginPos) + 2;
parentIDEndPos = thread.find("'", parentIDBeginPos);
int parentID =
atoi(
thread.substr(parentIDBeginPos, parentIDEndPos - parentIDBeginPos).c_str());
Comment* currentComment = new Comment(currCommentText, currCommentID);
currentComment->setURL(url_ + "?thread=" + str_currCommentID);
//в этот момент предком может быть либо текущий комментарий, либо кто-то из его предков. находим его
while (currentParent->getParent() != NULL) {
if (currentParent->getID() == parentID)
break;
currentParent = currentParent->getParent();
}
currentParent->addSubComment(currentComment);
currentParent = currentComment;
} while (true);
}
示例10: putMove
void
Consumer::sendTrailingComment(Comment const& comment, bool variationIsEmpty)
{
if (!comment.isEmpty())
{
#ifndef ALLOW_EMPTY_VARS
if (variationIsEmpty)
putMove(m_move = Move::null());
#endif
if (m_danglingEndMarker)
{
m_strm.put(token::End_Marker);
m_danglingEndMarker--;
}
Byte flag = writeComment(comm::Post, comment);
//M_ASSERT(flag);
m_strm.put(token::Comment);
m_data.put(flag);
m_endOfRun = true;
if (isMainline())
m_lastCommentPos = plyCount() + 1;
}
}
示例11: comment
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Origin::updateChild(Object* child) {
Comment* commentChild = Comment::Cast(child);
if ( commentChild != NULL ) {
Comment* commentElement = comment(commentChild->index());
if ( commentElement != NULL ) {
*commentElement = *commentChild;
return true;
}
return false;
}
// Do not know how to fetch child of type CompositeTime without an index
Arrival* arrivalChild = Arrival::Cast(child);
if ( arrivalChild != NULL ) {
Arrival* arrivalElement = arrival(arrivalChild->index());
if ( arrivalElement != NULL ) {
*arrivalElement = *arrivalChild;
return true;
}
return false;
}
StationMagnitude* stationMagnitudeChild = StationMagnitude::Cast(child);
if ( stationMagnitudeChild != NULL ) {
StationMagnitude* stationMagnitudeElement
= StationMagnitude::Cast(PublicObject::Find(stationMagnitudeChild->publicID()));
if ( stationMagnitudeElement && stationMagnitudeElement->parent() == this ) {
*stationMagnitudeElement = *stationMagnitudeChild;
return true;
}
return false;
}
Magnitude* magnitudeChild = Magnitude::Cast(child);
if ( magnitudeChild != NULL ) {
Magnitude* magnitudeElement
= Magnitude::Cast(PublicObject::Find(magnitudeChild->publicID()));
if ( magnitudeElement && magnitudeElement->parent() == this ) {
*magnitudeElement = *magnitudeChild;
return true;
}
return false;
}
return false;
}
示例12: runTest
/*
* Runs the test case.
*/
void runTest()
{
Document doc;
Comment newCommentNode;
String newCommentValue;
String newCommentName;
int newCommentType;
doc = (Document) baseT::load("hc_staff", true);
newCommentNode = doc.createComment(SA::construct_from_utf8("This is a new Comment node"));
newCommentValue = newCommentNode.getNodeValue();
baseT::assertEquals("This is a new Comment node", newCommentValue, __LINE__, __FILE__);
newCommentName = newCommentNode.getNodeName();
baseT::assertEquals("#comment", newCommentName, __LINE__, __FILE__);
newCommentType = (int) newCommentNode.getNodeType();
baseT::assertEquals(8, newCommentType, __LINE__, __FILE__);
}
示例13:
Byte
Consumer::writeComment(Byte position, Comment const& comment)
{
//M_ASSERT(position == comm::Ante || position == comm::Post);
Byte flag = 0;
if (!comment.isEmpty())
{
if (comment.engFlag())
flag |= comm::Ante_Eng;
if (comment.othFlag())
flag |= comm::Ante_Oth;
flag |= position;
m_text.put(comment.content(), comment.size() + 1);
}
return flag;
}
示例14: t
void CommentView::save()
{
dbo::Transaction t(session_);
bool isNew = comment_.id() == -1;
Comment *comment = comment_.modify();
comment->setText(editArea_->text());
if (isNew) {
session_.add(comment_);
comment->date = WDateTime::currentDateTime();
comment->author = session_.user();
session_.commentsChanged().emit(comment_);
}
renderView();
t.commit();
}
示例15: qDebug
void MainTest::createPost2()
{
Post *newPost = new Post;
newPost->setTitle("post title");
newPost->setSaveDate(QDateTime::currentDateTime());
db.posts()->append(newPost);
db.saveChanges();
for(int i = 0 ; i < 3; i++){
Comment *comment = new Comment;
comment->setMessage("comment #" + QString::number(i));
comment->setSaveDate(QDateTime::currentDateTime());
comment->setPostId(newPost->id());
db.comments()->append(comment);
}
db.saveChanges();
QTEST_ASSERT(newPost->id() != 0);
qDebug() << "New post2 inserted with id:" << newPost->id();
}