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


C++ dictionary函数代码示例

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


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

示例1: get_links

void	get_links(char ***lines, t_room **rlst)
{
	char	**links;
	t_room	*tmp;
	int		i;

	i = 0;
	while (lines && *lines && **lines && (strchr(**lines, '-')))
	{
		i = 0;
		while (lines && ***lines == '#')
			(*lines)++;
		links = ft_strsplit(**lines, '-');
		tmp = dictionary(links[0], &rlst);
		(tmp->links)[len(tmp->links)] = ft_strdup(links[1]);
		if (tmp && contains(tmp, links[1]))
			free((tmp->links)[len(tmp->links)]);
		tmp = dictionary(links[1], &rlst);
		(tmp->links)[len(tmp->links)] = ft_strdup(links[1]);
		if (tmp && contains(tmp, links[0]))
			free((tmp->links)[len(tmp->links)]);
		(*lines)++;
		free(links);
	}
	tmp->links[len(tmp->links)] = 0;
}
开发者ID:Siyanda-Mzam,项目名称:lemin,代码行数:26,代码来源:room_ops.c

示例2: dictionary

void PppDownScriptWriter::fill()
{
   dictionary()->SetValue(OBJECTNAME, QCoreApplication::instance()->objectName().toAscii().constData());
   dictionary()->SetValue(GETIPSECINFOLIB, ConfWriter::fileName(ConfWriter::GETIPSECINFO).toAscii().constData());

   const ConnectionSettings settings;
   const int iConnections = settings.connections();

   for (int i = 0; i < iConnections; i++)
   {
      const QString strName(settings.connection(i));

      if (!strName.isEmpty())
      {
         const PppIpSettings ipSetting(settings.pppSettings(strName).ipSettings());
         ctemplate::TemplateDictionary* const pConnection = dictionary()->AddSectionDictionary(CONN_SECTION);

         pConnection->SetValue(IPPARAM, (QCoreApplication::instance()->objectName() + "-" + strName).toAscii().constData());
         pConnection->SetValue(GATEWAY, settings.ipsecSettings(strName).gateway().toAscii().constData());

         if (ipSetting.useDefaultGateway())
            pConnection->AddSectionDictionary(DEFAULT_GATEWAY_SECTION);
      }
      else
         addErrorMsg(QObject::tr("No such connection: '%1'.").arg(strName));
   }
}
开发者ID:MichaelIT,项目名称:l2tp-ipsec-vpn,代码行数:27,代码来源:PppDownScriptWriter.cpp

示例3: fileName

Foam::foamChemistryReader<ThermoType>::foamChemistryReader
(
    const dictionary& thermoDict
)
:
    chemistryReader<ThermoType>(),
    speciesThermo_
    (
        IFstream
        (
            fileName(thermoDict.lookup("foamChemistryThermoFile")).expand()
        )()
    ),
    speciesTable_
    (
        dictionary
        (
            IFstream
            (
                fileName(thermoDict.lookup("foamChemistryFile")).expand()
            )()
        ).lookup("species")
    ),
    reactions_
    (
        dictionary
        (
            IFstream
            (
                fileName(thermoDict.lookup("foamChemistryFile")).expand()
            )()
        ).lookup("reactions"),
        typename Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
    )
{}
开发者ID:degirmen,项目名称:openfoam-extend-OpenFOAM-1.6-ext,代码行数:35,代码来源:foamChemistryReader.C

示例4: kdDebug

void
KSpellConfig::fillInDialog ()
{
  if ( nodialog )
    return;

  kdDebug(750) << "KSpellConfig::fillinDialog" << endl;

  cb1->setChecked( noRootAffix() );
  cb2->setChecked( runTogether() );
  encodingcombo->setCurrentItem( encoding() );
  clientcombo->setCurrentItem( client() );

  // get list of available dictionaries
  if ( iclient == KS_CLIENT_ISPELL )
    getAvailDictsIspell();
  else if ( iclient == KS_CLIENT_HSPELL )
  {
    langfnames.clear();
    dictcombo->clear();
    langfnames.append(""); // Default
    dictcombo->insertItem( i18n("Hebrew") );
  } else if ( iclient == KS_CLIENT_ZEMBEREK ) {
    langfnames.clear();
    dictcombo->clear();
    langfnames.append("");
    dictcombo->insertItem( i18n("Turkish") );
  }
  else
    getAvailDictsAspell();

  // select the used dictionary in the list
  int whichelement=-1;

  if ( dictFromList() )
    whichelement = langfnames.findIndex(dictionary());

  dictcombo->setMinimumWidth (dictcombo->sizeHint().width());

  if (dictionary().isEmpty() ||  whichelement!=-1)
  {
    setDictFromList (true);
    if (whichelement!=-1)
      dictcombo->setCurrentItem(whichelement);
  }
  else
    // Current dictionary vanished, present the user with a default if possible.
    if ( !langfnames.empty() )
    {
      setDictFromList( true );
      dictcombo->setCurrentItem(0);
    }
    else
      setDictFromList( false );

  sDictionary( dictFromList() );
  sPathDictionary( !dictFromList() );

}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:59,代码来源:ksconfig.cpp

示例5: speciesThermo_

Foam::foamChemistryReader<ThermoType>::foamChemistryReader
(
    const fileName& reactionsFileName,
    const fileName& thermoFileName
)
:
    chemistryReader<ThermoType>(),
    speciesThermo_(IFstream(thermoFileName)()),
    speciesTable_(dictionary(IFstream(reactionsFileName)()).lookup("species")),
    reactions_
    (
        dictionary(IFstream(reactionsFileName)()).lookup("reactions"),
        Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
    )
{}
开发者ID:degirmen,项目名称:openfoam-extend-OpenFOAM-1.6-ext,代码行数:15,代码来源:foamChemistryReader.C

示例6: NBDistrict

void
NIVissimDistrictConnection::dict_BuildDistrictNodes(NBDistrictCont& dc,
        NBNodeCont& nc) {
    for (std::map<int, std::vector<int> >::iterator k = myDistrictsConnections.begin(); k != myDistrictsConnections.end(); k++) {
        // get the connections
        const std::vector<int>& connections = (*k).second;
        // retrieve the current district
        std::string dsid = toString<int>((*k).first);
        NBDistrict* district = new NBDistrict(dsid);
        dc.insert(district);
        // compute the middle of the district
        PositionVector pos;
        for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
            NIVissimDistrictConnection* c = dictionary(*j);
            pos.push_back(c->geomPosition());
        }
        Position distCenter = pos.getPolygonCenter();
        if (connections.size() == 1) { // !!! ok, ok, maybe not the best way just to add an offset
            distCenter.add(10, 10);
        }
        district->setCenter(distCenter);
        // build the node
        std::string id = "District" + district->getID();
        NBNode* districtNode =
            new NBNode(id, district->getPosition(), district);
        if (!nc.insert(districtNode)) {
            throw 1;
        }
    }
}
开发者ID:kbleeck,项目名称:customSumo26,代码行数:30,代码来源:NIVissimDistrictConnection.cpp

示例7: while

void bPdfIn::doc(const char* filename) {

    // place cursor in the end of file:
    file.open(filename, std::fstream::in | std::fstream::ate);
    if(!file)
        throw "Cannot open PDF file."; 

    // Following little hack leads us directly to the end of "startxref" keyword.
    char chr = '\0';
    do {
        file.seekg(-2, std::ios::cur);
        if(chr == 'f')
             break;
    } while(file.get(chr));

    bPdf::getline(file);          // go to the next line - with xref position

    std::string xrefPosStr;
    xrefPosStr = bPdf::getline(file);
    size_t xrefPos = std::atoi(xrefPosStr.c_str());

    if( xrefPos == 0 )
	throw "bPdfIn was unable to find xref position, probably not a Pdf file.";

   // Load the cross-reference table. Dictionary of xref stream will be received.
   dictionary lastTrailer = loadXref(xrefPos);

   // Load trailer and previous xref tables and trailers if file was updated. Tables are loaded
   // in reversed chronological order so most recent entry for each object will come first for
   // bPdf::getObjPos(). Old trailers are all discarded.
   while(true) {
       if(lastTrailer["/Type"] != "/XRef") {
          // loadXref() left cursor one line after the last entry of the table. We should go back
          // to extract trailer (when there is no EOL after "trailer" keyword).
           chr = ' ';
           do {
               if(chr == '\n' || chr == '\r')
                    break;
               file.seekg(-2, std::ios::cur);
           } while(file.get(chr));

           lastTrailer = bPdf::unrollDict( extractObject() );
       } // if lastTrailer["/Type"] != "/XRef"

       if(trailer.empty())
            trailer = lastTrailer;

       if(lastTrailer.count("/XRefStm") != 0)          // hybrid-reference file
            loadXref((size_t) atoi(lastTrailer["/XRefStm"].c_str()));

       if(lastTrailer.count("/Prev") == 0)
            break;

       dictionary xrefDict = loadXref( (size_t)atoi(lastTrailer["/Prev"].c_str()) );
       lastTrailer = xrefDict.empty() ? dictionary() : xrefDict;
   }

   if(xrefSections.size() == 0)
	throw "bPdfIn was unable to find any cross-reference tables in file!";
}
开发者ID:szmer,项目名称:bPdf,代码行数:60,代码来源:bPdfIn.cpp

示例8: throwVMError

EncodedJSValue JSC_HOST_CALL JSKeyboardEventConstructor::constructJSKeyboardEvent(ExecState* exec)
{
    JSKeyboardEventConstructor* jsConstructor = jsCast<JSKeyboardEventConstructor*>(exec->callee());

    ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
    if (!executionContext)
        return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));

    AtomicString eventType = exec->argument(0).toString(exec)->value(exec);
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    KeyboardEventInit eventInit;

    JSValue initializerValue = exec->argument(1);
    if (!initializerValue.isUndefinedOrNull()) {
        // Given the above test, this will always yield an object.
        JSObject* initializerObject = initializerValue.toObject(exec);

        // Create the dictionary wrapper from the initializer object.
        JSDictionary dictionary(exec, initializerObject);

        // Attempt to fill in the EventInit.
        if (!fillKeyboardEventInit(eventInit, dictionary))
            return JSValue::encode(jsUndefined());
    }

    RefPtr<KeyboardEvent> event = KeyboardEvent::create(eventType, eventInit);
    return JSValue::encode(toJS(exec, jsConstructor->globalObject(), event.get()));
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:30,代码来源:JSKeyboardEvent.cpp

示例9: main

int main(int argc, char **argv)
{
	std::string source("/var/www/spellCorrect/data/big.txt");
	std::string destion("/var/www/spellCorrect/data/dictionary.txt");
	CreateDictionary dictionary(source, destion);
	return 0 ;
}
开发者ID:xiangbai,项目名称:spellCorrect,代码行数:7,代码来源:CreateDictionary.cpp

示例10: createPositionOptions

static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValue value)
{
    // Create default options.
    RefPtr<PositionOptions> options = PositionOptions::create();

    // Argument is optional (hence undefined is allowed), and null is allowed.
    if (value.isUndefinedOrNull()) {
        // Use default options.
        return options.release();
    }

    // Given the above test, this will always yield an object.
    JSObject* object = value.toObject(exec);

    // Create the dictionary wrapper from the initializer object.
    JSDictionary dictionary(exec, object);

    if (!dictionary.tryGetProperty("enableHighAccuracy", options.get(), setEnableHighAccuracy))
        return 0;
    if (!dictionary.tryGetProperty("timeout", options.get(), setTimeout))
        return 0;
    if (!dictionary.tryGetProperty("maximumAge", options.get(), setMaximumAge))
        return 0;

    return options.release();
}
开发者ID:1833183060,项目名称:wke,代码行数:26,代码来源:JSGeolocationCustom.cpp

示例11: apostropheTest

void apostropheTest()
{
    SmartKey::SmartKeyDictionary dictionary(g_settings);

     dictionary.loadSkippedCharsFromFile("/var/tmp/key_skipped");
     dictionary.loadEquivalencesFromFile("/var/tmp/key_equiv");
     dictionary.loadTermsFromFile("/var/tmp/key_dict_us");
     //dictionary.insert("talk", 413);
     /*
     dictionary.insert("y'all", 3);
     dictionary.insert("yskk", 4);
     dictionary.insert("y'akk", 6);
     dictionary.insert("y'dork", 5);

     dictionary.print();
      */
     printf("%s: number of nodes: %d\n", __FUNCTION__, dictionary.getNodeCount());

     /*
     dictionary.insert("thats", 10);
     dictionary.insert("that's", 11);
     dictionary.insert("that''s", 12);
*/
     ///test(dictionary, "thats", "that's");
     test(dictionary, "yall", "y'all");


}
开发者ID:ctbrowser,项目名称:smartkey-hun,代码行数:28,代码来源:InsertionTest.cpp

示例12: main

//Программа ConvertHtml
int main(int argc, char* argv[]) {
    try {
        Check ch(argc, argv);   //проверка введенных аргументов с консоли
    }
    catch (int e) {
        if (e==0) { cout << "Ошибка: в командной строке должно быть 2 или 3 аргумента, читайте документацию" << endl;  return -1; }
        if (e==1) { cout << "Ошибка: первый и второй файл д.б. с расширением .txt" << endl; return -1; }
        if (e==2) { cout << "3-й аргумент д.б. числом" << endl; return -1; }
    }
    set<string> setDictionary;  //множество для хранения словаря
    try {
        LoadDictionary dictionary(argv[1]);   //создаем объект словарь, передавая ссылку по аргументу
        setDictionary = dictionary.getDictionary(); //загружаем словарь
    }
    catch (int e) {
        if (e==0) { cout << "Ошибка, файл больше 2 Mb";  return -1; }
        if (e==1) { cout << "Ошибка, в словаре больше 100 000 строк"; return -1; }
    }
    catch (...) {
        cout << "Что-то пошло не так" ; return -1;
    }
    try {
        ConvertToHtml convert(setDictionary, argv[2]); //создаем объект convert, передавая ссылку по аргументу
        convert.modifyText();  //изменям текст из файла
        convert.buildHtml();   //генерируем HTML файлы
    }
    catch (int e) {
         if (e==0) { cout << "Ошибка, файл больше 2 Mb";  return -1; }
    }
     catch (...) {
        cout << "Что-то пошло не так" ; return -1;
    }
    cout << "Файлы HTML успешно сгенерированы" << endl;
    return 0;
}
开发者ID:troll1922,项目名称:Cplusplus,代码行数:36,代码来源:main.cpp

示例13: load_dictionary

dictionary
load_dictionary (string from, string to) {
  string name= from * "-" * to;
  if (dictionary::instances -> contains (name))
    return dictionary (name);
  dictionary dict= tm_new<dictionary_rep> (from, to);
  if (from != to) dict->load (name);
  return dict;
}
开发者ID:niujiashu,项目名称:texmacs-mirror,代码行数:9,代码来源:dictionary.cpp

示例14: bigDictSmallSearchTest

void bigDictSmallSearchTest() {
    SmartKey::SmartKeyDictionary dictionary(g_settings);

    dictionary.loadSkippedCharsFromFile("/var/tmp/key_skipped");
    dictionary.loadTermsFromFile("/var/tmp/key_dict_us");
    dictionary.loadEquivalencesFromFile("/var/tmp/key_equiv");

    test(dictionary, "ofrss", "ideas");
}
开发者ID:ctbrowser,项目名称:smartkey-hun,代码行数:9,代码来源:InsertionTest.cpp

示例15: boundsHandling_

Foam::interpolation2DTable<Type>::interpolation2DTable(const fileName& fName)
:
    List<Tuple2<scalar, List<Tuple2<scalar, Type> > > >(),
    boundsHandling_(interpolation2DTable::WARN),
    fileName_(fName),
    reader_(new openFoamTableReader<Type>(dictionary()))
{
    readTable();
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder2.0-libraries-swak4Foam,代码行数:9,代码来源:patchedInterpolation2DTable.C


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