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


C++ ListKey类代码示例

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


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

示例1: 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

示例2: SWDYNAMIC_CAST

TreeKey &SWGenBook::getTreeKey(const SWKey *k) const {
	const SWKey* thiskey = k?k:this->key;

	TreeKey *key = 0;

	SWTRY {
		key = SWDYNAMIC_CAST(TreeKey, (thiskey));
	}
	SWCATCH ( ... ) {}

	if (!key) {
		ListKey *lkTest = 0;
		SWTRY {
			lkTest = SWDYNAMIC_CAST(ListKey, thiskey);
		}
		SWCATCH ( ... ) {	}
		if (lkTest) {
			SWTRY {
				key = SWDYNAMIC_CAST(TreeKey, lkTest->getElement());
				if (!key) {
					VerseTreeKey *tkey = 0;
					SWTRY {
						tkey = SWDYNAMIC_CAST(VerseTreeKey, lkTest->getElement());
					}
					SWCATCH ( ... ) {}
					if (tkey) key = tkey->getTreeKey();
				}
			}
			SWCATCH ( ... ) {	}
		}
开发者ID:bluehavana,项目名称:sword,代码行数:30,代码来源:swgenbook.cpp

示例3: 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

示例4: 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 let's output a module with the entries from the result
	
	// we'll initialize our library of books
	SWMgr library(new MarkupFilterMgr(FMT_PLAIN));	// render plain without fancy markup

	// Let's get a book;
	SWModule *book = library.getModule("KJV");

	// couldn't find our test module
	if (!book) return -1;

	// now let's iterate the book and display
	for (result = TOP; !result.popError(); result++) {
		book->setKey(result);
		cout << "*** " << book->getKeyText() << ": " << book->renderText() << "\n";
	}

	return 0;
}
开发者ID:bluehavana,项目名称:sword,代码行数:34,代码来源:verserangeparse.cpp

示例5: main

int main(int argc, char **argv) {

	SWMgr mgr;
	SWModule *mod = mgr.getModule("KJVgb");

	VerseKey *key1 = (VerseKey *)mod->createKey();

	key1->setTestament(2);
	key1->setBook(4);
	key1->setChapter(2);
	key1->setVerse(3);

	cout << "\n" << key1->getText() << ":\n\n";

	ListKey keys;
	keys << *key1;

	cout << "\n" << keys.getRangeText() << ":\n\n";

	ListKey keys2 = keys;

	cout << "\n" << keys2.getRangeText() << ":\n\n";

	keys = key1->parseVerseList("Lk.4.5");

	cout << "\n" << key1->getText() << ":\n\n";

	key1->setText("jn.6.7");

	cout << "\n" << key1->getText() << ":\n\n";
	

	mod->setKey("lk.2.3");

	cout << "\n" << mod->getKeyText() << ":\n" << endl;
	cout << mod->getRawEntry() << endl;


	cout << "\nListkey persist key iteration test\n\n";
	keys = key1->parseVerseList("mat1", 0, true);

	for (keys = TOP; !keys.popError(); keys++) {
		cout << "\n" << keys.getText() << ":\n" << endl;
	}


	keys.setPersist(true);

	mod->setKey(keys);

	for ((*mod) = TOP; !mod->popError(); (*mod)++) {
		cout << "\n" << mod->getKeyText() << ":\n" << endl;
	}

	delete key1;

	return 0;
}
开发者ID:bluehavana,项目名称:sword,代码行数:58,代码来源:vtreekeytest.cpp

示例6: listkey_getVerselistIterator

SWHANDLE listkey_getVerselistIterator(const char *list, const char *key, const char *v11n) {
	VerseKey versekey;
        versekey.setVersificationSystem(v11n);
	static ListKey verses;
	
	versekey.setText(key);
	verses.clear();
	verses = versekey.parseVerseList(list, versekey);
	return (SWHANDLE)&verses;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: SWModule_doSearch

SWHANDLE SWModule_doSearch(SWHANDLE hmodule, const char *searchString, int type, int params ,void (*percent) (char, void *), void *percentUserData) {
	
	static ListKey results;
	SWKey * scope = 0;
	SWModule *module = (SWModule *)hmodule;
	if (!module) 	
		return -1;
	
	results.clear();
	results = module->search(searchString, type, params, scope, 0, percent, (void *) &percentUserData);
	
	return (SWHANDLE)&results;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: 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

示例9: VerseKey

void SearchThread::search()  {
	
	if (!module) {
		std::cout << "Return." << std::endl;
		return;
	}

	ListKey scopeList = VerseKey().ParseVerseList("Luke;John;Revelation","", true);
	for (int i=0; i < scopeList.Count(); ++i) {
		std::cout << (const char*)*scopeList.GetElement(i) << std::endl;
	}
	SWKey* scope = &scopeList;

	searchResult = module->Search(searchedText, -2, REG_ICASE, scope, 0, &percentUpdate);

	if (!scope)
		std::cout << "bad scope!" << std::endl;
	isSearching = false;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:19,代码来源:threaded_search.cpp

示例10: SWDYNAMIC_CAST

VerseKey &SWText::getVerseKey(const SWKey *keyToConvert) const {
	const SWKey *thisKey = keyToConvert ? keyToConvert : this->key;

	VerseKey *key = 0;
	// see if we have a VerseKey * or decendant
	SWTRY {
		key = SWDYNAMIC_CAST(VerseKey, thisKey);
	}
	SWCATCH ( ... ) {	}
	if (!key) {
		ListKey *lkTest = 0;
		SWTRY {
			lkTest = SWDYNAMIC_CAST(ListKey, thisKey);
		}
		SWCATCH ( ... ) {	}
		if (lkTest) {
			SWTRY {
				key = SWDYNAMIC_CAST(VerseKey, lkTest->GetElement());
			}
			SWCATCH ( ... ) {	}
		}
	}
开发者ID:raphink,项目名称:sword,代码行数:22,代码来源:swtext.cpp

示例11: main

int main(int argc, char **argv) {
	if ((argc < 2) || (argc > 4)) {
		fprintf(stderr, "usage: %s <\"string to parse\"> [locale_name] [test-in-set-verse]\n", *argv);
		exit(-1);
	}

	if (argc > 2)
		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(argv[2]);

	VerseKey DefaultVSKey;

	DefaultVSKey = "jas3:1";
	
	ListKey verses = DefaultVSKey.parseVerseList(argv[1], DefaultVSKey, true);

	std::cout << verses.getOSISRefRangeText() << "\n";

	if (argc > 3) {
		verses.setText(argv[3]);
		std::cout << "Verse is" << ((verses.popError()) ? " NOT" : "") << " in set.\n\n";
	}
	
	return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:24,代码来源:vs2osisreftxt.cpp

示例12: doquery

void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *range = 0, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) {
	static DiathekeMgr manager(NULL, NULL, false, outputencoding, outputformat,
		((OP_BIDI & optionfilters) == OP_BIDI),
		((OP_ARSHAPE & optionfilters) == OP_ARSHAPE));

	ModMap::iterator it;
	ListKey listkey;
	SectionMap::iterator sit;
	ConfigEntMap::iterator eit;

	SWModule *target;
	char *font = 0;
	char inputformat = 0;
	SWBuf encoding;
	char querytype = 0;

	if (locale) {
		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale);
	}

	//deal with queries to "system"
	if (!::stricmp(text, "system")) {
		querytype = QT_SYSTEM;
		systemquery(ref, output);
	}
	if (!strnicmp(text, "info", 4)) {
	        querytype = QT_INFO;
		text = ref;
	}
	//otherwise, we have a real book
	it = manager.Modules.find(text);
	if (it == manager.Modules.end()) { //book not found
		return;
	}
	target = (*it).second;
	SWKey *p = target->createKey();
        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
	if (!parser) {
        	delete p;
	        parser = new VerseKey();
	}

	if ((sit = manager.config->Sections.find((*it).second->getName())) != manager.config->Sections.end()) {
		if ((eit = (*sit).second.find("SourceType")) != (*sit).second.end()) {
			if (!::stricmp((char *)(*eit).second.c_str(), "GBF"))
				inputformat = FMT_GBF;
			else if (!::stricmp((char *)(*eit).second.c_str(), "ThML"))
				inputformat = FMT_THML;
			else if (!::stricmp((char *)(*eit).second.c_str(), "OSIS"))
				inputformat = FMT_OSIS;
			else if (!::stricmp((char *)(*eit).second.c_str(), "TEI"))
				inputformat = FMT_TEI;
		}
		encoding = ((eit = (*sit).second.find("Encoding")) != (*sit).second.end()) ? (*eit).second : (SWBuf)"";
	}


	if (querytype == QT_INFO) {
	  switch (inputformat) {
	  case FMT_THML :
	    *output << "ThML";
	    break;
	  case FMT_GBF :
	    *output << "GBF";
	    break;
	  case FMT_OSIS :
	    *output << "OSIS";
	    break;
	  case FMT_TEI :
	    *output << "TEI";
	    break;
	  default:
	    *output << "Other";
	  }
	  *output << ";";
	  *output << target->getType();
	  *output << ";";
	  delete parser;
	  return;
	}

	if (searchtype)
		querytype = QT_SEARCH;
	else if (!strcmp(target->getType(), "Biblical Texts"))
		querytype = QT_BIBLE;
	else if (!strcmp(target->getType(), "Commentaries"))
		querytype = QT_COMM;
	else if (!strcmp(target->getType(), "Lexicons / Dictionaries"))
		querytype = QT_LD;
	else if (!strcmp(target->getType(), "Generic Books"))
		querytype = QT_LD;

	if (optionfilters & OP_FOOTNOTES)
		manager.setGlobalOption("Footnotes","On");
	else
		manager.setGlobalOption("Footnotes","Off");
	if (optionfilters & OP_HEADINGS)
		manager.setGlobalOption("Headings","On");
	else
		manager.setGlobalOption("Headings","Off");
//.........这里部分代码省略.........
开发者ID:raphink,项目名称:sword,代码行数:101,代码来源:corediatheke.cpp

示例13: writeEntry

void writeEntry(SWModule *module, const SWBuf &key, const SWBuf &entry)
{
	if (key.size() && entry.size()) {
		std::cout << "from file: " << key << std::endl;
		VerseKey *vkey = (VerseKey *)module->getKey();
		VerseKey *linkMaster = (VerseKey *)module->createKey();

		ListKey listKey = vkey->parseVerseList(key.c_str(), "Gen1:1", true);

		bool first = true;
		for (listKey = TOP; !listKey.popError(); listKey++) {
			*vkey = listKey;
			if (first) {
				*linkMaster = *vkey;
				SWBuf text = module->getRawEntry();
				text += entry;


				//------------------------------------------------------------
				//  Tregelles Page marking special stuff
				//------------------------------------------------------------
/*
				const char *pageMarker = "<seg type=\"page\" subtype=\"";
				int newPage = page;
				SWBuf pageData = strstr(text.c_str(), pageMarker);
				if (pageData.length()) {
					pageData << strlen(pageMarker);
					const char *pn = pageData.stripPrefix('"');
					if (pn) newPage = atoi(pn);
				}
				// add page stuff for treg
				if (text.startsWith(pageMarker)) {
					// don't add anything cuz we already start with one
				}
				else {
					SWBuf pm = pageMarker;
					pm.appendFormatted("%d\" />", page);
					text = pm + text;
				}

				page = newPage;	// when our line set a new page number

*/
				//------------------------------------------------------------




				std::cout << "adding entry: " << *vkey << " length " << entry.size() << "/" << (unsigned short)text.size() << std::endl;
				module->setEntry(text);
				first = false;
			}
			else {
				std::cout << "linking entry: " << *vkey << " to " << *linkMaster << std::endl;
				module->linkEntry(linkMaster);
			}
		}

		delete linkMaster;
	}
}
开发者ID:,项目名称:,代码行数:61,代码来源:

示例14: PDL_JSException

std::string SwordPluginAPI::getVerses(const std::string& moduleName, const std::string& key, const std::string& single) {
    /*Get verses from a specific module (e.g. "ESV"). Set your biblepassage in key e.g. "James 1:19" */
    std::stringstream passage;
    std::stringstream tmpPassage;
    std::stringstream out;

    SWModule *module = displayLibrary->getModule(moduleName.c_str());
    /* if (!module || !(strcmp(module->Type(), "Biblical Texts") == 0 || strcmp(module->Type(), "Commentaries") == 0)) {
        PDL_JSException(parms, "getVerses: Module isn't verse driven (no bible or commentary). Currently BibleZ HD doesn't support Generic Books and Lexicons / Dictionaries!");
        return PDL_TRUE;
    } */

    //module->setKey(key);

    //VerseKey *vk = (VerseKey*)module->getKey();
    VerseKey *vk = dynamic_cast<VerseKey *>(module->getKey());
    //vk->AutoNormalize(false);
    vk->Headings(true);
    vk->setText(key.c_str());

    ListKey verses = VerseKey().ParseVerseList(key.c_str(), "", true);

    passage << "{\"bookName\": \"" << vk->getBookName() << "\", \"cnumber\": \"" << vk->Chapter()  << "\", \"vnumber\": \"" << vk->Verse() << "\", \"passageSingle\" : \"" << vk->getBookName() << " " << vk->Chapter() << ":" << vk->Verse() << "\", \"passage\" : \"" << vk->getBookName() << " " << vk->Chapter() << "\", \"abbrev\": \"" << vk->getBookAbbrev() << "\"}";
    if (single == "true") {
        verses = VerseKey().ParseVerseList(key.c_str(), "", true);
    } else {
        tmpPassage << vk->getBookName() << " " << vk->Chapter();
        verses = VerseKey().ParseVerseList(tmpPassage.str().c_str(), "", true);
    }

    AttributeTypeList::iterator i1;
    AttributeList::iterator i2;
    AttributeValue::iterator i3;

    out << "[";

    for (verses = TOP; !verses.Error(); verses++) {
        vk->setText(verses);

        if (strcmp(module->RenderText(), "") != 0) {
            //headingOn = 0;
            out << "{\"content\": \"" << convertString(module->RenderText()) << "\", ";
            out << "\"vnumber\": \"" << vk->Verse() << "\", ";
            out << "\"cnumber\": \"" << vk->Chapter() << "\"";
            out << ", \"heading\": \"" << convertString(module->getEntryAttributes()["Heading"]["Preverse"]["0"].c_str()) << "\"";

            for (i1 = module->getEntryAttributes().begin(); i1 != module->getEntryAttributes().end(); i1++) {
                if (strcmp(i1->first, "Footnote") == 0) {
                    out << ", \"footnotes\": [";
                    for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) {
                        out << "{";
                        for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) {
                            out << "\"" << i3->first << "\": \"" << convertString(i3->second.c_str()) << "\"";
                            //footnotesOn = 1;
                            if (i3 != --i2->second.end()) {
                                out << ", ";
                            }
                        }
                        out << "}";
                        if (i2 != --i1->second.end()) {
                            out << ", ";
                        }
                    }
                    out << "]";
                } /*else if (strcmp(i1->first, "Word") == 0) {
                    out << ", \"words\": [";
                    for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) {
                        out << "{";
                        for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) {
                            out << "\"" << i3->first << "\": \"" << convertString(i3->second.c_str()) << "\"";
                            if (i3 != --i2->second.end()) {
                                out << ", ";
                            }
                        }
                        out << "}";
                        if (i2 != --i1->second.end()) {
                            out << ", ";
                        }
                    }
                    out << "]";
                } */
            }

            if (vk->Chapter() == 1 && vk->Verse() == 1) {
                vk->setChapter(0);
                vk->setVerse(0);
                out << ", \"intro\": \"" << convertString(module->RenderText()) << "\"";
            }

            out << "}";

            ListKey helper = verses;
            helper++;
            if (!helper.Error()) {
                out << ", ";
            }
        }
    }

    out << "]";
//.........这里部分代码省略.........
开发者ID:zefanja,项目名称:biblez-plugin,代码行数:101,代码来源:SwordPluginAPI.cpp

示例15: main

int main(int argc, char **argv) {
  
  const char * helptext = "addvs 1.1 Bible & Commentary module creation tool for the SWORD Project\nUse -a to add a new verse from standard input or a file, -d to delete a verse,\n-l to link two verses, -c to create a new module.\n  usage:\n   %s -a </path/to/module> <verse> [</path/to/file/with/verse>]\n   %s -d </path/to/module> <key>\n   %s -l </path/to/module> <first verse (already assigned)> <second verse>\n   %s -c </path/to/module>\n";
  long entrysize;

  if (argc < 3) {
    fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
    exit(-1);
  }
 if (!strcmp(argv[1], "-a") && (argc == 4 || argc == 5)) {	
    
    // Do some initialization stuff
    char buffer[65536];  //this is the max size of any entry
    RawText * mod = new RawText(argv[2]);	// open our datapath with our RawText driver.
    VerseKey *vkey = new VerseKey;
    vkey->setIntros(true);
    vkey->setAutoNormalize(false);
    vkey->setPersist(true);      // the magical setting
    *vkey = argv[3];   
    // Set our VerseKey
    mod->setKey(*vkey);
    if (!vkey->getChapter()) {
      // bad hack >>
      // 0:0 is Book intro
      // (chapter):0 is Chapter intro
      //
      // 0:2 is Module intro
      // 0:1 is Testament intro
      int backstep = vkey->getVerse();
      vkey->setVerse(0);
      *mod -= backstep;       
      // << bad hack

      FILE *infile;
      // case: add from text file
      //Open our data file and read its contents into the buffer
      if (argc == 5) infile = fopen(argv[4], "r");
      // case: add from stdin
      else infile = stdin;
      
      entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
      
      mod->setEntry(buffer, entrysize);	// save text to module at current position
    }
    else {
      ListKey listkey = vkey->parseVerseList(argv[3], "Gen1:1", true);
      int i;
      bool havefirst = false;
      VerseKey firstverse;
      for (i = 0; i < listkey.getCount(); i++) {
	VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.getElement(i));
	if (element) {
	  mod->setKey(element->getLowerBound());
	  VerseKey finalkey = element->getUpperBound();
	  std::cout << mod->getKeyText() << "-" << (const char*)finalkey << std::endl;
	  if (!havefirst) {
	    havefirst = true;
	    firstverse = *mod->getKey();
	    FILE *infile;
	    // case: add from text file
	    //Open our data file and read its contents into the buffer
	    if (argc == 5) infile = fopen(argv[4], "r");
	    // case: add from stdin
	    else infile = stdin;
	    
	    entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
	    
	    mod->setEntry(buffer, entrysize);	// save text to module at current position
	    std::cout << "f" << (const char*)firstverse << std::endl;
	    (*mod)++;
	  }
	  while (*mod->getKey() <= finalkey) {
	    std::cout << mod->getKeyText() << std::endl;
	    *(SWModule*)mod << &firstverse;
	    (*mod)++;
	  }
	}
	else {
	  if (havefirst) {
	    mod->setKey(*listkey.getElement(i));
	    *(SWModule*)mod << &firstverse;
	    std::cout << mod->getKeyText() << std::endl;
	  }
	  else {
	    mod->setKey(*listkey.getElement(i));
	    havefirst = true;
	    firstverse = *mod->getKey();
	    FILE *infile;
	    // case: add from text file
	    //Open our data file and read its contents into the buffer
	    if (argc == 5) infile = fopen(argv[4], "r");
	    // case: add from stdin
	    else infile = stdin;
	    
	    entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
	    
	    mod->setEntry(buffer, entrysize);	// save text to module at current position
	    std::cout << "f" << (const char*)firstverse << std::endl;
	  }
	}
//.........这里部分代码省略.........
开发者ID:bluehavana,项目名称:sword,代码行数:101,代码来源:addvs.cpp


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