本文整理汇总了C++中Ztring::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Ztring::empty方法的具体用法?C++ Ztring::empty怎么用?C++ Ztring::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ztring
的用法示例。
在下文中一共展示了Ztring::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Comment
//---------------------------------------------------------------------------
void File_Celt::Comment()
{
Element_Name("Comment?");
while (Element_Offset<Element_Size)
{
Ztring value;
int32u size;
Get_L4(size, "size");
if (size)
Get_Local(size, value, "value");
//Filling
if (value.find(__T("CELT "))!=std::string::npos)
{
Ztring Version=value.SubString(__T("CELT "), __T(" ("));
Fill(Stream_Audio, 0, Audio_Encoded_Library, __T("CELT ")+Version);
Fill(Stream_Audio, 0, Audio_Encoded_Library_Name, __T("CELT"));
Fill(Stream_Audio, 0, Audio_Encoded_Library_Version, Version);
}
else if (!value.empty())
Fill(Stream_Audio, 0, "Comment", value);
}
Finish("CELT");
}
示例2: Event_Send
void MediaInfo_Config_MediaInfo::Event_Send (const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name)
{
CriticalSectionLocker CSL(CS);
if (Event_CallBackFunction)
Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler);
else
{
MediaInfo_Event_Generic* Event_Generic=(MediaInfo_Event_Generic*)Data_Content;
if ((Event_Generic->EventCode&0x00FFFF00)==(MediaInfo_Event_Global_Demux<<8))
{
if (!MediaInfoLib::Config.Demux_Get())
return;
if (File_Name.empty())
return;
MediaInfo_Event_Global_Demux_0* Event=(MediaInfo_Event_Global_Demux_0*)Data_Content;
Ztring File_Name_Final(File_Name);
for (size_t Pos=0; Pos<Event->StreamIDs_Size; Pos++)
File_Name_Final+=_T(".")+Ztring().From_Number(Event->StreamIDs[Pos], 16);
File_Name_Final+=_T(".raw");
File F;
F.Open(File_Name_Final, File::Access_Write_Append);
F.Write(Event->Content, Event->Content_Size);
}
}
}
示例3: Enums_Create_Item
//---------------------------------------------------------------------------
// Open an item
ZenLib::Ztring Enums_Create_Item(const Ztring &Directory, const Ztring &Name, Ztring &Contents)
{
Contents.clear();
Ztring Result;
//Load header
Ztring Partial;
Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.2.txt", Partial);
if (!Result.empty())
return Result;
Partial.FindAndReplace(L"%Name%", Ztring(Name).MakeLowerCase());
Contents+=Partial;
//Load line template
Ztring Line;
Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.5.txt", Line);
if (!Result.empty())
return Result;
//Read input file
ZtringListListF ZLL;
ZLL.Load(Ztring(L"../Source/Resource/Text/")+Directory+L"/"+Name+L".csv");
for (size_t Pos=0; Pos<ZLL.size(); Pos++)
{
Ztring Line_Temp=Line;
Line_Temp.FindAndReplace(L"%Name%", Name);
Ztring &ToAdd=ZLL(Pos, 0);
ToAdd.FindAndReplace(__T("/"), __T("_"), 0, Ztring_Recursive); //C++ does not accept "/" in names
ToAdd.FindAndReplace(__T("("), __T("_")); //C++ does not accept "(" in names
ToAdd.FindAndReplace(__T(")"), __T("_")); //C++ does not accept ")" in names
ToAdd.FindAndReplace(__T("*"), __T("_")); //C++ does not accept "*" in names
ToAdd.FindAndReplace(__T("-"), __T("_")); //C++ does not accept "-" in names
Line_Temp.FindAndReplace(L"%Line%", ToAdd);
Contents+=Line_Temp;
}
//Load footer template
Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.8.txt", Partial);
if (!Result.empty())
return Result;
Contents+=Partial;
return L"";
}
示例4: File_Duplicate_Set
Ztring MediaInfo_Config_MediaInfo::File_Duplicate_Set (const Ztring &Value_In)
{
//Preparing for File__Duplicate...
CS.Enter();
File__Duplicate_List.push_back(Value_In);
//Handling Memory index
Ztring ToReturn;
ZtringList List=Value_In;
for (size_t Pos=0; Pos<List.size(); Pos++)
{
//Form= "(-)Data", if "-" the value will be removed
Ztring &Value=List[Pos];
bool ToRemove=false;
if (Value.find(_T('-'))==0)
{
Value.erase(Value.begin());
ToRemove=true;
}
//Testing if this is information about a target
if (List[Pos].find(_T("memory:"))==0 || List[Pos].find(_T("file:"))==0)
{
//Searching if already exist
size_t Memory_Pos=File__Duplicate_Memory_Indexes.Find(List[Pos]);
if (!ToRemove && Memory_Pos==Error)
{
//Does not exist yet (and adding is wanted)
Memory_Pos=File__Duplicate_Memory_Indexes.Find(_T(""));
if (Memory_Pos!=Error)
File__Duplicate_Memory_Indexes[Memory_Pos]=List[Pos]; //A free place is found
else
{
//Adding the place at the end
Memory_Pos=File__Duplicate_Memory_Indexes.size();
File__Duplicate_Memory_Indexes.push_back(List[Pos]);
}
}
else if (ToRemove)
{
//Exists yet but Removal is wanted
File__Duplicate_Memory_Indexes[Memory_Pos].clear();
Memory_Pos=(size_t)-1;
}
ToReturn+=_T(";")+Ztring().From_Number(Memory_Pos);
}
}
if (!ToReturn.empty())
ToReturn.erase(ToReturn.begin()); //Remove first ";"
CS.Leave();
File_IsSeekable_Set(false); //If duplication, we can not seek anymore
return ToReturn;
}
示例5: TimeCode_Fill
//---------------------------------------------------------------------------
void File_Riff::TimeCode_Fill(const Ztring &Name, const Ztring &Value)
{
if (Value.empty())
return;
for (size_t StreamPos=0; StreamPos<Count_Get(Stream_Video); StreamPos++)
{
Fill(Stream_Video, StreamPos, Video_TimeCode_FirstFrame, Value);
Fill(Stream_Video, StreamPos, Video_TimeCode_Source, Name);
}
}
示例6: Write
//---------------------------------------------------------------------------
// Write
void ZtringList::Write(const Ztring &ToWrite)
{
clear();
if (ToWrite.empty())
return;
size_type PosC=0;
bool Fini=false;
Ztring C1;
Ztring DelimiterL;
Ztring DelimiterR;
do
{
//Searching quotes
if (ToWrite[PosC]==Quote[0])
{
size_t Pos_End=PosC+1;
while (Pos_End<ToWrite.size())
{
if (ToWrite[Pos_End]==Quote[0] && Pos_End+1<ToWrite.size() && ToWrite[Pos_End+1]==Quote[0])
Pos_End+=2; //Double quote, skipping
else
{
if (ToWrite[Pos_End]==Quote[0])
break;
Pos_End++;
}
}
C1=ToWrite.substr(PosC+Quote.size(), Pos_End-PosC);
PosC+=C1.size()+Quote.size();
if (C1.size()>0 && C1[C1.size()-1]==Quote[0])
{
C1.resize(C1.size()-1);
PosC+=Quote.size();
}
}
else //Normal
{
C1=ToWrite.SubString(tstring(), Separator[0], PosC, Ztring_AddLastItem);
PosC+=C1.size()+Separator[0].size();
}
C1.FindAndReplace(Quote+Quote, Quote, 0, Ztring_Recursive);
if (size()<Max[0])
push_back(C1);
if (PosC>=ToWrite.size())
Fini=true;
}
while (!Fini);
return;
}
示例7: PBCore_Transform__Common_End
//---------------------------------------------------------------------------
void PBCore_Transform__Common_End(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
{
//essenceTrackAnnotation - all fields (except *_String*) separated by |
Ztring Temp;
for (size_t Pos=0; Pos<MI.Count_Get(StreamKind, StreamPos); Pos++)
if (MI.Get(StreamKind, StreamPos, Pos, Info_Name).find(__T("String"))==std::string::npos && !MI.Get(StreamKind, StreamPos, Pos).empty())
Temp+=MI.Get(StreamKind, StreamPos, Pos, Info_Name)+__T(": ")+MI.Get(StreamKind, StreamPos, Pos)+__T('|');
if (!Temp.empty())
{
Temp.resize(Temp.size()-1);
ToReturn+=__T("\t\t\t<essenceTrackAnnotation>"); ToReturn+=Temp; ToReturn+=__T("</essenceTrackAnnotation>\n");
}
}
示例8: Event_Send
void MediaInfo_Config_MediaInfo::Event_Send (const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name)
{
CriticalSectionLocker CSL(CS);
if (Event_CallBackFunction)
Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler);
else
{
MediaInfo_Event_Generic* Event_Generic=(MediaInfo_Event_Generic*)Data_Content;
if ((Event_Generic->EventCode&0x00FFFF00)==(MediaInfo_Event_Global_Demux<<8))
{
if (!MediaInfoLib::Config.Demux_Get())
return;
if (File_Name.empty())
return;
MediaInfo_Event_Global_Demux_0* Event=(MediaInfo_Event_Global_Demux_0*)Data_Content;
Ztring File_Name_Final(File_Name);
bool AddRawExtension=false;
for (size_t Pos=0; Pos<Event->StreamIDs_Size; Pos++)
{
if (Event->StreamIDs_Width[Pos]==17)
{
Ztring ID;
ID.From_CC4((int32u)Event->StreamIDs[Pos]);
File_Name_Final+=_T('.')+ID;
}
else if (Event->StreamIDs_Width[Pos] && Event->StreamIDs_Width[Pos]<=16)
{
Ztring ID;
ID.From_Number(Event->StreamIDs[Pos], 16);
while (ID.size()<Event->StreamIDs_Width[Pos])
ID.insert(0, 1, _T('0'));
if (ID.size()>Event->StreamIDs_Width[Pos])
ID.erase(0, ID.size()-Event->StreamIDs_Width[Pos]);
File_Name_Final+=_T('.')+ID;
}
else
AddRawExtension=true;
}
if (AddRawExtension)
File_Name_Final+=_T(".raw");
File F;
F.Open(File_Name_Final, File::Access_Write_Append);
F.Write(Event->Content, Event->Content_Size);
}
}
}
示例9: 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();
}
示例10: Comment
//---------------------------------------------------------------------------
void File_Speex::Comment()
{
Element_Name("Comment?");
while (Element_Offset<Element_Size)
{
Ztring value;
int32u size;
Get_L4(size, "size");
if (size)
Get_Local(size, value, "value");
//Filling
if (!value.empty())
Fill(Stream_Audio, 0, "Comment", value);
}
Finish("Speex");
}
示例11: Load
//---------------------------------------------------------------------------
// Load
bool ZtringListListF::Load (const Ztring &NewFileName)
{
clear();
if (!NewFileName.empty())
Name=NewFileName;
size_t I1=Error;
if (Name.find(__T(".csv"))!=Error)
I1=CSV_Charger();
if (Name.find(__T(".cfg"))!=Error)
I1=CFG_Charger();
if (I1!=Error)
{
Backup_Nb=0; //mettre ici le code pour trouver le nb de backup
return true;
}
else
return false;
}
示例12: Write
//---------------------------------------------------------------------------
// Set
void InfoMap::Write(const Ztring &NewInfoMap)
{
clear();
if (NewInfoMap.empty())
return;
size_t Pos1=0, Pos2_EOL=0, Pos2_Separator=0;
while (Pos2_EOL!=(size_t)-1)
{
Pos2_EOL=NewInfoMap.find(__T('\n'), Pos1);
Pos2_Separator=NewInfoMap.find(__T(';'), Pos1);
if (Pos2_Separator<Pos2_EOL)
{
ZtringList List; List.Write(NewInfoMap.substr(Pos1, Pos2_EOL-Pos1));
insert (pair<Ztring, ZtringList>(NewInfoMap.substr(Pos1, Pos2_Separator-Pos1), List));
}
Pos1=Pos2_EOL+1;
}
}
示例13: Fill
//---------------------------------------------------------------------------
void File__Analyze::Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const Ztring &Value, bool Replace)
{
//Integrity
if (StreamKind>Stream_Max)
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_Number(Parameter));
NewList.push_back(Value);
Fill_Temp.push_back(NewList);
return; //No streams
}
Ztring &Target=(*Stream)[StreamKind][StreamPos](Parameter);
if (Target.empty() || Replace)
Target=Value; //First value
else if (Value.empty())
Target.clear(); //Empty value --> clear other values
else
{
Target+=MediaInfoLib::Config.TagSeparator_Get();
Target+=Value;
}
}
示例14: PBCore_Transform
//---------------------------------------------------------------------------
void PBCore_Transform(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
{
//Menu: only if TimeCode
if (StreamKind==Stream_Menu && MI.Get(Stream_Menu, StreamPos, Menu_Format)!=__T("TimeCode"))
return;
//essenceTrackType
Ztring essenceTrackType;
switch (StreamKind)
{
case Stream_Video:
essenceTrackType=__T("Video");
break;
case Stream_Audio:
essenceTrackType=__T("Audio");
break;
case Stream_Text:
{
Ztring Format=MI.Get(Stream_Text, StreamPos, Text_Format);
if (Format==__T("EIA-608") || Format==__T("EIA-708"))
essenceTrackType=__T("CC");
else
essenceTrackType=__T("Text");
}
break;
case Stream_Menu:
if (MI.Get(Stream_Menu, StreamPos, Menu_Format)==__T("TimeCode"))
{
essenceTrackType=__T("TimeCode");
break;
}
else
return; //Not supported
default: return; //Not supported
}
ToReturn+=__T("\t\t<pbcoreEssenceTrack>\n");
ToReturn+=__T("\t\t\t<essenceTrackType>")+essenceTrackType+__T("</essenceTrackType>\n");
//essenceTrackIdentifier
if (!MI.Get(StreamKind, StreamPos, __T("ID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("ID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>ID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("UniqueID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("UniqueID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>UniqueID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
else if (!MI.Get(StreamKind, StreamPos, __T("StreamKindID")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, __T("StreamKindID"))+__T("</essenceTrackIdentifier>\n");
ToReturn+=__T("\t\t\t<essenceTrackIdentifierSource>StreamKindID (Mediainfo)</essenceTrackIdentifierSource>\n");
}
//essenceTrackStandard
if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Standard).empty())
ToReturn+=__T("\t\t\t<essenceTrackStandard>")+MI.Get(Stream_Video, StreamPos, Video_Standard)+__T("</essenceTrackStandard>\n");
//essenceTrackEncoding
if (!MI.Get(StreamKind, StreamPos, __T("Format")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackEncoding>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("Format"));
if (!MI.Get(StreamKind, StreamPos, __T("Format_Profile")).empty()) ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("Format_Profile"));
if (!MI.Get(StreamKind, StreamPos, __T("CodecID")).empty()) ToReturn+=__T(" (")+MI.Get(StreamKind, StreamPos, __T("CodecID"))+__T(')');
ToReturn+=__T("</essenceTrackEncoding>\n");
}
//essenceTrackDataRate
if (!MI.Get(StreamKind, StreamPos, __T("BitRate")).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackDataRate>");
ToReturn+=MI.Get(StreamKind, StreamPos, __T("BitRate"));
if (!MI.Get(StreamKind, StreamPos, __T("BitRate_Mode")).empty())
ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("BitRate_Mode"));
ToReturn+=__T("</essenceTrackDataRate>\n");
}
//essenceTrackFrameRate
if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty())
{
ToReturn+=__T("\t\t\t<essenceTrackFrameRate>");
ToReturn+=MI.Get(Stream_Video, StreamPos, Video_FrameRate);
if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode).empty())
ToReturn+=__T(' ')+MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode);
ToReturn+=__T("</essenceTrackFrameRate>\n");
}
//essenceTrackSamplingRate
if (StreamKind==Stream_Audio && !MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty())
ToReturn+=__T("\t\t\t<essenceTrackSamplingRate>")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+__T("</essenceTrackSamplingRate>\n");
//essenceTrackBitDepth
if (!MI.Get(StreamKind, StreamPos, __T("BitDepth")).empty())
ToReturn+=__T("\t\t\t<essenceTrackBitDepth version=\"PBCoreXSD_Ver_1.2_D1\">")+MI.Get(StreamKind, StreamPos, __T("BitDepth"))+__T("</essenceTrackBitDepth>\n");
//.........这里部分代码省略.........
示例15: FileHeader_Begin
//---------------------------------------------------------------------------
bool File_SubRip::FileHeader_Begin()
{
if (!IsSub && (Buffer_Size<File_Size && Buffer_Size<65536))
{
Element_WaitForMoreData();
return false;
}
ZtringListList List;
List.Separator_Set(0, __T("\n\n"));
List.Separator_Set(1, __T("\n"));
if (Buffer[0]==0xEF
&& Buffer[1]==0xBB
&& Buffer[2]==0xBF)
HasBOM=true;
bool IsLocal=false;
Ztring Temp;
Temp.From_UTF8((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0));
if (Temp.empty())
{
Temp.From_Local((const char*)Buffer+(HasBOM?3:0), (Buffer_Size>65536?65536:Buffer_Size)-(HasBOM?3:0)); // Trying from local code page
IsLocal=true;
}
Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive);
List.Write(Temp);
if (List(0, 0)==__T("WEBVTT FILE") || List(0, 0)==__T("WEBVTT"))
IsVTT=true;
if (!IsVTT)
{
size_t IsOk=0;
size_t IsNok=0;
for (size_t Pos=0; Pos<List.size(); Pos++)
{
if (List(Pos, 0).To_int64u()==Pos+1)
IsOk++;
else
IsNok++;
if (List(Pos, 1).size()>22 && List(Pos, 1)[2]==__T(':') && List(Pos, 1)[5]==__T(':') && List(Pos, 1).find(__T(" --> "))!=string::npos)
IsOk++;
else
IsNok++;
}
if (!IsOk || IsNok>IsOk/2)
{
Reject();
return true;
}
}
if (!IsSub && File_Size!=(int64u)-1 && Buffer_Size!=File_Size)
{
Element_WaitForMoreData();
return false;
}
if (!Status[IsAccepted])
{
Accept();
Fill(Stream_General, 0, General_Format, IsVTT?"WebVTT":"SubRip");
Stream_Prepare(Stream_Text);
Fill(Stream_Text, 0, "Format", IsVTT?"WebVTT":"SubRip");
Fill(Stream_Text, 0, "Codec", IsVTT?"WebVTT":"SubRip");
}
if (IsLocal)
Temp.From_Local((const char*)Buffer+(HasBOM?3:0), Buffer_Size-(HasBOM?3:0));
else
Temp.From_UTF8((const char*)Buffer+(HasBOM?3:0), Buffer_Size-(HasBOM?3:0));
Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive);
List.Write(Temp);
#if MEDIAINFO_DEMUX
size_t Pos=0;
for (;;)
{
if (Pos>=List.size())
break;
if (List[Pos].size()>=3 || (IsVTT && List[Pos].size()>=2))
{
Ztring PTS_Begin_String=List[Pos][IsVTT?0:1].SubString(Ztring(), __T(" --> "));
Ztring PTS_End_String=List[Pos][IsVTT?0:1].SubString(__T(" --> "), Ztring());
if (IsVTT)
{
size_t Extra_Pos=PTS_End_String.find(__T(' '));
if (Extra_Pos!=string::npos)
PTS_End_String.resize(Extra_Pos); //Discarding positioning
}
item Item;
Item.PTS_Begin=SubRip_str2timecode(PTS_Begin_String.To_UTF8().c_str());
Item.PTS_End=SubRip_str2timecode(PTS_End_String.To_UTF8().c_str());
for (size_t Pos2=IsVTT?1:2; Pos2<List[Pos].size(); Pos2++)
//.........这里部分代码省略.........