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


C++ PropertyList::GetFetchobjURIs方法代码示例

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


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

示例1: LoadGrammars

// This function is used to recursively walk through the tree, loading and
// speech or dtmf grammars which are found.
//
void GrammarManager::LoadGrammars(const VXMLElement& doc,
                                  vxistring & documentID,
                                  PropertyList & properties)
{
  if (doc == 0) return;

  VXIMapHolder recProps(NULL);  // Initialize an empty holder.

  // (1) Retrieve the ID for this document.  This is important for grammar
  // activation.

  if (doc.GetName() == NODE_VXML)
    doc.GetAttribute(ATTRIBUTE__ITEMNAME, documentID);

  // (2) Look for grammars in current nodes.

  for (VXMLNodeIterator it(doc); it; ++it) {
    VXMLNode child = *it;

    if (child.GetType() != VXMLNode::Type_VXMLElement) continue;
    const VXMLElement & element = reinterpret_cast<const VXMLElement &>(child);

    VXMLElementType elementName = element.GetName();
    VXIrecGrammar * vg = NULL;

    if (recProps.GetValue() == NULL)
      recProps.Acquire(GetRecProperties(properties));

    // (3) Handle <grammar> & <dtmf>

    if (elementName == NODE_GRAMMAR || elementName == NODE_DTMF) {
      vxistring src;
      element.GetAttribute(ATTRIBUTE_SRC, src);

      // (3.1) Override the language setting (if specified as an attribute)
      vxistring lang;
      if (element.GetAttribute(ATTRIBUTE_XMLLANG, lang) == true)
        AddParamValue(recProps, REC_LANGUAGE, lang);

      // (3.2) Does the grammar come from an external URI?
      if (!src.empty()) {
        if (log.IsLogging(2)) {
          log.StartDiagnostic(2) << L"GrammarManager::LoadGrammars - <grammar "
            L"src=\"" << src << L"\">";
          log.EndDiagnostic();
        }

        VXIMapHolder fetchobj;
        if (fetchobj.GetValue() == NULL) throw VXIException::OutOfMemory();

        vxistring fragment;
        properties.GetFetchobjCacheAttrs(element, PropertyList::Grammar,
                                         fetchobj);
        properties.GetFetchobjURIs(element, fetchobj, src, fragment);

        if (!fragment.empty())
          log.LogError(215);

        vxistring mimeType;
        element.GetAttribute(ATTRIBUTE_TYPE, mimeType);

        VXIrecResult err = vxirec->LoadGrammarURI(vxirec, recProps.GetValue(),
                                                  mimeType.c_str(),
                                                  src.c_str(),
                                                  fetchobj.GetValue(), &vg);
        if (err != VXIrec_RESULT_SUCCESS)
          throw VXIException::InterpreterEvent(EV_ERROR_BAD_GRAMMAR);

        if (vg) AddGrammar(vg, documentID, element);
      }
      // (3.3) Otherwise this is an inlined grammar.
      else {
        log.LogDiagnostic(2, L"GrammarManager::LoadGrammars - <grammar>");

        vxistring text;
        GetEnclosedText(log, element, text);
        
        vxistring mimeType;
        element.GetAttribute(ATTRIBUTE_TYPE, mimeType);

        if (mimeType.empty() && elementName == NODE_DTMF)
          vg = GrammarManager::CreateGrammarFromString(vxirec, log, text,
                                                       REC_MIME_GENERIC_DTMF,
                                                       recProps);
        else
          vg = GrammarManager::CreateGrammarFromString(vxirec, log, text,
                                                       mimeType.c_str(),
                                                       recProps);
        
        if (vg == NULL) // "Error loading in-line grammar %s",text
          throw VXIException::InterpreterEvent(EV_ERROR_BAD_INLINE);

        AddGrammar(vg, documentID, element);
      }
    }

    // (4) Handle <choice>
//.........这里部分代码省略.........
开发者ID:chemeris,项目名称:sipxecs,代码行数:101,代码来源:GrammarManager.cpp


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