本文整理汇总了C++中FindField函数的典型用法代码示例。如果您正苦于以下问题:C++ FindField函数的具体用法?C++ FindField怎么用?C++ FindField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxCHECK_RET
void FieldSelectionPanel::AddField(CItemData::FieldType ft, bool selected, bool mandatory)
{
wxCHECK_RET(!mandatory || selected, wxT("A mandatory field must also be pre-selected"));
const wxString fieldName(towxstring(CItemData::FieldName(ft)));
if (FindField(ft, selected? m_lbSelected: m_lbAvailable) != wxNOT_FOUND) {
wxLogDebug(wxT("%ls already in %ls list, not adding it again"),
fieldName,
selected? wxT("selected"): wxT("available"));
return;
}
//if the field is already in another listbox, just move it
const int index = FindField(ft, selected? m_lbAvailable: m_lbSelected);
if (index != wxNOT_FOUND) {
wxLogDebug(wxT("%ls already in %ls list, moving it to %ls"),
fieldName,
selected? wxT("available"): wxT("selected"),
selected? wxT("selected"): wxT("available"));
MoveItem(index, selected? m_lbAvailable: m_lbSelected, selected? m_lbSelected: m_lbAvailable);
return;
}
//else, add it
wxString title(fieldName);
if (mandatory)
title += _(" [Mandatory Field]");
FieldData *data = new FieldData(mandatory, ft);
wxListBox* lb = selected? m_lbSelected: m_lbAvailable;
lb->Append(title, data);
}
示例2: FindField
IFieldPtr CFields::GetField(const CommonLib::CString& name) const
{
int nIndex = FindField(name);
if(nIndex == -1)
return IFieldPtr();
return GetField(nIndex);
}
示例3: FindField
GField* GFieldsImpl::GetField(const char* szName)
{
int nIndex = FindField(szName);
if(nIndex<0)
return NULL;
return m_fields[nIndex];
}
示例4: GetFieldOrdering
int
GetFieldOrdering(FieldList list,
int *order)
{
FieldSpec *field;
long ord;
field = FindField(list, "fieldOrder");
if (field == NULL)
ord = TYPE_ORDER;
else if (field->occurrence != GLOBAL
|| field->rank != 0
|| field->data == NULL
|| !LongVal(field->data, field->type, &ord)
|| ord != FIELD_ORDER && ord != TYPE_ORDER)
{
DebugMsg(1, "Bad field \"fieldOrder\".");
return FALSE;
}
if (order != NULL)
*order = ord;
return TRUE;
}
示例5: AddField
bool CRuleStruct::AddField(CRuleVariable* pField)
{
if(FindField(pField->m_oName.GetStr()))
return false;
m_oFields.Insert((uint32)(-1), pField);
m_bImplemented = false;
return true;
}
示例6: GetFieldValue
/**
* If any changes have been made to this component,
* they are now applied to the schematic component
*/
void BOM_TABLE_COMPONENT::ApplyFieldChanges()
{
for( auto& unit : Units )
{
auto cmp = unit.GetComp();
if( !cmp )
continue;
// Iterate over each column
SCH_FIELD* field;
for( auto& column : m_columnList->Columns )
{
if( column && HasValueChanged( column ) )
{
wxString value = GetFieldValue( column->Id() );
switch( column->Id() )
{
// Ignore read-only fields
case BOM_COL_ID_REFERENCE:
case BOM_COL_ID_QUANTITY:
continue;
// Special field considerations
case BOM_COL_ID_FOOTPRINT:
field = cmp->GetField( FOOTPRINT );
break;
case BOM_COL_ID_VALUE:
field = cmp->GetField( VALUE );
break;
case BOM_COL_ID_DATASHEET:
field = cmp->GetField( DATASHEET );
break;
default:
// Find the field by name (but ignore default fields)
field = cmp->FindField( column->Title(), false );
break;
}
// New field needs to be added?
if( !field && !value.IsEmpty() )
{
SCH_FIELD newField( wxPoint( 0, 0 ), -1, cmp, column->Title() );
field = cmp->AddField( newField );
}
if( field )
{
field->SetText( value );
}
}
}
}
}
示例7: AddCommandLine
static FieldSpec *
AddCommandLine(FieldList *list,
char *line)
{
FieldSpec *field;
if (line == NULL)
return NULL;
field = FindField(*list, "commandLine");
if (field == NULL)
{
field = NewFieldSpec(ECHAR, 1);
if (field == NULL)
{
DebugMsg(1, "AddCommandLine: Couldn't create field spec.");
return NULL;
}
field->dim[0] = strlen(line);
field->name = savestring("commandLine");
field->occurrence = GLOBAL;
if (!AddField(list, field))
{
DebugMsg(1, "AddCommandLine: Couldn't add field spec.");
return NULL;
}
}
else /* field != NULL */
{
if (field->occurrence != GLOBAL)
{
DebugMsg(1, "AddCommandLine: non-GLOBAL field \'commandLine\".");
return NULL;
}
field->type = ECHAR;
field->rank = 1;
field->dim = (long *) ((field->dim == NULL)
? malloc(sizeof(long))
: realloc(field->dim, sizeof(long)));
if (field->dim == NULL)
{
DebugMsg(1, "AddCommandLine: couldn't (re)allocate dimension.");
return NULL;
}
field->dim[0] = 1 + strlen(line);
}
field->data = line;
return field;
}
示例8: FindField
bool
MimeHeader::FieldExists(const char *pszFieldName) const
{
vector<MimeField>::iterator iter = FindField(pszFieldName);
if (iter == m_listFields.end())
return false;
return true;
}
示例9: SetFieldOrdering
int
SetFieldOrdering(FieldList *list,
int order)
{
FieldSpec *field;
if (*list == NULL)
{
DebugMsg(1, "SetFieldOrdering: NULL field list.");
return FALSE;
}
field = FindField(*list, "fieldOrder");
if (field == NULL)
{
if (order == TYPE_ORDER)
return TRUE;
field = NewFieldSpec(SHORT, 0);
if (field == NULL)
{
DebugMsg(1, "SetFieldOrdering: Couldn't create field spec.");
return FALSE;
}
field->name = StrDup("fieldOrder");
field->occurrence = GLOBAL;
if (!AddField(list, field))
{
DebugMsg(1, "SetFieldOrdering: Couldn't add field spec.");
return FALSE;
}
}
else /* field != NULL */
{
if (field->occurrence != GLOBAL)
{
DebugMsg(1, "SetFieldOrdering: non-GLOBAL field \"fieldOrder\".");
return FALSE;
}
field->type = SHORT;
field->rank = 0;
}
field->data = ((field->data == NULL)
? malloc(sizeof(short))
: realloc(field->data, sizeof(short)));
if (field->data == NULL)
{
DebugMsg(1, "SetFieldOrdering: couldn't (re)allocate data.");
return FALSE;
}
*(short *) field->data = order;
return TRUE;
}
示例10: CheckIdResolver
BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const
{
CheckIdResolver();
int32_t fieldId = idRslvr->GetFieldId(GetTypeId(), name);
int32_t pos = FindField(fieldId);
return FromMemory(*mem, pos, metaMgr);
}
示例11: FindField
TDC_ATTRIBUTE CTDLImportOutlookObjectsDlg::GetFieldMapping(const CTDCCsvColumnMapping& aMapping, OUTLOOK_FIELDTYPE nFieldType)
{
int nField = FindField(aMapping, nFieldType);
if (nField != -1)
return aMapping[nField].nTDCAttrib;
// else
return TDCA_NONE;
}
示例12: FindField
//------------------------------------------------------------------------------------------------------------
void CPerfTestContact::SetTextFieldL(TFieldType aFieldType,const TDesC& aText)
{
CContactItemFieldSet& fields = iContactItem->CardFields();
TInt fieldIndex = 0;
fieldIndex = FindField( aFieldType );
if ( fieldIndex > KErrNotFound )
{
CContactItemField& field = fields[ fieldIndex ];
ASSERT(field.StorageType()==KStorageTypeText);
STATIC_CAST(CContactTextField*,field.Storage())->SetText(aText.AllocL());
}
示例13: ParseRuleComment
/* Parse rule comment with dynamic fields */
char* ParseRuleComment(Eventinfo *lf) {
static char final[OS_COMMENT_MAX + 1] = { '\0' };
char orig[OS_COMMENT_MAX + 1] = { '\0' };
const char *field;
char *str;
char *var;
char *end;
char *tok;
size_t n = 0;
size_t z;
strncpy(orig, lf->generated_rule->comment, OS_COMMENT_MAX);
for (str = orig; (tok = strstr(str, "$(")); str = end) {
*tok = '\0';
var = tok + 2;
if (n + (z = strlen(str)) >= OS_COMMENT_MAX)
return strdup(lf->generated_rule->comment);
strncpy(&final[n], str, z);
n += z;
if (!(end = strchr(var, ')'))) {
*tok = '$';
str = tok;
break;
}
*(end++) = '\0';
if ((field = FindField(lf, var))) {
if (n + (z = strlen(field)) >= OS_COMMENT_MAX)
return strdup(lf->generated_rule->comment);
strncpy(&final[n], field, z);
n += z;
} else {
*tok = '$';
if (n + (z = strlen(tok)) + 1 >= OS_COMMENT_MAX)
return strdup(lf->generated_rule->comment);
strncpy(&final[n], tok, z);
n += z;
final[n++] = ')';
}
}
示例14: FindField
bool iDBF::GetStrDataArray(const wxString& fieldname, charPtr* dt)
{
int rows = NumOfRecords;
int fld = FindField(fieldname);
if (fld < 0 || fld > NumOfFields-1 || Field[fld]->Type != 'C')
return false;
for ( int xIndex = 0; xIndex < rows; ++xIndex)
{
while (Pos() != fld) Read();
int len = Field[fld]->Width;
char* result = new char[len+1];
Read(result, len);
dt[xIndex] = result;
}
return true;
}
示例15: LOG_MSG
bool iDBF::GetDblDataArray(const wxString& fieldname, double* dt)
{
LOG_MSG("Entering iDBF::GetDblDataArray");
int rows = NumOfRecords;
int fld = FindField(fieldname);
if (fld < 0 || fld > NumOfFields-1)
return 0;
pos =0;
record=0;
//ReOpen(); //MMM this must be a hack, temporarily disable and eventually remove it!
if (Field[fld]->Type == 'F')
{
for ( int xIndex = 0; xIndex < rows; ++xIndex)
{
while (Pos() != fld) Read();
int len = Field[fld]->Width;
char* result = new char[len+1];
Read(result, len);
//dt[xIndex] = atof(result);
wxString::Format("%s", result).ToCDouble(&dt[xIndex]);
delete [] result;
result = NULL;
}
}
else
{
for ( int xIndex = 0; xIndex < rows; ++xIndex)
{
while (Pos() != fld) Read();
double result;
Read(result);
dt[xIndex] = result;
}
}
LOG_MSG("Exiting iDBF::GetDblDataArray");
return 1;
}