当前位置: 首页>>代码示例>>C++>>正文


C++ String_256::Length方法代码示例

本文整理汇总了C++中String_256::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ String_256::Length方法的具体用法?C++ String_256::Length怎么用?C++ String_256::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String_256的用法示例。


在下文中一共展示了String_256::Length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateLocation

BOOL PathNameEx::CreateLocation()
{
	PORTNOTETRACE("other","PathNameEx::CreateLocation - do nothing");
#ifndef EXCLUDE_FROM_XARALX
	if (!IsValid())
		return FALSE;
	
	// We'll walk the location string from left to right - if we come across non-existent directories,
	// we create them
	String_256			strLocation = GetLocation(FALSE);
	String_256			strDirPath = drivename;
	INT32					nPos =  drivename.Length(); // start after the drivename
	while( nPos < strLocation.Length() )
	{
		while( ( strLocation[nPos] != chPathSep ) && ( nPos < strLocation.Length() ) )
		{
			strDirPath += strLocation[nPos];
			nPos++;
		}
		// strDirPath has been added a directory, we check if it exists
		
		if (_access((TCHAR*) strDirPath, 0) == -1) // not found, try to create the directory
		{
			if (_mkdir((TCHAR*) strDirPath))
			{
#ifdef _DEBUG
				TCHAR szMsg[256];
				TCHAR szError[128];
				switch (errno)
				{
					case EACCES:
						camStrcpy(szError, "access denied (EACCES)");
						break;
					case ENOENT:
						camStrcpy(szError, "path not found (ENOENT)");
						break;
					default:
						wsprintf(szError, "errno = %d", errno);
				}
				wsprintf(szMsg, "Create directory %s failed, %s", strDirPath, szError);
				ERROR3(szMsg);
#endif
				return FALSE;
			}
		}
		strDirPath += chPathSep; // add a backslash in case there are further subdirectories  
		nPos++; // move to the next position
	}
#endif
	return TRUE;
}
开发者ID:vata,项目名称:xarino,代码行数:51,代码来源:pathnmex.cpp

示例2: TRACE

/********************************************************************************************

>	TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
											const StringBase& Question,
											const StringBase& Param)
 	Author:		Colin_Barfoot (Xara Group Ltd) <[email protected]>
	Created:	27/06/97

	Purpose:	Default constructor for TemplateAttribute

	Inputs:		InternalName 
				Question
				Param

	Notes:		Currently forms a UserAttribute with a LongKey of
				WizOp\InternalName/Param

********************************************************************************************/
TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
										const StringBase& Question,
										const StringBase& Param)
{
	// Copy as much of the question as we can.
	SetWizOpNameAndParam(InternalName, Param);

	// Cache this test for faster Attribute gallery scans.
	m_fIsAnObjectName = (GetInternalName() == TA_NAME);

	if (Question.Length() > 0)
	{
		String_256 NewValue;
		INT32 LengthToCopy = (NewValue.MaxLength() < Question.Length())
								? TRACE( _T("TemplateAttribute::TemplateAttribute: Q truncated\n")),
								  NewValue.MaxLength()
								: Question.Length();
		if (LengthToCopy > 0)
		{
			String_256 TruncatedQuestion;
			Question.Left(&TruncatedQuestion, LengthToCopy);

			if (!Value.Value.Alloc(TruncatedQuestion.Length()))
			{
				ERROR1RAW(_R(IDE_NOMORE_MEMORY));
				return;
			}

			Value.Value = TruncatedQuestion;
		}
	}
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:50,代码来源:tmpltatr.cpp

示例3: WriteSepFunctions

BOOL PrintPSRenderRegion::WriteSepFunctions(KernelDC *pDC)
{
	PrintControl *pPrintCtl=NULL;
	View *pView = GetRenderView();
	if (pView) pPrintCtl = pView->GetPrintControl();
	if (!pPrintCtl)
		return TRUE;

	// Get a pointer to the typeset info structure
	TypesetInfo *pInfo = pPrintCtl->GetTypesetInfo();
	// Is screening off?
	if (!pInfo->AreScreening())
		return TRUE;

	// Get hold of our PostScript prolog resource...
	CCResTextFile ScreenFile;

	// Open the file
	if (!ScreenFile.open(_R(IDM_PS_SPOTFUNCS), _R(IDT_PS_RES)))
	{
		// Failed to open the file...
		ERROR2(FALSE, "Could not get at PostScript resource!");
	} 

	// Read each line from the file and output it to the DC.
	String_256 LineBuf;
	TCHAR *pBuf = (TCHAR *) LineBuf;
	
	while (!ScreenFile.eof())
	{
		// Copy this line to output.
		ScreenFile.read(&LineBuf);
		pDC->OutputTCHARAsChar(pBuf, LineBuf.Length());
		pDC->OutputNewLine();
	}
	
	// All done
	ScreenFile.close();

	return TRUE;
}
开发者ID:vata,项目名称:xarino,代码行数:41,代码来源:psrndrgn.cpp

示例4: CommitSection

BOOL ScaleTab::CommitSection()
{
TRACEUSER( "Neville", _T("commit Scale section\n"));
	ERROR3IF(pPrefsDlg == NULL, "ScaleTab::CommitSection called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE));	// The Scale tab identifier
	if (!ok)
		return TRUE;	// Talk to View failed to return now

	// Ok has been pressed so take the values from this section of the dialog box
	// Takes the values in the dialog and sets the DimScale object accordingly.
	BOOL Valid=TRUE;		// Flag for validity of value
//	BOOL State=FALSE;		// Flag for state of button/switch
	BOOL SetOk=TRUE;		// Preference value set ok

	// Section = Scale settings

	// Now check that we have the selected view still, just in case it has switched
	// without us being told about it or even we have no current document/view.
	// This may be a valid state now, so do not complain about it. 
	DocView* pCurrentView = DocView::GetSelected();
	if (pCurrentView != NULL)
	{
		// Only if there is a current view do we read the values.
		String_256 DrawingStr;
		String_256 RealStr;
		//TCHAR* pDrawingStr = DrawingStr;
		//TCHAR* pRealStr = RealStr;
		BOOL Active;

		// Get the values from the dialog box
		Active 		= pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0, &Valid);
		DrawingStr  = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), &Valid);
		RealStr 	= pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_REALSCALE), &Valid);

		Spread* pSpread = pCurrentView->GetFirstSelectedSpread();
		// If no selected spread then use the visible spread
		if (pSpread == NULL)
			pSpread = pCurrentView->GetVisibleSpread();

		// Only do the chnage if we have a valid spread pointer and we have changed something.
		if ( (pSpread != NULL) &&
			 (
			 	(OldActiveState != Active) ||
			 	(OldDrawingStr != DrawingStr) ||
			 	(OldRealStr != RealStr)
			 )
		   )
		{
			pDimScale = pSpread->GetPtrDimScale();
			if (pDimScale != NULL)
			{
				// Only if active is set do we need to try and set new strings
				// and hence a new drawing scale
				if (Active)
				{
					// Dim Scales can only be 32 characters long
					String_32 DrawingStr32 = _T("");
					String_32 RealStr32 = _T("");
					// Check if read in strings are longer than this
					if (DrawingStr.Length() > DrawingStr32.MaxLength())
					{
						InformError(_R(IDE_OPTS_INVALIDDRAWSCALE));
						return FALSE;
					}
					if (RealStr.Length() > RealStr32.MaxLength())
					{
						InformError(_R(IDE_OPTS_INVALIDREALSCALE));
						return FALSE;
					}

					RealStr32 = RealStr;
					DrawingStr32 = DrawingStr;

					// Try and set these strings as new drawing and real scales strings
					SetOk = pDimScale->SetDrawingScaleStr(DrawingStr32);
					if (!SetOk)
					{
						InformError(_R(IDE_OPTS_INVALIDDRAWSCALE));
						return FALSE;
					}

					SetOk = SetOk && pDimScale->SetRealScaleStr(RealStr32);
					if (!SetOk)
					{
						InformError(_R(IDE_OPTS_INVALIDREALSCALE));
						return FALSE;
					}
				
					// Now try to convert these into a new scaling factor
					if (SetOk)
						SetOk = SetOk && pDimScale->SetScaleFactor();
				
					// If we failed in any of the conversions then warn the user and fail
					if (!SetOk)
					{
						InformError(_R(IDE_OPTS_INVALIDSCALING));
						return FALSE;
					}
				}
//.........这里部分代码省略.........
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,代码来源:optsscal.cpp


注:本文中的String_256::Length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。