Ejemplo n.º 1
0
PRGINTERFACE_API void  PrepareArrayForReport(CMapStringToString &mstr)
{
	//check the start position of the resister group
	int grpoffset=0;
	CString skey,sval,perrecord;
	zero = 0.0;
	if(mstr.Lookup(_T("Z19"),perrecord) && (perrecord.FindOneOf("0123456789") >= 0)){
		zero = atof(perrecord);
	}
	z14 = 0;
	if(mstr.Lookup(_T("Z14"),perrecord) && (perrecord.FindOneOf("0123456789") >= 0)){
		z14 = atoi(perrecord);
	}

	do{
		skey.Format("Z%d",31+grpoffset++*20);
		if(mstr.Lookup(skey,sval) && sval.FindOneOf("0123456789") >= 0)
			break;
	}while(grpoffset<9);
	
	--grpoffset;
	
				
	for (int grpindex = 0;grpindex < 8;grpindex++){
		skey.Format("Z%d",31+grpindex*20);
		if (mstr.Lookup(skey,sval) && (sval.FindOneOf("0123456789") >= 0) )
		{
			if(sval.FindOneOf("0123456789") != -1)
			{
				skey.Format("Z%d",31+grpindex*20+12);
				mstr.SetAt(skey,CString(Panhao[grpindex]));
				skey.Format("jhsel%d",grpindex);
				if(mstr.Lookup(skey,sval) && (sval.FindOneOf("0123456789") >= 0))
				{
					sval = _T("±")+sval;
					skey.Format("Z%d",31+grpindex*20+13);
					mstr.SetAt(skey,sval);
				}
			}
		}
	}
	return;
	//move the table and insert "/" at corresponding place
	for ( grpindex = 0;grpindex < 8;grpindex++)
		for (int subindex = 0;subindex< 14;subindex++){
			skey.Format("Z%d",31+grpindex*20+subindex);
			if (!mstr.Lookup(skey,sval) || sval.FindOneOf("0123456789") < 0)
				mstr.SetAt(skey,_T("/"));
			else	if(sval.FindOneOf("0123456789") == -1)
				mstr.SetAt(skey,_T("/"));
			else {
				mstr.RemoveKey(skey);
				skey.Format("Z%d",31+(grpindex-grpoffset)*20+subindex);
				mstr.SetAt(skey,sval);
			}
			
		}
}
Ejemplo n.º 2
0
void CDz3Handler::PrepareArrayForReport(CMapStringToString& mstr)
{
	//check the start position of the resister group
	int grpoffset=0;
	CString skey,sval;
	do{
		skey.Format("Z%d",31+grpoffset++*20);
		if(mstr.Lookup(skey,sval))
			break;
	}while(grpoffset<9);
	
	--grpoffset;
	
				
		for (int grpindex = 0;grpindex < 8;grpindex++){
			skey.Format("Z%d",31+grpindex*20);
			if (mstr.Lookup(skey,sval))
			{
				if(sval.FindOneOf("0123456789") != -1)
				{
					skey.Format("Z%d",31+grpindex*20+12);
					mstr.SetAt(skey,CString(Panhao[grpindex]));
					skey.Format("jhsel%d",grpindex);
					if(mstr.Lookup(skey,sval))
					{
						sval = _T("±")+sval;
						skey.Format("Z%d",31+grpindex*20+13);
						mstr.SetAt(skey,sval);
					}
				}
			}
		}
		
		//move the table and insert "/" at corresponding place
		for ( grpindex = 0;grpindex < 8;grpindex++)
			for (int subindex = 0;subindex< 14;subindex++){
				skey.Format("Z%d",31+grpindex*20+subindex);
				if (!mstr.Lookup(skey,sval))
					mstr.SetAt(skey,_T("/"));
				else	if(sval.FindOneOf("0123456789") == -1)
							mstr.SetAt(skey,_T("/"));
						else {
							mstr.RemoveKey(skey);
							skey.Format("Z%d",31+(grpindex-grpoffset)*20+subindex);
							mstr.SetAt(skey,sval);
						}
				
			}
}
Ejemplo n.º 3
0
int main()
{
    CMapStringToString map;

    if( !map.IsEmpty() ) _fail;
    if( map.GetCount() != 0 ) _fail;
    if( map.GetSize() != 0 ) _fail;

    map.SetAt( _T("0"), _T(" ") );
    map.SetAt( _T("1"), _T("A") );
    map.SetAt( _T("2"), _T("B") );

    CString value;
    if( !map.Lookup( _T("0"), value ) ) _fail;
    if( value != _T(" ") ) _fail;
    if( !map.Lookup( _T("1"), value ) ) _fail;
    if( value != _T("A") ) _fail;
    if( !map.Lookup( _T("2"), value ) ) _fail;
    if( value != _T("B") ) _fail;
    if( map.Lookup( _T("3"), value ) ) _fail;

    POSITION    position = map.GetStartPosition();
    CString     key;
    BOOL        bFound0 = FALSE;
    BOOL        bFound1 = FALSE;
    BOOL        bFound2 = FALSE;
    while( position != NULL ) {
        map.GetNextAssoc( position, key, value );
        if( key == _T("0") ) {
            if( bFound0 ) _fail;
            if( value != _T(" ") ) _fail;
            bFound0 = TRUE;
        } else if( key == _T("1") ) {
            if( bFound1 ) _fail;
            if( value != _T("A") ) _fail;
            bFound1 = TRUE;
        } else if( key == _T("2") ) {
            if( bFound2 ) _fail;
            if( value != _T("B") ) _fail;
            bFound2 = TRUE;
        } else {
            _fail;
        }
    }
    if( !bFound0 ) _fail;
    if( !bFound1 ) _fail;
    if( !bFound2 ) _fail;

    map.RemoveKey( _T("0") );
    if( map.Lookup( _T("0"), value ) ) _fail;

    CMapStringToString smap1;
    CMapStringToString smap2;
    smap1[_T("0")] = _T(" ");
    smap1[_T("1")] = _T("A");
    smap1[_T("2")] = _T("B");
    
    CMemFile file;
    CArchive ar( &file, CArchive::store );
    smap1.Serialize( ar );
    ar.Close();

    file.Seek( 0, CFile::begin );
    CArchive ar2( &file, CArchive::load );
    smap2.Serialize( ar2 );
    ar2.Close();

    if( smap2[_T("0")] != _T(" ") ) _fail;
    if( smap2[_T("1")] != _T("A") ) _fail;
    if( smap2[_T("2")] != _T("B") ) _fail;

    _PASS;
}