本文整理汇总了C++中VerseKey类的典型用法代码示例。如果您正苦于以下问题:C++ VerseKey类的具体用法?C++ VerseKey怎么用?C++ VerseKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VerseKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
SWMgr manager(new MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
const char *bookName = (argc > 1) ? argv[1] : "WLC";
SWModule *b = manager.getModule(bookName);
if (!b) return -1;
SWModule &book = *b;
book.setProcessEntryAttributes(false);
VerseKey *vk = SWDYNAMIC_CAST(VerseKey, book.getKey());
// find the first non-zero entry
for (book = TOP; !book.popError() && !book.getRawEntryBuf().size(); book++);
if (!book.getRawEntryBuf().size()) return -2; // empty module
for (;!book.popError(); book++) {
cout << "$$$";
if (vk) cout << vk->getOSISRef();
else cout << book.getKeyText();
cout << "\n" << book.renderText() << "\n\n";
}
return 0;
}
开发者ID:bluehavana,项目名称:sword,代码行数:28,代码来源:outrender.cpp
示例2: parseRangeKey
std::string parseRangeKey(const char* keyValue, const char* locale) {
const char* oldLocale = LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName();
LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale);
std::string ret;
VerseKey DefaultVSKey;
DefaultVSKey = "jas3:1";
ListKey verses = DefaultVSKey.ParseVerseList(keyValue, DefaultVSKey, true);
for (int i = 0; i < verses.Count(); i++) {
VerseKey *element = dynamic_cast<VerseKey *>(verses.GetElement(i));
if (element) {
if (ret.length()) {
ret.append(" ");
}
ret.appendFormatted( "%s - %s;", (const char*)element->LowerBound(), (const char*)element->UpperBound() );
}
else {
if (ret.length()) {
ret.append(" ");
}
ret.appendFormatted("%s;", (const char *)*verses.GetElement(i));
}
}
// cout << ret.c_str() << endl;
LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(oldLocale);
return ret;
};
开发者ID:kalemas,项目名称:swordxx,代码行数:33,代码来源:versekey_test.cpp
示例3: findOffset
void RawCom4::increment(int steps) {
long start;
unsigned long size;
VerseKey *tmpkey = &getVerseKey();
findOffset(tmpkey->getTestament(), tmpkey->getTestamentIndex(), &start, &size);
SWKey lastgood = *tmpkey;
while (steps) {
long laststart = start;
unsigned long lastsize = size;
SWKey lasttry = *tmpkey;
(steps > 0) ? ++(*key) : --(*key);
tmpkey = &getVerseKey();
if ((error = key->popError())) {
*key = lastgood;
break;
}
long index = tmpkey->getTestamentIndex();
findOffset(tmpkey->getTestament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
// && (start > 0)
&& (size)) // and we actually have a size
||(!skipConsecutiveLinks)) { // or we don't want to skip consecutive links
steps += (steps < 0) ? 1 : -1;
lastgood = *tmpkey;
}
}
error = (error) ? KEYERR_OUTOFBOUNDS : 0;
}
开发者ID:bluehavana,项目名称:sword,代码行数:32,代码来源:rawcom4.cpp
示例4:
SWBuf &RawFiles::getRawEntryBuf() {
FileDesc *datafile;
long start = 0;
unsigned short size = 0;
VerseKey *key = &getVerseKey();
findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
entryBuf = "";
if (size) {
SWBuf tmpbuf = path;
tmpbuf += '/';
readText(key->Testament(), start, size, entryBuf);
tmpbuf += entryBuf;
entryBuf = "";
datafile = FileMgr::getSystemFileMgr()->open(tmpbuf.c_str(), FileMgr::RDONLY);
if (datafile->getFd() > 0) {
size = datafile->seek(0, SEEK_END);
char *tmpBuf = new char [ size + 1 ];
memset(tmpBuf, 0, size + 1);
datafile->seek(0, SEEK_SET);
datafile->read(tmpBuf, size);
entryBuf = tmpBuf;
delete [] tmpBuf;
// preptext(entrybuf);
}
FileMgr::getSystemFileMgr()->close(datafile);
}
return entryBuf;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:30,代码来源:rawfiles.cpp
示例5: writeidx
void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
{
long pos;
short tmp;
for (; ((key1 <= key3) && (key1.popError() != KEYERR_OUTOFBOUNDS) && (key1.getTestament() == testmnt)); key1+=1) {
if (key1.getVerse() == 1) { // new chapter
if (key1.getChapter() == 1) { // new book
pos = lseek(cfp, 0, SEEK_CUR);
write(bfp, &pos, 4);
pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
write(cfp, &pos, 4);
write(vfp, &chapoffset, 4); /* Book intro (vss) set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
write(vfp, &chapsize, 2);
}
pos = lseek(vfp, 0, SEEK_CUR);
write(cfp, &pos, 4);
write(vfp, &chapoffset, 4); /* Chapter intro */
write(vfp, &chapsize, 2);
}
if (key1 >= key2) {
write(vfp, &offset, 4);
write(vfp, &size, 2);
}
else {
pos = 0;
tmp = 0;
write(vfp, &pos, 4);
write(vfp, &tmp, 2);
}
}
}
开发者ID:bluehavana,项目名称:sword,代码行数:32,代码来源:gbfidx.cpp
示例6: main
int main(int argc, char **argv)
{
const char *range = (argc > 1) ? argv[1] : "Mat 2:10,12-15";
VerseKey parser;
ListKey result;
result = parser.parseVerseList(range, parser.getText().c_str(), true);
// let's iterate the key and display
for (result.positionToTop(); !result.popError(); result.increment()) {
cout << result.getText() << "\n";
}
cout << endl;
// Now let's output a module with the entries from the result
// we'll initialize our library of books
SWMgr library(std::make_shared<MarkupFilterMgr>(FMT_PLAIN)); // render plain without fancy markup
// Let's get a book;
auto const book(library.getModule("KJV"));
// couldn't find our test module
if (!book) return -1;
// now let's iterate the book and display
for (result.positionToTop(); !result.popError(); result.increment()) {
book->setKey(result);
cout << "*** " << book->getKeyText() << ": " << book->renderText() << "\n";
}
return 0;
}
开发者ID:swordxx,项目名称:swordxx,代码行数:34,代码来源:verserangeparse.cpp
示例7: writeEntry
void writeEntry(SWModule & module,
std::string const & key,
std::string const & entry,
bool const replace)
{
if (key.size() && entry.size()) {
std::cout << "from file: " << key << std::endl;
VerseKey *vkey = (VerseKey *)module.getKey();
std::unique_ptr<VerseKey> linkMaster(
static_cast<VerseKey *>(module.createKey().release()));
ListKey listKey = vkey->parseVerseList(key.c_str(), "Gen1:1", true);
bool first = true;
for (listKey.positionToTop(); !listKey.popError(); listKey.increment()) {
vkey->positionFrom(listKey);
if (first) {
*linkMaster = *vkey;
std::string text;
if (!replace)
text = module.getRawEntry();
text += entry;
std::cout << "adding entry: " << vkey->getText() << " length " << entry.size() << "/" << (unsigned short)text.size() << std::endl;
module.setEntry(text.c_str());
first = false;
}
else {
std::cout << "linking entry: " << vkey->getText() << " to " << linkMaster->getText() << std::endl;
module.linkEntry(*linkMaster);
}
}
}
}
开发者ID:swordxx,项目名称:swordxx,代码行数:34,代码来源:imp2vs.cpp
示例8: VerseKey
SWKey *SWText::createKey() const {
VerseKey *vk = new VerseKey();
vk->setVersificationSystem(versification);
return vk;
}
开发者ID:raphink,项目名称:sword,代码行数:7,代码来源:swtext.cpp
示例9:
bool RawCom4::hasEntry(const SWKey *k) const {
long start;
unsigned long size;
VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size);
return size;
}
开发者ID:bluehavana,项目名称:sword,代码行数:8,代码来源:rawcom4.cpp
示例10: setIndex
void SWCom::setIndex(long iindex) {
VerseKey *key = &getVerseKey();
key->setTestament(1);
key->setIndex(iindex);
if (key != this->key) {
this->key->copyFrom(*key);
}
}
开发者ID:bluehavana,项目名称:sword,代码行数:9,代码来源:swcom.cpp
示例11: hasEntry
bool zCom::hasEntry(const SWKey *k) const {
long start;
unsigned short size;
unsigned long buffnum;
VerseKey *vk = &getVerseKey(k);
findOffset(vk->Testament(), vk->TestamentIndex(), &start, &size, &buffnum);
return size;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:9,代码来源:zcom.cpp
示例12: doLinkEntry
void zCom::linkEntry(const SWKey *inkey) {
VerseKey *destkey = &getVerseKey();
const VerseKey *srckey = &getVerseKey(inkey);
doLinkEntry(destkey->Testament(), destkey->TestamentIndex(), srckey->TestamentIndex());
if (inkey != srckey) // free our key if we created a VerseKey
delete srckey;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:9,代码来源:zcom.cpp
示例13: tag
bool ThMLRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
if (!substituteToken(buf, token)) { // manually process if it wasn't a simple substitution
MyUserData *u = (MyUserData *)userData;
XMLTag tag(token);
if ((!tag.isEndTag()) && (!tag.isEmpty()))
u->startTag = tag;
if (tag.getName() && !strcmp(tag.getName(), "sync")) {
SWBuf value = tag.getAttribute("value");
if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "morph")) { //>
buf.appendFormatted(" {\\cf4 \\sub (%s)}", value.c_str());
}
else if( tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "Strongs")) {
if (value[0] == 'H' || value[0] == 'G' || value[0] == 'A') {
value<<1;
buf.appendFormatted(" {\\cf3 \\sub <%s>}", value.c_str());
}
else if (value[0] == 'T') {
value<<1;
buf.appendFormatted(" {\\cf4 \\sub (%s)}", value.c_str());
}
}
else if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "Dict")) {
if (!tag.isEndTag())
buf += "{\\b ";
else buf += "}";
}
}
// <note> tag
else if (!strcmp(tag.getName(), "note")) {
if (!tag.isEndTag()) {
if (!tag.isEmpty()) {
SWBuf type = tag.getAttribute("type");
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
VerseKey *vkey = NULL;
// see if we have a VerseKey * or descendant
SWTRY {
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
}
SWCATCH ( ... ) { }
if (vkey) {
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
buf.appendFormatted("{\\super <a href=\"\">*%c%i.%s</a>} ", ch, vkey->Verse(), footnoteNumber.c_str());
}
u->suspendTextPassThru = true;
}
}
if (tag.isEndTag()) {
u->suspendTextPassThru = false;
}
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:51,代码来源:thmlrtf.cpp
示例14: main
int main(int argc, char **argv) {
SWMgr mymgr;
SWModule *bbe = mymgr.Modules["BBE"];
if (bbe) {
VerseKey vk;
vk.setPersist(true);
bbe->setKey(vk);
for (; !bbe->popError(); (*bbe)++ ) {
std::cout << vk.getIndex() << std::endl;
}
}
return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:15,代码来源:indextest.cpp
示例15: flushCache
void zCom::setEntry(const char *inbuf, long len) {
VerseKey *key = &getVerseKey();
// see if we've jumped across blocks since last write
if (lastWriteKey) {
if (!sameBlock(lastWriteKey, key)) {
flushCache();
}
delete lastWriteKey;
}
doSetText(key->Testament(), key->TestamentIndex(), inbuf, len);
lastWriteKey = (VerseKey *)key->clone(); // must delete
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:15,代码来源:zcom.cpp
示例16: main
int main(int argc, char **argv)
{
const char *range = (argc > 1) ? argv[1] : "Mat 2:10,12-15";
VerseKey parser;
ListKey result;
result = parser.parseVerseList(range, parser, true);
// let's iterate the key and display
for (result = TOP; !result.popError(); result++) {
cout << result << "\n";
}
cout << endl;
// Now if we'd like persist this key for use inside of a book...
result.setPersist(true);
// Let's get a book;
SWMgr library(new MarkupFilterMgr(FMT_PLAIN)); // render plain without fancy markup
SWModule *book = library.getModule("KJV");
// and set our limited key inside
book->setKey(result);
// now let's iterate the book and display
for ((*book) = TOP; !book->popError(); (*book)++) {
cout << "*** " << book->getKeyText() << ": " << book->renderText() << "\n";
}
// Since we've told our result key to persist in book, we can reuse our
// setup by simply resetting result, e.g.
//
// result = parser.ParseVerseList(someNewRange, parser, true);
//
// Now an iteration of book will give us our new range.
//
// To stop persistence of our custom key, we'll need to set our book's key
// to something simple:
//
// book->setKey("gen.1.1");
//
// Resetting our book object's key to something not persistent will revert our book object to using its default key for positioning
//
//
return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:47,代码来源:verserangeparse.cpp
示例17: return
VerseKey &SWText::getVerseKey(const SWKey *keyToConvert) const {
SWKey const * tmp = keyToConvert ? keyToConvert : this->key;
/// \bug remove const_cast:
SWKey * thisKey = const_cast<SWKey *>(tmp);
if (VerseKey * const key = dynamic_cast<VerseKey *>(thisKey))
return *key;
if (ListKey * const lkTest = dynamic_cast<ListKey *>(thisKey))
if (VerseKey * const key =
dynamic_cast<VerseKey *>(lkTest->getElement()))
return *key;
VerseKey * retKey = (tmpSecond) ? tmpVK1 : tmpVK2;
tmpSecond = !tmpSecond;
retKey->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
(*retKey) = *thisKey;
return (*retKey);
}
开发者ID:kalemas,项目名称:swordxx,代码行数:18,代码来源:swtext.cpp
示例18: main
int main(int argc, char **argv) {
const char *modName = "HunKar";
SWMgr library;
SWModule *book = library.getModule(modName);
if (!book) {
cerr << "Can't find module: " << modName << endl;
return -1;
}
VerseKey* key = ((VerseKey *)book->getKey());
key->setIntros(true);
book->setSkipConsecutiveLinks(true);
book->setPosition(TOP);
cout << *key << endl;
return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:18,代码来源:verseposition.cpp
示例19:
/******************************************************************************
* zCom::getRawEntry - Returns the correct verse when char * cast
* is requested
*
* RET: string buffer with verse
*/
SWBuf &zCom::getRawEntryBuf() {
long start = 0;
unsigned short size = 0;
unsigned long buffnum;
VerseKey *key = &getVerseKey();
findOffset(key->Testament(), key->TestamentIndex(), &start, &size, &buffnum);
entrySize = size; // support getEntrySize call
entryBuf = "";
zReadText(key->Testament(), start, size, buffnum, entryBuf);
rawFilter(entryBuf, key);
// if (!isUnicode())
prepText(entryBuf);
return entryBuf;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:25,代码来源:zcom.cpp
示例20: main
int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s <Mod Name>\n", argv[0]);
std::exit(-1);
}
SWMgr mgr;
auto const it = mgr.modules().find(argv[1]);
if (it == mgr.modules().end()) {
fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
std::exit(-2);
}
SWModule & mod = *it->second;
SWKey *key = mod.getKey();
VerseKey * vkey = nullptr;
try {
vkey = dynamic_cast<VerseKey *>(key);
}
catch (...) {}
if (!vkey) {
fprintf(stderr, "error: %s: %s module is not keyed to verses \n", argv[0], argv[1]);
std::exit(-3);
}
vkey->setIntros(false); // turn on mod/testmnt/book/chap headings
mod.positionToTop();
while (!mod.popError()) {
if (vkey->getVerse()) {
if (!mod.renderText().length()) {
std::cout << vkey->getText() << std::endl;
}
mod.increment();
}
}
}
开发者ID:swordxx,项目名称:swordxx,代码行数:41,代码来源:emptyvss.cpp
注:本文中的VerseKey类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论