本文整理汇总了C++中LString::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ LString::equals方法的具体用法?C++ LString::equals怎么用?C++ LString::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LString
的用法示例。
在下文中一共展示了LString::equals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readChildData
void LDOMObjInStream::readChildData(LVariant &value)
{
//LDomNode *pNode = m_data.current()->getCurChild();
m_data.traverse();
for (;;) {
LDomNode *pNode = m_data.current();
if (pNode->children.size()==0) {
value.setStringValue(pNode->value);
break;
}
//
// Case: structured value
//
if (!value.isObject()) {
// data inconsistency !!
reportError();
break;
}
LScriptable *pObjOrig = value.getObjectPtr();
if (pObjOrig!=NULL) {
// TO DO!!
// Check compatibility between "value" and LDOM data
LString clsnm = LDOMObjOutStream::getTypeName(pObjOrig);
LString domname = m_data.current()->type_name;
if (clsnm.equals(domname)) {
// compatible object --> don't create new one
pObjOrig->readFrom(*this);
break;
}
}
// incompatible obj --> create new obj based on the LDOM typename
LSerializable *ptmp = readObjImpl();
LScriptable *pObj = dynamic_cast<LScriptable *>(ptmp);
if (pObj==NULL) {
LOG_DPRINTLN("ERROR!!");
reportError();
delete ptmp;
break;
}
else {
// variant "value" own the created object "pObj"
//LScrSp<LScriptable> *pSpObj = new LScrSp<LScriptable>(pObj);
//value.setObjectPtr(pSpObj);
value.setObjectPtr(pObj);
}
break;
}
m_data.popNode();
}
示例2: getRendererByType
RendererPtr Object::getRendererByType(const LString &type_name)
{
rendtab_t::const_iterator i = m_rendtab.begin();
rendtab_t::const_iterator e = m_rendtab.end();
for (; i!=e; ++i) {
if ( type_name.equals(i->second->getTypeName()) )
return i->second;
}
return RendererPtr();
}
示例3: 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()));
}
示例4: write
// write PDB file to stream
bool PDBFileWriter::write(qlib::OutStream &outs)
{
m_pMol = getTarget<MolCoord>();
if (m_pMol==NULL) {
LOG_DPRINTLN("PDBWriter> MolCoord is not attached !!");
return false;
}
// check extension record handlers
PDBFileReader::HndlrTab &htab = PDBFileReader::m_htab;
bool bUseHndlr = htab.size()>0;
MolCoord *pMol = m_pMol;
qlib::PrintStream prs(outs);
//
// write header
//
//LString sbuf = pqsys->getVersion();
//prs.formatln("REMARK PDB File Generated by CueMol (ver %s)", sbuf.c_str());
prs.formatln("REMARK PDB File Generated by CueMol2");
//
// write SSBOND record
//
writeSSBonds(prs);
//
// write LINK record
//
writeLinks(prs);
writeSecstr(prs);
//
// write extension records (CRYST1)
//
if (bUseHndlr) {
LString sbuf;
PDBFileReader::HndlrTab::const_iterator iter = htab.begin();
for (; iter!=htab.end(); ++iter) {
PDBFileReader::RecordHandler *ph = iter->second;
if (ph!=NULL && ph->write(sbuf, pMol)) {
prs.println(sbuf);
}
}
}
//
// write body (ATOM/ANISOU records)
//
int nserial = 1;
// Sort chain names by ASCII order
// take care of '_' (empty) chain
std::list<LString> chnames;
{
MolCoord::ChainIter iter = pMol->begin();
bool bHasEmptyChain = false;
for (; iter!=pMol->end(); ++iter) {
MolChainPtr pChn = iter->second;
LString chnam = (pChn->getName().c_str());
if (chnam.equals("_")) {
bHasEmptyChain = true;
continue;
}
chnames.push_back(chnam);
}
chnames.sort();
if (bHasEmptyChain)
chnames.push_back("_");
}
std::list<LString>::const_iterator cniter = chnames.begin();
for (; cniter!=chnames.end(); ++cniter) {
LString chnam = *cniter;
MolChainPtr pChn = pMol->getChain(chnam);
// format chain name
char cch = convChainName(chnam);
LString resnam;
MolChain::ResidCursor2 riter = pChn->begin2();
// int nlastres = 0;
for (; riter!=pChn->end2(); ++riter) {
//MolResiduePtr pRes = *riter;
MolResiduePtr pRes = riter->second;
if (pRes.isnull()) continue;
ResidIndex rindex = pRes->getIndex();
resnam = pRes->getName();
// format residue name
// resnam = resnam.toUpperCase();
resnam = resnam.substr(0,3);
// sort atom by AID
std::list<int> atmlist;
//.........这里部分代码省略.........
示例5: writeSecstr
void PDBFileWriter::writeSecstr(qlib::PrintStream &prs)
{
MolResiduePtr pRes1;
int nhx = 1;
MolCoordPtr pMol(m_pMol);
ResidIterator riter(pMol); //(MolCoordPtr(m_pMol));
// Write HELIX records
for (riter.first(); riter.hasMore(); riter.next()) {
LString sec;
LString pfx;
MolResiduePtr pRes = riter.get();
pRes->getPropStr("secondary2", sec);
// MB_DPRINTLN("%s%d => %s", pRes->getChainName().c_str(), pRes->getIndex().first, sec.c_str());
if (sec.length()>=2)
pfx= sec.substr(1,1);
if (!(sec.startsWith("H")||sec.startsWith("G")||sec.startsWith("I")))
continue;
if (pfx.equals("s"))
pRes1 = pRes;
else if (pfx.equals("e")) {
LString resn1 = pRes1->getName().substr(0,3);
LString chn1 = pRes1->getChainName().substr(0,1);
ResidIndex resix1 = pRes1->getIndex();
char ins1 = resix1.second;
if (ins1=='\0') ins1 = ' ';
LString resn2 = pRes->getName().substr(0,3);
LString chn2 = pRes->getChainName().substr(0,1);
ResidIndex resix2 = pRes->getIndex();
char ins2 = resix2.second;
if (ins2=='\0') ins2 = ' ';
prs.print("HELIX ");
// helix seqno
prs.format(" %3d", nhx);
// helix ID
prs.format(" %3d", nhx);
// start resname
prs.format(" %3s", resn1.c_str());
prs.format(" %1s", chn1.c_str());
prs.format(" %4d", resix1.first);
prs.format("%c", ins1);
// end resname
prs.format(" %3s", resn2.c_str());
prs.format(" %1s", chn2.c_str());
prs.format(" %4d", resix2.first);
prs.format("%c", ins2);
// typeof helix
int ntype = 1;
if (sec.startsWith("G"))
ntype = 5;
else if (sec.startsWith("I"))
ntype = 3;
prs.format("%2d", ntype);
prs.println("");
++nhx;
}
}
// Write SHEET records
int nsh = 1;
for (riter.first(); riter.hasMore(); riter.next()) {
LString sec;
LString pfx;
MolResiduePtr pRes = riter.get();
pRes->getPropStr("secondary2", sec);
// MB_DPRINTLN("%s%d => %s", pRes->getChainName().c_str(), pRes->getIndex().first, sec.c_str());
if (sec.length()>=2)
pfx= sec.substr(1,1);
if (!(sec.startsWith("E")))
continue;
if (pfx.equals("s"))
pRes1 = pRes;
else if (pfx.equals("e")) {
LString resn1 = pRes1->getName().substr(0,3);
LString chn1 = pRes1->getChainName().substr(0,1);
ResidIndex resix1 = pRes1->getIndex();
char ins1 = resix1.second;
if (ins1=='\0') ins1 = ' ';
LString resn2 = pRes->getName().substr(0,3);
LString chn2 = pRes->getChainName().substr(0,1);
ResidIndex resix2 = pRes->getIndex();
char ins2 = resix2.second;
if (ins2=='\0') ins2 = ' ';
//.........这里部分代码省略.........
示例6: writeAtomLine
bool PDBFileWriter::writeAtomLine(int nserial, const ResidIndex &rindex,
const char *resnam, char chainch,
MolAtomPtr pa, qlib::PrintStream &prs)
{
int resind = rindex.first;
char inscode = rindex.second;
LString atomnam = pa->getName().c_str();
// atomnam = atomnam.toUpperCase();
// conv ILE's CD name
// (CD is converted to CD1 in PDBFileReader, so this should not occur)
if (LChar::equals(resnam, "ILE") && atomnam.equals("CD"))
atomnam = "CD1";
#ifdef QTL_CONV
// conv nucl's prime to aster
atomnam.replace('\'', '*');
// convert THY's C5A to C5M
if (LChar::equals(resnam, "THY") &&
atomnam.equals("C5A")) {
atomnam = "C5M";
}
// conv nucl name
if (LChar::equals(resnam, "ADE")) {
resnam = " A";
}
else if (LChar::equals(resnam, "THY")) {
resnam = " T";
}
else if (LChar::equals(resnam, "GUA")) {
resnam = " G";
}
else if (LChar::equals(resnam, "CYT")) {
resnam = " C";
}
else if (LChar::equals(resnam, "URI")) {
resnam = " U";
}
#endif
LString shead;
shead = LString::format("%5d ", nserial);
// format atom name
shead += formatAtomName(pa);
shead += LString::format("%3s "
"%c"
"%4d"
"%c",
resnam,
chainch,
resind,
(inscode=='\0') ? ' ' : inscode);
//////////
// output to the stream
prs.print("ATOM ");
prs.print(shead);
// Get atom position before applying xformMat, if xformMat is set
Vector4D pos = pa->getRawPos();
prs.formatln(" "
"%8.3f"
"%8.3f"
"%8.3f"
"%6.2f"
"%6.2f"
" "
" ",
pos.x(),
pos.y(),
pos.z(),
pa->getOcc(),
pa->getBfac());
if (pa->hasAnIsoU()) {
prs.print("ANISOU");
prs.print(shead);
int u11 = int(pa->getU(0,0) * 1.0e4);
int u22 = int(pa->getU(1,1) * 1.0e4);
int u33 = int(pa->getU(2,2) * 1.0e4);
int u12 = int(pa->getU(0,1) * 1.0e4);
int u13 = int(pa->getU(0,2) * 1.0e4);
int u23 = int(pa->getU(1,2) * 1.0e4);
prs.formatln(" "
" %6d"
" %6d"
" %6d"
" %6d"
" %6d"
" %6d"
" ",
//.........这里部分代码省略.........
示例7: 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");
}
//.........这里部分代码省略.........
示例8: chkCred
void XmlRpcMgr::chkCred(const LString &c)
{
// TO DO: implementation
if (!c.equals("XXX"))
throw( xmlrpc_c::fault("Invalid credential", xmlrpc_c::fault::CODE_UNSPECIFIED) );
}
示例9: 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();
//.........这里部分代码省略.........
示例10: style_ctxt
qlib::LScrSp<qlib::LScrObjBase> SceneXMLReader::fromByteArray(const qlib::LScrSp<qlib::LByteArray> &pbuf)
{
qlib::uid_t nSceneID = m_pClient->getUID();
// Enter the context
AutoStyleCtxt style_ctxt(nSceneID);
MB_DPRINTLN("fromXML\n%s<<<", pbuf->data());
MB_DPRINTLN("Length: %d", pbuf->size());
//
// Setup streams
//
qlib::StrInStream fis(pbuf);
qlib::LDom2InStream ois(fis);
qlib::LDom2Tree tree;
ois.read(tree);
qlib::LDom2Node *pNode = tree.top();
//pNode->dump();
qlib::LScrSp<qlib::LScrObjBase> pSObj;
LString tag = pNode->getTagName();
LString type_name = pNode->getTypeName();
if (tag.equals("renderer") && !type_name.isEmpty()) {
// pbuf contains Renderer
RendererFactory *pRF = RendererFactory::getInstance();
RendererPtr pRend = pRF->create(type_name);
pRend->resetAllProps();
pRend->readFrom2(pNode);
pSObj = pRend;
}
else if (tag.equals("object") && !type_name.isEmpty()) {
ObjectPtr pObj = pNode->createObjByTypeNameT<Object>();
pObj->readFrom2(pNode);
LString src = pObj->getSource();
LString altsrc = pObj->getAltSource();
LString srctype = pObj->getSourceType();
pNode->requestDataLoad(src, altsrc, srctype, pObj.get());
pSObj = pObj;
// clearChunkMap();
procDataSrcLoad(ois, pNode);
procDataChunks(ois, pNode);
// clearChunkMap();
}
else if (tag.equals("camera")) {
// pbuf contains Camera
CameraPtr pCam(MB_NEW Camera);
pCam->readFrom2(pNode);
pSObj = pCam;
}
else {
MB_DPRINTLN("readRendFromXML> ERROR, Invalid QSC XML");
return pSObj;
}
return pSObj;
}