示例#1
0
/****************************************
function: writeToFile of WritingJSON

Inputs: N/A

Outputs: N/A

Description: read result vector and convert them into JSON and write them into txt file.
****************************************/
void WritingJSON::writeToFile(void){
	vector<result*>::iterator it;			//iterator of vector of pointers of result
	vector<listing*>::iterator il;			//iterator for listing vector in each result object
	vector<listing*> list;					//temp var to store listing of current result object in the loop
	string title;
	string manufacturer;
	string currency;
	string price;
	Json::FastWriter fast_writer;			//FastWriter function of json
	
	//cout<<"result set size is "<<res.size()<<endl;
	std::ofstream fil("result.txt", std::ios::out);							//generate result.txt file
																			//iterate the whole vector of pointers of result
	for(it = res.begin(); it != res.end(); it++){							
		Json::Value value;													//for each record of result, generate a new json data and according to the result object
		Json::Value arrayobj;
		value["product_name"] = (*it)->getPDname();
		list = (*it)->getList();
		//cout<<(*it)->getPDname()<<endl;
		
		for(il = list.begin(); il !=list.end(); il++){						//this loop is used to read the related listing of each result object and put them in array of json.
			Json::Value item;
			item["title"] = (*il)->getTit();
			item["manufacturer"] = (*il)->getManuf();
			item["currency"] = (*il)->getCur();
			item["price"] = (*il)->getPrice();
			arrayobj.append(item);
		}
		value["listing"] = arrayobj;
		
		fil<<reOrder(fast_writer.write(value))<<endl;						//convert json data to string and write into result.text
	}
	fil.close();
	
}
示例#2
0
文件: toc.c 项目: mfitz21/pcsx2-rr
unsigned long GetLastTrack1Addr(void)
{
 unsigned char xbuffer[4];DWORD dwStatus;
 unsigned long lmax;
 TOC xTOC;

 LockGenCDAccess();

 memset(&(xTOC),0,sizeof(xTOC));

 dwStatus=GetSCSITOC((LPTOC)&xTOC);

 UnlockGenCDAccess();

 if(dwStatus!=SS_COMP) return 0;

 addr2time(reOrder(xTOC.tracks[1].lAddr),xbuffer);

 xbuffer[0]=itob(xbuffer[0]);
 xbuffer[1]=itob(xbuffer[1]);
 xbuffer[2]=itob(xbuffer[2]);
 xbuffer[3]=itob(xbuffer[3]);

 lmax=time2addrB(xbuffer);
 if(lmax<150) return 0;

 return lmax-150;
}
示例#3
0
文件: toc.c 项目: mfitz21/pcsx2-rr
void ReadTOC(void)
{
 unsigned char xbuffer[4];DWORD dwStatus;

 LockGenCDAccess();

 memset(&(sTOC),0,sizeof(sTOC));                       // init toc infos

 dwStatus=GetSCSITOC((LPTOC)&sTOC);                    // get toc by scsi... may change that for ioctrl in xp/2k?

 UnlockGenCDAccess();

 if(dwStatus!=SS_COMP) return;

#ifdef DBGOUT  	 
 auxprintf("TOC Last %d, max %08x,%08x\n",sTOC.cLastTrack,sTOC.tracks[sTOC.cLastTrack].lAddr,reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr));
#endif 
                                                      // re-order it to psemu pro standards
 addr2time(reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr),xbuffer);

#ifdef DBGOUT  	
 auxprintf("TOC %d, %d, %d, %d\n",
           xbuffer[0],xbuffer[1],xbuffer[2],xbuffer[3]  );
#endif
           
 xbuffer[0]=itob(xbuffer[0]);
 xbuffer[1]=itob(xbuffer[1]);
 xbuffer[2]=itob(xbuffer[2]);
 xbuffer[3]=itob(xbuffer[3]);
 lMaxAddr=time2addrB(xbuffer);                         // get max data adr
}
示例#4
0
void GuiTabBookCtrl::onMouseDragged(const GuiEvent &event)
{
   Parent::onMouseDragged( event );

   if ( !mDraggingTab )
       return;

   GuiTabPageCtrl *selectedPage = NULL;
   if ( mSelectedPageNum != -1 )
      selectedPage = mPages[mSelectedPageNum].Page;

   if ( !selectedPage )
       return;

   Point2I localMouse = globalToLocalCoord( event.mousePoint );
   if( mTabRect.pointInRect( localMouse ) )
   {
      GuiTabPageCtrl *tab = findHitTab( localMouse );
      if( tab != NULL && tab != selectedPage )
      {
         S32 targetIndex = -1;
         for( S32 i = 0; i < mPages.size(); i++ )
         {
            if( mPages[i].Page == tab )
            {
               targetIndex = i;
               break;
            }
         }

         if ( targetIndex > mSelectedPageNum )
         {
            reOrder( tab, selectedPage );
         }
         else
         {
            reOrder( selectedPage, tab );
         }
      }
   }
}
void FileManager::addNewToDrag()
{
	//			add to the drop area
	if( this->_lines.size() > 7 )
	{
		delete this->_lines.first();
		this->_lines.removeAt( 0 );
	}
	FileItem* item = new FileItem( _CurrentFileName, 1, _open );
	this->_lines.append( item );
	//

	logDragFileToCompose( _CurrentFileName );

	reOrder();
	return;
}