当前位置: 首页>>代码示例>>C++>>正文


C++ Note::getDate方法代码示例

本文整理汇总了C++中Note::getDate方法的典型用法代码示例。如果您正苦于以下问题:C++ Note::getDate方法的具体用法?C++ Note::getDate怎么用?C++ Note::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Note的用法示例。


在下文中一共展示了Note::getDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addNote

void NoteCollection::addNote( Note& note )
{
	if( note.hasDate() )
	{
		const Glib::DateTime& date = note.getDate();

		if( m_vecNotes.empty() ||
				date.compare( m_vecNotes.back()->getDate() ) >= 0 )
		{
			m_vecNotes.push_back( &note );
			return;
		}
		else if( date.compare( m_vecNotes.front()->getDate() ) <= 0 )
		{
			m_vecNotes.insert( m_vecNotes.begin(), &note );
			return;
		}

		unsigned int left = 0;
		unsigned int right = m_vecNotes.size() - 1;

		while( right - left > 1 )
		{
			unsigned int mid = ( right + left ) / 2;
			int diffMid = date.compare( m_vecNotes[ mid ]->getDate() );
			if( diffMid > 0 )
			{
				left = mid;
			}
			else
			{
				right = mid;
			}
		}

		m_vecNotes.insert( m_vecNotes.begin() + right, &note );
	}
	else
	{
		m_vecGeneralNotes.push_back( &note );
	}
}
开发者ID:stesim,项目名称:myorg,代码行数:42,代码来源:notecollection.cpp

示例2: updateRow

bool DbNote::updateRow(Note & note)
{
    sqlite3_stmt *statement;
    string stmnt =
        "update NoteTable SET date=?,NoteText=?,NoteTitle=?,NoteRef=?,KatKey=? where NoteKey=?;";
    if (!openDB())
    {
        throw SQLError("Can't open the DB-Connection");
        return false;
    }
    int req = sqlite3_prepare_v2(db, stmnt.c_str(), -1, &statement, 0);
    if (req != SQLITE_OK)
    {
        throw SQLError("Preparing Update-Statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 1,
                            (note.getDate().getDateString()).c_str(),
                            (note.getDate().getDateString()).length(), SQLITE_TRANSIENT);

    if (req != SQLITE_OK)
    {
        throw SQLError("Binding Date into update statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 2, (note.getNoteText()).c_str(),
                            (note.getNoteText()).length(), SQLITE_TRANSIENT);
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note text into update statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 3, (note.getNotetitle()).c_str(),
                            (note.getNotetitle()).length(), SQLITE_TRANSIENT);
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note title into update statement failed");
        return false;
    }
    req = sqlite3_bind_int(statement, 4, note.getNoteRef());
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note ref into update statement failed");
        return false;
    }
    req = sqlite3_bind_int(statement, 5, note.getKatKey());
    if (req != SQLITE_OK)
    {
        throw SQLError(
            "Binding note category key into update statement failed");
        return false;
    }
    req = sqlite3_bind_int(statement, 6, note.getNoteKey());
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note key into update statement failed");
        return false;
    }
    req = sqlite3_step(statement);
    if (req != SQLITE_DONE)
    {
        throw SQLError("execute of insert statement failed");
        return false;
    }
    sqlite3_finalize(statement);
    sqlite3_close(db);
    return true;
}
开发者ID:harryherold,项目名称:qtnote,代码行数:68,代码来源:DbNote.cpp

示例3: insertTable

bool DbNote::insertTable(Note & note)
{
    sqlite3_stmt *statement;
    string stmnt =
        "insert into NoteTable (date,NoteText,NoteTitle,NoteRef,KatKey) values (?,?,?,?,?)";

    if (!openDB())
    {
        throw SQLError("Can't open the DB-Connection");
        return false;
    }
    int req = sqlite3_prepare_v2(db, stmnt.c_str(), stmnt.length(), &statement,
                                 0);
    if (req != SQLITE_OK)
    {
        throw SQLError("Preparing Insert-Statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 1,
                            (note.getDate().getDateString()).c_str(),
                            (note.getDate().getDateString()).length(), SQLITE_TRANSIENT);
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding Date into insert statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 2, (note.getNoteText()).c_str(),
                            (note.getNoteText()).length(), SQLITE_TRANSIENT);
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note text into insert statement failed");
        return false;
    }
    req = sqlite3_bind_text(statement, 3, (note.getNotetitle()).c_str(),
                            (note.getNotetitle()).length(), SQLITE_TRANSIENT);
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note title into insert statement failed");
        return false;
    }
    req = sqlite3_bind_int(statement, 4, note.getNoteRef());
    if (req != SQLITE_OK)
    {
        throw SQLError("Binding note ref into insert statement failed");
        return false;
    }
    req = sqlite3_bind_int(statement, 5, note.getKatKey());
    if (req != SQLITE_OK)
    {
        throw SQLError(
            "Binding note category key into insert statement failed");
        return false;
    }
    req = sqlite3_step(statement);
    if (req != SQLITE_DONE)
    {
        throw SQLError("execute of insert statement failed");
        return false;
    }
    sqlite3_finalize(statement);
    sqlite3_close(db);
    return true;
}
开发者ID:harryherold,项目名称:qtnote,代码行数:63,代码来源:DbNote.cpp


注:本文中的Note::getDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。