本文整理汇总了C++中Ztring::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Ztring::size方法的具体用法?C++ Ztring::size怎么用?C++ Ztring::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ztring
的用法示例。
在下文中一共展示了Ztring::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
//---------------------------------------------------------------------------
// Write
void ZtringListList::Write(const Ztring &ToWrite)
{
clear();
if (!&ToWrite || !ToWrite.size())
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]);
do
{
C1=ToWrite.SubString(_T(""), Separator[0], PosC, Ztring_AddLastItem);
ZL1.Write(C1);
push_back(ZL1);
PosC+=C1.size()+Separator[0].size();
if (PosC>=ToWrite.size())
Fini=true;
}
while (!Fini);
}
示例2: 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;
}
示例3: 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);
}
}
}
示例4: NettoyerEspaces
//---------------------------------------------------------------------------
// Nettoyage
bool ZtringListListF::NettoyerEspaces (Ztring &ANettoyer)
{
size_t Debut=0;
while (Debut<ANettoyer.size() && ANettoyer[Debut]==__T(' '))
Debut++;
size_t Fin=ANettoyer.size()-1;
while (Fin!=(size_t)-2 && ANettoyer[Fin]==__T(' '))
Fin--;
if (Fin>=Debut)
ANettoyer=ANettoyer.substr(Debut, Fin-Debut+1);
else
ANettoyer=Ztring();
return true;
}
示例5: 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;
}
示例6: OldFiles_Test
Ztring OldFiles_Test ()
{
//Checking version in Info_Version
ToShow+=__T("Version checked : ");
F.Open(__T("../Source/MediaInfo/MediaInfo_Config.cpp"));
I=F.Read(C, 1000000);
if (!I)
{
ToShow+=__T("Error opening ../Source/MediaInfo/MediaInfo_Config.cpp");
return ToShow;
}
C[I]=0;
Z.From_Local(C);
Version=Z.SubString(__T("MediaInfoLib - v"), __T("\")"));
if (Version.size()!=7)
{
ToShow+=__T("Error reading ../Source/MediaInfo/MediaInfo.cpp : \"MediaInfoLib - vX.X.X.X - \" not found");
return ToShow;
}
Version_Short=Version; Version_Short.resize(3);
ToShow+=Version+__T("\r\n");
//Checking version in MediaInfo.h
if (Test_Version("../Source/MediaInfo/MediaInfo.h", "@version ", "\n")) return ToShow;
if (Test_Version("../Source/MediaInfo/MediaInfoList.h", "@version ", "\n")) return ToShow;
if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " FILEVERSION ", "\n")) return ToShow;
if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " PRODUCTVERSION ", "\n")) return ToShow;
if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"FileVersion\", \"", "\"")) return ToShow;
if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"ProductVersion\", \"", "\"")) return ToShow;
if (Test_Version("../History.txt", "Version ", " ")) return ToShow;
if (Test_Date(__T("MSVC/Library/MediaInfo.lib"))) return ToShow;
if (Test_Date(__T("MSVC/Dll/MediaInfo.dll"))) return ToShow;
return ToShow;
}
示例7: CSV_Charger
//---------------------------------------------------------------------------
// Load CSV
bool ZtringListListF::CSV_Charger ()
{
//Read file
File F;
if (!F.Open(Name))
return false;
int8u* Buffer=new int8u[(size_t)F.Size_Get()+1];
size_t BytesCount=F.Read(Buffer, (size_t)F.Size_Get());
F.Close();
if (BytesCount==Error)
{
delete[] Buffer; //Buffer=NULL;
return false;
}
Buffer[(int32u)BytesCount]=(int8u)'\0';
//Convert file in UTF-8 or Local
Ztring File;
if (!Local)
{
//UTF-8
File.From_UTF8((char*)Buffer, 0, BytesCount);
#ifdef _DEBUG
if (File.size()==0)
File.From_Local((char*)Buffer, 0, BytesCount);
#endif //_DEBUG
}
if (File.size()==0)
//Local of UTF-8 failed
File.From_Local((char*)Buffer, 0, BytesCount);
//Separators
if (Separator[0]==__T("(Default)"))
Separator[0]=EOL;
Ztring SeparatorT=Separator[1];
Separator[1]=__T(";");
//Writing
Write(File);
//Separators
Separator[1]=SeparatorT;
delete[] Buffer; //Buffer=NULL;
return true;
}
示例8: ReportLeaks
void MemoryDebug::ReportLeaks()
{
Ztring m_File;
//std::ofstream m_File ("Debug_MemoryLeak.txt"); // Fichier de sortie
// Détail des fuites
std::size_t TotalSize = 0;
for (TBlockMap::iterator i = m_Blocks.begin(); i != m_Blocks.end(); ++i)
{
// Ajout de la taille du bloc au cumul
TotalSize += i->second.Size;
// Inscription dans le fichier des informations sur le bloc courant
/*
m_File << "-> 0x" << std::hex << i->first << std::dec
<< " | " << std::setw(7) << std::setfill(' ') << static_cast<int>(i->second.Size) << " bytes"
<< " | " << i->second.File.c_str() << " (" << i->second.Line << ")" << std::endl;
*/
m_File.append(_T("-> 0x"));
m_File.append(Ztring::ToZtring((size_t)i->first, 16));
m_File.append(_T(" | "));
Ztring Temp;
Temp.From_Number(static_cast<int>(i->second.Size));
while(Temp.size()<7)
Temp=_T(" ")+Temp;
m_File.append(Temp);
m_File.append(_T(" bytes"));
m_File.append(_T(" | "));
m_File.append(Ztring().From_Local(i->second.File.c_str()));
m_File.append(_T(" ("));
m_File.append(Ztring::ToZtring(i->second.Line));
m_File.append(_T(")"));
m_File.append(EOL);
}
// Affichage du cumul des fuites
/*
m_File << std::endl << std::endl << "-- "
<< static_cast<int>(m_Blocks.size()) << " non-released blocs, "
<< static_cast<int>(TotalSize) << " bytes --"
<< std::endl;
*/
m_File.append(EOL);
m_File.append(EOL);
m_File.append(_T("-- "));
m_File.append(Ztring::ToZtring(static_cast<int>(m_Blocks.size())));
m_File.append(_T(" non-released blocs, "));
m_File.append(Ztring::ToZtring(static_cast<int>(TotalSize)));
m_File.append(_T(" bytes --"));
m_File.append(EOL);
std::string ToWrite=m_File.To_Local().c_str();
int m_File_sav=open("Debug_MemoryLeak.txt", O_BINARY|O_RDWR |O_CREAT); // Fichier de sortie
write(m_File_sav, (int8u*)ToWrite.c_str(), ToWrite.size());
close(m_File_sav);
}
示例9: 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;
}
示例10: 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;
}
示例11: 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");
}
}
示例12: 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;
}
示例13: Write
//---------------------------------------------------------------------------
// Write
void ZtringList::Write(const Ztring &ToWrite)
{
clear();
if (!&ToWrite || !ToWrite.size())
return;
size_type PosC=0;
bool Fini=false;
Ztring C1;
Ztring DelimiterL;
Ztring DelimiterR;
do
{
if (ToWrite.size()>PosC && Quote.size()>0 && ToWrite[PosC]==Quote[0] && ToWrite.substr(PosC, Quote.size())==Quote) //Quote found (ToWrite[PosC]==Quote[0] is here for optimization
{
DelimiterL=Quote;
DelimiterR=Quote+Separator[0];
}
else
{
DelimiterL.clear();
DelimiterR=Separator[0];
}
C1=ToWrite.SubString(DelimiterL, DelimiterR, PosC, Ztring_AddLastItem);
if (DelimiterR.size()>Separator[0].size() && C1.size()==ToWrite.size()-Quote.size()-PosC) //This is the last item of the line, we must suppress the Quote at the end
C1.resize(C1.size()-Quote.size());
if (size()<Max[0])
push_back(C1);
else
{
//No more adding is permit, we add to the last element (with the separator)
at(size()-1)+=Separator[0];
at(size()-1)+=C1;
}
PosC+=C1.size()+DelimiterL.size()+DelimiterR.size();
if (PosC>=ToWrite.size())
Fini=true;
}
while (!Fini);
return;
}
示例14: user_data_start
//---------------------------------------------------------------------------
// Packet "B2", User defined size, this is often used of library name
void File_AvsV::user_data_start()
{
Element_Name("user_data_start");
//Rejecting junk from the end
size_t Library_End_Offset=(size_t)Element_Size;
while (Library_End_Offset>0
&& (Buffer[Buffer_Offset+Library_End_Offset-1]<0x20
|| Buffer[Buffer_Offset+Library_End_Offset-1]>0x7D
|| (Buffer[Buffer_Offset+Library_End_Offset-1]>=0x3A
&& Buffer[Buffer_Offset+Library_End_Offset-1]<=0x40)))
Library_End_Offset--;
if (Library_End_Offset==0)
return; //No good info
//Accepting good data after junk
size_t Library_Start_Offset=Library_End_Offset-1;
while (Library_Start_Offset>0 && (Buffer[Buffer_Offset+Library_Start_Offset-1]>=0x20 && Buffer[Buffer_Offset+Library_Start_Offset-1]<=0x7D))
Library_Start_Offset--;
//But don't accept non-alpha caracters at the beginning (except for "3ivx")
if (Library_End_Offset-Library_Start_Offset!=4 || CC4(Buffer+Buffer_Offset+Library_Start_Offset)!=0x33697678) //3ivx
while (Library_Start_Offset<Element_Size && Buffer[Buffer_Offset+Library_Start_Offset]<=0x40)
Library_Start_Offset++;
//Parsing
Ztring Temp;
if (Library_Start_Offset>0)
Skip_XX(Library_Start_Offset, "junk");
if (Library_End_Offset-Library_Start_Offset)
Get_Local(Library_End_Offset-Library_Start_Offset, Temp,"data");
if (Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "junk");
FILLING_BEGIN();
//NextCode
NextCode_Test();
if (Temp.size()>=4)
Library=Temp;
FILLING_END();
}
示例15: Write
//---------------------------------------------------------------------------
// Set
void Translation::Write(const Ztring &NewLanguage)
{
clear();
if (!&NewLanguage || !NewLanguage.size())
return;
size_t Pos1=0, Pos2_EOL=0, Pos2_Separator=0;
while (Pos2_EOL!=(size_t)-1)
{
Pos2_EOL=NewLanguage.find(__T('\n'), Pos1);
Pos2_Separator=NewLanguage.find(__T(';'), Pos1);
if (Pos2_Separator<Pos2_EOL)
{
operator[](NewLanguage.substr(Pos1, Pos2_Separator-Pos1))=NewLanguage.substr(Pos2_Separator+1, Pos2_EOL-Pos2_Separator-1);
}
Pos1=Pos2_EOL+1;
}
}