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


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

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


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

示例1: appendAtomScrHelper

int MolCoord::appendAtomScrHelper(MolAtomPtr pAtom, const LString &ch,
				  ResidIndex resid, const LString &resn)
{
  qlib::uid_t nuid = pAtom->getParentUID();
  if (nuid!=qlib::invalid_uid) {
    // pAtom has been already belonged to other mol
    // --> ERROR!!
    MB_DPRINTLN("MolCoord.appendAtom> ERROR, pAtom already belongs to mol %d ().", nuid);
    return -1;
  }

  pAtom->setParentUID(getUID());
  pAtom->setChainName(ch);
  pAtom->setResIndex(resid);

  if (resn.isEmpty()) {
    // res name is determined by chain name and resindex
    MolResiduePtr pRes = getResidue(ch, resid);
    if (pRes.isnull()) {
      // ERROR!! cannot determine the residue to append to
      return -1;
    }
    pAtom->setResName(pRes->getName());
  }
  else {
    pAtom->setResName(resn);
  }

  return appendAtom(pAtom);
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:30,代码来源:MolCoord.cpp

示例2: procDataChunks

void SceneXMLReader::procDataChunks(qlib::LDom2InStream &ois, LDom2Node *pNode)
{
  for (;;) {
    try {
      LString chunkid = ois.getNextDataChunkID();
      if (chunkid.isEmpty())
        return;
      MB_DPRINTLN("SceneXMLReader> load datachunk: %s", chunkid.c_str());

      //LDataSrcContainer *pCnt = findChunkObj(chunkid);
      LDataSrcContainer *pCnt = ois.findChunkObj(chunkid);
      if (pCnt==NULL) {
        LOG_DPRINTLN("SceneXMLReader> data container for chunk %s not found.", chunkid.c_str());
        return;
      }

      qlib::InStream *pin = ois.getNextChunkStream();
      pCnt->readFromStream(*pin);
      ois.closeChunkStream(pin);
      
    }
    catch (qlib::LException &e) {
      pNode->appendErrMsg("SceneXML> Load object error (ignored).");
      pNode->appendErrMsg("SceneXML> Reason: %s", e.getMsg().c_str());
    }
    catch (...) {
      pNode->appendErrMsg("SceneXML> Load object error (ignored).");
      pNode->appendErrMsg("SceneXML> Reason: unknown");
    }
  }
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:31,代码来源:SceneXMLReader.cpp

示例3: fromStrAID

/// Convert from (persistent) string representation to aid
int MolCoord::fromStrAID(const LString &strid) const
{
  if (!m_reAid.match(strid)) {
    LOG_DPRINTLN("MolCoord> Invalid aid strid=%s (re match failed)", strid.c_str());
    return -1;
  }

  // text type aid
  int nsc = m_reAid.getSubstrCount();
  if (nsc<4) {
    LOG_DPRINTLN("MolCoord> Invalid aid strid=%s", strid.c_str());
    return -1;
  }
  //elem.setAtomID(-1);
  LString sChainName = m_reAid.getSubstr(1);
  LString sResInd = m_reAid.getSubstr(2);
  ResidIndex nResInd;
  if (!sResInd.toInt(&nResInd.first)) {
    LOG_DPRINTLN("MolCoord> Invalid aid resid value=%s", sResInd.c_str());
    return -1;
  }
  LString sInsCode = m_reAid.getSubstr(3);
  if (sInsCode.isEmpty())
    nResInd.second = '\0';
  else
    nResInd.second = sInsCode.getAt(0);
  LString sAtomName = m_reAid.getSubstr(4);
  char cAltLoc = '\0';
  if (nsc>6) {
    LString sAltLoc = m_reAid.getSubstr(6);
    if (!sAltLoc.isEmpty())
      cAltLoc = sAltLoc.getAt(0);
  }

  MolAtomPtr pAtom = getAtom(sChainName, nResInd, sAtomName, cAltLoc);
  if (pAtom.isnull()) {
    LOG_DPRINTLN("MolCoord> fromStrAID/ atom <%s %s %s %c> not found in %s",
		 sChainName.c_str(), nResInd.toString().c_str(), sAtomName.c_str(),
		 cAltLoc=='\0'?' ':cAltLoc,
		 getName().c_str());
    return -1;
  }

  return pAtom->getID();
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:46,代码来源:MolCoord.cpp

示例4: selectSrcAltSrc

// static
LString  LDataSrcContainer::selectSrcAltSrc(const LString &src,
                                            const LString &altsrc,
                                            const LString &base_path,
                                            bool &rbReadFromAltSrc)
{
  bool bReadFromAltSrc = false;

  LString abs_path;

  // First, try to convert "src" to abs path
  if (isAbsolutePath(src))
    abs_path = src;
  else if (!base_path.isEmpty())
    abs_path = makeAbsolutePath(src, base_path);
  
  if (abs_path.isEmpty() || !isFileReadable(abs_path)) {
    // Second, try to convert "altsrc" to abs path
    if (altsrc.isEmpty()) {
      // empty alt src --> no src path info available (ERROR)
      LString msg = LString::format("Fatal error, cannot open file: \"%s\"",
                                    abs_path.c_str());
      LOG_DPRINTLN("SceneXML> %s", msg.c_str());
      MB_THROW(qlib::IOException, msg);
      return LString();
    }

    if (isAbsolutePath(altsrc))
      abs_path = altsrc;
    else if (!base_path.isEmpty())
      abs_path = makeAbsolutePath(altsrc, base_path);

    if (!isFileReadable(abs_path)) {
      LString msg = LString::format("Fatal error, cannot open file: \"%s\"",
                                    abs_path.c_str());
      LOG_DPRINTLN("SceneXML> %s", msg.c_str());
      MB_THROW(qlib::IOException, msg);
      return LString();
    }
    // read from alt_src property (abs_path==alt_src)
    bReadFromAltSrc = true;
  }

  rbReadFromAltSrc = bReadFromAltSrc;
  return abs_path;
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:46,代码来源:LDataSrcContainer.cpp

示例5: load

/** module initialization */
bool TopparManager::load()
{
  SysConfig *pconf = SysConfig::getInstance();
  SysConfig::Section *psec = pconf->getSection("toppar");
  bool bOK = false;
  if (psec!=NULL) {
    SysConfig::const_iterator iter = psec->begin();
    iter=psec->findName(iter, "toppar_file");
    for (; iter!=psec->end(); iter=psec->findName(++iter, "toppar_file")) {
      SysConfig::Section *pchild = *iter;
      LString val = pchild->getStringData();
      if (val.isEmpty()) continue;;

      int cpos = val.indexOf(':');
      if (cpos<0) continue;
      LString type = val.substr(0, cpos);
      LString fnam = val.substr(cpos+1);
      fnam = pconf->convPathName(fnam);

      /*if (!fnam.startsWith(MB_PATH_SEPARATOR)) {
        LString config_dir = pconf->get("config_dir");
        fnam = config_dir + MB_PATH_SEPARATOR + fnam;
      }*/
      
      if (readPrmTop(fnam, type))
        bOK = true;
    }
  }

  if (!bOK) {
    //
    // read from default directory with default type/filename
    //
    LString type("cns");
    LString fnam;

    for ( ;; ) {
      fnam = "queptl.prm";
      if (!readPrmTop(fnam, type))
        break;

      fnam = "queptl.top";
      if (!readPrmTop(fnam, type))
        break;

      fnam = "queptl.lin";
      if (!readPrmTop(fnam, type))
        break;

      return true;
    }
    LOG_DPRINTLN("Toppar> warning: no mol topology/parameter files is loaded.");
  }

  // m_pTopoDB->dump();
  return true;
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:58,代码来源:TopparManager.cpp

示例6:

 BOOST_FOREACH (const LString &brush, uniqset) {
   LString def = pSM->getMaterial(brush, "warabi_brush");
   if (!def.isEmpty()) {
     def = def.trim(" \r\n\t");
     ps.formatln("Brush \"%s\" : {", brush.c_str());
     ps.println(def);
     ps.println("}");
     bWritten = true;
   }
 }
开发者ID:CueMol,项目名称:cuemol2,代码行数:10,代码来源:WbpSceneExporter.cpp

示例7: LString

LString LString::operator +(const LString &o) const {
    if (this->isEmpty()) return o;
    if (o.isEmpty()) return *this;

    LStringData *newStr = LStringData::create(this->length() + o.length() + 1);
    std::copy(this->mData->begin(), this->mData->end(), newStr->begin());
    std::copy(o.mData->begin(), o.mData->end(), newStr->begin() + this->length());

    newStr->mSize = this->length() + o.length();
    return LString(newStr);
}
开发者ID:Latexi95,项目名称:CBCompiler,代码行数:11,代码来源:lstring.cpp

示例8: writeListElemObject

void LDOMObjOutStream::writeListElemObject(const LScriptable *pScr)
{
  LString clsname = getTypeName(pScr);
  if (clsname.isEmpty())
    return;

  m_data.pushListElem();
  m_data.setTypeName(clsname);
  writeObject(pScr);
  m_data.popNode();
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:11,代码来源:LDOMObjStream.cpp

示例9: compile

SelCommand::SelCommand(const LString &psz)
  : m_pSelRoot(NULL)
{
  if (psz.isEmpty()) return;
  bool res = compile(psz);
  if (!res) {
    // TO DO: error handling/throw exception
    MB_DPRINTLN("Cannot initialize SelCommand with %s", psz.c_str());
    return;
  }
  m_origcmd = psz;
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:12,代码来源:SelCommand.cpp

示例10: readStr

  LString readStr(int start, int end) {
    if (m_recbuf.isEmpty()) return LString();

    start --; end --;
    if (end >= m_recbuf.length())
      end = m_recbuf.length()-1;
    if (start<0)
      start = 0;
    if (start>end)
      start = end;

    return m_recbuf.substr(start, end-start+1);
  }
开发者ID:CueMol,项目名称:cuemol2,代码行数:13,代码来源:MSMSFileReader.hpp

示例11: equals

bool Selection::equals(Selection *pSel) const
{
  LString tmp = toString();

  if (pSel==NULL) {
    if (tmp.isEmpty())
      return true;
    else
      return false;
  }

  return (tmp.equals(pSel->toString()));
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:13,代码来源:SelCommand.cpp

示例12: 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

示例13: if

/// read one MOL entry from stream
bool MOL2MolReader::readMol(qlib::LineStream &lin, bool bskip)
{
  LString sline;
  std::vector<LString> slist;
  
  for (;;) {
    sline = lin.readLine().chomp();
    if (sline.isEmpty() && !lin.ready())
      return false; // EOF
  
    if (sline.equals("@<TRIPOS>MOLECULE")) {
      break;
    }
  }

  // mol_name
  LString cmpd_name = lin.readLine().trim(" \t\r\n");
  if (cmpd_name.isEmpty())
    cmpd_name = "_"; // XXX

  // molecule info
  sline = lin.readLine().chomp();
  split(sline, ' ', std::back_inserter(slist));
  if (slist.size()<1) {
    MB_THROW(MOL2FormatException, "Invalid atom info record");
  }
  int natoms;
  if (!slist[0].toInt(&natoms)) {
    MB_THROW(MOL2FormatException, "Invalid atom info record");
  }
  int nbonds=0;
  if (slist.size()>1) {
    if (!slist[1].toInt(&nbonds)) {
      MB_THROW(MOL2FormatException, "Invalid atom info record");
    }
  }

  // mol_type
  LString mol_type = lin.readLine().chomp();
  bool bApplyTopo = false;
  if (mol_type.equals("PROTEIN") ||
      mol_type.equals("NUCLEIC_ACID"))
    bApplyTopo = true;    

  // Ignore charge_type
  // Ignore mol_comment

  // Search ATOM record
  for (;;) {
    sline = lin.readLine().chomp();
    if (sline.isEmpty() && !lin.ready())
      return false; // EOF
  
    if (sline.equals("@<TRIPOS>ATOM")) {
      break;
    }
  }

  int i, idot, iresid, naid, ind, prev_resid;
  ElemID eleid;
  double xx, yy, zz;
  LString aname, atype, satom, res_name;
  std::map<int,int> atommap;
  std::map<LString, int> aname_counts;
  std::map<LString, int>::iterator an_iter;

  // XXXX
  prev_resid = -999999;
  
  for (i=0; i<natoms; ++i) {
    //LOG_DPRINTLN("i=%d, natoms=%d", i, natoms);

    sline = lin.readLine().chomp();
    slist.clear();
    split(sline, ' ', std::back_inserter(slist));
    if (slist.size()<8) {
      MB_THROW(MOL2FormatException, "Invalid atom record");
    }

    if (!slist[0].toInt(&ind)) {
      MB_THROW(MOL2FormatException, "Invalid atom ID record");
    }

    aname = slist[1];
    an_iter = aname_counts.find(aname);
    if (an_iter==aname_counts.end()) {
      aname_counts.insert(std::pair<LString, int>(aname, 1));
    }
    else {
      an_iter->second = an_iter->second + 1;
      aname = LString::format("%d%s", an_iter->second, aname.c_str());
    }

    if (!slist[2].toRealNum(&xx)) {
      MB_THROW(MOL2FormatException, "Invalid atom coord record");
    }
    if (!slist[3].toRealNum(&yy)) {
      MB_THROW(MOL2FormatException, "Invalid atom coord record");
    }
//.........这里部分代码省略.........
开发者ID:CueMol,项目名称:cuemol2,代码行数:101,代码来源:MOL2MolReader.cpp

示例14: main

///
///   main routine for CueTTY (CLI version)
///
int main(int argc, const char *argv[])
{
  if (qlib::init())
    MB_DPRINTLN("qlib::init() OK.");
  else {
    LOG_DPRINTLN("Init: ERROR!!");
    return -1;
  }

  int i;
  LString loadscr;
  LString confpath;
  std::deque<LString> args2;

  for (i=1; i<argc; ++i) {
    MB_DPRINTLN("arg%d=%s", i, argv[i]);
    LString value = argv[i];

    if (value.equals("-conf")) {
      ++i;
      if (i>=argc) break;
      confpath = argv[i];
      ++i;
    }

    break;
  }
  
  for (; i<argc; ++i) {
    MB_DPRINTLN("arg%d=%s", i, argv[i]);
    args2.push_back(argv[i]);
  }

  if (args2.size()>0)
    loadscr = args2.front();

  if (confpath.isEmpty()) {
    confpath = DEFAULT_CONFIG;
  }

  if (!qsys::init(confpath)) {
    LOG_DPRINTLN("Qsys Init (%s): ERROR!!", confpath.c_str());
    return -1;
  }

  MB_DPRINTLN("main> confpath=%s", confpath.c_str());

  // load molstr/lwview module
  molstr::init();
  lwview::init();
  anim::init();

#if !defined(QM_BUILD_LW)
  // load other modules
  render::init();
  molvis::init();
  xtal::init();
  symm::init();
  surface::init();
  molanl::init();
#endif

#ifdef HAVE_JAVASCRIPT
  // load internal JS module
  jsbr::init();
#endif

#ifdef HAVE_PYTHON
  // load python module
  pybr::init();
#endif

  //////////

  if (!loadscr.isEmpty()) {
    process_input(loadscr, args2);
  }

  //////////

#ifdef HAVE_PYTHON
  // unload python module
  pybr::fini();
  MB_DPRINTLN("=== pybr::fini() OK ===");
#endif

#ifdef HAVE_JAVASCRIPT
  jsbr::fini();
  MB_DPRINTLN("=== jsbr::fini() OK ===");
#endif

#if !defined(QM_BUILD_LW)
  // load other modules
  render::fini();
  molvis::fini();
  xtal::fini();
  symm::fini();
//.........这里部分代码省略.........
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:101,代码来源:cli_main.cpp

示例15: process_input

void process_input(const LString &loadscr, const std::deque<LString> &args)
{
  qsys::SceneManager *pSM = qsys::SceneManager::getInstance();
  LOG_DPRINTLN("CueMol version %s build %s", pSM->getVersion().c_str(), pSM->getBuildID().c_str());

  fs::path scr_path(loadscr);
  
  fs::path full_path = fs::system_complete( scr_path );

  if ( !fs::exists( full_path ) ) {
#if (BOOST_FILESYSTEM_VERSION==2)
    std::cout << "\nNot found: " << full_path.file_string() << std::endl;
#else
    std::cout << "\nNot found: " << full_path.string() << std::endl;
#endif
    return;
  }

  //std::cerr << "\nFull path: " << full_path.file_string() << std::endl;
  //std::cerr << "Extn: " << full_path.extension() << std::endl;

  if (full_path.extension()==".qsc") {
    //qsys::ScenePtr rscene = pSM->loadSceneFrom(scr_path.file_string(), "xml");
    //qlib::FileOutStream &fos = qlib::FileOutStream::getStdErr();
    //rscene->writeTo(fos, true);
  }
  else if (full_path.extension()==".js") {
    //qsys::ScenePtr rscene = pSM->createScene();
    //qlib::uid_t scene_id = rscene->getUID();
    //rscene->execJSFile(loadscr);
    //pSM->destroyScene(scene_id);

    jsbr::Interp *pInt = jsbr::createInterp(NULL);
    pInt->setCmdArgs(args);

    // setup system default script path
    qsys::SysConfig *pconf = qsys::SysConfig::getInstance();
    LString scrdir = pconf->get("script_dir");
    MB_DPRINTLN("sysconfig: script_dir=%s", scrdir.c_str());
    if (!scrdir.isEmpty())
      pInt->setScriptPath("system", pconf->convPathName(scrdir));

    // run startup script
    pInt->execFile("startup.js");

    // run the main script
    pInt->execFile(loadscr);

    delete pInt;
  }
  else if (full_path.extension()==".py") {
#ifdef HAVE_PYTHON
    pybr::runFile(loadscr);
#else
    LOG_DPRINTLN("Python not supported!!");
#endif
  }
  MB_DPRINTLN("main> cleanup ...");
  pSM->destroyAllScenes();
  MB_DPRINTLN("main> cleanup done.");
}
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:61,代码来源:cli_main.cpp


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