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


C++ LString::chomp方法代码示例

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


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

示例1: loadIccFile

/// load from icc file
void CmsXform::loadIccFile(const LString &path)
{
#ifdef HAVE_LCMS2_H
  m_pimpl->cleanup();
  cmsHPROFILE hInProf = cmsCreate_sRGBProfile();
  cmsHPROFILE hOutProf = cmsOpenProfileFromFile(path, "r");
  if (hOutProf==NULL) {
    MB_THROW(qlib::IOException, "cannot open icc file: "+path);
    return;
  }

  int nProofIntent = m_nIntent;
  
  m_info = LString();
  LString info;

  info = GetProfileInfo(hOutProf, cmsInfoDescription);
  info = info.chomp();
  if (!info.isEmpty())
    m_info += info+"\n";

  info = GetProfileInfo(hOutProf, cmsInfoManufacturer);
  info = info.chomp();
  if (!info.isEmpty())
    m_info += info+"\n";

  info = GetProfileInfo(hOutProf, cmsInfoModel);
  info = info.chomp();
  if (!info.isEmpty())
    m_info += info+"\n";

  info = GetProfileInfo(hOutProf, cmsInfoCopyright);
  info = info.chomp();
  if (!info.isEmpty())
    m_info += info+"\n";

#ifdef USEPROOFING
  cmsUInt16Number alarm[cmsMAXCHANNELS];
  for (int i=0; i < cmsMAXCHANNELS; i++)
    alarm[i] = 0xFFFF;
  cmsSetAlarmCodes(alarm);

  m_pimpl->m_hTr = cmsCreateProofingTransform(hInProf,
                                              TYPE_RGB_8,
                                              hInProf,
                                              TYPE_RGB_8,
                                              hOutProf,
                                              nProofIntent,
                                              nProofIntent,
                                              //INTENT_ABSOLUTE_COLORIMETRIC,
                                              //INTENT_PERCEPTUAL,
                                              cmsFLAGS_SOFTPROOFING);
  
  cmsHPROFILE hNullProf = cmsCreateNULLProfile();
  m_pimpl->m_hTrChk = cmsCreateProofingTransform(hInProf,
                                                 TYPE_RGB_DBL,
                                                 hNullProf,
                                                 TYPE_GRAY_DBL,
                                                 hOutProf,
                                                 nProofIntent,
                                                 nProofIntent,
                                                 cmsFLAGS_SOFTPROOFING|cmsFLAGS_GAMUTCHECK|cmsFLAGS_NOCACHE);
  cmsCloseProfile(hNullProf);

#else
  m_pimpl->m_hTr1 = cmsCreateTransform(hInProf,
                                       TYPE_RGB_8,
                                       hOutProf,
                                       //TYPE_CMYK_8,
                                       TYPE_CMYK_FLT,
                                       nProofIntent, 0);
  m_pimpl->m_hTr2 = cmsCreateTransform(hOutProf,
                                       //TYPE_CMYK_8,
                                       TYPE_CMYK_FLT,
                                       hInProf,
                                       TYPE_RGB_8,
                                       //INTENT_ABSOLUTE_COLORIMETRIC,
                                       INTENT_PERCEPTUAL,
                                       0);

#endif

  cmsCloseProfile(hInProf);
  cmsCloseProfile(hOutProf);
#endif
  return;
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:88,代码来源:CmsXform.cpp

示例2: read


//.........这里部分代码省略.........
  
  for (i=0; i<ncomment; ++i) {
    readLine();
    m_line = m_line.trim("\r\n ");
    LOG_DPRINTLN("%s", m_line.c_str());
  }
  readLine();

  ///////////////////
  // read atoms
  readLine();
  removeComment();

  if (!m_line.toInt(&m_natom)) {
    MB_THROW(qlib::FileFormatException, "Cannot read natom line");
    return;
  }
  MB_DPRINTLN("natoms=%d", m_natom);
  
  LString stmp;

  for (i=0; i<m_natom; ++i) {
    readLine();
    // LOG_DPRINTLN("%s", m_line.c_str());

    // chain name
    stmp = m_line.substr(9, 3);
    stmp = stmp.trim(" ");
    // stmp = stmp.toLowerCase();
    LString chain(stmp.c_str());

    // residue number
    stmp = m_line.substr(14, 4);
    int nresi;
    if (!stmp.toInt(&nresi)) {
      LString msg = LString::format("cannot convert resid number: %s", stmp.c_str());
      MB_THROW(qlib::FileFormatException, msg);
      return;
    }
    ResidIndex residx(nresi);

    //  residue name
    stmp = m_line.substr(19, 4);
    stmp = stmp.trim(" ");
    // stmp = stmp.toLowerCase();
    LString resn(stmp.c_str());

    // atom name
    stmp = m_line.substr(24, 4);
    stmp = stmp.trim(" ");
    // stmp = stmp.toLowerCase();
    LString name(stmp.c_str());
    
    // charge
    stmp = m_line.substr(34, 10);
    double charge;
    if (!stmp.toDouble(&charge)) {
      LString msg = LString::format("cannot convert charge %s", stmp.c_str());
      MB_THROW(qlib::FileFormatException, msg);
      return;
    }

    // mass
    stmp = m_line.substr(50, 8);
    double mass;
    if (!stmp.toDouble(&mass)) {
      LString msg = LString::format("cannot convert mass <%s>", stmp.c_str());
      MB_THROW(qlib::FileFormatException, msg);
      return;
    }

    ElemID eleid = convMassElem(mass);

    //LOG_DPRINTLN("ATOM %s %s %d %s",
    //(*pAtoms)[i].name.c_str(),
    //(*pAtoms)[i].resn.c_str(),
    //(*pAtoms)[i].resid,
    //(*pAtoms)[i].chain.c_str());

    MolAtomPtr pAtom = MolAtomPtr(MB_NEW MolAtom());
    pAtom->setParentUID(m_pMol->getUID());
    pAtom->setName(name);
    pAtom->setElement(eleid);
    pAtom->setChainName(chain);
    pAtom->setResIndex(residx);
    pAtom->setResName(resn);
    
    if (m_pMol->appendAtom(pAtom)<0) {
      LString stmp = m_line;
      stmp = stmp.chomp();
      // stmp = stmp.toUpperCase();
      // m_nErrCount ++;
      // if (m_nErrCount<m_nErrMax)
      LOG_DPRINTLN("PsfReader> read ATOM line failed: %s", stmp.c_str());
    }
    
  }
  readLine();

}
开发者ID:CueMol,项目名称:cuemol2,代码行数:101,代码来源:PsfReader.cpp


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