MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / getChildLocations

Method getChildLocations

src/database/WizDatabase.cpp:3816–3843  ·  view source on GitHub ↗

! Find direct child locations of \a strParentLocation from \a arrayAllLocation, then store unique set in \a arrayLocation. If \a strParentLocation is empty, then the unique root locations of \a arrayAllLocation is returned. */

Source from the content-addressed store, hash-verified

3814 then the unique root locations of \a arrayAllLocation is returned.
3815 */
3816bool WizDatabase::getChildLocations(const CWizStdStringArray& arrayAllLocation, \
3817 const QString& strParentLocation, \
3818 CWizStdStringArray& arrayLocation)
3819{
3820 if (strParentLocation.isEmpty())
3821 return getAllRootLocations(arrayAllLocation, arrayLocation);
3822
3823 std::set<QString> setLocation;
3824
3825 CWizStdStringArray::const_iterator it;
3826 for (it = arrayAllLocation.begin(); it != arrayAllLocation.end(); it++) {
3827 const QString& location = *it;
3828
3829 if (location.length() > strParentLocation.length() && location.startsWith(strParentLocation))
3830 {
3831 int index = location.indexOf('/', strParentLocation.length() + 1);
3832 if (index > 0)
3833 {
3834 QString strChild = location.left(index + 1);
3835 setLocation.insert(strChild);
3836 }
3837 }
3838 }
3839
3840 arrayLocation.assign(setLocation.begin(), setLocation.end());
3841
3842 return true;
3843}
3844
3845bool WizDatabase::isInDeletedItems(const CString& strLocation)
3846{

Calls 4

isEmptyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected