[commit] r2413 - in trunk: Doc GME/Search
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Jan 10 16:21:02 CST 2014
Author: ksmyth
Date: Fri Jan 10 16:21:02 2014
New Revision: 2413
Log:
Attribute search: allow _id=id-0065-00000001 and _guid={...}
Modified:
trunk/Doc/README_in.txt
trunk/GME/Search/Input.cpp
trunk/GME/Search/Input.h
trunk/GME/Search/SearchAlg.cpp
trunk/GME/Search/SearchDlg.cpp
Modified: trunk/Doc/README_in.txt
==============================================================================
--- trunk/Doc/README_in.txt Fri Jan 10 16:20:49 2014 (r2412)
+++ trunk/Doc/README_in.txt Fri Jan 10 16:21:02 2014 (r2413)
@@ -29,6 +29,8 @@
Release Notes
----------------------------------
- Fix opening mga file when its paradigm mta no longer exists
+ - Attribute search: allow searching for _id=id-0065-00000001 or _guid={...}
+ - Search: Autocomplete for Kind
Release Notes of Release 13.11.14
----------------------------------
Modified: trunk/GME/Search/Input.cpp
==============================================================================
--- trunk/GME/Search/Input.cpp Fri Jan 10 16:20:49 2014 (r2412)
+++ trunk/GME/Search/Input.cpp Fri Jan 10 16:21:02 2014 (r2413)
@@ -60,12 +60,10 @@
m_regNameFirst = GetRegExp(strNameFirst);
m_regRoleFirst = GetRegExp(strRoleFirst);
m_regKindFirst = GetRegExp(strKindFirst);
- m_regAttributeFirst = GetRegExp(strAttributeFirst);
m_regNameSecond=GetRegExp(strNameSecond);
m_regKindSecond=GetRegExp(strKindSecond);
m_regRoleSecond=GetRegExp(strRoleSecond);
- m_regAttributeSecond=GetRegExp(strAttributeSecond);
//get string forms
Modified: trunk/GME/Search/Input.h
==============================================================================
--- trunk/GME/Search/Input.h Fri Jan 10 16:20:49 2014 (r2412)
+++ trunk/GME/Search/Input.h Fri Jan 10 16:21:02 2014 (r2413)
@@ -38,12 +38,10 @@
wregex &GetFirstNameRegExp() {return m_regNameFirst;}
wregex &GetFirstRoleRegExp() {return m_regRoleFirst;}
wregex &GetFirstKindRegExp() {return m_regKindFirst;}
- wregex &GetFirstAttributeRegExp() {return m_regAttributeFirst;}
wregex &GetSecondNameRegExp() {return m_regNameSecond;}
wregex &GetSecondRoleRegExp() {return m_regRoleSecond;}
wregex &GetSecondKindRegExp() {return m_regKindSecond;}
- wregex &GetSecondAttributeRegExp() {return m_regAttributeSecond;}
//getter methods string forms
CString &GetFirstName() {return m_strNameFirst;}
@@ -80,15 +78,12 @@
wregex m_regRoleFirst;
/// The kind of object the user is searching for.
wregex m_regKindFirst;
- /// The name of the attribute the user wants to search for.
- wregex m_regAttributeFirst;
/// The type of attribute the user wants to search for.
//attval_enum getAttrType;
/// The value of the attribute the user wants to search for.
wregex m_regNameSecond;
wregex m_regRoleSecond;
wregex m_regKindSecond;
- wregex m_regAttributeSecond;
//String forms of input
CString m_strNameFirst;
Modified: trunk/GME/Search/SearchAlg.cpp
==============================================================================
--- trunk/GME/Search/SearchAlg.cpp Fri Jan 10 16:20:49 2014 (r2412)
+++ trunk/GME/Search/SearchAlg.cpp Fri Jan 10 16:21:02 2014 (r2413)
@@ -186,7 +186,8 @@
void CSearch::SearchFolderHierarchy(IMgaFolder *root)
{
// Search in Root Models & Below
- CComPtrList<IMgaModel> *rootmodlist = new CComPtrList<IMgaModel>; //needed to use new or the addtail below would fail
+ std::unique_ptr<CComPtrList<IMgaModel>> rootmodlist_cleanup(new CComPtrList<IMgaModel>);
+ CComPtrList<IMgaModel> *rootmodlist = rootmodlist_cleanup.get(); //needed to use new or the addtail below would fail
CComPtr<IMgaFCOs> children;
COMTHROW( root->get_ChildFCOs(&children));
MGACOLL_ITERATE(IMgaFCO, children) {
@@ -230,8 +231,6 @@
SearchModelHierarchy(rootmodel);
}
- delete rootmodlist; //no longer needed, (used new above)
-
// Search in Folders & Below
CComPtr<IMgaFolders> flist;
COMTHROW( root->get_ChildFolders(&flist));
@@ -244,7 +243,8 @@
//uncomment next line, and comment out rest of function for more dfs approach
// SearchFolderHierarchy(MGACOLL_ITER);
- CComPtrList<IMgaModel> *mlist = new CComPtrList<IMgaModel>; //needed to use new or the addtail below would fail
+ std::unique_ptr<CComPtrList<IMgaModel>> mlist_cleanup(new CComPtrList<IMgaModel>);
+ CComPtrList<IMgaModel> *mlist = mlist_cleanup.get(); //needed to use new or the addtail below would fail
CComPtr<IMgaFCOs> subchildren;
COMTHROW( MGACOLL_ITER->get_ChildFCOs(&subchildren));
MGACOLL_ITERATE(IMgaFCO, subchildren) {
@@ -288,8 +288,6 @@
SearchModelHierarchy(submodel);
}
- delete mlist; //no longer needed, (used new above)
-
// Search in SubFolders & Below
CComPtr<IMgaFolders> sflist;
COMTHROW( MGACOLL_ITER->get_ChildFolders(&sflist));
@@ -497,6 +495,34 @@
}
} MGACOLL_ITERATE_END;
+ for(std::vector<Attribute>::iterator it=expressionStack.begin();it!=expressionStack.end();++it)
+ {
+ Attribute& attr = *it;
+ _bstr_t id;
+ if (_wcsicmp(attr.name, L"_id") == 0)
+ {
+ if (FAILED(cObj->get_ID(id.GetAddress())))
+ {
+ attr.eval = FALSE;
+ continue;
+ }
+ attr.eval = attr.CheckString(std::tr1::regex_search(static_cast<const wchar_t*>(id), attr.GetRegExp(attr.value,filter.MatchWholeWord())));
+ continue;
+ }
+ else if (_wcsicmp(attr.name, L"_guid") == 0)
+ {
+ if (FAILED(cObj->GetGuidDisp(id.GetAddress())))
+ {
+ attr.eval = FALSE;
+ continue;
+ }
+ if (attr.value.GetLength() == 38 && attr.value.GetAt(0) == L'{' && attr.value.GetAt(37) == L'}') // special case for _guid={00000000-0000-0000-0000-00000000000}
+ attr.eval = wcscmp(static_cast<const wchar_t*>(id), attr.value) == 0;
+ else
+ attr.eval = attr.CheckString(std::tr1::regex_search(static_cast<const wchar_t*>(id), attr.GetRegExp(attr.value,filter.MatchWholeWord())));
+ }
+ }
+
//now check the attributes one by one
for (auto attributePairIt = attributePairs.begin(); attributePairIt != attributePairs.end(); ++attributePairIt)
{
@@ -586,7 +612,7 @@
}
else
attribute.eval = TRUE;
- }
+ }
return EvaluateResult(expressionStack);
}
Modified: trunk/GME/Search/SearchDlg.cpp
==============================================================================
--- trunk/GME/Search/SearchDlg.cpp Fri Jan 10 16:20:49 2014 (r2412)
+++ trunk/GME/Search/SearchDlg.cpp Fri Jan 10 16:21:02 2014 (r2413)
@@ -179,6 +179,9 @@
m_pgsSearch.SetRange(1,16000);
m_pgsSearch.SetStep(1);
+ InsertTextToControl(CString(L"_id="), m_edtAttributeCtrlFirst);
+ InsertTextToControl(CString(L"_guid="), m_edtAttributeCtrlFirst);
+
//load search history from registry
LoadSearchHistory();
@@ -326,8 +329,15 @@
//this might throw error related to regular expression
inp.GetInput(m_edtNameFirst,m_edtRoleNameFirst,m_edtKindNameFirst,m_edtAttributeFirst,m_edtNameSecond,m_edtRoleNameSecond,m_edtKindNameSecond,m_edtAttributeSecond,m_edtAttrValue,
m_chkMod,m_chkAtom,m_chkRef,m_chkSet,m_chkConnection,m_chkSplSearch,m_chkFullWord,NULL,0,m_chkMatchCase,m_radioScope,m_radioLogical);
- }
- catch(...)
+
+ if (results == NULL)
+ COMTHROW(results.CoCreateInstance(L"Mga.MgaFCOs"));
+ CSearch searchGME(inp);
+ searchGME.Search(rootInput, ccpObjectsInTerr, specialSearchFCO,results,&m_pgsSearch);
+ DisplayResults();
+
+ }
+ catch (std::tr1::regex_error& err)
{
m_pgsSearch.ShowWindow(SW_HIDE);
m_pgsSearch.SetPos(1);
@@ -339,14 +349,6 @@
return;
}
-
- if (results == NULL)
- COMTHROW(results.CoCreateInstance(L"Mga.MgaFCOs"));
- CSearch searchGME(inp);
- searchGME.Search(rootInput, ccpObjectsInTerr, specialSearchFCO,results,&m_pgsSearch);
- // AfxMessageBox(_T("Finished Searching"));
-
- DisplayResults();
m_pgsSearch.ShowWindow(SW_HIDE);
m_pgsSearch.SetPos(1);
More information about the gme-commit
mailing list