Example #1
0
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;
}
Example #2
0
void CBibitemView::OnEndlabeleditListFields(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if (!m_Updating) {
		LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
		if (pDispInfo->item.pszText != NULL) {
			int i = pDispInfo->item.iItem;
			CField* f = (CField*)m_ListFields.GetItemData(i);
			if (pDispInfo->item.iSubItem == 0) {
				// It's the field name
				f->SetName(pDispInfo->item.pszText);
				m_ListFields.SetItem(i, pDispInfo->item.iSubItem, LVIF_IMAGE, NULL, 
					m_BibDef->GetRequired(m_BibItem->GetType(), pDispInfo->item.pszText), 0, 0, 0);
			} else if (pDispInfo->item.iSubItem == 1) {
				// It's the field value
				f->SetValue(pDispInfo->item.pszText);
			}
			m_ListFields.SetItemText(i, pDispInfo->item.iSubItem, pDispInfo->item.pszText);
			UpdateMissing();
			*pResult = 1;
			SetModified(m_Modified || f->GetModified());
		} else
			*pResult = 0;
	} else
		*pResult = 0;
}
Example #3
0
/************************************************************************************
函数名称:
int CFields::QuerySaveLength()
功能说明:得到保存一条记录到Buffer所需要的字节数.

详细解释:1.内部对每一个字段调用CField::QuerySaveLength().
          2.如果函数执行失败,则返回-1.
    
出入参数:
[in]: 无.
     
[out]:无.

返回类型:int.

制作:YTLI   2002/07/15

修改: 
***********************************************************************************/
int CFields::QueryLength()
{
	int iRetValue = 0; 
	for (int i= 0;i<m_FieldArray.GetSize();i++)
	{
		CField* pField = (CField*)m_FieldArray.GetAt(i);
		if(!pField)
			return -1;

		iRetValue += pField->QuerySaveLength();
	}
	/*
	POSITION pos  = m_FieldList.GetHeadPosition();

	while(pos)
	{
		CField* pField = m_FieldList.GetNext(pos);
		
		if(!pField)
			return -1;

		iRetValue += pField->QuerySaveLength();
	}
	*/
	return iRetValue;
}
Example #4
0
/************************************************************************************
函数名称:
int CFields::LoadFromBuffer(LPBYTE& lpData,int FieldCount)
功能说明:从Buffer读取指定个数的字段信息.

详细解释:1.返回读取的字节数.
          2.如果传入的参数无效,则返回-1.
    
出入参数:
[in]: 1.lpData:要读的起始地址.
      2.FieldCount:要读取的字段个数.	  
     
[out]:1.lpData:传入参数lpData向后移动FieldCount个记录后的地址.

返回类型:int

制作:YTLI   2002/07/15

修改: 
***********************************************************************************/
int CFields::LoadFromBuffer(LPBYTE& lpData,int FieldCount)
{
	if( (!lpData) || (FieldCount <=0) )
        return -1;

	m_nCurVersion    = 0;
	m_nLastPosVersion = -1;

	int iRetValue = (int)lpData;
	int iFieldCnt = 0;

	while( iFieldCnt < FieldCount )
	{
		CFieldType chType = GetFieldType(lpData);
		CField* pField   = NewFieldType(this,chType);

		if(!pField)
			return -1;

		pField->m_pFields = this;
		lpData += pField->LoadFromBuffer(lpData);

		Add(pField);
		
		iFieldCnt++;
	}

	iRetValue = (int)lpData - iRetValue;
	return iRetValue;
}
Example #5
0
uint32 CRdbPrefixIndex::DetachRecord(CRecord* pRecord)
{
	CField* pField;
	uint32 nFieldNo = m_pIdxDef->m_pFields[0];

	char* sStr = NULL;
	uint32 nStrLen = 0;

	pField = pRecord->GetField(nFieldNo);
	sStr = pField->GetString(&nStrLen);

	uint64 nRowId = pRecord->m_nRowId;

	if(m_oTree.RemoveNode((const uint8*)sStr, nStrLen, FOCP_NAME::IsEqualRowId, &nRowId))
	{
		uint64 nTreeThis = m_oTree.GetThis();
		if(!nTreeThis)
		{
			uint64 pAddr[2] = {nTreeThis, m_oAllocator.GetThis()};
			vcommit(m_nThis, (char*)pAddr, 16);
		}
		return RDB_SUCCESS;
	}
	return RDB_RECORD_NOT_EXIST;
}
Example #6
0
uint32 CRdbPrefixIndex::AttachRecord(CRecord* pRecord)
{
	CField* pField;
	uint32 nFieldNo = m_pIdxDef->m_pFields[0];
	char* sStr = NULL;
	uint32 nStrLen = 0;
	pField = pRecord->GetField(nFieldNo);
	sStr = pField->GetString(&nStrLen);

	bool bConflict;
	int32 bMemory = 1;
	if(m_pTabDef->m_pBaseAttr->nStorage == RDB_FILE_TABLE)
		bMemory = 0;

	uint64 nNode;
	uint64 nRowId = pRecord->m_nRowId;
	uint64 nTreeThis = m_oTree.GetThis();
	TNTreeNode* pNode = m_oTree.InsertNode((const uint8*)sStr, nStrLen, nRowId, bMemory, nNode, bConflict);
	if(!pNode)
	{
		if(bConflict)
			return RDB_UNIQUE_INDEX_CONFLICT;
		return RDB_LACK_STORAGE;
	}
	m_oTree.ReleaseNode(nNode, pNode);
	uint64 nTreeThis2 = m_oTree.GetThis();
	if(nTreeThis != nTreeThis2)
	{
		uint64 pAddr[2] = {nTreeThis2, m_oAllocator.GetThis()};
		vcommit(m_nThis, (char*)pAddr, 16);
	}
	return RDB_SUCCESS;
}
Example #7
0
BOOL CTableBase::GetBooleanValue(LPCTSTR _szLabel)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
		return pField->GetBooleanValue();

	ASSERT(FALSE); // NAo encontrou o campo !
	return FALSE;
}
Example #8
0
BOOL CTableBase::GetDateValue(LPCTSTR _szLabel, COleDateTime *pOdt)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
		return pField->GetDateValue(pOdt);

	ASSERT(FALSE); // Nao encontrou o campo !
	return FALSE;
}
Example #9
0
double CTableBase::GetDoubleValue(LPCTSTR _szLabel)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
		return pField->GetDoubleValue();

	ASSERT(FALSE); // NAo encontrou o campo !
	return 0.0;
}
Example #10
0
//----------------------------------------
void CProductErs::AddInternalHighResolutionFieldCalculation()
{
  string internalFieldName;
  CField* fieldTest = NULL;

//  internalFieldName = MakeInternalFieldName(m_latitudeFieldName);
//  m_listInternalFieldName.InsertUnique( internalFieldName );
//  m_fieldNameEquivalence.Insert(m_latitudeFieldName, internalFieldName, false);
  
  fieldTest = FindFieldByName(m_latitudeFieldName, false, NULL, false);
  if (fieldTest != NULL)
  {
    internalFieldName = MakeInternalNameByAddingRoot(fieldTest->GetFullNameWithRecord());
    m_listInternalFieldName.InsertUnique( internalFieldName );
    m_fieldNameEquivalence.Insert(m_latitudeFieldName, internalFieldName, false);
  }

//  internalFieldName = MakeInternalFieldName(m_longitudeFieldName);
//  m_listInternalFieldName.InsertUnique( internalFieldName );
//  m_fieldNameEquivalence.Insert(m_longitudeFieldName, internalFieldName, false);

  fieldTest = FindFieldByName(m_longitudeFieldName, false, NULL, false);
  if (fieldTest != NULL)
  {
    internalFieldName = MakeInternalNameByAddingRoot(fieldTest->GetFullNameWithRecord());
    m_listInternalFieldName.InsertUnique( internalFieldName );
    m_fieldNameEquivalence.Insert(m_longitudeFieldName, internalFieldName, false);
  }

//  internalFieldName = MakeInternalFieldName(m_timeStampSecondFieldName);
//  m_listInternalFieldName.InsertUnique( internalFieldName );
//  m_fieldNameEquivalence.Insert(m_timeStampSecondFieldName, internalFieldName, false);

  fieldTest = FindFieldByName(m_timeStampSecondFieldName, false, NULL, false);
  if (fieldTest != NULL)
  {
    internalFieldName = MakeInternalNameByAddingRoot(fieldTest->GetFullNameWithRecord());
    m_listInternalFieldName.InsertUnique( internalFieldName );
    m_fieldNameEquivalence.Insert(m_timeStampSecondFieldName, internalFieldName, false);
  }


//  internalFieldName = MakeInternalFieldName(m_timeStampMicrosecondFieldName);
//  m_listInternalFieldName.InsertUnique( internalFieldName );
//  m_fieldNameEquivalence.Insert(m_timeStampMicrosecondFieldName, internalFieldName, false);
  
  fieldTest = FindFieldByName(m_timeStampMicrosecondFieldName, false, NULL, false);
  if (fieldTest != NULL)
  {
    internalFieldName = MakeInternalNameByAddingRoot(fieldTest->GetFullNameWithRecord());
    m_listInternalFieldName.InsertUnique( internalFieldName );
    m_fieldNameEquivalence.Insert(m_timeStampMicrosecondFieldName, internalFieldName, false);
  }


}
Example #11
0
/**
 * Add a filter item
 */
CField * CBibList::AddFilter(CString name, CString cond)
{
	CBibItem *filter = GetFilter();
	if (!filter)
		filter = New();
	CField *flt = filter->New();
	flt->SetName(name);
	flt->SetValue(cond);
	return flt;
}
Example #12
0
CField* CField::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
{
    assert(pSchemaRoot != NULL);
    assert(pParentNode != NULL);
    assert(pParentNode->getNodeType() == XSD_FIELD_ARRAY);

    if (pSchemaRoot == NULL || pParentNode == NULL)
    {
        // TODO: Throw Exception
        return NULL;
    }

    CField *pField = NULL;

    if (xpath != NULL && *xpath != 0)
    {
        IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);

        if (pTree == NULL)
        {
            return NULL;
        }

        const char* pXPath = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_XPATH);

        assert(pXPath != NULL && *pXPath != 0);

        if (pXPath == NULL || *pXPath == 0)
        {
            assert(!"Throw Exception");
            // TODO: throw exception
        }

        if (pXPath != NULL)
        {
            pField = new CField(pParentNode);
            pField->setXSDXPath(xpath);
            pField->setXPath(pXPath);
        }
        else
        {
            assert(!"xpath can not be be empty!");
            // TODO: throw MakeExceptionFromMap(EX_STR_MISSING_XPATH_IN_FIELD);
        }

        const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);

        if (pID != NULL)
        {
            pField->setID(pID);
        }
   }

    return pField;
}
Example #13
0
/**
 * Metodo para setar um valor tipo data no label _szLabel
 */ 
BOOL CTableBase::SetValue(LPCTSTR _szLabel, COleDateTime o)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
	{
		pField->SetValue(o);
		return TRUE;
	}

	return FALSE;
}
Example #14
0
/**
 * Metodo para setar um valor tipo long no label _szLabel
 */ 
BOOL CTableBase::SetValue(LPCTSTR _szLabel, long _l)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
	{
		pField->SetValue(_l);
		return TRUE;
	}

	return FALSE;
}
Example #15
0
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());
	}
}
Example #16
0
/************************************************************************************
函数名称:
	CFieldList::Modify
功能说明:
	修改一个字段
详细解释:

出入参数:
	[in,out]nIndex:旧字段的位置
	[in,out]pField :新的字段
返回类型:

制作:
	Eric 2002-9-4
修改:

************************************************************************************/
bool CFieldList::Modify(int nIndex,CFieldType NewFieldType)
{
	CField *pField = this->FieldByIndex(nIndex);
	if (pField ==NULL)
		return false;
	if (pField->GetFieldType() == NewFieldType)
		return true;
	CField* pNewField=CreateField(NewFieldType);
	pNewField->CopyCommonProperty(pField);
	Modify(IndexOf(pField),pNewField);
	return true;
}
Example #17
0
 /*!
   \brief Sending all active (enabled) fields from client to server.
 Each field is identified uniquely by its string identity. Not only should we
 send the id to server but also we need to send ids of reference domain and reference axis.
 With these two id, it's easier to make reference to grid where all data should be written.
 Remark: This function must be called AFTER all active (enabled) files have been created on the server side
 */
 void CFile::sendEnabledFields()
 {
   size_t size = this->enabledFields.size();
   for (size_t i = 0; i < size; ++i)
   {
     CField* field = this->enabledFields[i];
     this->sendAddField(field->getId());
     field->checkAttributes();
     field->sendAllAttributesToServer();
     field->sendAddAllVariables();
   }
 }
Example #18
0
long CTableBase::GetLongValue(LPCTSTR _szLabel)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
	{
		ASSERT(pField->GetType() == CField::FIELD_TYPE_NUMBER);
		return pField->GetLongValue();
	}

	ASSERT(FALSE); // NAo encontrou o campo !
	return 0L;
}
Example #19
0
/************************************************************************************
函数名称:
bool CField::LoadDataFromBuffer(LPBYTE& lpIndicate, LPBYTE& lpData)
功能说明:虚函數,读取一条记录某一字段的数据,可以用来读取值标签.

详细解释:1.子类实现.      

出入参数:
[in]: 1.lpIndicate:指示字节地址.
      2.lpData    :数据地址.
  
[out]:1.lpIndicate:下一数据块的指示字节地址.
      2.lpData    :下一数据块的数据地址. 

返回类型:bool

制作:YTLI 2002/07/12

修改: 
************************************************************************************/
void CField::LoadDataFromBuffer( LPBYTE& lpData)
{	
	if(m_pValue==NULL)
	{//旧版本
		if(m_nNextModifyField == -1)
		{
			NewData();
			LoadDataFromBuffer(lpData);			
			DeleteData();
		}
		else
		{
			if(m_pFields->IsConvertToLastVersion(this))
			{
				NewData();
				LoadDataFromBuffer(lpData);
				CField* pNewField = m_pFields->m_FieldVersion.GetFieldByAbsolutePos(m_nNextModifyField);
				pNewField->ConvertToCurField(this); 
				DeleteData();
			}
		}
	}
	else
	{//当前最新
		if (GetFieldType() == fString)
		{
			FieldString* pStr = (FieldString*)m_pValue;
			char *pBuf = new char[m_nWidth+2];
			memset(pBuf,0,m_nWidth+2);
			memcpy(pBuf,lpData,m_nWidth);
			*pStr= pBuf;
			/*
  			char* lpstr = pStr->GetBuffer(m_nWidth+2);
			memcpy(lpstr,lpData,m_nWidth);
			*(lpstr+m_nWidth)= 0;
			*(lpstr+m_nWidth+1)= 0;
			pStr->ReleaseBuffer();	
			*/
			//pStr->TrimLeft();//,左边空格保留
			pStr->TrimRight();   

			
			lpData =  lpData + Align4(m_nWidth);
		}
		else
		{
			memcpy( &*((FieldNUM *)m_pValue), lpData, sizeof(FieldNUM) );	//ytli Modify 2002/09/04
			lpData =  lpData + sizeof(FieldNUM);
		}
		
	}
}
void CShapefileFeatureClass::InitFields()
{
	m_allFields.clear();
	int iField;
	int lFieldnum =DBFGetFieldCount(m_dbfHandle);
	char            szFieldName[20];
	int             nWidth, nPrecision;
	char            chNativeType;
	DBFFieldType    eDBFType;
	//获得属性字段的信息
	for( iField = 0; 
		m_dbfHandle != NULL && iField < lFieldnum; 
		iField++ )
	{
		CField *pField =new CField();



		chNativeType = DBFGetNativeFieldType( m_dbfHandle, iField );
		eDBFType = DBFGetFieldInfo( m_dbfHandle, iField, szFieldName,
			&nWidth, &nPrecision );

		pField->SetName(szFieldName);

		pField->SetLength(nWidth);

		pField->SetPrecision(nPrecision);

		if( chNativeType == 'D' )
		{
			/* XXX - mloskot:
			* Shapefile date has following 8-chars long format: 20060101.
			* OGR splits it as YYYY/MM/DD, so 2 additional characters are required.
			* Is this correct assumtion? What about time part of date?
			* Shouldn't this format look as datetime: YYYY/MM/DD HH:MM:SS
			* with 4 additional characters?
			*/
			pField->SetLength( nWidth + 2 );
			pField->SetType( FTYPE_DATE );
		}
		else if( eDBFType == FTDouble )
			pField->SetType( FTYPE_DOUBLE);
		else if( eDBFType == FTInteger )
			pField->SetType(FTYPE_LONG);
		else if(eDBFType==FTLogical)
			pField->SetType(FTYPE_BOOL);
		else
			pField->SetType( FTYPE_STRING);

		m_allFields.push_back(CFieldPtr(pField));
	}
}
Example #21
0
CString	CTableBase::GetStringValue(LPCTSTR _szLabel)
{
	CField *pField;
	if(m_mapFields.Lookup(_szLabel, pField))
	{
		//ASSERT(pField->GetType() == CField::FIELD_TYPE_STRING);
		return pField->GetStringValue();
	}

	TRACE(L"CTableBase::GetStringValue Não encontrei campo: %s\r\n", _szLabel);
	ASSERT(FALSE); // Nao encontrou o campo !
	return _T("");
}
Example #22
0
/*
#获取字段和记录信息 文件名没有,则返回当前表信息
>Command
	Text
		GetDataInfo 表名
<Command
	Text
		ColInfo	列信息
		Fail 错误信息
 */
bool TCManager::GetDataInfo(TCPacket &inP,AnaWord &aw,TCPacket &outP)
{
	if (aw.GetWordCount()!=2)
		return SetResultState(false,outP,GetLanguage(FormatIsError)); 

	int nUserID = GetUserID(inP);
	if (nUserID==0)
		return SetResultState(false,outP,GetLanguage(UserIDIsNotFound));

	CDataInterface *pDI = g_system.GetCurData(nUserID,aw.GetAt(1));
	if (pDI ==NULL)
	{
		return SetResultState(false,outP,GetLanguage(UserTableIsNotFound));
	}

	CDataAccess &da = pDI->m_DataAccess;

	
	string strScript ;
	int nCnt = da.GetRecordCount();
	char  buffer[50];
	memset(buffer,0,50);
	sprintf(buffer,"%d",nCnt);
	string sRecordCount = buffer;
	for (int i=0;i<da.GetFieldCount();i++)
	{
		CField *pField = da.FieldByIndex(i);
		string ss = (const char*)pField->GetFieldName();				
		ss = AnaWord::GetUniquely(ss);
		CFieldType ft = pField->GetFieldType();
		if (ft ==fString )
			ss = ss + " s ";
		else if (ft == fDate)
			ss = ss + " d ";
		else if (ft == fInt)
			ss = ss + " n ";
		else if (ft == fDouble)
			ss = ss + " f ";
		else if (ft == fBoolean)
			ss = ss + " b ";
		
		char buf[10];
		sprintf(buf," %d ",pField->GetWidth());
		string sWidth = buf;
		strScript = strScript+ " "+ ss +sWidth;
	}
	sRecordCount = "ColInfo "+sRecordCount + strScript;
	outP.AddItem("Text",sRecordCount);
	return SetResultState(true,outP);
}
Example #23
0
int CFields::SaveToBuffer(TCLFile *pFile)
{
	if(!pFile)
		return false;

	for (int i= 0;i<m_FieldArray.GetSize();i++)
	{
		CField* pField = (CField*)m_FieldArray.GetAt(i);
		if(pField)
			pField->SaveToBuffer(pFile);

	}

	return true;
}
Example #24
0
/************************************************************************************
函数名称:
void CFields::NewData() 
功能说明:为一条记录分配一个新空间.

详细解释:
    
出入参数:
[in]: 无.
     
[out]:无.

返回类型:void.

制作:YTLI   2002/07/15

修改: 
***********************************************************************************/
void CFields::NewData() 
{
	int nOldVersion = m_nCurVersion;
	SetCurVersion();

	ClearAllVersionPointer();

	for (int i= 0;i<m_FieldArray.GetSize();i++)
	{
		CField* pField = (CField*)m_FieldArray.GetAt(i);
		if(pField)
			pField->NewData();
	}

	SetCurVersion(nOldVersion);	
}
Example #25
0
/**
 * Metodo para limpar todos os valores dos campos da tabela
 */
void CTableBase::Reset(BOOL bExcludeKeys)
{
	POSITION pos = m_mapFields.GetStartPosition();
	CString sKey;
	CField *pField;

	while(pos != NULL)
	{
		m_mapFields.GetNextAssoc( pos, sKey, pField );
		
		if(pField->IsKey() && bExcludeKeys)
			continue;

		pField->SetValue(_T(""));
	}
}
Example #26
0
void CBibitemView::OnInsertitemListFields(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	if (!m_Updating) {

		CField* f = new CField(m_TmpItem);
		// Name
		CString tmp = m_ListFields.GetItemText(pNMListView->iItem, 0);
		f->SetName(tmp);
		m_TmpItem->AddTail((CObject*)f);
		m_ListFields.SetItemData(pNMListView->iItem, (DWORD)f);
		SetModified(TRUE);
	}
	
	*pResult = 0;
}
Example #27
0
/*
	EditCol 表名 所在列号 {字段名A 类型 长度}
	列号是从0开始(-1表示从后面追加),类型表示,s 字符串 d 日期类型 n 数字类型
 */
bool TCManager::EditCol(TCPacket &inP,AnaWord &aw, TCPacket &outP)
{
	if (aw.GetWordCount()%3 !=0)//保证是3的整数倍
		return SetResultState(false,outP,GetLanguage(FormatIsError)); 

	int nUserID = GetUserID(inP);
	if (nUserID==0)
		return SetResultState(false,outP,GetLanguage(UserIDIsNotFound));

	CDataInterface *pDI = g_system.GetCurData(nUserID,aw.GetAt(1));
	if (pDI ==NULL)
		return SetResultState(false,outP,GetLanguage(UserTableIsNotFound));
	

	string sColStart = aw.GetAt(2);
	int nColStart = atoi(sColStart.c_str());
	if (nColStart<0 || nColStart+aw.GetWordCount()/3-1 > pDI->GetColCount())
		return SetResultState(false,outP,GetLanguage(ColIndexOutOfRangeFail)); 

	for (int i=1;i<	aw.GetWordCount()/3 ;i++)
	{
		string sName =aw.GetAt(i*3+0);
		string sType =aw.GetAt(i*3+1);
		string sLength =aw.GetAt(i*3+2);
		CFieldType ft = fDouble;
		if (sType == "s" || sType == "S")
			ft = fString;
		else if (sType == "d" || sType == "D")
			ft = fDate;
		else if (sType == "n" || sType == "N")
			ft = fInt;
		else if (sType == "f" || sType == "F")
			ft = fDouble;
		else if (sType == "b" || sType == "B")
			ft = fBoolean;

		CField *pField = pDI->m_DataAccess.m_pFieldList->CreateField(ft);
		pField->SetWidth(atoi(sLength.c_str()));
		//pDI->m_DataAccess.m_pFieldList->Insert(pField,nColStart++);
		pDI->m_DataAccess.m_pFieldList->Modify(nColStart++,pField);
		if (pField->SetFieldName(sName)==false)
			return SetResultState(false,outP,GetLanguage(SetFieldNameFail));
	}


	return SetResultState(true,outP);
}
Example #28
0
/**
 * Fill lst with all field names in the list, duplicates are ignored.
 */
void CBibList::GetAllFieldNames(CStringList *lst)
{
	POSITION p = GetHeadPosition();
	while (p) {
		CBibItem *bi = (CBibItem*)GetNext(p);
		if (bi->IsRegularItem()) {
			POSITION pf = bi->GetHeadPosition();
			while (pf) {
				CField *fi = (CField*)bi->GetNext(pf);
				CString fn = fi->GetName();
				fn.MakeLower();
				if (lst->Find(fn) == NULL)
					lst->AddTail(fn);
			}
		}
	}
}
Example #29
0
/**
 * Metodo para zerar o valor dos campos da tabela
 */ 
void CTableBase::ResetFields(CStringList &sIgnoreList)
{
	CField *pField;
	POSITION p;
	CString sLabel;
	CString sTmp;

	p = m_mapFields.GetStartPosition();

	while(p)
	{
		m_mapFields.GetNextAssoc(p, sLabel, pField);
		if(sIgnoreList.Find(sLabel) == NULL)
		{
			pField->SetValue(L"");
		}
	}

}
Example #30
0
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());
	}
}