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


C++ Ztring::find方法代码示例

本文整理汇总了C++中Ztring::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Ztring::find方法的具体用法?C++ Ztring::find怎么用?C++ Ztring::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ztring的用法示例。


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

示例1: while

Ztring ZtringListList::Read1 (size_type Pos1) const
{
    Ztring ToReturn;
    size_type Size=size()-1;
    for (size_type Pos=0; Pos<Size; Pos++)
        ToReturn+=operator[](Pos).Read(Pos1)+Separator[0];
    ToReturn+=operator[](Size).Read(Pos1);

    //Delete all useless separators at the end
    if(ToReturn(ToReturn.size()-1)==Separator[0][Separator[0].size()-1]) //Optimize speed
        while (ToReturn.find(Separator[0].c_str(), ToReturn.size()-Separator[0].size())!=std::string::npos)
            ToReturn.resize(ToReturn.size()-Separator[0].size());

    return ToReturn;
}
开发者ID:aleksei-t,项目名称:flylinkdc-r5xx,代码行数:15,代码来源:ZtringListList.cpp

示例2: Configuration

//---------------------------------------------------------------------------
void File_Cmml::Configuration()
{
    Element_Name("Configuration");

    //Parsing
    Ztring Data;
    Get_UTF8(Element_Size, Data,                                "Data");

    FILLING_BEGIN();
        Ztring Value;
        Value=Data.SubString(_T("<head>"), _T("</head>"));
        if (!Value.empty())
            Fill(Stream_Text, 0, Text_Title, Value.SubString(_T("<title>"), _T("</title>")));
        if (Data.find(_T("<clip"))!=string::npos)
            Finish("CMML");
    FILLING_END();
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:18,代码来源:File_Cmml.cpp

示例3: Read

//---------------------------------------------------------------------------
// Read
Ztring ZtringListList::Read () const
{
    //Integrity
    if (size()==0)
        return _T("");

    Ztring ToReturn;
    size_type Size=size()-1;
    for (size_type Pos0=0; Pos0<Size; Pos0++)
        ToReturn+=Read(Pos0)+Separator[0];
    ToReturn+=Read(Size);

    //Delete all useless separators at the end
    if(ToReturn.size()>0 && Separator[0].size() && ToReturn(ToReturn.size()-1)==Separator[0][Separator[0].size()-1]) //Optimize speed
        while (ToReturn.find(Separator[0].c_str(), ToReturn.size()-Separator[0].size())!=std::string::npos)
            ToReturn.resize(ToReturn.size()-Separator[0].size());

    return ToReturn;
}
开发者ID:anelson,项目名称:panoply,代码行数:21,代码来源:ZtringListList.cpp

示例4: Read

//---------------------------------------------------------------------------
// Read
Ztring ZtringList::Read () const
{
    //Integrity
    if (size()==0)
        return _T("");

    Ztring Retour;
    for (size_type Pos=0; Pos<size(); Pos++)
    {
        if (operator[](Pos).find(Separator[0])==std::string::npos)
            Retour+=operator[](Pos)+Separator[0];
        else
            Retour+=Quote+operator[](Pos)+Quote+Separator[0];
    }

    //delete all useless separators at the end
    while (Retour.find(Separator[0].c_str(), Retour.size()-Separator[0].size())!=std::string::npos)
        Retour.resize(Retour.size()-Separator[0].size());

    return Retour;
}
开发者ID:aidv,项目名称:scripts,代码行数:23,代码来源:ZtringList.cpp

示例5: Read

//---------------------------------------------------------------------------
// Read
Ztring ZtringList::Read () const
{
    //Integrity
    if (size()==0)
        return Ztring();

    Ztring Retour;
    Ztring ToFind=Separator[0]+Quote[0]+__T("\r\n");
    for (size_type Pos=0; Pos<size(); Pos++)
    {
        if (operator[](Pos).find_first_of(ToFind)==std::string::npos)
            Retour+=operator[](Pos)+Separator[0];
        else if (operator[](Pos).find(Separator[0])==std::string::npos
              && operator[](Pos).find(Quote)==std::string::npos
              && operator[](Pos).find('\r')==std::string::npos
              && operator[](Pos).find('\n')==std::string::npos)
            Retour+=operator[](Pos)+Separator[0];
        else
        {
            if (operator[](Pos).find(Quote)==std::string::npos)
                Retour+=Quote+operator[](Pos)+Quote+Separator[0];
            else
            {
                Ztring Value=operator[](Pos);
                Value.FindAndReplace(Quote, Quote+Quote, 0, Ztring_Recursive);
                Retour+=Quote+Value+Quote+Separator[0];
            }
        }
    }

    //delete all useless separators at the end
    //while (Retour.find(Separator[0].c_str(), Retour.size()-Separator[0].size())!=std::string::npos)
    if (Retour.find(Separator[0].c_str(), Retour.size()-Separator[0].size())!=std::string::npos)
        Retour.resize(Retour.size()-Separator[0].size());

    return Retour;
}
开发者ID:3F,项目名称:FlightSDCpp,代码行数:39,代码来源:ZtringList.cpp

示例6: Read_Buffer_Continue


//.........这里部分代码省略.........
        Skip_L2(                                                "0x0000");
        Skip_L4(                                                "0x00000000");
        Skip_L4(                                                "0x0000002A");
        Skip_L4(                                                "Unknown (same 1/2/3)");
        Skip_L4(                                                "Unknown (same 1/2/3)");
        Info_L1(Number,                                         "Ordered number"); Element_Info1(Number);
        Skip_L4(                                                "0x00000000");
        Element_Info1(Name);
        if (Unknown_Length+31!=Size)
        {
            Reject();
            return;
        }
        Element_End();
    }
    Element_End();
    Skip_L2(                                                    "0x0000");
    Skip_L2(                                                    "0x0018");
    Skip_L4(                                                    "0x00000001");
    Skip_L2(                                                    "0x0018");
    Skip_L4(                                                    "0x00000001");
    Skip_L2(                                                    "0x0001");
    Skip_L3(                                                    "0x00095A");
    Get_L4 (Unknown_Length,                                     "Opaque length");
    Skip_XX(Unknown_Length,                                     "Opaque");
    Skip_L3(                                                    "0x00045A");
    Skip_L4(                                                    "0x00000016");
    Skip_L4(                                                    "0x06002026");
    Skip_L4(                                                    "0x00000000");
    Skip_L2(                                                    "0x0000");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "0x00000000");
    Skip_L3(                                                    "0x00025A");
    Skip_L4(                                                    "0x00000015");
    Skip_L4(                                                    "0x075A2032");
    Skip_L4(                                                    "0x00000C00");
    Skip_L4(                                                    "0x01204200");
    Skip_L4(                                                    "0x01000000");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "0x00025A00");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "0x015A0000");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "Unknown");
    Skip_L4(                                                    "0x01000000");
    Get_L4 (FileName_Count,                                     "File name count");
    if (13*FileName_Count>Element_Size)
    {
        Reject();
        return;
    }
    Get_L4 (Directory_Length,                                   "Directory length");
    Get_UTF8(Directory_Length, Directory,                       "Directory");
    Skip_L4(                                                    "0x00000000");
    Element_Begin1("File names");
    size_t Pos_Offset=0;
    for (int32u Pos=0; Pos<FileName_Count; Pos++)
    {
        Ztring Name;
        int32u Name_Length, Purpose;
        Element_Begin1("File names");
        Skip_L1(                                                "0x0002");
        Skip_L4(                                                "Ordered number except WAV files and -1");
        Get_L4 (Name_Length,                                    "Name length");
        Get_UTF8(Name_Length, Name,                             "Name"); Element_Name(Name);
        Get_C4 (Purpose,                                        "Purpose (e.g. EVAW for .wav files)");
        Element_End();

        switch (Purpose)
        {
            case 0x45564157:
                            if (Pos-Pos_Offset<Names.size()
                             && (Name.find(Names[Pos-Pos_Offset])==0
                              || Name.find(Names[Pos-Pos_Offset]+__T(".wav"))+5==Name.size()))
                            {
                                File__ReferenceFilesHelper::reference ReferenceFile;
                                ReferenceFile.StreamKind=Stream_Audio;
                                ReferenceFile.FileNames.push_back(Directory+PathSeparator+Name);
                                ReferenceFiles->References.push_back(ReferenceFile);
                            }
                            else if (ReferenceFiles->References.empty())
                                Pos_Offset++;
            default:        ;
        }

    }
    Element_End();
    Skip_XX(Element_Size-Element_Offset,                        "Unknown");

    FILLING_BEGIN();
        Accept("Ptx"); //Could be Ptf (former formatn but not supported, so we don't care currently
        Fill("Ptx");
        Fill(Stream_General, 0, General_Format, "Pro Tools Session");
        Fill(Stream_General, 0, General_Format_Version, "Version 10");
        Fill(Stream_General, 0, General_Encoded_Library_Name, LibraryName);
        Fill(Stream_General, 0, General_Encoded_Library_Version, LibraryVersion);
    FILLING_END();
}
开发者ID:DanHenebry,项目名称:mpc-hc,代码行数:101,代码来源:File_Ptx.cpp

示例7: Write

//---------------------------------------------------------------------------
// Write
void ZtringListList::Write(const Ztring &ToWrite)
{
    clear();

    if (ToWrite.empty())
        return;

    size_type PosC=0;
    bool Fini=false;
    Ztring C1;
    ZtringList ZL1;
    ZL1.Separator_Set(0, Separator[1]);
    ZL1.Quote_Set(Quote);
    ZL1.Max_Set(0, Max[1]);

    //Detecting carriage return format
    Ztring WriteSeparator;
    if (Separator[0]==EOL)
    {
        size_t CarriageReturn_Pos=ToWrite.find_first_of(__T("\r\n"));
        if (CarriageReturn_Pos!=string::npos)
        {
            if (ToWrite[CarriageReturn_Pos]==__T('\r'))
            {
                if (CarriageReturn_Pos+1<ToWrite.size() && ToWrite[CarriageReturn_Pos+1]==__T('\n'))
                    WriteSeparator=__T("\r\n");
                else
                    WriteSeparator=__T("\r");
            }
            else
                WriteSeparator=__T("\n");
        }
        else
            WriteSeparator=Separator[0];
    }
    else
        WriteSeparator=Separator[0];

    do
    {
        //Searching end of line, but it must not be in quotes
        bool InQuotes=false;
        Ztring CharsToFind=WriteSeparator+Quote;
        size_t Pos_End=PosC;
        while (Pos_End<ToWrite.size())
        {
            Pos_End=ToWrite.find(WriteSeparator, Pos_End);
            if (Pos_End!=string::npos)
            {
                if (Pos_End+Quote.size()<ToWrite.size() && ToWrite[Pos_End]==Quote[0] && ToWrite[Pos_End+1]!=Quote[0])
                {
                    InQuotes=!InQuotes; //This is not double quotes, so this is a normal quote
                    /*if (!InQuotes)
                    {
                        C1=ToWrite.substr(PosC, Pos_End-PosC);
                        break;
                    }*/
                }

                if (!InQuotes && Pos_End+WriteSeparator.size()<=ToWrite.size() && ToWrite[Pos_End]==WriteSeparator[0])
                {
                    C1=ToWrite.substr(PosC, Pos_End-PosC);
                    break;
                }

                if (InQuotes && Pos_End+Quote.size()*2<ToWrite.size() && ToWrite[Pos_End]==Quote[0] && ToWrite[Pos_End+1]==Quote[0])
                    Pos_End+=2;
                else
                    Pos_End++;
            }
        }
        if (Pos_End>=ToWrite.size())
            C1=ToWrite.substr(PosC, string::npos);

        ZL1.Write(C1);
        push_back(ZL1);
        PosC+=C1.size()+WriteSeparator.size();
        if (PosC>=ToWrite.size())
            Fini=true;
    }
    while (!Fini);
}
开发者ID:aleksei-t,项目名称:flylinkdc-r5xx,代码行数:84,代码来源:ZtringListList.cpp

示例8: Read_Buffer_Continue


//.........这里部分代码省略.........
        Demux(Buffer, Buffer_Size, ContentType_MainStream);
    #endif //MEDIAINFO_DEMUX

    // Output
    #if MEDIAINFO_EVENTS
        for (; p; p=p->NextSiblingElement())
        {
            //p
            if (!strcmp(p->Value(), "p"))
            {
                int64u DTS_Begin=(int64u)-1;
                const char* Attribute=p->Attribute("begin");
                if (Attribute)
                    DTS_Begin=Ttml_str2timecode(Attribute);
                int64u DTS_End=(int64u)-1;
                Attribute=p->Attribute("end");
                if (Attribute)
                    DTS_End=Ttml_str2timecode(Attribute);
                string ContentUtf8;
                XMLPrinter printer;
                p->Accept(&printer);
                ContentUtf8+=printer.CStr();
                while (!ContentUtf8.empty() && (ContentUtf8[ContentUtf8.size()-1]=='\r' || ContentUtf8[ContentUtf8.size()-1]=='\n'))
                    ContentUtf8.resize(ContentUtf8.size()-1);
                Ztring Content; Content.From_UTF8(ContentUtf8.c_str());

                Frame_Count_NotParsedIncluded=Frame_Count;
                EVENT_BEGIN (Global, SimpleText, 0)
                    //Hack: remove "p", "span", "br"
                    Content.FindAndReplace(__T("\r"), Ztring(), 0, ZenLib::Ztring_Recursive);
                    Content.FindAndReplace(__T("\n"), Ztring(), 0, ZenLib::Ztring_Recursive);
                    for (;;)
                    {
                        size_t Span_Begin=Content.find(__T("<p"));
                        if (Span_Begin==string::npos)
                            break;
                        
                        size_t Span_End=Content.find(__T(">"), Span_Begin+5);
                        if (Span_End==string::npos)
                            break;

                        size_t ShlashSpan_Begin=Content.find(__T("</p>"), Span_End+1);
                        if (ShlashSpan_Begin==string::npos)
                            break;

                        Content.erase(ShlashSpan_Begin, 7);
                        Content.erase(Span_Begin, Span_End-Span_Begin+1);
                    }
                    for (;;)
                    {
                        size_t Span_Begin=Content.find(__T("<span"));
                        if (Span_Begin==string::npos)
                            break;
                        
                        size_t Span_End=Content.find(__T(">"), Span_Begin+5);
                        if (Span_End==string::npos)
                            break;

                        size_t ShlashSpan_Begin=Content.find(__T("</span>"), Span_End+1);
                        if (ShlashSpan_Begin==string::npos)
                            break;

                        Content.erase(ShlashSpan_Begin, 7);
                        Content.erase(Span_Begin, Span_End-Span_Begin+1);
                    }
                    Content.FindAndReplace(__T("<br>"), EOL, 0, ZenLib::Ztring_Recursive);
开发者ID:pavel-pimenov,项目名称:sandbox,代码行数:67,代码来源:File_Ttml.cpp

示例9: Fill

//---------------------------------------------------------------------------
void File__Analyze::Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const Ztring &Value, bool Replace)
{
    //Integrity
    if (StreamKind>Stream_Max || Parameter==NULL || Parameter[0]=='\0')
        return;

    //Handling values with \r\n inside
    if (Value.find(_T('\r'))!=string::npos || Value.find(_T('\n'))!=string::npos)
    {
        Ztring NewValue=Value;
        NewValue.FindAndReplace(_T("\r\n"), _T(" / "), 0, Ztring_Recursive);
        NewValue.FindAndReplace(_T("\r"), _T(" / "), 0, Ztring_Recursive);
        NewValue.FindAndReplace(_T("\n"), _T(" / "), 0, Ztring_Recursive);
        if (NewValue.size()>=3 && NewValue.rfind(_T(" / "))==NewValue.size()-3)
            NewValue.resize(NewValue.size()-3);
        Fill(StreamKind, StreamPos, Parameter, NewValue, Replace);
        return;
    }

    //Handle Value before StreamKind
    if (StreamKind==Stream_Max || StreamPos>=(*Stream)[StreamKind].size())
    {
        ZtringList NewList;
        NewList.push_back(Ztring().From_UTF8(Parameter));
        NewList.push_back(Value);
        Fill_Temp.push_back(NewList);
        return; //No streams
    }

    //Handling of well known parameters
    size_t Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Ztring().From_Local(Parameter));
    if (Pos!=Error)
    {
        Fill(StreamKind, StreamPos, Pos, Value, Replace);
        return;
    }

    //Handling of unknown parameters
    if (Value.empty())
    {
        if (!Replace)
        {
            size_t Pos=(*Stream_More)[StreamKind][StreamPos].Find(Ztring().From_UTF8(Parameter), Info_Name);
            if (Pos!=(size_t)-1)
                (*Stream_More)[StreamKind][StreamPos][Pos].clear(); //Empty value --> clear other values
        }
    }
    else
    {
        Ztring &Target=(*Stream_More)[StreamKind][StreamPos](Ztring().From_UTF8(Parameter), Info_Text);
        if (Target.empty() || Replace)
        {
            Target=Value; //First value
            (*Stream_More)[StreamKind][StreamPos](Ztring().From_UTF8(Parameter), Info_Options)=_T("Y NT");
        }
        else
        {
            Target+=MediaInfoLib::Config.TagSeparator_Get();
            Target+=Value;
        }
    }
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:63,代码来源:File__Analyze_Streams.cpp

示例10: Data_Parse

//---------------------------------------------------------------------------
void File_ApeTag::Data_Parse()
{
    //If footer
    if (Element_Code==(int64u)-1)
    {
        HeaderFooter();
        Finish("ApeTag");
        return;
    }

    //Parsing
    Ztring Value;
    Get_UTF8(Element_Size, Value,                               "Value"); Element_Info(Value);

    //Filling
    transform(Key.begin(), Key.end(), Key.begin(), (int(*)(int))toupper); //(int(*)(int)) is a patch for unix
         if (Key=="ALBUM")          Fill(Stream_General, 0, General_Album, Value);
    else if (Key=="ARTIST")         Fill(Stream_General, 0, General_Performer, Value);
    else if (Key=="AUTHOR")         Fill(Stream_General, 0, General_WrittenBy, Value);
    else if (Key=="BAND")           Fill(Stream_General, 0, General_Performer, Value);
    else if (Key=="COMMENT")        Fill(Stream_General, 0, General_Comment, Value);
    else if (Key=="COMMENTS")       Fill(Stream_General, 0, General_Comment, Value);
    else if (Key=="COMPOSER")       Fill(Stream_General, 0, General_Composer, Value);
    else if (Key=="CONTENTGROUP")   Fill(Stream_General, 0, General_Genre, Value);
    else if (Key=="COPYRIGHT")      Fill(Stream_General, 0, General_Copyright, Value);
    else if (Key=="DISK")
    {
                                    if (Value.find(_T("/"))!=Error)
                                    {
                                        Fill(Stream_General, 0, General_Part_Position_Total, Value.SubString(_T("/"), _T("")));
                                        Fill(Stream_General, 0, General_Part_Position, Value.SubString(_T(""), _T("/")));
                                    }
                                    else
                                        Fill(Stream_General, 0, General_Track_Position, Value);
    }
    else if (Key=="ENCODEDBY")      Fill(Stream_General, 0, General_EncodedBy, Value);
    else if (Key=="GENRE")          Fill(Stream_General, 0, General_Genre, Value);
    else if (Key=="ORIGARTIST")     Fill(Stream_General, 0, General_Original_Performer, Value);
    else if (Key=="TITLE")          Fill(Stream_General, 0, General_Title, Value);
    else if (Key=="TRACK")
    {
                                    if (Value.find(_T("/"))!=Error)
                                    {
                                        Fill(Stream_General, 0, General_Track_Position_Total, Value.SubString(_T("/"), _T("")));
                                        Fill(Stream_General, 0, General_Track_Position, Value.SubString(_T(""), _T("/")));
                                    }
                                    else
                                        Fill(Stream_General, 0, General_Track_Position, Value);
    }
    else if (Key=="UNSYNCEDLYRICS") Fill(Stream_General, 0, General_Lyrics, Value);
    else if (Key=="WWW")            Fill(Stream_General, 0, General_Title_Url, Value);
    else if (Key=="YEAR")           Fill(Stream_General, 0, General_Recorded_Date, Value);
    else if (Key=="CONTENT GROUP DESCRIPTION") Fill(Stream_General, 0, General_Title, Value);
    else if (Key=="ORIGINAL ALBUM/MOVIE/SHOW TITLE") Fill(Stream_General, 0, General_Original_Album, Value);
    else if (Key=="ORIGINAL ARTIST(S)/PERFORMER(S)") Fill(Stream_General, 0, General_Original_Performer, Value);
    else if (Key=="MP3GAIN_MINMAX") Fill(Stream_Audio, 0, "MP3Gain, Min/Max", Value);
    else if (Key=="MP3GAIN_UNDO") Fill(Stream_Audio, 0, "MP3Gain, Undo", Value);
    else if (Key=="REPLAYGAIN_TRACK_GAIN") Fill(Stream_Audio, 0, Audio_ReplayGain_Gain, Value.To_float64(), 2, true);
    else if (Key=="REPLAYGAIN_TRACK_PEAK") Fill(Stream_Audio, 0, Audio_ReplayGain_Peak, Value.To_float64(), 6, true);
    else                            Fill(Stream_General, 0, Key.c_str(), Value);
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:62,代码来源:File_ApeTag.cpp


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