本文整理汇总了C++中note::Ptr类的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_note_added
void NotebookApplicationAddin::on_note_added(const Note::Ptr & note)
{
note->signal_tag_added().connect(
sigc::mem_fun(*this, &NotebookApplicationAddin::on_tag_added));
note->signal_tag_removed().connect(
sigc::mem_fun(*this, &NotebookApplicationAddin::on_tag_removed));
}
示例2: get_template_note
// BEGIN Notebook::get_template_note()
Note::Ptr Notebook::get_template_note() const {
std::cout << "Notebook:: get template note()";
NoteManager & noteManager = Gnote::obj().default_note_manager();
Note::Ptr note = noteManager.find (m_template_note_title);
std::cout << "Notebook:: find note";
if (!note) {
std::cout << "Notebook:: no note";
// FIXME: need to get a unique name as well as uuid
// we should have a default create() function which fills all this junk in...
note = noteManager.create_new_note("New Note", "");
//note = noteManager.create (m_template_note_title,
// NoteManager::get_note_template_content (
// m_template_note_title));
// Flag this as a template note
//qDebug() << "Notebook:: get or create sys tag 2";
Tag::Ptr tag = TagManager::obj().get_or_create_system_tag (TagManager::TEMPLATE_NOTE_SYSTEM_TAG);
note->add_tag (tag);
// Add on the notebook system tag so Tomboy
// will persist the tag/notebook across sessions
// if no other notes are added to the notebook.
//qDebug() << "Notebook:: get or create sys tag 3";
tag = TagManager::obj().get_or_create_system_tag (NOTEBOOK_TAG_PREFIX + get_name());
note->add_tag (tag);
//note->queue_save (Note::CONTENT_CHANGED);
}
else
std::cout << "Notebook:: note found";
return note;
} // END Notebook::get_template_note()
示例3: move_note_to_notebook
/// <summary>
/// Place the specified note into the specified notebook. If the
/// note already belongs to a notebook, it will be removed from that
/// notebook first.
/// </summary>
/// <param name="note">
/// A <see cref="Note"/>
/// </param>
/// <param name="notebook">
/// A <see cref="Notebook"/>. If Notebook is null, the note will
/// be removed from its current notebook.
/// </param>
/// <returns>True if the note was successfully moved.</returns>
bool NotebookManager::move_note_to_notebook (const Note::Ptr & note,
const Notebook::Ptr & notebook)
{
if (!note) {
return false;
}
// NOTE: In the future we may want to allow notes
// to exist in multiple notebooks. For now, to
// alleviate the confusion, only allow a note to
// exist in one notebook at a time.
Notebook::Ptr currentNotebook = get_notebook_from_note (note);
if (currentNotebook == notebook)
return true; // It's already there.
if(currentNotebook) {
note->remove_tag (currentNotebook->get_tag());
m_note_removed_from_notebook(*note, currentNotebook);
}
// Only attempt to add the notebook tag when this
// menu item is not the "No notebook" menu item.
if(notebook) {
note->add_tag(notebook->get_tag());
m_note_added_to_notebook(*note, notebook);
}
return true;
}
示例4: GetNoteTitle
std::string RemoteControl::GetNoteTitle(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return "";
return note->get_title();
}
示例5: GetNoteCreateDate
int32_t RemoteControl::GetNoteCreateDate(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return -1;
return note->create_date().sec();
}
示例6: GetNoteContentsXml
std::string RemoteControl::GetNoteContentsXml(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return "";
return note->xml_content();
}
示例7: GetNoteCompleteXml
std::string RemoteControl::GetNoteCompleteXml(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return "";
return note->get_complete_note_xml();
}
示例8: AddTagToNote
bool RemoteControl::AddTagToNote(const std::string& uri, const std::string& tag_name)
{
Note::Ptr note = m_manager.find_by_uri (uri);
if (!note) {
return false;
}
Tag::Ptr tag = TagManager::obj().get_or_create_tag (tag_name);
note->add_tag (tag);
return true;
}
示例9: HideNote
bool RemoteControl::HideNote(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return false;
note->get_window()->hide();
return true;
}
示例10: SetNoteContentsXml
bool RemoteControl::SetNoteContentsXml(const std::string& uri,
const std::string& xml_contents)
{
Note::Ptr note;
note = m_manager.find_by_uri(uri);
if(!note) {
return false;
}
note->set_xml_content(xml_contents);
return true;
}
示例11: CreateNote
std::string RemoteControl::CreateNote()
{
try {
Note::Ptr note = m_manager.create ();
return note->uri();
}
catch(...)
{
}
return "";
}
示例12: SetNoteCompleteXml
bool RemoteControl::SetNoteCompleteXml(const std::string& uri,
const std::string& xml_contents)
{
Note::Ptr note;
note = m_manager.find_by_uri(uri);
if(!note) {
return false;
}
note->load_foreign_note_xml(xml_contents, CONTENT_CHANGED);
return true;
}
示例13: RemoveTagFromNote
bool RemoteControl::RemoveTagFromNote(const std::string& uri,
const std::string& tag_name)
{
Note::Ptr note = m_manager.find_by_uri (uri);
if (!note)
return false;
Tag::Ptr tag = TagManager::obj().get_tag (tag_name);
if (tag) {
note->remove_tag (tag);
}
return true;
}
示例14: DisplayNote
bool RemoteControl::DisplayNote(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note) {
return false;
}
note->get_window()->present();
return true;
}
示例15:
std::vector< std::string > RemoteControl::GetTagsForNote(const std::string& uri)
{
Note::Ptr note;
note = m_manager.find_by_uri (uri);
if (!note)
return std::vector< std::string >();
std::vector< std::string > tags;
std::list<Tag::Ptr> l;
note->get_tags(l);
for (std::list<Tag::Ptr>::const_iterator iter = l.begin();
iter != l.end(); ++iter) {
tags.push_back((*iter)->normalized_name());
}
return tags;
}