MCPcopy Create free account
hub / github.com/KDE/kdevelop / findSessionInList

Function findSessionInList

app/main.cpp:179–193  ·  view source on GitHub ↗

Tries to find a session identified by @p data in @p sessions. The @p data may be either a session's name or a string-representation of its UUID. @return pointer to the session or NULL if nothing appropriate has been found

Source from the content-addressed store, hash-verified

177/// The @p data may be either a session's name or a string-representation of its UUID.
178/// @return pointer to the session or NULL if nothing appropriate has been found
179static const KDevelop::SessionInfo* findSessionInList( const SessionInfos& sessions, const QString& data )
180{
181 // We won't search a session without input data, since that could lead to false-positives
182 // with unnamed sessions
183 if( data.isEmpty() )
184 return nullptr;
185
186 for( auto it = sessions.constBegin(); it != sessions.constEnd(); ++it ) {
187 if ( ( it->name == data ) || ( it->uuid.toString() == data ) ) {
188 const KDevelop::SessionInfo& sessionRef = *it;
189 return &sessionRef;
190 }
191 }
192 return nullptr;
193}
194
195/// Tries to find sessions containing project @p projectUrl in @p sessions.
196static const KDevelop::SessionInfos findSessionsWithProject(const SessionInfos& sessions, const QUrl& projectUrl)

Callers 1

mainFunction · 0.85

Calls 4

constBeginMethod · 0.80
constEndMethod · 0.80
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected