本文整理汇总了C++中Ztring::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Ztring::insert方法的具体用法?C++ Ztring::insert怎么用?C++ Ztring::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ztring
的用法示例。
在下文中一共展示了Ztring::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: contextMenuEvent
//---------------------------------------------------------------------------
void GUI_Main_Core_Table::contextMenuEvent (QContextMenuEvent* Event)
{
//Retrieving data
QTableWidgetItem* Item=itemAt(Event->pos());
if (Item==NULL)
return;
string FileName=FileName_Before+item(Item->row(), 0)->text().toLocal8Bit().data();
string Field=horizontalHeaderItem(Item->column())->text().toLocal8Bit().data();
ZtringList History; History.Write(C->History(FileName, Field));
Ztring Date;
if (Field=="OriginationDate" || Field=="OriginationTime" || Field=="ICRD")
{
Date=C->FileDate_Get(FileName);
if (Date.size()>=10+1+8)
{
if (Date.size()>=10+1+8)
Date.resize(10+1+8);
if (Field=="ICRD")
Date.insert(0, "&Set ICRD to file creation timestamp ("); //If you change this, change at the end of method too
else
Date.insert(0, "&Set originationDate and Time to file creation timestamp ("); //If you change this, change at the end of method too
Date.append(")");
}
else
Date.clear();
}
//Creating menu
QMenu menu(this);
//Handling AllFiles display
{
menu.addAction(new QAction("Fill all open files with this field value", this)); //If you change this, change the test text too
menu.addSeparator();
}
//Handling Clear display
if (!item(Item->row(), Item->column())->text().isEmpty() && C->IsValid(FileName, Field, string()))
{
menu.addAction(new QAction("Clear this value", this)); //If you change this, change the test text too
menu.addSeparator();
}
//Handling date display
if (!Date.empty())
{
menu.addAction(new QAction(QString().fromUtf8(Date.To_Local().c_str()), this));
menu.addSeparator();
}
//Handling history display
size_t Pos=History.size();
if (!History.empty())
do
{
Pos--;
QString Text=QString().fromUtf8(History[Pos].To_Local().c_str());
if (!Text.isEmpty())
{
QAction* Action=new QAction(Text, this);
menu.addAction(Action);
}
}
while (Pos>0);
//Displaying
QAction* Action=menu.exec(Event->globalPos());
if (Action==NULL)
return;
//Retrieving data
QString Text=Action->text();
//Special cases
if (Text=="Fill all open files with this field value") //If you change this, change the creation text too
{
for (int Row=0; Row<rowCount(); Row++)
{
item(Row, Item->column())->setText(QString().fromUtf8(Ztring(C->Get(FileName, Field)).To_Local().c_str()));
dataChanged(indexFromItem(item(Row, Item->column())), indexFromItem(item(Row, Item->column())));
//Special cases
if (Field=="UMID" || Field=="LoudnessValue" || Field=="LoudnessRange" || Field=="MaxTruePeakLevel" || Field=="MaxMomentaryLoudness" || Field=="MaxShortTermLoudness")
{
//Changing BextVersion Enabled value
SetText (*Item, "BextVersion");
SetEnabled(*Item, "BextVersion");
}
}
return;
}
if (Text=="Clear this value") //If you change this, change the creation text too
Text.clear();
//Filling
if (Text.contains("&Set ")) //If you change this, change the creation text too
{
//.........这里部分代码省略.........
示例3: Event_CallBackFunction
void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_Size, void* UserHandle_Void)
{
/*Retrieving UserHandle*/
struct Events_UserHandle_struct* UserHandle=(struct Events_UserHandle_struct*)UserHandle_Void;
struct MediaInfo_Event_Generic* Event_Generic=(struct MediaInfo_Event_Generic*) Data_Content;
unsigned char ParserID;
unsigned short EventID;
unsigned char EventVersion;
/*integrity tests*/
if (Data_Size<4)
return; //There is a problem
if (UserHandle->PerEvent[Event_Generic->EventCode].F==NULL)
{
Ztring Number; Number.From_Number(Event_Generic->EventCode, 16);
while (Number.size()<8)
Number.insert(0, 1, __T('0'));
Ztring Name=Ztring(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number+__T("\\")+UserHandle->Name.Name_Get()+__T(".txt"));
if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New")))
Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New"));
if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)))
Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario));
if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number))
Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number);
if (!Dir::Exists(FileName(Name).Path_Get()))
Dir::Create(FileName(Name).Path_Get());
UserHandle->PerEvent[Event_Generic->EventCode].F=fopen(Name.To_Local().c_str(), "w");
}
/*Retrieving EventID*/
ParserID =(unsigned char) ((Event_Generic->EventCode&0xFF000000)>>24);
EventID =(unsigned short)((Event_Generic->EventCode&0x00FFFF00)>>8 );
EventVersion=(unsigned char) ( Event_Generic->EventCode&0x000000FF );
//*Global to all parsers
switch (EventID)
{
CASE (Global, Demux, 4)
CASE (Video, SliceInfo, 0)
default : ;
}
switch (ParserID)
{
case MediaInfo_Parser_None :
switch (EventID)
{
case MediaInfo_Event_General_Start : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Start_0)) General_Start_0((struct MediaInfo_Event_General_Start_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_End : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_End_0)) General_End_0((struct MediaInfo_Event_General_End_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_Parser_Selected : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Parser_Selected_0)) General_Parser_Selected_0((struct MediaInfo_Event_General_Parser_Selected_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_Move_Request : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Move_Request_0)) General_Move_Request_0((struct MediaInfo_Event_General_Move_Request_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_Move_Done : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Move_Done_0)) General_Move_Done_0((struct MediaInfo_Event_General_Move_Done_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_SubFile_Start : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_SubFile_Start_0)) General_SubFile_Start_0((struct MediaInfo_Event_General_SubFile_Start_0*)Data_Content, UserHandle); break;
case MediaInfo_Event_General_SubFile_End : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_SubFile_End_0)) General_SubFile_End_0((struct MediaInfo_Event_General_SubFile_End_0*)Data_Content, UserHandle); break;
default : ;
}
break;
default : ; //ParserID is unknown
}
}