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


C++ Strng::Len方法代码示例

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


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

示例1: BuildDataDefn

void CActuator::BuildDataDefn(DataDefnBlk & DDB)
  {
  DDB.BeginStruct(this, "CActuator", NULL, DDB_NoPage);
  DDB.Text("");
  DDB.CheckBoxBtn("On",           "",         DC_, "", &bOn,           this, isParmStopped, DDBYesNo);
  DDB.CheckBoxBtn("ShowCnv",      "",         DC_, "", &bWithCnvComment,this, isParmStopped, DDBYesNo);
  DDB.Visibility();
  DDB.Long("", "Ac_Cnt",  DC_, "", idmCount,       this, isParmStopped/*|AffectsStruct*/);
  DDB.Text("");
  if (m_DataBlk.GetSize()>0)
    {
    DDB.Button("Check_tags",   "", DC_,    "",    idmCheckBtn,      this, isParmStopped);
    DDB.Text("");
    DDB.String("State",        "", DC_,    "",    &m_StateLine[0],  this, noSnap|noFile);
    DDB.Text("Error:");
    DDB.String("Msg_1",        "", DC_,    "",    &m_StateLine[1],  this, noSnap|noFile);
    DDB.String("Msg_2",        "", DC_,    "",    &m_StateLine[2],  this, noSnap|noFile);
    DDB.Text("");
    }
  DDB.Text("----------------------------------------");

  static DDBValueLst DDBFail[]={
      {Fail_None,                         "None"             },
      {Fail_Hold,                         "Hold"             },
      {Fail_Hold|Fail_Noise,              "Hold,Noise"       },
      {Fail_MinVal,                       "MinVal"           },
      {Fail_MaxVal,                       "MaxVal"           },
      {Fail_LoVal,                        "LoVal"            },
      {Fail_HiVal,                        "HiVal"            },
      {Fail_MinVal|Fail_Ramp,             "MinVal,Ramp"      },
      {Fail_MaxVal|Fail_Ramp,             "MaxVal,Ramp"      },
      {Fail_LoVal|Fail_Ramp,              "LoVal,Ramp"       },
      {Fail_HiVal|Fail_Ramp,              "HiVal,Ramp"       },
      {Fail_MinVal|Fail_Noise,            "MinVal,Noise"     },
      {Fail_MaxVal|Fail_Noise,            "MaxVal,Noise"     },
      {Fail_LoVal|Fail_Noise,             "LoVal,Noise"      },
      {Fail_HiVal|Fail_Noise,             "HiVal,Noise"      },
      {Fail_MinVal|Fail_Ramp|Fail_Noise,  "MinVal,Ramp,Noise"},
      {Fail_MaxVal|Fail_Ramp|Fail_Noise,  "MaxVal,Ramp,Noise"},
      {Fail_LoVal|Fail_Ramp|Fail_Noise,   "LoVal,Ramp,Noise" },
      {Fail_HiVal|Fail_Ramp|Fail_Noise,   "HiVal,Ramp,Noise" },
      {0}};
  static DDBValueLst DDBXForms[]={
      {XF_None,   "None"   },
      {XF_Linear, "Linear" },
      //{XF_Sqr,    "Sqr"    },
      //{XF_Sqrt,   "Sqrt"   },
      {0}};
  static DDBValueLst DDBFilters[]={
      {Flt_None,        "None"   },
      {Flt_FirstOrder,  "FirstOrder" },
      {0}};
  static DDBValueLst DDBRawXLates[]={
      {XL_None,     "None"   },
      {XL_AtoD,     "AtoD"  },
      {XL_Linear,   "Linear" },
      //{XL_PulseEncode  "PulseWidth" },
      {0}};
  char Buff[128];
  Strng Tag;
  if (DDB.BeginArray(this, "Cfg", "Ac_Cfg", m_DataBlk.GetSize()))
    {
    for (int i=0; i<m_DataBlk.GetSize(); i++)
      {
      if (1)// i>0 && (i % 2)==1)
        {
        sprintf(Buff, "%d", i);
        DDB.Page(Buff, DDB_OptPage);
        }
      DDB.BeginElement(this, i);
      CActuatorBlk * T = m_DataBlk[i];
      Strng CnvTxt;
      if (bWithCnvComment && XRefsValid() && T->m_bValid)
        GetValidCnvTxt(T->m_OutputVar, CnvTxt);
      DDB.String("ID",                 "",            DC_,          "", idmCfgTags+(i*NoOfCfgTags)+1, this, isParmStopped|isTag);
      DDB.String("OutputTag",          "",            DC_,          "", idmCfgTags+(i*NoOfCfgTags)+2, this, isParmStopped|isTag);
      //DDB.Double("RequiredValue",      "ReqdVal",         DC_,          "", &T->m_dReqdValue,               this, isResult|noFileAtAll);
      DDB.Double("RequiredValue",      "Rqd",         DC_,          "", &T->m_dReqdValue,               this, isResult|noFileAtAll);
      if (CnvTxt.Len())
        DDB.TagComment(CnvTxt());

//      DDB.Byte  ("Transform",          "",            DC_,          "",   &T->m_Xform.m_iType,  this, isParm|SetOnChange, DDBXForms);
//      DDB.Visibility(NSHM_All, T->m_Xform.m_iType);
//      DDB.Float ("Xf.Factor",          "",            DC_,          "",   &T->m_Xform.m_dFactor,      this, isParm);
//      DDB.Float ("Xf.Bias",            "",            DC_,          "",   &T->m_Xform.m_dBias,        this, isParm);
//
//      DDB.Visibility();
//
//      DDB.Byte  ("Filter",             "",            DC_,          "",   &T->m_Flt.m_iType,   this, isParm|SetOnChange, DDBFilters);
//      DDB.Visibility(NSHM_All, T->m_Flt.m_iType == Flt_FirstOrder);
//      DDB.Float ("Flt.TimeConst",      "Flt.Tau",     DC_Time,      "s",  &T->m_Flt.m_dTau,    this, isParm);
//      DDB.Double("Flt.PrevValue",      "",            DC_,          "",   &T->m_Flt.m_dPrevValue, this, InitHidden);
//      DDB.Visibility();
//
//      DDB.Byte  ("Fail.Mode",          "",            DC_,          "",   &T->m_Fail.m_iType,   this, isParm|SetOnChange, DDBFail);
//      DDB.Float ("Fail.LoValue",       "",            DC_,          "",   &T->m_Fail.m_dLoValue,   this, isParm);
//      DDB.Float ("Fail.HiValue",       "",            DC_,          "",   &T->m_Fail.m_dHiValue,   this, isParm);
//      DDB.Float ("Fail.NoiseStdDev",   "",            DC_,          "%",  &T->m_Fail.m_dNoiseStdDevFrac,   this, isParm);
//      DDB.Float ("Fail.SlewTime",      "",            DC_Time,      "s",  &T->m_Fail.m_dSlewTime,   this, isParm);
//
//.........这里部分代码省略.........
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:101,代码来源:Actuator.cpp

示例2: OnOK

void CChangeTag::OnOK() 
  {
  if (m_ReadOnly)
    CDialog::OnOK();

  //gs_pAccWnd->CloseAccessData(False, False, True);
  //gs_pAccWnd->CloseWnd();
  UpdateData(TRUE);
  Strng OldTag(m_OldTag.GetBuffer(0));
  OldTag.Trim(" \t\n\r\v\f");
  Strng NewTag(m_NewTag.GetBuffer(0));
  if (OldTag.XStrICmp(NewTag)!=0)
    {
    CWaitCursor Wait;
    BOOL ok = TRUE;
    if (TaggedObject::ValidateTagChanged(NewTag))
      {
      Strng s;
      s.Set("New tag '%s' is illegal and has been altered to '%s'\nContinue?", (const char*)m_NewTag, NewTag());
      ok = (AfxMessageBox(s(), MB_YESNO|MB_ICONQUESTION)==IDYES);
      if (ok)
        LogNote("ChangeTag", 0, "New tag '%s' altered to '%s'", (const char*)m_NewTag, NewTag());
      }
    if (ok && !gs_pPrj->AllGrfLoaded())
      {
      Strng s;
      s.Set("All the graphics pages have not been loaded!\nTag '%s' may not be changed in the graphics window.\nContinue?", OldTag());
      ok = (AfxMessageBox(s(), MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2)==IDYES);
      }
    if (ok)
      {
      pStatusBar->SetMsg("Attempting to change tag %s to %s", OldTag(), NewTag());
      int Err = gs_Exec.ChangeTag(OldTag(), NewTag());
      Strng Txt;
      switch (Err)
        {
        case EOCT_NOTFOUND:
          Txt.Set("Tag %s not found", OldTag());
          break;
        case EOCT_DUPLICATE:
          Txt.Set("Duplicate Tag %s", NewTag());
          break;
        case EOCT_FAILED:
          Txt.Set("FAILURE %s", OldTag());
          break;
        case EOCT_NULLTAG:
          Txt.Set("Valid (not blank) tags must be specified");
          break;
        case EOCT_INVALIDTAG:
          Txt.Set("Valid (all characters must be legal) tags must be specified");
          break;
        case EOCT_BADTAGLEN:
          Txt.Set("New tag length is too long");
          break;
        case EOCT_NOTDIFFER:
          Txt.Set("Tags should differ");
          break;
        case EOCT_NOTALLOWED:
          Txt.Set("Tag %s not allowed to be changed", OldTag());
          break;
        case EOCT_DRVNOTALLOWED:
          Txt.Set("Tag %s is referenced by a driver and cannot be changed while solving", OldTag());
          break;
        case EOCT_ARCNOTALLOWED:
          Txt.Set("Tag %s is referenced by the acrhiver and cannot be changed while solving", OldTag());
          break;
        case EOCT_DONE:
          CExploreScd::RefreshIt(true); 
          gs_AccessWnds.CloseAccessData(-1, False, False, True);
          gs_AccessWnds.CloseWnd(-1);
          for (int a=0; a<NAccessWnds; a++)
            {
            if (!fCallAccess && gs_AccessWnds.CurTag(a) && strlen(gs_AccessWnds.CurTag(a))>0 && _stricmp(gs_AccessWnds.CurTag(a), OldTag())==0)
              {
              fCallAccess = 1;
              break;
              }
            }
          if (fCallAccess)
            {
            char* pTxt = new char[NewTag.Len()+1];
            strcpy(pTxt, NewTag());
            ScdMainWnd()->PostMessage(WMU_TAGACTION, SUB_TAG_ACCESS, (LPARAM)pTxt);
            }

          CDialog::OnOK();
          break;
        }
      if (Txt.Len()>0)
        {
        m_OldTag = OldTag();
        m_NewTag = NewTag();
        MessageBox(Txt(), "Change Tag", MB_OK);
        UpdateData(FALSE);
        }
      else
        pStatusBar->SetMsg("Changed tag %s to %s", OldTag(), NewTag());
      }
    }
  else
//.........这里部分代码省略.........
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:101,代码来源:CHNGTAG.CPP


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