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

Method AsString

src/db/hierdbpath.cpp:144–170  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// AsString -- Returns a TSTRING representation of the current path

Source from the content-addressed store, hash-verified

142///////////////////////////////////////////////////////////////////////////////
143// AsString -- Returns a TSTRING representation of the current path
144TSTRING cHierDbPath::AsString(void) const
145{
146 TSTRING ret = _T("");
147
148 if (mCurrPath.size() == 1)
149 {
150 ret = *(mCurrPath.begin());
151 ret += mDelimitingChar;
152 return ret;
153 }
154
155 DbPath::const_iterator it = mCurrPath.begin();
156
157 // The loop adds delimiting characters until the last element in the
158 // sequence is reached, so we don't have a trailing character.
159 while (it != mCurrPath.end())
160 {
161 // the loop is constructed in this odd fashion because I don't want a trailing mDelimiter
162 ret += (*it);
163 ++it;
164 if (it != mCurrPath.end())
165 ret += mDelimitingChar;
166 }
167
168 //return the completed TSTRING
169 return ret;
170}
171
172///////////////////////////////////////////////////////////////////////////////
173// GetSize: Returns the number of substrings in the sequence

Callers 1

GetCwdMethod · 0.45

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected