當前位置: 首頁>>代碼示例>>C++>>正文


C++ CloneString函數代碼示例

本文整理匯總了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();
}
開發者ID:LaoZhongGu,項目名稱:RushGame,代碼行數:12,代碼來源:CPipeResult.cpp

示例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;
}
開發者ID:nightstyles,項目名稱:focp,代碼行數:52,代碼來源:RdbUtility.cpp

示例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;
}
開發者ID:LaoZhongGu,項目名稱:RushGame,代碼行數:15,代碼來源:CPipeResult.cpp

示例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;
}
開發者ID:jeppeter,項目名稱:vbox,代碼行數:60,代碼來源:StringFuncs.c

示例5: RelinquishMagickMemory

void Magick::Options::density(const Point &density_)
{
  if (!density_.isValid())
    _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
  else
   CloneString(&_imageInfo->density,density_);
}
開發者ID:riingo,項目名稱:ImageMagick,代碼行數:7,代碼來源:Options.cpp

示例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;
}
開發者ID:CliffsDover,項目名稱:graphicsmagick,代碼行數:60,代碼來源:drawtest.c

示例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;
//.........這裏部分代碼省略.........
開發者ID:saitoha,項目名稱:ImageMagick-V7-SIXEL,代碼行數:101,代碼來源:magick-wand.c

示例8: CloneString

char * RString::GetBuffer(void)
{
	if(RefCount() > 0)
	{
		CloneString();
		return myString;
	}
	return myString; //are we sure this is safe?
}
開發者ID:rezalas,項目名稱:riftshadow,代碼行數:9,代碼來源:strings.c

示例9: CloneString

LinuxEcatHardware::LinuxEcatHardware( const char *name )
{
   if( !name ) name = "eth0";

   fd = -1;
   ifname = CloneString( name );

   SetRefName( "LinuxEcatHw" );
}
開發者ID:DJGCrusader,項目名稱:ParallelScissorManipulator,代碼行數:9,代碼來源:ecat_linux.cpp

示例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;
}
開發者ID:nightstyles,項目名稱:focp,代碼行數:44,代碼來源:RdbUtility.cpp

示例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);
}
開發者ID:chanke,項目名稱:openafs-osd,代碼行數:56,代碼來源:set_restore.cpp

示例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" );
}
開發者ID:DJGCrusader,項目名稱:ParallelScissorManipulator,代碼行數:45,代碼來源:ecat_winudp.cpp

示例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;

}
開發者ID:Joincheng,項目名稱:lithtech,代碼行數:15,代碼來源:BackEndDialog.cpp

示例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] ) );
		}
	}
}
開發者ID:BenLubar,項目名稱:SwarmDirector2,代碼行數:14,代碼來源:hintmessage.cpp

示例15: CloneString

//--------------------------------------------------------------------------------------------------------------
void DownloadManager::MarkMapAsDownloadedFromServer( const char *serverMapName )
{
	if ( !serverMapName )
		return;

	if ( HasMapBeenDownloadedFromServer( serverMapName ) )
		return;

	m_downloadedMaps.AddToTail( CloneString( serverMapName ) );


	return;
}
開發者ID:Axitonium,項目名稱:SourceEngine2007,代碼行數:14,代碼來源:download.cpp


注:本文中的CloneString函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。