当前位置: 首页>>代码示例>>C++>>正文


C++ Fill函数代码示例

本文整理汇总了C++中Fill函数的典型用法代码示例。如果您正苦于以下问题:C++ Fill函数的具体用法?C++ Fill怎么用?C++ Fill使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Fill函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: uInd

void EN
( const SparseMatrix<Real>& A,
  const Matrix<Real>& b,
        Real lambda1,
        Real lambda2,
        Matrix<Real>& x,
  const qp::affine::Ctrl<Real>& ctrl )
{
    EL_DEBUG_CSE
    const Int m = A.Height();
    const Int n = A.Width();
    const Range<Int> uInd(0,n), vInd(n,2*n), rInd(2*n,2*n+m);
    SparseMatrix<Real> Q, AHat, G;
    Matrix<Real> c, h;

    // Q := | 2*lambda_2     0      0 |
    //      |     0      2*lambda_2 0 |
    //      |     0          0      2 |
    // ================================
    Zeros( Q, 2*n+m, 2*n+m );
    Q.Reserve( 2*n+m );
    for( Int e=0; e<2*n; ++e )
        Q.QueueUpdate( e, e, 2*lambda2 );
    for( Int e=0; e<m; ++e )
        Q.QueueUpdate( 2*n+e, 2*n+e, Real(1) );
    Q.ProcessQueues();

    // c := lambda_1*[1;1;0]
    // =====================
    Zeros( c, 2*n+m, 1 );
    auto cuv = c( IR(0,2*n), ALL );
    Fill( cuv, lambda1 );

    // \hat A := [A, -A, I]
    // ====================
    const Int numEntriesA = A.NumEntries();
    Zeros( AHat, m, 2*n+m );
    AHat.Reserve( 2*numEntriesA+m );
    for( Int e=0; e<numEntriesA; ++e )
    {
        AHat.QueueUpdate( A.Row(e), A.Col(e),    A.Value(e) );
        AHat.QueueUpdate( A.Row(e), A.Col(e)+n, -A.Value(e) );
    }
    for( Int e=0; e<m; ++e )
        AHat.QueueUpdate( e, e+2*n, Real(1) );
    AHat.ProcessQueues();

    // G := | -I  0 0 |
    //      |  0 -I 0 |
    // ================
    Zeros( G, 2*n, 2*n+m );
    G.Reserve( 2*m );
    for( Int e=0; e<2*m; ++e )
        G.QueueUpdate( e, e, Real(-1) );
    G.ProcessQueues();

    // h := 0
    // ======
    Zeros( h, 2*n, 1 );

    // Solve the affine QP
    // ===================
    Matrix<Real> xHat, y, z, s;
    QP( Q, AHat, G, b, c, h, xHat, y, z, s, ctrl );

    // x := u - v
    // ==========
    x = xHat( uInd, ALL );
    x -= xHat( vInd, ALL );
}
开发者ID:elemental,项目名称:Elemental,代码行数:70,代码来源:EN.cpp

示例2: Rectangle

 Rectangle(Point const & edge, double width, double height,
     Fill const & fill = Fill(), Stroke const & stroke = Stroke())
     : Shape(fill, stroke), edge(edge), width(width),
     height(height) { }
开发者ID:fedra,项目名称:Path-Plotter,代码行数:4,代码来源:simple_svg_1.0.0.hpp

示例3: Polyline

 Polyline(Fill const & fill = Fill(), Stroke const & stroke = Stroke())
     : Shape(fill, stroke) { }
开发者ID:fedra,项目名称:Path-Plotter,代码行数:2,代码来源:simple_svg_1.0.0.hpp

示例4: Fill

 void Fill(const ProtectedAirspaceWarningManager &awm) {
   const ProtectedAirspaceWarningManager::Lease lease(awm);
   Fill(lease);
 }
开发者ID:henrik1g,项目名称:XCSoar,代码行数:4,代码来源:MapItemListBuilder.cpp

示例5: Shape

 Shape(Fill const & fill = Fill(), Stroke const & stroke = Stroke())
     : fill(fill), stroke(stroke) { }
开发者ID:fedra,项目名称:Path-Plotter,代码行数:2,代码来源:simple_svg_1.0.0.hpp

示例6: Store

void CChunkRenderNSF::StoreSample(const CDSample *pDSample)
{
	// Store sample and fill with zeros
	Store(pDSample->GetData(), pDSample->GetSize());
	Fill(CCompiler::AdjustSampleAddress(GetAbsoluteAddr()));
}
开发者ID:BattyBovine,项目名称:UmaTracker,代码行数:6,代码来源:ChunkRenderBinary.cpp

示例7: Reject

//---------------------------------------------------------------------------
bool File_Dxw::FileHeader_Begin()
{
    XMLDocument document;
    if (!FileHeader_Begin_XML(document))
       return false;

    {
        XMLElement* Root=document.FirstChildElement("indexFile");
        if (Root)
        {
            const char* Attribute=Root->Attribute("xmlns");
            if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=__T("urn:digimetrics-xml-wrapper"))
            {
                Reject("DXW");
                return false;
            }

            Accept("DXW");
            Fill(Stream_General, 0, General_Format, "DXW");

            ReferenceFiles_Accept(this, Config);

            #if defined(MEDIAINFO_REFERENCES_YES)
            XMLElement* Track=Root->FirstChildElement();
            while (Track)
            {
                if (string(Track->Value())=="clip")
                {
                    sequence* Sequence=new sequence;

                    Attribute=Track->Attribute("file");
                    if (Attribute)
                    {
                        Sequence->AddFileName(Ztring().From_UTF8(Attribute));

                        Attribute=Track->Attribute("type");
                        if (Attribute)
                        {
                            Ztring StreamKind; StreamKind.From_UTF8(Attribute);
                            if (StreamKind==__T("video"))
                                 Sequence->StreamKind=Stream_Video;
                            if (StreamKind==__T("audio"))
                                 Sequence->StreamKind=Stream_Audio;
                            if (StreamKind==__T("data"))
                                 Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
                        }

                        Attribute=Track->Attribute("source");
                        if (Attribute)
                        {
                            Ztring StreamKind; StreamKind.From_UTF8(Attribute);
                            if (StreamKind==__T("main"))
                                 Sequence->IsMain=true;
                        }

                        Attribute=Track->Attribute("default_timecode");
                        if (Attribute)
                        {
                            Sequence->Config["File_DefaultTimeCode"].From_UTF8(Attribute);
                        }

                        Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
                    }

                    Attribute=Track->Attribute("framerate");
                    if (Attribute)
                    {
                        Sequence->FrameRate_Set(Ztring().From_UTF8(Attribute).To_float64());

                        Attribute=Track->Attribute("type");
                        if (Attribute)
                        {
                            Ztring StreamKind; StreamKind.From_UTF8(Attribute);
                            if (StreamKind==__T("video"))
                                 Sequence->StreamKind=Stream_Video;
                            if (StreamKind==__T("audio"))
                                 Sequence->StreamKind=Stream_Audio;
                            if (StreamKind==__T("data"))
                                 Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing
                        }

                        XMLElement* Frame=Track->FirstChildElement();
                        while (Frame)
                        {
                            if (string(Frame->Value())=="frame")
                            {
                                Attribute=Frame->Attribute("file");
                                if (Attribute)
                                    Sequence->AddFileName(Ztring().From_UTF8(Attribute));
                            }

                            Frame=Frame->NextSiblingElement();
                        }
                    }

                    Sequence->StreamID=ReferenceFiles->Sequences_Size()+1;
                    ReferenceFiles->AddSequence(Sequence);
                }

//.........这里部分代码省略.........
开发者ID:MediaArea,项目名称:MediaInfoLib,代码行数:101,代码来源:File_Dxw.cpp

示例8: Skip_C4

//---------------------------------------------------------------------------
void File_Ivf::FileHeader_Parse()
{
    //Parsing
    int32u frame_rate_num, frame_rate_den, frame_count, fourcc;
    int16u version, header_size, width, height;

    Skip_C4 (                                                   "Signature");
    Get_L2 (version,                                            "Version");
    if (version==0)
    {
        Get_L2 (header_size,                                    "Header Size");
        if (header_size>=32)
        {
            Get_C4 (fourcc,                                     "Fourcc");
            Get_L2 (width,                                      "Width");
            Get_L2 (height,                                     "Height");
            Get_L4 (frame_rate_num,                             "FrameRate Numerator");
            Get_L4 (frame_rate_den,                             "FrameRate Denominator");
            Get_L4 (frame_count,                                "Frame Count");
            Skip_L4(                                            "Unused");
            if (header_size-32)
                Skip_XX(header_size-32,                         "Unknown");
        }
        else
        {
            fourcc=0x00000000;
            width=0;
            height=0;
            frame_rate_num=0;
            frame_rate_den=0;
            frame_count=0;
        }
    }
    else
    {
        header_size=0;
        fourcc=0x00000000;
        width=0;
        height=0;
        frame_rate_num=0;
        frame_rate_den=0;
        frame_count=0;
    }

    FILLING_BEGIN();
        Accept("IVF");

        Fill(Stream_General, 0, General_Format, "IVF");

        if (version==0 && header_size>=32)
        {
            Stream_Prepare(Stream_Video);
            CodecID_Fill(Ztring().From_CC4(fourcc), Stream_Video, 0, InfoCodecID_Format_Riff);
            Fill(Stream_Video, 0, Video_FrameRate, (float)frame_rate_num / frame_rate_den);
            Fill(Stream_Video, 0, Video_FrameCount, frame_count);
            Fill(Stream_Video, 0, Video_Width, width);
            Fill(Stream_Video, 0, Video_Height, height);
            Fill(Stream_Video, 0, Video_StreamSize, File_Size-header_size-12*frame_count); //Overhead is 12 byte per frame
        }

        //No more need data
        Finish("IVF");
    FILLING_END();
}
开发者ID:asfdfdfd,项目名称:MediaInfoLib-Avdump2-Mac,代码行数:65,代码来源:File_Ivf.cpp

示例9: Fill

/****************************************************************************
@Function 		Fill
@Input			pOb				Object to fill with
@Return			int				-1 if the block if the best option is already full
@Description	Note: Ask Aaron
****************************************************************************/
int CBlock::Fill(
	CObject	* const pOb)
{
	SVtx	*pVtx;
	int		i;
	SMesh	*pMesh;

	/*
		Build blocks from the large meshes
	*/
	if(!pOb->m_vMeshLg.empty()) {
		pMesh = &pOb->m_vMeshLg.back();

//		_RPT1(_CRT_WARN, "Fill() using large with %d vtx\n", pMesh->nVtxNum);

		// Find the vertex with the fewest unused triangles
		for(i = 0; i < pMesh->nVtxNum; ++i) {
			pVtx = pMesh->ppVtx[i];

			if(pVtx->nTriNumFree == 1) {
				if(FillFrom(pMesh, pVtx, pOb))
					return Fill(pOb);
			}
		}

		if(m_sOptBest.IsEmpty()) {
			// Just start from any old vertex
			for(i = 0; i < pMesh->nVtxNum; ++i) {
				pVtx = pMesh->ppVtx[i];

				if(pVtx->nTriNumFree) {
					if(FillFrom(pMesh, pVtx, pOb))
						return Fill(pOb);
					break;
				}
			}

			if(m_sOptBest.IsEmpty()) {
				pOb->m_vMeshLg.pop_back();					// Delete the mesh from the list
				return Fill(pOb);
			}
		}

		if(m_sOptBest.IsFull())
			return -1;
	}

	/*
		Match together the small meshes into blocks
	*/
	_ASSERT(m_sOptBest.IsEmpty());
	i = m_nVtxLimit - m_sOptBest.nVtxNum - 3;

//	_RPT0(_CRT_WARN, "Fill() grouping small ");

	// Starting with the largest meshes, lump them into this block
	while(i >= 0 && (m_nVtxLimit - m_sOptBest.nVtxNum) >= 3) {
		if(pOb->m_pvMesh[i].empty()) {
			--i;
			continue;
		}

		pMesh = &pOb->m_pvMesh[i].back();
		m_sOptBest.Add(pMesh);
//		_RPT1(_CRT_WARN, "+%d", pMesh->nVtxNum);
		pOb->m_pvMesh[i].pop_back();
		i = PVRT_MIN(i, m_nVtxLimit - m_sOptBest.nVtxNum - 3);
	}

	// If there's any space left in this block (and clearly there are no blocks
	// just the right size to fit) then take SOME of the largest block available.
	if(!m_sOptBest.IsFull()) {
		m_sOpt.Copy(&m_sOptBest);

		// Note: This loop purposely does not check m_pvMesh[0] - any block
		// which is looking to grab more geometry would have already sucked
		// up those meshes
		for(i = (m_nVtxLimit-3); i; --i) {
			if(!pOb->m_pvMesh[i].empty()) {
				pMesh = &pOb->m_pvMesh[i].back();

				_ASSERT(pMesh->ppVtx[0]->nTriNumFree);
				_ASSERT(!m_sOpt.UsingVertex(pMesh->ppVtx[0]));

				m_sOpt.AddVertex(pMesh->ppVtx[0]);
//				_RPT1(_CRT_WARN, "(+%d)\n", pMesh->nVtxNum);
				AddBestTriangles(pOb);

				m_sOptBest.Copy(&m_sOpt);
				_ASSERT(m_sOptBest.IsFull());
				return i;
			}
		}
	}
//.........这里部分代码省略.........
开发者ID:006,项目名称:ios_lab,代码行数:101,代码来源:PVRTGeometry.cpp

示例10: Reject

//---------------------------------------------------------------------------
bool File_Hls::FileHeader_Begin()
{
    //Element_Size
    if (File_Size>1024*1024 || File_Size<10)
    {
        Reject("HLS");
        return false; //HLS files are not big
    }

    if (Buffer_Size<File_Size)
        return false; //Wait for complete file

    Ztring Document; Document.From_UTF8((char*)Buffer, Buffer_Size);
    ZtringList Lines;
    size_t LinesSeparator_Pos=Document.find_first_of(__T("\r\n"));
    if (LinesSeparator_Pos>File_Size-1)
    {
        Reject("HLS");
        return false;
    }
    Ztring LinesSeparator;
    if (Document[LinesSeparator_Pos]==__T('\r') && LinesSeparator_Pos+1<Document.size() && Document[LinesSeparator_Pos+1]==__T('\n'))
        LinesSeparator=__T("\r\n");
    else if (Document[LinesSeparator_Pos]==__T('\r'))
        LinesSeparator=__T("\r");
    else if (Document[LinesSeparator_Pos]==__T('\n'))
        LinesSeparator=__T("\n");
    else
    {
        Reject("HLS");
        return false;
    }
    Lines.Separator_Set(0, LinesSeparator);
    Lines.Write(Document);

    if (Lines(0)!=__T("#EXTM3U"))
    {
        Reject("HLS");
        return false;
    }

    Accept("HLS");
    Fill(Stream_General, 0, General_Format, "HLS");

    ReferenceFiles=new File__ReferenceFilesHelper(this, Config);
    if (!IsSub)
        ReferenceFiles->ContainerHasNoId=true;

    File__ReferenceFilesHelper::reference ReferenceFile;

    bool IsGroup=false;
    for (size_t Line=0; Line<Lines.size(); Line++)
    {
        if (!Lines[Line].empty())
        {
            if (Lines[Line].find(__T("#EXT-X-KEY:"))==0)
            {
                ZtringListList List;
                List.Separator_Set(0, __T(","));
                List.Separator_Set(1, __T("="));
                List.Write(Lines[Line].substr(11, string::npos));
                for (size_t Pos=0; Pos<List.size(); ++Pos)
                {
                    if (List[Pos](0)==__T("METHOD"))
                    {
                        if (List[Pos](1).find(__T("AES-128"))==0)
                        {
                            Fill(Stream_General, 0, General_Encryption_Format, "AES");
                            Fill(Stream_General, 0, General_Encryption_Length, "128");
                            Fill(Stream_General, 0, General_Encryption_Method, "Segment");
                            Fill(Stream_General, 0, General_Encryption_Mode, "CBC");
                            Fill(Stream_General, 0, General_Encryption_Padding, "PKCS7");
                            Fill(Stream_General, 0, General_Encryption_InitializationVector, "Sequence number");

                            #if MEDIAINFO_AES
                            //Trying to get the key from FileName.FileExt.key
                            if (Config->Encryption_Key_Get().empty())
                            {
                                File KeyFile;
                                if (KeyFile.Open(File_Name+__T(".key")))
                                {
                                    if (KeyFile.Size_Get()==16)
                                    {
                                        int8u Key[16];
                                        if (KeyFile.Read(Key, 16)==16)
                                            Config->Encryption_Key_Set(Key, 16);
                                    }
                                    else
                                        Fill(Stream_General, 0, "Encryption_Key_Problem", KeyFile.Size_Get());
                                }
                            }
                            #endif
                        }
                        Fill(Stream_General, 0, General_Encryption, List[Pos](1));
                    }
                }
            }
            else if (Lines[Line].find(__T("#EXT-X-STREAM-INF:"))==0)
            {
//.........这里部分代码省略.........
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:101,代码来源:File_Hls.cpp

示例11: checktracks

void checktracks(TString inputfile, TString outputfile)
{

  //"HiForest_Centrality_Unpacker_Hydjet_Quenched_MinBias_5020GeV_750_RECODEBUG_v0_merged_forest_0.root";

  TFile *_file0 = new TFile(inputfile);

  TTreeReader readerTrack("anaTrack/trackTree",_file0);
  TTreeReaderValue<int> ntrk(readerTrack, "nTrk");
  TTreeReaderArray<float> trkDxyError1(readerTrack, "trkDxyError1");
  TTreeReaderArray<float> trkDxy1(readerTrack, "trkDxy1");
  TTreeReaderArray<float> trkPt(readerTrack, "trkPt");
  TTreeReaderArray<float> trkPhi(readerTrack, "trkPhi");
  TTreeReaderArray<float> trkEta(readerTrack, "trkEta");
  TTreeReaderArray<float> trkMVA(readerTrack, "trkMVA");

  TTreeReaderArray<float> trkChi2(readerTrack, "trkChi2");
  TTreeReaderArray<float> trkDz1(readerTrack, "trkDz1");
  TTreeReaderArray<float> trkDzError1(readerTrack, "trkDzError1");
  

  
  TTreeReaderArray<bool> highPurity(readerTrack, "highPurity");
  

#ifdef Run2011
  TTreeReaderArray<int> trkNhit(readerTrack, "trkNHit");
  TTreeReaderArray<int> trkAlgo(readerTrack, "trkAlgo");
  TTreeReaderArray<int> trkOriginalAlgo(readerTrack, "trkOriginalAlgo");
  TTreeReaderArray<float> trkNdof(readerTrack, "trkNdof");
#else
  TTreeReaderArray<unsigned char> trkNhit(readerTrack, "trkNHit");
  TTreeReaderArray<unsigned char> trkAlgo(readerTrack, "trkAlgo");
  TTreeReaderArray<unsigned char> trkOriginalAlgo(readerTrack, "trkOriginalAlgo");
  TTreeReaderArray<unsigned char>   trkNdof(readerTrack, "trkNdof");
#endif

  float ptmax = 20;

  auto hpt = getH("hpt",50,0,ptmax);
  auto hpt4 = getH("hpt4",50,0,ptmax);
  auto hpt5 = getH("hpt5",50,0,2);
  auto hpt6 = getH("hpt6",50,0,ptmax);
  auto hpt7 = getH("hpt7",50,0,ptmax);

  auto hphi = getH("hphi",30,-3.2,3.2);
  auto heta = getH("heta",30,-3,3);
  auto hnhit = getH("hnhit",26,5,30);
  auto hnTrk = getH("hnTrk",50,0,7000);

  auto hchi2n = getH("hchi2n",50,0,6);



  auto hIPsign = getH("hIPsign",50,-50,50);
  auto hZsign = getH("hZsign",50,-50,50);

  auto hmva4 = getH("hmva4",50,-1,1);
  auto hmva5 = getH("hmva5",50,-1,1);
  auto hmva6 = getH("hmva6",50,-1,1);
  auto hmva7 = getH("hmva7",50,-1,1);

  auto halgos = new TH2F("halgos","halgos",8,4,12,8,4,12);

  int onep = readerTrack.GetEntries(true)/100;
  int counter = 0;
  while(readerTrack.Next()) {
  //  while(readerTrack.Next() && counter<1000) {
    counter++;
    if (counter%onep == 0) std::cout<<counter/onep<<"\%"<<std::endl;
    hnTrk->Fill(*ntrk);
    for (int i=0;i<*ntrk;i++) {
      if (highPurity[i])
	hIPsign->Fill(trkDxy1[i]/trkDxyError1[i]);
	hZsign->Fill(trkDz1[i]/trkDzError1[i]);

	hchi2n->Fill(trkChi2[i]/trkNdof[i]);

	
	if (trkAlgo[i]==4) {hmva4->Fill(trkMVA[i]);hpt4->Fill(trkPt[i]); }
	if (trkAlgo[i]==5) {hmva5->Fill(trkMVA[i]);hpt5->Fill(trkPt[i]); }
	if (trkAlgo[i]==6) {hmva6->Fill(trkMVA[i]);hpt6->Fill(trkPt[i]); }
	if (trkAlgo[i]==7) {hmva7->Fill(trkMVA[i]);hpt7->Fill(trkPt[i]); }
	
	hphi->Fill(trkPhi[i]);
	heta->Fill(trkEta[i]);
	hnhit->Fill(trkNhit[i]);
	hpt->Fill(trkPt[i]);
	
	halgos->Fill(trkAlgo[i],trkOriginalAlgo[i]);

	
    }
    
  }

  std::cout<<counter<<std::endl;


  TFile *fout = new TFile(outputfile,"recreate");
//.........这里部分代码省略.........
开发者ID:istaslis,项目名称:trackcomparison,代码行数:101,代码来源:buildhist.C

示例12: Get_L1

//---------------------------------------------------------------------------
void File_Lagarith::Read_Buffer_Continue()
{
    //Parsing
    int8u version;
    Get_L1 (version,                                            "version");
    Skip_XX(Element_Size-Element_Offset,                        "data");

    FILLING_BEGIN();
        Accept();
        Fill();
        switch (version)
        {
            case 0x02 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break;
            case 0x03 : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:2"); Fill(Stream_Video, 0, Video_BitDepth, 8); break;
            case 0x04 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break;
            case 0x05 : Fill(Stream_Video, 0, Video_ColorSpace, "Grey"); break;
            case 0x06 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break;
            case 0x07 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break;
            case 0x08 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break;
            case 0x09 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break;
            case 0x0A : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break;
            case 0x0B : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break;
            default   : ;
        }

    FILLING_END();
    Finish();
}
开发者ID:Murder66,项目名称:mpc-hc-master,代码行数:29,代码来源:File_Lagarith.cpp

示例13: Stream_Prepare

//---------------------------------------------------------------------------
void File_Lagarith::Streams_Fill()
{
    Stream_Prepare(Stream_Video);
    Fill(Stream_Video, 0, Video_Format, "Lagarith");
}
开发者ID:Murder66,项目名称:mpc-hc-master,代码行数:6,代码来源:File_Lagarith.cpp

示例14: Reject

//---------------------------------------------------------------------------
bool File_Xmp::FileHeader_Begin()
{
    XMLDocument document;
    if (!FileHeader_Begin_XML(document))
       return false;

    std::string NameSpace;
    XMLElement* XmpMeta=document.FirstChildElement("xmpmeta");
    if (XmpMeta==NULL)
    {
        NameSpace="x:";
        XmpMeta=document.FirstChildElement((NameSpace+"xmpmeta").c_str());
    }
    if (!XmpMeta)
    {
        Reject("XMP");
        return false;
    }

    XMLElement* Rdf=XmpMeta->FirstChildElement("RDF");
    if (Rdf==NULL)
    {
        NameSpace="rdf:";
        Rdf=XmpMeta->FirstChildElement((NameSpace+"RDF").c_str());
    }
    if (!Rdf)
    {
        Reject("XMP");
        return false;
    }

    Accept("XMP");

    for (XMLElement* Rdf_Item=Rdf->FirstChildElement(); Rdf_Item; Rdf_Item=Rdf_Item->NextSiblingElement())
    {
        //RDF item
        if (!strcmp(Rdf_Item->Value(), (NameSpace+"Description").c_str()))
        {
            const char* Attribute;

            Attribute=Rdf_Item->Attribute("xmlns:pdfaid");
            if (Attribute)
            {
                string Profile;

                if (strcmp(Attribute, "http://www.aiim.org/pdfa/ns/id/"))
                    Profile=Attribute;
                else
                {
                    Profile+="A";

                    Attribute=Rdf_Item->Attribute("pdfaid:part");
                    if (Attribute)
                    {
                        Profile+='-';
                        Profile+=Attribute;

                        Attribute=Rdf_Item->Attribute("pdfaid:conformance");
                        if (Attribute)
                        {
                            string Conformance(Attribute);
                            if (Conformance.size()==1 && Conformance[0]>='A' && Conformance[0]<='Z')
                                Conformance[0]+=0x20; // From "A" to "a"
                            Profile+=Conformance;
                        }
                    }
                }

                Fill(Stream_General, 0, General_Format_Profile, Profile);
            }
        }
    }

    Finish();
    return true;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:77,代码来源:File_Xmp.cpp

示例15: Skip_B4

//---------------------------------------------------------------------------
void File_ImpulseTracker::Read_Buffer_Continue()
{
    //Parsing
    Ztring SongName;
    int16u OrdNum, InsNum, SmpNum, PatNum, Flags, Special;
    int8u  VersionMajor, VersionMinor, SoftwareVersionMajor, SoftwareVersionMinor, IS, TS;
    bool Stereo;
    Skip_B4(                                                    "Signature");

    Get_Local(26, SongName,                                     "Song name");
    Skip_L1(                                                    "Unknown");
    Skip_L1(                                                    "Unknown");
    Get_L2 (OrdNum,                                             "Orders count");
    Get_L2 (InsNum,                                             "Instruments count");
    Get_L2 (SmpNum,                                             "Samples count");
    Get_L2 (PatNum,                                             "Paterns count");
    Get_L1 (SoftwareVersionMinor,                               "Cwt/v (Minor)");
    Get_L1 (SoftwareVersionMajor,                               "Cwt/v (Major)");
    Get_L1 (VersionMinor,                                       "Cwt (Minor)");
    Get_L1 (VersionMajor,                                       "Cwt (Major)");
    Get_L2 (Flags,                                              "Flags");
        Get_Flags (Flags, 0, Stereo,                            "Stereo");
        Skip_Flags(Flags, 1,                                    "Vol0MixOptimizations");
        Skip_Flags(Flags, 2,                                    "Use instruments/Samples");
        Skip_Flags(Flags, 3,                                    "Linear/Amiga slides");
        Skip_Flags(Flags, 4,                                    "Old/IT Effects");
    Get_L2 (Special,                                            "Special");
        Skip_Flags(Special, 0,                                  "Song Message attached");
    Skip_L1(                                                    "Global volume");
    Skip_L1(                                                    "Mix volume");
    Get_L1 (IS,                                                 "Initial Speed");
    Get_L1 (TS,                                                 "Initial Temp");
    Skip_L1(                                                    "Panning separation between channels");
    Skip_L1(                                                    "0");
    Skip_L2(                                                    "Message Length");
    Skip_L4(                                                    "Message Offset");
    Skip_L1(                                                    "Unknown");
    Skip_L1(                                                    "Unknown");
    Skip_L1(                                                    "Unknown");
    Skip_L1(                                                    "Unknown");
    Skip_L1(                                                    "Unknown");
    Skip_XX(64,                                                 "Chnl Pan");
    Skip_XX(64,                                                 "Chnl Vol");
    Skip_XX(OrdNum,                                             "Orders");
    Skip_XX(InsNum*4,                                           "Instruments");
    Skip_XX(SmpNum*4,                                           "Samples");
    Skip_XX(PatNum*4,                                           "Patterns");

    FILLING_BEGIN();
        Accept("Impulse Tracker");

        Fill(Stream_General, 0, General_Format, "Impulse Tracker");
        Fill(Stream_General, 0, General_Format_Version, Ztring(__T("Version "))+Ztring::ToZtring(VersionMajor)+__T(".")+Ztring::ToZtring(VersionMinor/16)+Ztring::ToZtring(VersionMinor%16));
        Fill(Stream_General, 0, General_Track, SongName);
        Fill(Stream_General, 0, General_Encoded_Application, Ztring(__T("Impulse Tracker ")+Ztring::ToZtring(SoftwareVersionMajor)+__T(".")+Ztring::ToZtring(SoftwareVersionMinor/16)+Ztring::ToZtring(SoftwareVersionMinor%16)));
        Fill(Stream_General, 0, "BPM", TS);

        Stream_Prepare(Stream_Audio);
        Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Stereo?2:1);

        //No more need data
        Finish("Impulse Tracker");
    FILLING_END();
}
开发者ID:3F,项目名称:FlightSDCpp,代码行数:65,代码来源:File_ImpulseTracker.cpp


注:本文中的Fill函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。