MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / SeekTo

Function SeekTo

src/tw/dbexplore.cpp:123–142  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// SeekTo -- seeks to the named noun; this takes care of interpriting special nouns. If the seek fails, then Done() is true and false is returned. If noun is a special character, then it is altered to what it mapped to. //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

121// If noun is a special character, then it is altered to what it mapped to.
122///////////////////////////////////////////////////////////////////////////////
123static bool SeekTo(cDbDataSourceIter* pIter, TSTRING& noun)
124{
125 if (noun[0] == _T('*'))
126 {
127 // interprite the rest of the string as a number index to seek to...
128 int index = _ttoi(&noun[1]);
129 if (index < 0)
130 return false;
131 pIter->SeekBegin();
132 for (int i = 0; ((i < index) && (!pIter->Done())); i++, pIter->Next())
133 {
134 }
135 if (pIter->Done())
136 return false;
137 noun = pIter->GetShortName();
138 return true;
139 }
140 else
141 return (pIter->SeekTo(noun.c_str()));
142}
143
144///////////////////////////////////////////////////////////////////////////////
145// PrintFCO

Callers 1

ExecuteMethod · 0.85

Calls 6

c_strMethod · 0.80
SeekBeginMethod · 0.45
DoneMethod · 0.45
NextMethod · 0.45
GetShortNameMethod · 0.45
SeekToMethod · 0.45

Tested by

no test coverage detected