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


C++ StringTokenizer::get_next方法代码示例

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


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

示例1: result

/*!

\brief Looks up states from names.
\param[in] Name String containing state names.
\param[out] state Mask object to store found states.
\return Returns dmz::True if all named states are found.
\note State names should be delineated by the "|" character (a.k.a. the bitwise or
operator).

*/
dmz::Boolean
dmz::Definitions::lookup_state (const String &Name, Mask &state) const {

   Boolean result (False);

   if (_state.defs) {

      StringTokenizer st (Name, '|');
      String value = st.get_next ();

      result = value;

      while (value) {

         trim_ascii_white_space (value);
         convert_ascii_white_space (value);

         Mask *ptr (_state.defs->maskTable.lookup (value));

         if (ptr) { state |= *ptr; }
         else if (_state.log) {

            _state.log->error << "Unable to find state: " << value
               << " in state name: " << Name << endl;

            result = False;
         }

         value = st.get_next ();
      }
   }

   return result;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:44,代码来源:dmzRuntimeInit.cpp

示例2: result

/*!

\brief Creates a directory.
\details Defined in dmzSystemFile.h. Function will create a path as deep as is
requested in \a Path. Function returns dmz::True if path already exists.
\param[in] Path String containing directory to create.
\return Returns dmz::True if directory was successfully created.

*/
dmz::Boolean
dmz::create_directory (const String &Path) {

   Boolean result (False);

   if (Path) {

      result = True;
      const String FormattedPath (format_path (Path));
      StringTokenizer st (FormattedPath, '/');
      String dir;
      if (FormattedPath.get_char (0) == '/') { dir << "/"; }
      String part (st.get_next ());

      while (part) {

         if (dir) { dir << "/" << part; }
         else { dir = part; }

         if (!is_valid_path (dir)) {

            if (mkdir (dir.get_buffer (), S_IRUSR | S_IWUSR | S_IXUSR) != 0) {

               result = False;
            }
         }

         if (result) { part = st.get_next (); }
         else { part.flush (); }
      }
   }

   return result;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:43,代码来源:dmzSystemFileUnix.cpp

示例3: result

/*!

\brief Looks up all config contexts with the given name.
\details All config context found with a matching name are stored as children of \a data.
\param[in] Name String containing name of config contexts to lookup.
\param[out] data Config to store the found config contexts.
\return Returns dmz::True if any config contexts were found.

*/
dmz::Boolean
dmz::Config::lookup_all_config (const String &Name, Config &data) const {

   Boolean result (False);
   StringTokenizer it (Name, LocalScopeChar);
   String sub = it.get_next ();
   Boolean done (!sub ? True : False);

   Config prev ("prev");
   prev.add_config (*this);
   Config current (sub);

   while (!done) {

      ConfigIterator tableIt;
      Config next;

      ConfigContext *curContext = current.get_config_context ();

      while (prev.get_next_config (tableIt, next)) {

         ConfigContext *nextContext = next.get_config_context ();

         if (nextContext && curContext) {

            ConfigContext::DataList *dl (nextContext->configTable.lookup (sub));

            if (dl) {

               dl->lock.lock ();
                  ConfigContext::DataStruct *ds = dl->head;
                  while (ds) {

                     if (ds->handle) {

                        curContext->add_config (ds->context);
                     }

                     ds = ds->next;
                  }
               dl->lock.unlock ();
            }
         }
      }

      if (current.is_empty ()) { done = True; }
      else {

         sub = it.get_next ();
         if (!sub) { data = current; done = True; result = True; }
         else { prev = current; Config next (sub); current = next; }
      }
   }

   if (data.is_empty ()) { data.set_config_context (0); result = False; }

   return result;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:67,代码来源:dmzRuntimeConfig.cpp

示例4: ArchiveName

void
dmz::ArchivePluginObject::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   init_archive_scope (local);

   if (is_archive_scope_empty ()) { add_archive_scope ("archive"); }

   _defaultHandle = _defs.create_named_handle (ObjectAttributeDefaultName);

   Config filterList;

   if (local.lookup_all_config ("archive", filterList)) {

      ConfigIterator it;
      Config filter;

      // Read list in reverse order so they are stored in the correct order in the 
      // filter list.
      while (filterList.get_prev_config (it, filter)) {

         const String ArchiveName (config_to_string ("name", filter, ArchiveDefaultName));

         const Handle ArchiveHandle (activate_archive (ArchiveName));

         _log.info << "Activating archive: " << ArchiveName << endl;

         FilterStruct *fs (filter.has_children () ? new FilterStruct : 0);

         if (fs) {

            const String ModeStr = config_to_string ("mode", filter, "export|import");

            if (ModeStr) {

               StringTokenizer st (ModeStr, '|');
               String value;

               while (st.get_next (value)) {

                  trim_ascii_white_space (value);
                  value.to_lower ();

                  if (value == "import") { fs->mode |= LocalImportMask; }
                  else if (value == "export") { fs->mode |= LocalExportMask; }
                  else { _log.error << "Unknown archive mode: " << value << endl; }
               }
            }

            Config objects;

            if (filter.lookup_all_config ("object-type-set.object-type", objects)) {

               ConfigIterator typesIt;
               Config typeConfig;

               while (objects.get_next_config (typesIt, typeConfig)) {

                  const String Name (config_to_string ("name", typeConfig));
                  const Boolean Exclude (config_to_boolean ("exclude", typeConfig, True));

                  if (Exclude) {

                     if (!fs->exTypes.add_object_type (Name, context)) {

                        _log.error << "Unable to add object type: '" << Name
                           << "' to archive filter for archive: "
                           << _defs.lookup_named_handle_name (ArchiveHandle) << endl;
                     }
                     else {

                        _log.info << "Excluding object type: " << Name << endl;
                     }
                  }
                  else if (!fs->inTypes.add_object_type (Name, context)) {

                     _log.error << "Unable to add object type: '" << Name
                        << "' to archive filter for archive: "
                        << _defs.lookup_named_handle_name (ArchiveHandle) << endl;
                  }
                  else {

                     _log.info << "Including object type: " << Name << endl;
                  }
               }
            }
            else { _log.info << "No object types filtered for: " << ArchiveName << endl; }

            Config attrConfig;

            if (filter.lookup_all_config ("attribute", attrConfig)) {

               ConfigIterator attrIt;
               Config currentAttr;

               while (attrConfig.get_next_config (attrIt, currentAttr)) {

                  const String Name (
                     config_to_string ("name", currentAttr, ObjectAttributeDefaultName));
//.........这里部分代码省略.........
开发者ID:rdarken,项目名称:dmz,代码行数:101,代码来源:dmzArchivePluginObject.cpp


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