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


C++ MathCell::GetValue方法代码示例

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


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

示例1: ParseCellTag

// ParseCellTag
// This function is responsible for creating
// a tree of groupcells when loading XML document.
// Any changes in GroupCell structure or methods
// has to be reflected here in order to ensure proper
// loading of WXMX files.
MathCell* MathParser::ParseCellTag(wxXmlNode* node)
{
  GroupCell *group = NULL;

  // read hide status
#if wxCHECK_VERSION(2,9,0)
  bool hide = (node->GetAttribute(wxT("hide"), wxT("false")) == wxT("true")) ? true : false;
#else
  bool hide = (node->GetPropVal(wxT("hide"), wxT("false")) == wxT("true")) ? true : false;
#endif
  // read (group)cell type
#if wxCHECK_VERSION(2,9,0)
  wxString type = node->GetAttribute(wxT("type"), wxT("text"));
#else
  wxString type = node->GetPropVal(wxT("type"), wxT("text"));
#endif

  if (type == wxT("code")) {
    group = new GroupCell(GC_TYPE_CODE);
    wxXmlNode *children = node->GetChildren();
    while (children) {
      if (children->GetName() == wxT("input")) {
        MathCell *editor = ParseTag(children->GetChildren());
        group->SetEditableContent(editor->GetValue());
        delete editor;
      }
      if (children->GetName() == wxT("output"))
        group->AppendOutput(ParseTag(children->GetChildren()));
      children = children->GetNext();
    }
  }
  else if (type == wxT("image")) {
    group = new GroupCell(GC_TYPE_IMAGE);
    wxXmlNode *children = node->GetChildren();
    while (children) {
      if (children->GetName() == wxT("editor")) {
        MathCell *ed = ParseEditorTag(children);
        group->SetEditableContent(ed->GetValue());
        delete ed;
      }
      else
        group->AppendOutput(ParseTag(children));
      children = children->GetNext();
    }
  }
  else if (type == wxT("pagebreak")) {
    group = new GroupCell(GC_TYPE_PAGEBREAK);
  }
  else if (type == wxT("text")) {
    group = new GroupCell(GC_TYPE_TEXT);
    MathCell *editor = ParseTag(node->GetChildren());
    group->SetEditableContent(editor->GetValue());
    delete editor;
  }
  else {
    // text types
    if (type == wxT("title"))
      group = new GroupCell(GC_TYPE_TITLE);
    else if (type == wxT("section"))
      group = new GroupCell(GC_TYPE_SECTION);
    else if (type == wxT("subsection"))
      group = new GroupCell(GC_TYPE_SUBSECTION);
    else
      return NULL;

    wxXmlNode *children = node->GetChildren();
    while (children) {
      if (children->GetName() == wxT("editor")) {
        MathCell *ed = ParseEditorTag(children);
        group->SetEditableContent(ed->GetValue());
        delete ed;
      }
      else if (children->GetName() == wxT("fold")) { // we have folded groupcells
        wxXmlNode *xmlcells = children->GetChildren();
        MathCell *tree = NULL;
        MathCell *last = NULL;
        if (xmlcells) {
          last = tree = ParseTag(xmlcells, false); // first cell
          while (xmlcells->GetNext()) {
            xmlcells = xmlcells->GetNext();
            MathCell *cell = ParseTag(xmlcells, false);

            last->m_next = last->m_nextToDraw = cell;
            last->m_next->m_previous = last->m_next->m_previousToDraw = last;

            last = last->m_next;
          }
          if (tree)
            group->HideTree((GroupCell *)tree);
        }
      }
      children = children->GetNext();
    }
  }
//.........这里部分代码省略.........
开发者ID:DevJohan,项目名称:wxmaxima,代码行数:101,代码来源:MathParser.cpp


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