本文整理汇总了C++中Reference::chapter_get方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::chapter_get方法的具体用法?C++ Reference::chapter_get怎么用?C++ Reference::chapter_get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::chapter_get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resource_url_enter_reference
ustring resource_url_enter_reference(const ustring& constructor, map <unsigned int, ustring>& books, map <unsigned int, ustring>& books2, const Reference& reference)
{
ustring url (constructor);
replace_text(url, resource_url_constructor_book(), books[reference.book_get()]);
replace_text(url, resource_url_constructor_book2(), books2[reference.book_get()]);
replace_text(url, resource_url_constructor_chapter(), convert_to_string(reference.chapter_get()));
replace_text(url, resource_url_constructor_verse(), number_in_string(reference.verse_get()));
return url;
}
示例2: BibleWorksReferenceSet
void WindowsOutpost::BibleWorksReferenceSet(const Reference & reference)
// Schedules a reference to be sent to BibleWorks.
{
if (!reference.book_get())
return;
// As it does not respond properly to chapter/verses that are 0, care for that.
unsigned int goto_ch = reference.chapter_get();
if (goto_ch == 0)
goto_ch = 1;
ustring goto_vs = reference.verse_get();
if (goto_vs == "0")
goto_vs = "1";
ustring bw_book = books_id_to_bibleworks(reference.book_get());
if (bw_book.empty())
return;
bibleworks_reference_set_value = "BibleWorksReferenceSet " + bw_book + " " + convert_to_string(goto_ch) + ":" + goto_vs;
}
示例3: OnlineBibleReferenceSet
void WindowsOutpost::OnlineBibleReferenceSet(const Reference & reference)
// Schedules a reference to be sent to the Online Bible.
// Sample:
// OLB ShowPassage AV "Mt 10:5"
{
// Ensure that the Online Bible server is connected.
online_bible_server_connect (true);
// Send the references.
if (!reference.book_get())
return;
if (!reference.chapter_get())
return;
if (reference.verse_get().empty())
return;
onlinebible_reference_set_value = "OLB ShowPassage AV \"" + books_id_to_online_bible (reference.book_get()) + " " + convert_to_string(reference.chapter_get()) + ":" + reference.verse_get() + "\"";
}
示例4: notes_store_index_entry
void notes_store_index_entry (sqlite3 *db, gint32 id)
{
gchar *sql;
// Delete optional previous entry with "id".
sql = g_strdup_printf("delete from notes where id = %d;", id);
sqlite3_exec(db, sql, NULL, NULL, NULL);
g_free(sql);
// Read the note with "id".
ustring note;
ustring project;
ustring references;
ustring category;
int date_created;
ustring user_created;
int date_modified;
ustring logbook;
notes_read_one_from_file (id, note, project, references, category, date_created, user_created, date_modified, logbook);
// Bail out if there's no note.
if (note.empty()) {
return;
}
// Attend to the id: use variable "id".
// Attend to the encoded references.
Parse parse(references, false);
ustring encoded_references;
for (unsigned int i = 0; i < parse.words.size(); i++) {
Reference oldRef;
Reference newRef;
reference_discover(oldRef, parse.words[i], newRef);
ustring book = books_id_to_english(newRef.book_get());
ustring chapter = convert_to_string(newRef.chapter_get());
vector < int >verses = verses_encode(newRef.verse_get());
int book_chapter = reference_to_numerical_equivalent(book, chapter, "0");
for (unsigned int i2 = 0; i2 < verses.size(); i2++) {
encoded_references.append(" ");
encoded_references.append(convert_to_string(int (book_chapter + verses[i2])));
}
}
encoded_references.append(" ");
// Attend to the project: use variable "project".
// Apostrophies need to be doubled before storing them.
project = double_apostrophy(project);
// Attend to the category: use variable "category".
// Apostrophies need to be doubled before storing them.
category = double_apostrophy(category);
// Attend to the note text in case folded form
// Apostrophies need to be doubled before storing them.
note = note.casefold ();
note = double_apostrophy(note);
// Attend to the date created: use variable "date_created".
// Attend to the date modified: use variable "date_modified".
// Put new data in the database.
sql = g_strdup_printf("insert into notes values (%d, '%s', '%s', '%s', '%s', %d, %d);",
id, encoded_references.c_str(), project.c_str(), category.c_str(), note.c_str(), date_created, date_modified);
sqlite3_exec(db, sql, NULL, NULL, NULL);
g_free(sql);
}
示例5: kjv_get_strongs_data
void kjv_get_strongs_data (const Reference& reference, vector <ustring>& strongs, vector <ustring>& words)
// This gets the words and their applicable Strong's numbers for a verse.
{
sqlite3 *db;
int rc;
char *error = NULL;
try {
// Open the database.
rc = sqlite3_open(kjv_sql_filename().c_str(), &db);
if (rc)
throw runtime_error(sqlite3_errmsg(db));
sqlite3_busy_timeout(db, 1000);
// Retrieve the bits.
SqliteReader reader(0);
char *sql;
sql = g_strdup_printf("select fragment, lemma from kjv where book = %d and chapter = %d and verse = %d order by item asc;", reference.book_get(), reference.chapter_get(), convert_to_int (reference.verse_get()));
rc = sqlite3_exec(db, sql, reader.callback, &reader, &error);
g_free(sql);
if (rc) {
throw runtime_error(sqlite3_errmsg(db));
}
words = reader.ustring0;
strongs = reader.ustring1;
}
catch(exception & ex) {
gw_critical(ex.what());
}
sqlite3_close(db);
}
示例6: kjv_import_sword
void kjv_import_sword (const ustring& textfile, const ustring& database)
{
// Show the progress. KJV has 31102 verses.
ProgressWindow progresswindow (_("Importing King James Bible"), false);
progresswindow.set_iterate (0, 1, 31102);
gchar * contents;
g_file_get_contents(textfile.c_str(), &contents, NULL, NULL);
if (!contents)
return;
// Create the database, put it in fast mode.
unix_unlink (database.c_str());
sqlite3 *db;
sqlite3_open(database.c_str(), &db);
sqlite3_exec(db, "create table kjv (book integer, chapter integer, verse integer, item integer, fragment text, lemma text);", NULL, NULL, NULL);
sqlite3_exec(db, "PRAGMA synchronous=OFF;", NULL, NULL, NULL);
// Parse input.
xmlParserInputBufferPtr inputbuffer;
inputbuffer = xmlParserInputBufferCreateMem(contents, strlen (contents), XML_CHAR_ENCODING_NONE);
xmlTextReaderPtr reader = xmlNewTextReader(inputbuffer, NULL);
if (reader) {
bool within_relevant_element = false;
Reference reference (0, 0, "0");
unsigned int item_number = 0;
ustring textfragment;
ustring lemmata;
while ((xmlTextReaderRead(reader) == 1)) {
switch (xmlTextReaderNodeType(reader)) {
case XML_READER_TYPE_ELEMENT:
{
xmlChar *element_name = xmlTextReaderName(reader);
// Deal with a verse element.
if (!xmlStrcmp(element_name, BAD_CAST "verse")) {
progresswindow.iterate();
char *attribute;
attribute = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "osisID");
if (attribute) {
Parse parse (attribute, false, ".");
if (parse.words.size() == 3) {
reference.assign(books_osis_to_id (parse.words[0]), // book
convert_to_int (parse.words[1]), // chapter
parse.words[2]); // verse
} else {
gw_critical (attribute);
}
free(attribute);
}
item_number = 0;
}
// Deal with a w element.
if (!xmlStrcmp(element_name, BAD_CAST "w")) {
within_relevant_element = true;
item_number++;
textfragment.clear();
lemmata.clear();
char *attribute;
attribute = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "lemma");
if (attribute) {
lemmata = attribute;
free(attribute);
}
}
break;
}
case XML_READER_TYPE_TEXT:
{
if (within_relevant_element) {
xmlChar *text = xmlTextReaderValue(reader);
if (text) {
textfragment = (const char *)text;
xmlFree(text);
textfragment = textfragment.casefold();
}
}
break;
}
case XML_READER_TYPE_END_ELEMENT:
{
xmlChar *element_name = xmlTextReaderName(reader);
if (!xmlStrcmp(element_name, BAD_CAST "w")) {
replace_text (lemmata, "strong:", "");
char *sql;
sql = g_strdup_printf("insert into kjv values (%d, %d, %d, %d, '%s', '%s');",
reference.book_get(), reference.chapter_get(), convert_to_int (reference.verse_get()),
item_number,
double_apostrophy (textfragment).c_str(), lemmata.c_str());
sqlite3_exec(db, sql, NULL, NULL, NULL);
g_free(sql);
within_relevant_element = false;
}
break;
}
}
}
}
if (reader)
xmlFreeTextReader(reader);
if (inputbuffer)
xmlFreeParserInputBuffer(inputbuffer);
//.........这里部分代码省略.........
示例7: html_write_keyterms
void WindowCheckKeyterms::html_write_keyterms (HtmlWriter2& htmlwriter, unsigned int keyword_id)
{
// Get data about the project.
extern Settings *settings;
ustring project = settings->genconfig.project_get();
ProjectConfiguration *projectconfig = settings->projectconfig(project);
ustring versification = projectconfig->versification_get();
// Add action links.
htmlwriter.paragraph_open ();
htmlwriter.hyperlink_add ("index", "[Index]");
htmlwriter.text_add (" ");
htmlwriter.hyperlink_add ("send", _("[Send to references window]"));
htmlwriter.paragraph_close ();
// Add the keyterm itself.
ustring keyterm;
keyterms_get_term(keyword_id, keyterm);
htmlwriter.heading_open (3);
htmlwriter.text_add (keyterm);
htmlwriter.heading_close();
// Retrieve the renderings.
vector <ustring> renderings;
vector <bool> wholewords;
vector <bool> casesensitives;
get_renderings(renderings, wholewords, casesensitives);
// Get the data for the keyword identifier.
ustring dummy;
ustring information;
keyterms_get_data(keyword_id, dummy, information, references);
// Divide the information into lines.
ParseLine parseline (information);
// Write the information.
for (unsigned int i = 0; i < parseline.lines.size(); i++) {
information = parseline.lines[i];
htmlwriter.paragraph_open ();
size_t pos = information.find (keyterms_reference_start_markup ());
while (pos != string::npos) {
htmlwriter.text_add (information.substr (0, pos));
information.erase (0, pos + keyterms_reference_start_markup ().length());
pos = information.find (keyterms_reference_end_markup ());
if (pos != string::npos) {
// Extract the reference.
htmlwriter.paragraph_close ();
ustring original_reference_text = information.substr (0, pos);
Reference reference = get_reference (original_reference_text);
// Remap the reference.
{
Mapping mapping(versification, reference.book_get());
vector <int> chapters;
vector <int> verses;
mapping.original_to_me(reference.chapter_get(), reference.verse_get(), chapters, verses);
if (!chapters.empty()) {
reference.chapter_set(chapters[0]);
reference.verse_set(convert_to_string (verses[0]));
}
}
ustring remapped_reference_text = reference.human_readable ("");
ustring displayed_reference_text (remapped_reference_text);
if (remapped_reference_text != original_reference_text) {
displayed_reference_text.append (" (");
displayed_reference_text.append (original_reference_text);
displayed_reference_text.append (")");
}
// Add the reference with hyperlink.
htmlwriter.hyperlink_add ("goto " + remapped_reference_text, remapped_reference_text);
information.erase (0, pos + keyterms_reference_end_markup ().length());
// Add the reference's text.
ustring verse = project_retrieve_verse(project, reference);
if (verse.empty()) {
verse.append(_("<empty>"));
} else {
CategorizeLine cl(verse);
cl.remove_verse_number(reference.verse_get());
verse = cl.verse;
}
htmlwriter.text_add (" ");
// Add the verse plus markup for approved text.
vector <size_t> startpositions;
vector <size_t> lengths;
size_t processposition = 0;
if (find_renderings (verse, renderings, wholewords, casesensitives, &startpositions, &lengths)) {
quick_sort (startpositions, lengths, 0, startpositions.size());
// Overlapping items need to be combined to avoid crashes.
xml_combine_overlaps (startpositions, lengths);
for (unsigned int i = 0; i < startpositions.size(); i++) {
htmlwriter.text_add (verse.substr (0, startpositions[i] - processposition));
htmlwriter.bold_open();
htmlwriter.text_add (verse.substr (startpositions[i] - processposition, lengths[i]));
htmlwriter.bold_close();
verse.erase (0, startpositions[i] - processposition + lengths[i]);
processposition = startpositions[i] + lengths[i];
}
// Add whatever is left over of the verse. This could be the full verse in case it wasn't processed.
//.........这里部分代码省略.........
示例8: SantaFeFocusReferenceSet
void WindowsOutpost::SantaFeFocusReferenceSet(const Reference & reference)
// Schedules a reference to be sent to the santa fe focus system.
{
if (!reference.book_get())
return;
ustring bk = books_id_to_paratext(reference.book_get());
if (bk.empty())
return;
santafefocus_reference_set_value = "SantaFeFocusReferenceSet " + bk + " " + convert_to_string(reference.chapter_get()) + ":" + reference.verse_get();
}