本文整理汇总了C++中CField::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::GetValue方法的具体用法?C++ CField::GetValue怎么用?C++ CField::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CField
的用法示例。
在下文中一共展示了CField::GetValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDblclkListFields
void CBibitemView::OnDblclkListFields(NMHDR* pNMHDR, LRESULT* pResult)
{
if (m_SelField != -1) {
// Open URL
CField *fi = (CField*)m_ListFields.GetItemData(m_SelField);
if (fi) {
if (!fi->GetValue().IsEmpty() &&
(fi->GetName().CompareNoCase(STR_LOCALURL) == 0 ||
fi->GetName().CompareNoCase(STR_URL) == 0)) {
CString val = fi->GetValue();
CStringList lst;
SplitSepString(val, &lst);
POSITION p = lst.GetHeadPosition();
while (p) {
if (ShellExec(lst.GetNext(p))) {
if (p)
// Wait some time if there are other files to show
Sleep(500);
} else
MessageBeep(MB_ICONEXCLAMATION);
}
} else
// Or show edit dialog
OnFieldlistPopupEdit();
}
}
*pResult = 0;
}
示例2: OnFieldlistPopupEdit
void CBibitemView::OnFieldlistPopupEdit()
{
CSourceDialog dlg;
CField* fi = (CField*)m_ListFields.GetItemData(m_SelField);
dlg.SetSource(fi->GetValue());
if (dlg.DoModal() == IDOK) {
fi->SetValue(dlg.GetSource());
SetModified(m_Modified || fi->GetModified());
m_ListFields.SetItemText(m_SelField, 1, dlg.GetSource());
}
}
示例3: OnPopupBrowse
void CBibitemView::OnPopupBrowse()
{
CString f;
CString fn;
CField* fi = (CField*)m_ListFields.GetItemData(m_SelField);
fn = DecodeFilename(fi->GetValue());
CFileFind finder;
if (!finder.FindFile(fn))
// Dialog will not show when file does not exist
fn.Empty();
finder.Close();
f.Format(_T("%s||"), AfxLoadString(IDS_STRING_ALLFILTER));
CFileDialogEx dlg(TRUE, NULL, fn, OFN_HIDEREADONLY | OFN_ENABLESIZING, f, this);
if (dlg.DoModal() == IDOK) {
m_ListFields.SetItemText(m_SelField, 1, EncodeFilename(dlg.GetPathName()));
fi->SetValue(EncodeFilename(dlg.GetPathName()));
SetModified(fi->GetModified());
}
}
示例4: GetAllFieldValues
void CBibList::GetAllFieldValues(CString field, CStringList *lst)
{
lst->RemoveAll();
if (field.IsEmpty())
return;
POSITION p = GetHeadPosition();
while (p) {
CBibItem *bi = (CBibItem*)GetNext(p);
if (bi->IsRegularItem()) {
CField *fi = bi->Find(field);
if (fi) {
CString val = fi->GetValue();
if (!val.IsEmpty() && lst->Find(val) == NULL)
lst->AddTail(val);
}
}
}
}
示例5: AddLocalURL
/**
* Find a Field with name `Local-Url' and append the filename.
* If no such field exists add one.
*/
void CBibitemView::AddLocalURL(CString url)
{
CField *fi = m_TmpItem->Find(STR_LOCALURL);
if (!fi)
AddField(STR_LOCALURL, url, FALSE);
else {
CString val = fi->GetValue();
if (!val.IsEmpty())
val += _T("; ") + url;
else
val = url;
fi->SetValue(val);
for (int i = 0; i < m_ListFields.GetItemCount(); i++) {
if (m_ListFields.GetItemData(i) == (DWORD)fi) {
m_ListFields.SetItemText(i, 1, val);
break;
}
}
}
}
示例6: OnPopupLocalurl
void CBibitemView::OnPopupLocalurl()
{
CString f, fn;
f.Format(_T("%s||"), AfxLoadString(IDS_STRING_ALLFILTER));
CFileDialogEx dlg(TRUE, NULL, fn, OFN_HIDEREADONLY | OFN_ENABLESIZING, f, this);
if (dlg.DoModal() == IDOK) {
CField *fi = m_TmpItem->Find(STR_LOCALURL);
if (fi == NULL) {
fi = m_TmpItem->New();
fi->SetName(STR_LOCALURL);
fi->SetValue(EncodeFilename(dlg.GetPathName()));
} else {
CString val = fi->GetValue();
if (!val.IsEmpty())
val += _T("; ") + EncodeFilename(dlg.GetPathName());
else
val = EncodeFilename(dlg.GetPathName());
fi->SetValue(val);
}
SetModified();
PopulateFields();
}
}
示例7: DoSearch
//.........这里部分代码省略.........
m_editRecEnd.GetWindowText(str);
int recend = _ttoi(str);
int n = rs.GetCount();
str.Format(AfxLoadString(IDS_STRING_SEARCHRESULTSNUM), n);
m_staticResults.SetWindowText(str);
if (recend > 0)
n = min(n, recend);
int ix = -1;
#ifdef _DEBUG
CFile dbgfile;
try {
dbgfile.Open(COptions::AddBackslash(COptions::GetAppPath()) + _T("result.xml"), CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate);
} catch (...) {
}
#endif
for (int i = recstart - 1; i < n; i++) {
CYazRecord rec = rs.GetRecord(i);
CString rawdata = rec.GetRaw();
#ifdef _DEBUG
try {
dbgfile.Write(rawdata, rawdata.GetLength());
} catch (...) {
}
int selstart = m_editRawData.GetWindowTextLength();
m_editRawData.SetSel(selstart, selstart, TRUE);
m_editRawData.ReplaceSel(rawdata + _T("\r\n"));
#endif
// Add the item to m_Results list
CBibItem* item = m_Results.New();
item->SetType(rec.GetType());
item->Add(_T("raw"), rawdata);
str = rec.GetValue(STR_AUTHOR);
if (!str.IsEmpty())
item->Add(STR_AUTHOR, str);
str = rec.GetValue(STR_EDITOR);
if (!str.IsEmpty())
item->Add(STR_EDITOR, str);
str = rec.GetValue(STR_TITLE);
if (!str.IsEmpty())
item->Add(STR_TITLE, str);
str = rec.GetValue(STR_EDITION);
if (!str.IsEmpty())
item->Add(STR_EDITION, str);
str = rec.GetValue(STR_SERIES);
if (!str.IsEmpty())
item->Add(STR_SERIES, str);
str = rec.GetValue(_T("Performer"));
if (!str.IsEmpty())
item->Add(_T("Performer"), str);
str = rec.GetValue(STR_YEAR);
if (!str.IsEmpty())
item->Add(STR_YEAR, str);
str = rec.GetValue(_T("ISBN"));
if (!str.IsEmpty())
item->Add(_T("ISBN"), str);
str = rec.GetValue(_T("Topic"));
if (!str.IsEmpty())
item->Add(_T("Topic"), str);
str = rec.GetValue(_T("Contents"));
if (!str.IsEmpty())
item->Add(_T("Contents"), str);
// Add it to the listview
CField* field = item->Find(STR_AUTHOR);
if (!field)
field = item->Find(STR_EDITOR);
if (!field)
field = item->Find(_T("Performer"));
if (field)
ix = m_lstResults.InsertItem(ix+1, field->GetValue(), -1);
else
ix = m_lstResults.InsertItem(ix+1, NULL, -1);
m_lstResults.SetItemData(ix, (DWORD)item);
field = item->Find(STR_TITLE);
if (field)
m_lstResults.SetItemText(ix, 1, field->GetValue());
field = item->Find(STR_YEAR);
if (field)
m_lstResults.SetItemText(ix, 2, field->GetValue());
}
delete q;
#ifdef _DEBUG
try {
dbgfile.Close();
} catch (...) {
}
#endif
} // if (conn.GetConnected())
} catch (...) {
ShowError(IDS_STRING_YAZEXCEPTION);
}
m_lstResults.SetRedraw();
m_staticResults.Invalidate();
}
示例8:
inline bool CField::operator==(const CField& oValue) const
{
return operator==(oValue.GetValue());
}
示例9: PopulateFields
void CBibitemView::PopulateFields()
{
// At the moment nothing is selected
m_SelField = -1;
BeginUpdate();
int l = -1, c = -1;
m_ListFields.GetEditPos(l, c);
m_ListFields.DeleteAllItems();
POSITION h = m_TmpItem->GetHeadPosition();
CField* fi;
int j = 0;
for (int i = 0; i < m_TmpItem->GetCount(); i++) {
fi = (CField*)m_TmpItem->GetNext(h);
if (fi) {
j = m_ListFields.InsertItem(j, fi->GetName(), m_BibDef->GetRequired(m_TmpItem->GetType(), fi->GetName()));
m_ListFields.SetItemText(j, 1, fi->GetValue());
m_ListFields.SetItemData(j, (DWORD)fi);
}
if (h == NULL)
break;
}
// Add all other fields
CField *finew;
CBibItem *bi = m_BibDef->FindType(m_TmpItem->GetType());
if (bi != NULL) {
h = bi->GetHeadPosition();
for (i = 0; i < bi->GetCount(); i++) {
fi = (CField*)bi->GetNext(h);
if (fi != NULL && m_TmpItem->Find(fi->GetName()) == NULL) {
finew = m_TmpItem->New();
finew->SetName(fi->GetName());
finew->SetModified(FALSE);
j = m_ListFields.InsertItem(j, finew->GetName(), m_BibDef->GetRequired(m_TmpItem->GetType(), finew->GetName()));
m_ListFields.SetItemText(j, 1, _T(""));
m_ListFields.SetItemData(j, (DWORD)finew);
}
if (h == NULL)
break;
}
}
// Sort it
LVSORTPARAM ss;
ss.iHeader = 0;
ss.pListView = &m_ListFields;
ss.bSortAsc = TRUE;
// Sort the list
m_ListFields.SortItems(SortFunc, (LPARAM)&ss);
m_SortAsc = FALSE;
// Edit the last cell if any
if (l > -1 && c > -1) {
if (l >= m_ListFields.GetItemCount()) {
m_ListFields.CancelEdit(TRUE);
m_ListFields.EditSubItem(m_ListFields.GetItemCount()-1, c);
} else
m_ListFields.EditSubItem(l, c);
}
m_ListFields.UpdateEditor();
EndUpdate();
}
示例10: KeySortProc
int CBibList::KeySortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CBibList *lst = (CBibList*)lParamSort;
POSITION p = lst->FindIndex(lParam1);
if (!p)
return 0;
CBibItem *bi1 = (CBibItem*)lst->GetAt(p);
p = lst->FindIndex(lParam2);
if (!p)
return 0;
CBibItem *bi2 = (CBibItem*)lst->GetAt(p);
// Handle @string{}, @comment{}, @preamble{} differently
// - Filter should be on top of the file
// - Preamble should be AFTER strings, so string macros can be used
// - Strings should be on top of the file
// - Comments should be where they actually are
// Only real Bib items should be sorted by their Key
// Put filter on top of the file
if (bi1->IsType(STR_COMMENT) && bi1->GetKey().CompareNoCase(STR_FILTER) == 0)
return -1;
else if (bi2->IsType(STR_COMMENT) && bi2->GetKey().CompareNoCase(STR_FILTER) == 0)
return 1;
// Comments should be where they are
if (bi1->IsType(STR_COMMENT) || bi2->IsType(STR_COMMENT))
return 0;
// Strings should be before preambles
if (bi1->IsType(STR_PREAMBLE) && bi2->IsType(STR_STRING))
return 1;
if (bi1->IsType(STR_STRING) && bi2->IsType(STR_PREAMBLE))
return -1;
// Preambles are before real bibitems
if (bi1->IsType(STR_PREAMBLE) && !bi2->IsType(STR_PREAMBLE))
return -1;
if (!bi1->IsType(STR_PREAMBLE) && bi2->IsType(STR_PREAMBLE))
return 1;
if (bi1->IsType(STR_PREAMBLE) && bi2->IsType(STR_PREAMBLE))
return 0;
// Strings are before real bibitems
if (bi1->IsType(STR_STRING) && !bi2->IsType(STR_STRING))
return -1;
if (!bi1->IsType(STR_STRING) && bi2->IsType(STR_STRING))
return 1;
// Ensure that cross-referenced items appear after cross-referencing items
CField* crossref = bi1->Find(STR_CROSSREF);
CBibItem* refed;
CString crv;
if (crossref) {
crv = crossref->GetValue();
if (!crv.IsEmpty()) {
refed = lst->Find(crv);
if (refed)
refed->m_CrossRefed = TRUE;
}
}
crossref = bi2->Find(STR_CROSSREF);
if (crossref) {
crv = crossref->GetValue();
if (!crv.IsEmpty()) {
refed = lst->Find(crv);
if (refed)
refed->m_CrossRefed = TRUE;
}
}
if (bi1->m_CrossRefed && !bi2->m_CrossRefed)
return 1;
else if (bi2->m_CrossRefed && !bi1->m_CrossRefed)
return -1;
// Reached that, both must be real bibitems -> compare the key
if (((CBibedtApp*)AfxGetApp())->m_Options->m_SortCaseSensitive)
return bi1->GetKey().Compare(bi2->GetKey());
else
return bi1->GetKey().CompareNoCase(bi2->GetKey());
}
示例11: ExecuteMemberFunction
CScriptObject::MEMBERRESULT CFieldScriptObject::ExecuteMemberFunction( char* pszName, Variant* pParameters, int nParameters, Variant& returnValue )
{
//field value query/modification functions - only if field properties allow!
if( stricmp( pszName, "getfieldvalue" ) == 0 )
{
if( nParameters == 1 )
{
//search the entire field list
int iMax = m_FieldList.GetSize();
for( int i = 0; i < iMax; i++ )
{
//get the next item and return the value if it's the one we're looking for
CField* pField = m_FieldList[i];
if( pField && pField->m_Code == pParameters[0] )
{
if( pField->m_dwFlags & FIELD_SCRIPTREAD )
{
returnValue = pField->GetValue();
return OK;
}
else
{
AfxMessageBox( CString("Field is protected: ") + CString(LPCSTR(pParameters[0])) );
return UNKNOWN_ERROR;
}
}
};
//couldn't find it...
AfxMessageBox( CString("Field not found: ") + CString(LPCSTR(pParameters[0])) );
return UNKNOWN_ERROR;
}
else
return nParameters < 1 ? TOO_FEW_PARAMS : TOO_MANY_PARAMS;
}
if( stricmp( pszName, "setfieldvalue" ) == 0 )
{
if( nParameters == 2 )
{
//search the entire field list
int iMax = m_FieldList.GetSize();
for( int i = 0; i < iMax; i++ )
{
//get the next item and change the value if it's the one we're looking for
CField* pField = m_FieldList[i];
if( pField && pField->m_Code == pParameters[0] )
{
if( pField->m_dwFlags & FIELD_SCRIPTWRITE )
{
pField->SetValue( pParameters[1] );
return OK;
}
else
{
AfxMessageBox( CString("Field is protected: ") + CString(LPCSTR(pParameters[0])) );
return UNKNOWN_ERROR;
}
}
};
//couldn't find it...
AfxMessageBox( CString("Field not found: ") + CString(LPCSTR(pParameters[0])) );
return UNKNOWN_ERROR;
}
else
return nParameters < 2 ? TOO_FEW_PARAMS : TOO_MANY_PARAMS;
}
return NOT_FOUND;
}