本文整理汇总了C++中CloneString函数的典型用法代码示例。如果您正苦于以下问题:C++ CloneString函数的具体用法?C++ CloneString怎么用?C++ CloneString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CloneString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPipeResult
CPipeConnectSuccResult::CPipeConnectSuccResult(
int32 nPipeId, uint32 uSessionID,
const CAddress& LocalAddr,
const CAddress& RemoteAddr, CPipeThread* pThread)
: CPipeResult(nPipeId, uSessionID)
{
m_szLocalAddr = CloneString(LocalAddr.GetAddress(), pThread);
m_uLocalPort = LocalAddr.GetPort();
m_szRemoteAddr = CloneString(RemoteAddr.GetAddress(), pThread);
m_uRemotePort = RemoteAddr.GetPort();
}
示例2: CloneFieldDef
bool CloneFieldDef(const char* sLogName, CRdbFieldDef* &pDstFieldDefines, CRdbFieldDef* pSrcFieldDefines, uint32 nFieldCount)
{
uint32 i;
pDstFieldDefines = NULL;
if(nFieldCount)
{
pDstFieldDefines = new CRdbFieldDef[nFieldCount];
if(!pDstFieldDefines)
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s): RDB_LACK_MEMORY"));
return false;
}
CBinary::MemorySet(pDstFieldDefines, 0, nFieldCount*sizeof(CRdbFieldDef));
for(i=0; i<nFieldCount; ++i)
{
pDstFieldDefines[i] = pSrcFieldDefines[i];
pDstFieldDefines[i].nJob = 1;
pDstFieldDefines[i].sFieldName = CloneString(sLogName, pSrcFieldDefines[i].sFieldName);
pDstFieldDefines[i].sDefault = NULL;
char * sDefault = pSrcFieldDefines[i].sDefault;
if(sDefault && sDefault[0])
pDstFieldDefines[i].sDefault = CloneString(sLogName, sDefault);
if(!pDstFieldDefines[i].sFieldName ||
(!pDstFieldDefines[i].sDefault && sDefault))
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s): RDB_LACK_MEMORY", pSrcFieldDefines[i].sFieldName));
if(pDstFieldDefines[i].sFieldName)
delete[] pDstFieldDefines[i].sFieldName;
if(pDstFieldDefines[i].sDefault)
delete[] pDstFieldDefines[i].sDefault;
for(uint32 j=0; j<i; ++i)
FreeFieldDefine(pDstFieldDefines[j]);
delete[] pDstFieldDefines;
pDstFieldDefines = NULL;
return false;
}
}
for(i=0; i<nFieldCount; ++i)
{
if(CorrectFieldAttr(sLogName, pDstFieldDefines+i))
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s) Failure", pDstFieldDefines[i].sFieldName));
for(i=0; i<nFieldCount; ++i)
FreeFieldDefine(pDstFieldDefines[i]);
delete[] pDstFieldDefines;
pDstFieldDefines = NULL;
return false;
}
}
}
return true;
}
示例3: CloneString
CPipeAcceptedResult::CPipeAcceptedResult(int32 nPipeId,uint32 uSessionID, int32 newPipeId, uint32 threadId,
uint32 oldthreadid, IPipe* pPipe, const CAddress& LocalAddr, const CAddress& RemoteAddr, CPipeThread* pThread)
:CPipeResult(nPipeId, uSessionID)
{
m_szLocalAddr = CloneString( LocalAddr.GetAddress(), pThread );
m_uLocalPort = LocalAddr.GetPort();
m_szRemoteAddr = CloneString( RemoteAddr.GetAddress(), pThread );
m_uRemotePort = RemoteAddr.GetPort();
m_pPipe = pPipe;
m_uOldThreadId = oldthreadid;
m_nNewPipeID = newPipeId;
m_uThreadId = threadId;
}
示例4: SplitStringByWhitespace
STRING_LIST*
SplitStringByWhitespace (
IN CHAR8 *String
)
/*++
Routine Description:
Creates and returns a 'split' STRING_LIST by splitting the string
on whitespace boundaries.
Arguments:
String The string to 'split'
Returns:
EFI_STATUS
--*/
{
CHAR8 *Pos;
CHAR8 *EndOfSubString;
CHAR8 *EndOfString;
STRING_LIST *Output;
UINTN Item;
String = CloneString (String);
if (String == NULL) {
return NULL;
}
EndOfString = String + strlen (String);
Output = NewStringList ();
for (Pos = String, Item = 0; Pos < EndOfString; Item++) {
while (isspace ((int)*Pos)) {
Pos++;
}
for (EndOfSubString=Pos;
(*EndOfSubString != '\0') && !isspace ((int)*EndOfSubString);
EndOfSubString++
) {
}
if (EndOfSubString == Pos) {
break;
}
*EndOfSubString = '\0';
AppendCopyOfStringToList (&Output, Pos);
Pos = EndOfSubString + 1;
}
free (String);
return Output;
}
示例5: RelinquishMagickMemory
void Magick::Options::density(const Point &density_)
{
if (!density_.isValid())
_imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
else
CloneString(&_imageInfo->density,density_);
}
示例6: main
int main ( int argc, char **argv )
{
Image *canvas = (Image *)NULL;
char outfile[MaxTextExtent];
int rows, columns = 0;
char size[MaxTextExtent];
ImageInfo *image_info;
ExceptionInfo exception;
if ( argc != 2 )
{
(void) printf ( "Usage: %s filename\n", argv[0] );
exit( 1 );
}
outfile[MaxTextExtent-1]='\0';
(void) strncpy( outfile, argv[1], MaxTextExtent-1 );
if (LocaleNCompare("drawtest",argv[0],7) == 0)
InitializeMagick((char *) NULL);
else
InitializeMagick(*argv);
/*
* Create canvas image
*/
columns=596;
rows=842;
image_info=CloneImageInfo((ImageInfo*)NULL);
GetExceptionInfo( &exception );
FormatString(size, "%dx%d", columns, rows);
(void) CloneString(&image_info->size, size);
(void) strcpy( image_info->filename, "xc:white");
canvas = ReadImage ( image_info, &exception );
if (exception.severity != UndefinedException)
CatchException(&exception);
if ( canvas == (Image *)NULL )
{
(void) printf ( "Failed to read canvas image %s\n", image_info->filename );
exit(1);
}
/*
* Scribble on image
*/
ScribbleImage( canvas );
/*
* Save image to file
*/
canvas->filename[MaxTextExtent-1]='\0';
(void) strncpy( canvas->filename, outfile, MaxTextExtent-1);
(void) WriteImage ( image_info, canvas );
DestroyExceptionInfo( &exception );
DestroyImage( canvas );
DestroyImageInfo( image_info );
DestroyMagick();
return 0;
}
示例7: MagickQueryMultilineFontMetrics
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k Q u e r y M u l t i l i n e F o n t M e t r i c s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickQueryMultilineFontMetrics() returns a 13 element array representing the
% following font metrics:
%
% Element Description
% -------------------------------------------------
% 0 character width
% 1 character height
% 2 ascender
% 3 descender
% 4 text width
% 5 text height
% 6 maximum horizontal advance
% 7 bounding box: x1
% 8 bounding box: y1
% 9 bounding box: x2
% 10 bounding box: y2
% 11 origin: x
% 12 origin: y
%
% This method is like MagickQueryFontMetrics() but it returns the maximum text
% width and height for multiple lines of text.
%
% The format of the MagickQueryFontMetrics method is:
%
% double *MagickQueryMultilineFontMetrics(MagickWand *wand,
% const DrawingWand *drawing_wand,const char *text)
%
% A description of each parameter follows:
%
% o wand: the Magick wand.
%
% o drawing_wand: the drawing wand.
%
% o text: the text.
%
*/
WandExport double *MagickQueryMultilineFontMetrics(MagickWand *wand,
const DrawingWand *drawing_wand,const char *text)
{
double
*font_metrics;
DrawInfo
*draw_info;
MagickBooleanType
status;
TypeMetric
metrics;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
assert(drawing_wand != (const DrawingWand *) NULL);
if (wand->images == (Image *) NULL)
{
(void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
"ContainsNoImages","`%s'",wand->name);
return((double *) NULL);
}
font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
if (font_metrics == (double *) NULL)
return((double *) NULL);
draw_info=PeekDrawingWand(drawing_wand);
if (draw_info == (DrawInfo *) NULL)
{
font_metrics=(double *) RelinquishMagickMemory(font_metrics);
return((double *) NULL);
}
(void) CloneString(&draw_info->text,text);
(void) ResetMagickMemory(&metrics,0,sizeof(metrics));
status=GetMultilineTypeMetrics(wand->images,draw_info,&metrics,
wand->exception);
draw_info=DestroyDrawInfo(draw_info);
if (status == MagickFalse)
{
font_metrics=(double *) RelinquishMagickMemory(font_metrics);
return((double *) NULL);
}
font_metrics[0]=metrics.pixels_per_em.x;
font_metrics[1]=metrics.pixels_per_em.y;
font_metrics[2]=metrics.ascent;
font_metrics[3]=metrics.descent;
font_metrics[4]=metrics.width;
font_metrics[5]=metrics.height;
font_metrics[6]=metrics.max_advance;
font_metrics[7]=metrics.bounds.x1;
//.........这里部分代码省略.........
示例8: CloneString
char * RString::GetBuffer(void)
{
if(RefCount() > 0)
{
CloneString();
return myString;
}
return myString; //are we sure this is safe?
}
示例9: CloneString
LinuxEcatHardware::LinuxEcatHardware( const char *name )
{
if( !name ) name = "eth0";
fd = -1;
ifname = CloneString( name );
SetRefName( "LinuxEcatHw" );
}
示例10: CloneIndexDef
bool CloneIndexDef(const char* sLogName, CRdbIndexDef & oDstIndexDef, CRdbIndexDef & oSrcIndexDef)
{
oDstIndexDef = oSrcIndexDef;
oDstIndexDef.sIndexName = CloneString(sLogName, oSrcIndexDef.sIndexName);
if(!oDstIndexDef.sIndexName)
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY"));
return false;
}
oDstIndexDef.sTableName = CloneString(sLogName, oSrcIndexDef.sTableName);
if(!oDstIndexDef.sTableName)
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY"));
delete[] oDstIndexDef.sIndexName;
return false;
}
if(oSrcIndexDef.sPrimaryIndex)
{
oDstIndexDef.sPrimaryIndex = CloneString(sLogName, oSrcIndexDef.sPrimaryIndex);
if(!oDstIndexDef.sPrimaryIndex)
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY"));
delete[] oDstIndexDef.sIndexName;
delete[] oDstIndexDef.sTableName;
return false;
}
}
if(oSrcIndexDef.pFieldList)
{
oDstIndexDef.pFieldList = CloneString(sLogName, oSrcIndexDef.pFieldList);
if(!oDstIndexDef.pFieldList)
{
FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY"));
delete[] oDstIndexDef.sIndexName;
delete[] oDstIndexDef.sTableName;
if(oDstIndexDef.sPrimaryIndex)
delete[] oDstIndexDef.sPrimaryIndex;
return false;
}
}
oDstIndexDef.nIndexNo = oSrcIndexDef.nIndexNo;
oDstIndexDef.nStorageAddr = 0;
return true;
}
示例11: Filesets_Restore_OnEndTask_LookupFileset
void Filesets_Restore_OnEndTask_LookupFileset (HWND hDlg, LPTASKPACKET ptp, LPSET_RESTORE_PARAMS psrp)
{
if (ptp)
{
psrp->lpi = (ptp->rc) ? TASKDATA(ptp)->lpi : NULL;
}
if (!psrp->lpi)
{
psrp->lpi = (LPIDENT)FL_GetSelectedData (GetDlgItem (hDlg, IDC_AGG_LIST));
}
BOOL fCreate = (psrp->lpi && psrp->lpi->fIsFileset()) ? FALSE : TRUE;
TCHAR szFileset[ cchNAME ];
GetDlgItemText (hDlg, IDC_RESTORE_SETNAME, szFileset, cchNAME);
LPTSTR pszText;
if (szFileset[0] == TEXT('\0'))
{
pszText = CloneString (TEXT(""));
}
else if (fCreate)
{
pszText = FormatString (IDS_RESTORE_CREATESET, TEXT("%s"), szFileset);
}
else
{
TCHAR szServer[ cchNAME ];
TCHAR szAggregate[ cchNAME ];
psrp->lpi->GetServerName (szServer);
psrp->lpi->GetAggregateName (szAggregate);
pszText = FormatString (IDS_RESTORE_OVERWRITESET, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
}
SetDlgItemText (hDlg, IDC_RESTORE_CREATE, pszText);
FreeString (pszText);
EnableWindow (GetDlgItem (hDlg, IDC_RESTORE_SERVER), fCreate);
EnableWindow (GetDlgItem (hDlg, IDC_AGG_LIST), fCreate);
if (psrp->lpi)
{
LPIDENT lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_RESTORE_SERVER));
if (psrp->lpi->GetServer() != lpiServer)
{
CB_SetSelectedByData (GetDlgItem (hDlg, IDC_RESTORE_SERVER), (LPARAM)psrp->lpi->GetServer());
Filesets_Restore_OnSelectServer (hDlg, psrp);
}
else if (!psrp->lpi->fIsServer())
{
FL_SetSelectedByData (GetDlgItem (hDlg, IDC_AGG_LIST), (LPARAM)psrp->lpi->GetAggregate());
}
}
Filesets_Restore_EnableOK (hDlg, psrp);
}
示例12: CloneString
/**
Create an EtherCAT hardware interface which uses UDP formatted messages. This is the only type of EtherCAT interface that can
be used under Windows without installing special drivers.
The low level EtherCAT protocol normally does not use an IP address, however since this driver transmits EtherCAT packets over
UDP/IP, the Ethernet interface used with this driver must have a valid IP address assigned. In addition, the network mask
associated with the Ethernet interface should be defined in such a way that no other network interface on the same PC is a member
of the same network. That is, if multiple interfaces are installed then they should be allocated to seperate networks.
i.e. ( IP1 & mask1 ) != (IP2 & mask2)
where IP1 and mask1 are the IP address and net mask of the first interface, and IP2 and mask2 are for the second interface.
For example, the following two interfaces are on different networks:
IP: 192.168.1.1 mask: 255.255.255.0
IP: 192.168.2.1 mask: 255.255.255.0
but the following two interfaces are on the same network:
IP: 192.168.1.1 mask: 255.255.255.0
IP: 192.168.1.2 mask: 255.255.255.0
This is important because this drive has no direct control of which interface the packets are being sent out. This is entirely
controlled by the upper layer routing algorithms in the windows network stack.
The name parameter passed to this function can be used to identify which interface this object should bind to. It can take
any of the following forms:
- If not specified, then the first valid interface found will be used. This is useful if there's only one interface on the PC.
- If of the form; eth0, eth1, eth2, etc, then the nth valid interface will be used.
- For more control, the IP address of the desired interface can be passed. This should be sent as a string in dotted decimal
notation. For example: "192.168.1.1"
@param name Used to identify the Ethernet interface as described above.
*/
WinUdpEcatHardware::WinUdpEcatHardware( const char *name )
{
hndl = 0;
recv = 0;
if( !name )
ifname = 0;
else
ifname = CloneString( name );
SetRefName( "UdpEcatHw" );
}
示例13: CloneString
// This function allows for a sub task to be started. This does not create
// a new task or redirect messages, only changes possible UI for a sub
// task that is being performed as part of a larger task. When you switch
// to a task, that task also becomes the active subtask
bool CBackEndDialog::ActivateSubTask(const char* pszSubTaskName)
{
//copy the string (it could be lost on this thread by the time it gets to the other
//thread)
char* pszSubTask = CloneString(pszSubTaskName);
PostMessage(USER_COMMAND_ACTIVATE_SUBTASK, (WPARAM)pszSubTask);
return true;
}
示例14: CloneString
//--------------------------------------------------------------------------------------------------------------
CHintMessage::CHintMessage( const char * hintString, CUtlVector< const char * > * args, float duration )
{
m_hintString = hintString;
m_duration = duration;
if ( args )
{
for ( int i=0; i<args->Count(); ++i )
{
m_args.AddToTail( CloneString( (*args)[i] ) );
}
}
}
示例15: CloneString
//--------------------------------------------------------------------------------------------------------------
void DownloadManager::MarkMapAsDownloadedFromServer( const char *serverMapName )
{
if ( !serverMapName )
return;
if ( HasMapBeenDownloadedFromServer( serverMapName ) )
return;
m_downloadedMaps.AddToTail( CloneString( serverMapName ) );
return;
}